{"id":34649005,"url":"https://github.com/clintval/bedspec","last_synced_at":"2026-05-27T15:04:45.697Z","repository":{"id":261492195,"uuid":"752742999","full_name":"clintval/bedspec","owner":"clintval","description":"An HTS-specs compliant BED toolkit","archived":false,"fork":false,"pushed_at":"2026-04-14T00:35:22.000Z","size":146,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-28T22:35:16.959Z","etag":null,"topics":["bed","bioinformatics","hts","interval","ngs"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/bedspec/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clintval.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-04T17:24:24.000Z","updated_at":"2026-04-14T00:35:25.000Z","dependencies_parsed_at":"2024-11-06T21:25:29.655Z","dependency_job_id":"b1881515-0067-4bbe-b5b2-96af0f55c236","html_url":"https://github.com/clintval/bedspec","commit_stats":null,"previous_names":["clintval/bedspec"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/clintval/bedspec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clintval%2Fbedspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clintval%2Fbedspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clintval%2Fbedspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clintval%2Fbedspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clintval","download_url":"https://codeload.github.com/clintval/bedspec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clintval%2Fbedspec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33571016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bed","bioinformatics","hts","interval","ngs"],"created_at":"2025-12-24T17:53:35.961Z","updated_at":"2026-05-27T15:04:45.692Z","avatar_url":"https://github.com/clintval.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 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.10_|_3.11_|_3.12_|_3.13-blue)](https://github.com/clintval/typeline)\n[![basedpyright](https://img.shields.io/badge/basedpyright-checked-42b983)](https://docs.basedpyright.com/latest/)\n[![mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://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### Building a BED Feature\n\n```pycon\n\u003e\u003e\u003e from bedspec import Bed3\n\u003e\u003e\u003e \n\u003e\u003e\u003e bed = Bed3(\"chr1\", start=2, end=8)\n\n```\n\n### Writing\n\n```pycon\n\u003e\u003e\u003e from bedspec import BedWriter\n\u003e\u003e\u003e from tempfile import NamedTemporaryFile\n\u003e\u003e\u003e \n\u003e\u003e\u003e temp_file = NamedTemporaryFile(mode=\"w+t\", suffix=\".txt\")\n\u003e\u003e\u003e\n\u003e\u003e\u003e with BedWriter.from_path(temp_file.name, Bed3) as writer:\n...     writer.write(bed)\n\n```\n\n### Reading\n\n```pycon\n\u003e\u003e\u003e from bedspec import BedReader\n\u003e\u003e\u003e \n\u003e\u003e\u003e with BedReader.from_path(temp_file.name, Bed3) as reader:\n...     for bed in reader:\n...         print(bed)\nBed3(refname='chr1', start=2, end=8)\n\n```\n\n### BED Types\n\nThis package provides builtin classes for the following BED formats:\n\n```pycon\n\u003e\u003e\u003e from bedspec import Bed2\n\u003e\u003e\u003e from bedspec import Bed3\n\u003e\u003e\u003e from bedspec import Bed4\n\u003e\u003e\u003e from bedspec import Bed5\n\u003e\u003e\u003e from bedspec import Bed6\n\u003e\u003e\u003e from bedspec import Bed12\n\u003e\u003e\u003e from bedspec import BedGraph\n\u003e\u003e\u003e from bedspec import BedPE\n\n```\n\n### Overlap Detection\n\nUse a fast overlap detector for any collection of interval types, including third-party:\n\n```pycon\n\u003e\u003e\u003e from bedspec import Bed3, Bed4\n\u003e\u003e\u003e from bedspec.overlap import OverlapDetector\n\u003e\u003e\u003e\n\u003e\u003e\u003e bed1 = Bed3(\"chr1\", start=1, end=4)\n\u003e\u003e\u003e bed2 = Bed3(\"chr1\", start=5, end=9)\n\u003e\u003e\u003e \n\u003e\u003e\u003e detector = OverlapDetector[Bed3]([bed1, bed2])\n\u003e\u003e\u003e \n\u003e\u003e\u003e my_feature = Bed4(\"chr1\", start=2, end=3, name=\"hi-mom\")\n\u003e\u003e\u003e detector.overlaps(my_feature)\nTrue\n\n```\n\nThe overlap detector supports the following operations:\n\n- `overlapping`: return all overlapping features\n- `overlaps`: test if any overlapping features exist\n- `enclosed_by`: return those enclosed by the input feature\n- `enclosing`: return those enclosing the input feature\n\n### Custom BED Types\n\nTo create a custom BED record, inherit from the relevant BED-type (`PointBed`, `SimpleBed`, `PairBed`).\n\nFor example, to create a custom BED3+1 class:\n\n```pycon\n\u003e\u003e\u003e from dataclasses import dataclass\n\u003e\u003e\u003e \n\u003e\u003e\u003e from bedspec import SimpleBed\n\u003e\u003e\u003e \n\u003e\u003e\u003e @dataclass\n... class Bed3Plus1(SimpleBed):\n...     refname: str\n...     start: int\n...     end: int\n...     my_custom_field: float | None\n\n```\n\nYou can also inherit and extend a pre-existing BED class:\n\n```pycon\n\u003e\u003e\u003e from dataclasses import dataclass\n\u003e\u003e\u003e\n\u003e\u003e\u003e from bedspec import Bed3\n\u003e\u003e\u003e\n\u003e\u003e\u003e @dataclass\n... class Bed3Plus1(Bed3):\n...     my_custom_field: float | None\n\u003e\u003e\u003e\n\u003e\u003e\u003e Bed3Plus1(refname=\"chr1\", start=2, end=3, my_custom_field=0.1)\nBed3Plus1(refname='chr1', start=2, end=3, my_custom_field=0.1)\n\n```\n\n## Development and Testing\n\nSee the [contributing guide](./CONTRIBUTING.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclintval%2Fbedspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclintval%2Fbedspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclintval%2Fbedspec/lists"}