pyranges
GenomicRanges for Python.
What it is and what it does
PyRanges is a Python library for working with genomic intervals—discrete regions of DNA sequences like genes, regulatory features, or sequencing reads. It wraps pandas DataFrames to provide a genomics-specific interface optimized for fast querying and manipulation of these intervals, making it easier to perform common bioinformatics tasks like overlap detection, merging, and filtering without writing low-level code.
The library is built on top of pandas and integrates with the broader Python data science ecosystem, so you can chain operations with a terse syntax and leverage existing pandas and NumPy tools on the results. It depends on ncls for interval indexing, sorted_nearest for nearest-neighbor queries, tabulate for display, and natsort for natural sorting of genomic coordinates.
Use it for:
- Find overlapping genomic features (e.g., which genes overlap with a set of ChIP-seq peaks)
- Merge or subtract genomic intervals to build consensus annotations or mask regions
- Query and filter large genomic datasets by chromosome, position, or feature type
- Perform nearest-neighbor searches to find the closest gene to a variant position
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyRanges provides efficient querying and manipulation of genomic intervals (genes, features, reads) using a pandas-backed interface optimized for genomics workflows.
Yes. PyRanges is actively maintained, has no known vulnerabilities, installs with low friction, and is widely used in bioinformatics. The MIT license poses no restrictions. Install it if you work with genomic intervals or annotations in Python.
Install
pyranges on PyPI
pip
pip install pyrangesuv
uv add pyrangespoetry
poetry add pyrangesInstalling pyranges
Before you install
Low install friction with a pure Python wheel distribution. Active maintenance with recent commits (last commit 2026-04-23) and steady releases; 493 repository stars indicate established use in the bioinformatics community.
License in practice
MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions beyond attribution.
Quickstart
import pyranges as pr
import pandas as pd
# Create a PyRanges object from a DataFrame
df = pd.DataFrame({'Chromosome': ['chr1'], 'Start': [0], 'End': [1]})
gr = pr.PyRanges(df)
print(gr)
Verify before relying
- Whether the package requires specific versions of pandas, ncls, or other runtime dependencies beyond what pip resolves automatically
- Performance characteristics and scalability limits for very large genomic datasets
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — pandas, ncls, tabulate, sorted_nearest, natsort |
| Maintenance | actively maintained — 518 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 88,207/month — #13,743 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyranges-0.1.4-py3-none-any.whl
Keywords: bioinformatics, genomicranges, genomics
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
pybedtoolsWraps the BEDTools suite to perform genomic…
permissive · top 15,000 on PyPI
nclsNCLS provides a fast interval overlap query…
permissive · top 15,000 on PyPI
cgcg is a clinical sequencing platform that…
unclear · top 15,000 on PyPI
gtfparseParses GTF (gene transfer format) files into…
permissive · top 15,000 on PyPI
pyensemblPyEnsembl provides a Python interface to query…
permissive · top 15,000 on PyPI
refgenieRefgenie manages standardized folder structures…
permissive · top 15,000 on PyPI
bx-pythonbx-python provides Python classes and utilities…
permissive · top 15,000 on PyPI
gseapyPerforms gene set enrichment analysis (GSEA) on…
permissive · top 15,000 on PyPI
deepbiopDeepBioP is a deep learning preprocessing…
permissive · top 15,000 on PyPI
pyBigWigA Python C extension for reading and writing…
permissive · top 15,000 on PyPI