--- id: pybedtools version: "0.12.0" license: MIT license_treatment: permissive maintenance: aging --- # pybedtools — Wrapper around BEDTools for bioinformatics work License: permissive · Maintenance: aging · Downloads: 109.6K/mo ## What it is and what it does pybedtools is a Python wrapper around the BEDTools suite, a widely-used toolkit for genomic interval manipulation. It lets you perform operations like subtract, intersect, and closest on genomic features directly from Python code, rather than chaining shell commands. The package supports all BEDTools-compatible file formats (BED, GFF, and others, including gzipped variants) and can stream results like Unix pipes, making it memory-efficient for large genomic datasets. The package depends on numpy, pysam, and pandas for data handling. It's designed for bioinformaticians and computational biologists who want to avoid writing complex bash scripts for routine genomic analyses. The main trade-off is the high install friction: BEDTools itself must be available on your system as a compiled binary before pybedtools can wrap it. Use it for: - Find genes within a specific distance of intergenic variants by combining subtract and closest operations on BED/GFF files. - Filter genomic features by intersection with regulatory regions or exclusion zones using subtract and intersect. - Stream large genomic datasets through multiple operations without materializing intermediate results to disk. - Iterate over genomic features and access their attributes (name, coordinates, scores) programmatically in Python loops. - Automate repetitive genomic interval analyses that would otherwise require shell script pipelines. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Wraps the BEDTools suite to perform genomic interval operations (subtract, intersect, closest, etc.) directly from Python, supporting all BEDTools-compatible formats and streaming results. Yes, if you have BEDTools already installed and work regularly with genomic intervals in Python. The high install friction and aging maintenance status (516 days since release) are real drawbacks, but the package is stable, permissively licensed, and solves a genuine problem for bioinformaticians. Not worth installing if you lack BEDTools or only occasionally need interval operations. ## Install pip install pybedtools uv add pybedtools poetry add pybedtools ## Installing pybedtools Before you install: High install friction: requires BEDTools as a compiled system dependency. Package is aging (516 days since last release) but repo is not archived with recent activity on 2025-03-16. License in practice: MIT license is permissive; you can use, modify, and distribute pybedtools with minimal restrictions, suitable for academic and commercial projects. Quickstart: from pybedtools import BedTool snps = BedTool('snps.bed.gz') genes = BedTool('hg19.gff') intergenic_snps = snps.subtract(genes) nearby = genes.closest(intergenic_snps, d=True, stream=True) for gene in nearby: if int(gene[-1]) < 5000: print(gene.name) BEDTools must be installed and available on the system as a compiled binary before pybedtools can wrap it. Verify before relying: - Whether BEDTools must be pre-installed on the system or if pybedtools handles installation automatically - Compatibility with Python versions beyond 3.8 (classifiers list 3.6, 3.7, 3.8 but requires_python is unspecified) ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: high - Maintenance: aging - Downloads: 109.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags genomic interval manipulation python, bedtools python wrapper, genome algebra operations, bioinformatics interval operations, bed file processing python, genomic feature comparison, intergenic region analysis, bioinformatics, genomics, bedtools-wrapper [View on SkillFed](https://skillfed.io/packages/pybedtools) · [View on PyPI](https://pypi.org/project/pybedtools/)