bedspec


Namebedspec JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/clintval/bedspec
SummaryAn HTS-specs compliant BED toolkit.
upload_time2024-04-19 02:05:53
maintainerNone
docs_urlNone
authorClint Valentine
requires_python<4.0,>=3.12
licenseMIT
keywords bioinformatics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bedspec

[![PyPi Release](https://badge.fury.io/py/bedspec.svg)](https://badge.fury.io/py/bedspec)
[![CI](https://github.com/clintval/bedspec/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/clintval/bedspec/actions/workflows/tests.yml?query=branch%3Amain)
[![Python Versions](https://img.shields.io/badge/python-3.12-blue)](https://github.com/clintval/bedspec)
[![MyPy Checked](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)

An HTS-specs compliant BED toolkit.

## Installation

The package can be installed with `pip`:

```console
pip install bedspec
```

## Quickstart

### Writing

```python
from bedspec import BedWriter, Bed3

bed = Bed3("chr1", start=2, end=8)

with BedWriter(open("test.bed", "w")) as writer:
    writer.write(bed)
```

### Reading

```python
from bedspec import BedReader, Bed3

with BedReader[Bed3](open("test.bed")) as reader:
    for bed in reader:
        print(bed)
```
```console
Bed3(contig="chr1", start=2, start=8)
```

### BED Types

This package provides pre-defined classes for the following BED formats:

```python
from bedspec import Bed2
from bedspec import Bed3
from bedspec import Bed4
from bedspec import Bed5
from bedspec import Bed6
from bedspec import BedPE
```

### Custom BED Types

To create a custom BED record, inherit from the relevent BED-type:

| Type        | Description                                          |
| ---         | ---                                                  |
| `PointBed`  | BED records that are a single point (1-length) only. |
| `SimpleBed` | BED records that are a single interval.              |
| `PairBed`   | BED records that are a pair of intervals.            |

For example, to create a custom BED3+1 class:

```python
from dataclasses import dataclass

from bedspec import SimpleBed

@dataclass
class MyCustomBed(SimpleBed):
    contig: str
    start: int
    end: int
    my_custom_field: float
```

## Development and Testing

See the [contributing guide](./CONTRIBUTING.md) for more information.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/clintval/bedspec",
    "name": "bedspec",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": "bioinformatics",
    "author": "Clint Valentine",
    "author_email": "valentine.clint@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/89/a9c778400a0eba49139485e8b4bbb9770686d2d0a4bf5239e349b4f25c86/bedspec-0.2.0.tar.gz",
    "platform": null,
    "description": "# bedspec\n\n[![PyPi Release](https://badge.fury.io/py/bedspec.svg)](https://badge.fury.io/py/bedspec)\n[![CI](https://github.com/clintval/bedspec/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/clintval/bedspec/actions/workflows/tests.yml?query=branch%3Amain)\n[![Python Versions](https://img.shields.io/badge/python-3.12-blue)](https://github.com/clintval/bedspec)\n[![MyPy Checked](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)\n\nAn HTS-specs compliant BED toolkit.\n\n## Installation\n\nThe package can be installed with `pip`:\n\n```console\npip install bedspec\n```\n\n## Quickstart\n\n### Writing\n\n```python\nfrom bedspec import BedWriter, Bed3\n\nbed = Bed3(\"chr1\", start=2, end=8)\n\nwith BedWriter(open(\"test.bed\", \"w\")) as writer:\n    writer.write(bed)\n```\n\n### Reading\n\n```python\nfrom bedspec import BedReader, Bed3\n\nwith BedReader[Bed3](open(\"test.bed\")) as reader:\n    for bed in reader:\n        print(bed)\n```\n```console\nBed3(contig=\"chr1\", start=2, start=8)\n```\n\n### BED Types\n\nThis package provides pre-defined classes for the following BED formats:\n\n```python\nfrom bedspec import Bed2\nfrom bedspec import Bed3\nfrom bedspec import Bed4\nfrom bedspec import Bed5\nfrom bedspec import Bed6\nfrom bedspec import BedPE\n```\n\n### Custom BED Types\n\nTo create a custom BED record, inherit from the relevent BED-type:\n\n| Type        | Description                                          |\n| ---         | ---                                                  |\n| `PointBed`  | BED records that are a single point (1-length) only. |\n| `SimpleBed` | BED records that are a single interval.              |\n| `PairBed`   | BED records that are a pair of intervals.            |\n\nFor example, to create a custom BED3+1 class:\n\n```python\nfrom dataclasses import dataclass\n\nfrom bedspec import SimpleBed\n\n@dataclass\nclass MyCustomBed(SimpleBed):\n    contig: str\n    start: int\n    end: int\n    my_custom_field: float\n```\n\n## Development and Testing\n\nSee the [contributing guide](./CONTRIBUTING.md) for more information.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An HTS-specs compliant BED toolkit.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/clintval/bedspec",
        "Repository": "https://github.com/clintval/bedspec"
    },
    "split_keywords": [
        "bioinformatics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "717aa1bfee7886d2940588c2e2918bf1f715f0da874aa998c7942677cb96529f",
                "md5": "b64ed8409a3ea5e686dff4e285c9c8ae",
                "sha256": "c92367d10f95bba2de0c45b41fa5b5044620ca82947473ca077141d7df749732"
            },
            "downloads": -1,
            "filename": "bedspec-0.2.0-cp312-cp312-macosx_12_0_x86_64.whl",
            "has_sig": false,
            "md5_digest": "b64ed8409a3ea5e686dff4e285c9c8ae",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": "<4.0,>=3.12",
            "size": 110000,
            "upload_time": "2024-04-19T02:05:47",
            "upload_time_iso_8601": "2024-04-19T02:05:47.962515Z",
            "url": "https://files.pythonhosted.org/packages/71/7a/a1bfee7886d2940588c2e2918bf1f715f0da874aa998c7942677cb96529f/bedspec-0.2.0-cp312-cp312-macosx_12_0_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c41d3c155b9240b5205fb1754d1b93e7711d33f7b9df0ccd431c9e9b1a276ff7",
                "md5": "4425b04b0efd0a069acb49ede3140eb2",
                "sha256": "648c46739a69a865040eab7fb8a5553dd6d1ba545a56620e4e9f32d00cc41f51"
            },
            "downloads": -1,
            "filename": "bedspec-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "4425b04b0efd0a069acb49ede3140eb2",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": "<4.0,>=3.12",
            "size": 327981,
            "upload_time": "2024-04-19T02:05:49",
            "upload_time_iso_8601": "2024-04-19T02:05:49.466490Z",
            "url": "https://files.pythonhosted.org/packages/c4/1d/3c155b9240b5205fb1754d1b93e7711d33f7b9df0ccd431c9e9b1a276ff7/bedspec-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux_2_5_x86_64.manylinux1_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33d7da4d873f9af73a50e6fdc9ea2ef336dac036adf36a53b118a3b73f9888d8",
                "md5": "b6c7aa7fa43f57b6f7bb92a22c8e2b5c",
                "sha256": "1b8ba4a472f49f07c4fba32a30311b75cfca0abcdd6ad3bb3ac4fe83a0278fe9"
            },
            "downloads": -1,
            "filename": "bedspec-0.2.0-cp312-cp312-musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "b6c7aa7fa43f57b6f7bb92a22c8e2b5c",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": "<4.0,>=3.12",
            "size": 333223,
            "upload_time": "2024-04-19T02:05:51",
            "upload_time_iso_8601": "2024-04-19T02:05:51.433959Z",
            "url": "https://files.pythonhosted.org/packages/33/d7/da4d873f9af73a50e6fdc9ea2ef336dac036adf36a53b118a3b73f9888d8/bedspec-0.2.0-cp312-cp312-musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d89a9c778400a0eba49139485e8b4bbb9770686d2d0a4bf5239e349b4f25c86",
                "md5": "5168c60681e0ac374386a0a6329f3ade",
                "sha256": "4f872a362df429c3ab1ff3b86d24770bdb243b11ffe29e6b2677af69d2b33f2a"
            },
            "downloads": -1,
            "filename": "bedspec-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5168c60681e0ac374386a0a6329f3ade",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 122058,
            "upload_time": "2024-04-19T02:05:53",
            "upload_time_iso_8601": "2024-04-19T02:05:53.423598Z",
            "url": "https://files.pythonhosted.org/packages/8d/89/a9c778400a0eba49139485e8b4bbb9770686d2d0a4bf5239e349b4f25c86/bedspec-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 02:05:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "clintval",
    "github_project": "bedspec",
    "github_not_found": true,
    "lcname": "bedspec"
}
        
Elapsed time: 0.25006s