Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Interval tree convenience classes for genomic data

Project Description

Convenience classes for loading UCSC genomic annotation records into a set of interval tree data structures.


The easiest way to install most Python packages is via easy_install or pip:

$ pip install intervaltree-bio

The package requires the intervaltree package (which is normally installed automatically when using pip or easy_install).


One of the major uses for Interval tree data structures is in bioinformatics, where the intervals correspond to genes or other features of the genome.

As genomes typically consist of a set of chromosomes, a separate interval tree for each chromosome has to be maintained. Thus, rather than using an single interval tree, you would typically use something like defaultdict(IntervalTree) to index data of genomic features. The module intervaltree_bio offers a GenomeIntervalTree data structure, which is a similar convenience data structure. In addition to specific methods for working with genomic intervals it also provides facilities for reading BED files and the refGene table from UCSC.

The core example is loading the transcription regions of the knownGene table from the UCSC website:

>> from intervaltree_bio import GenomeIntervalTree
>> knownGene = GenomeIntervalTree.from_table()
>> len(knownGene)

It is then possible to use the data structure to search known genes within given intervals:

>> result = knownGene[b'chr1'].search(100000, 138529)

It is possible to load other UCSC tables besides knownGene or specify custom URL or file to read the table from. Consult the docstring of the GenomeIntervalTree.from_table method for more details.

Release History

Release History

This version
History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date (12.2 kB) Copy SHA256 Checksum SHA256 Source Jan 28, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting