skillfed

pyranges

GenomicRanges for Python.

pyranges v0.1.4 88.2K downloads/30d#13,743 on PyPI493
Permissive license MIT Active released

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 pyranges

uv

uv add pyranges

poetry

poetry add pyranges

Installing 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

Development Status :: 4 - BetaEnvironment :: Other EnvironmentIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Topic :: Scientific/Engineering

Tags

genomic intervals manipulationgenomics data queryinggenomic ranges pythonbioinformatics interval operationsgenomic annotations library
bioinformaticsgenomicsinterval-queries

More Scientific/Engineering packages