Skip to main content

Operations and utilities for Genomic Interval Dataframes.

Project description

Bioframe: Operations on Genomic Interval Dataframes

CI Docs status Preprint Zenodo Slack NumFOCUS

Bioframe enables flexible and scalable operations on genomic interval dataframes in Python.

Bioframe is built directly on top of Pandas. Bioframe provides:

  • A variety of genomic interval operations that work directly on dataframes.
  • Operations for special classes of genomic intervals, including chromosome arms and fixed-size bins.
  • Conveniences for diverse tabular genomic data formats and loading genome assembly summary information.

Read the docs, including the guide, as well as the bioframe preprint for more information.

Bioframe is an Affiliated Project of NumFOCUS.

Installation

Bioframe is available on PyPI and bioconda:

pip install bioframe

Contributing

Interested in contributing to bioframe? That's great! To get started, check out the contributing guide. Discussions about the project roadmap take place on the Open2C Slack and regular developer meetings scheduled there. Anyone can join and participate!

Interval operations

Key genomic interval operations in bioframe include:

  • overlap: Find pairs of overlapping genomic intervals between two dataframes.
  • closest: For every interval in a dataframe, find the closest intervals in a second dataframe.
  • cluster: Group overlapping intervals in a dataframe into clusters.
  • complement: Find genomic intervals that are not covered by any interval from a dataframe.

Bioframe additionally has functions that are frequently used for genomic interval operations and can be expressed as combinations of these core operations and dataframe operations, including: coverage, expand, merge, select, and subtract.

To overlap two dataframes, call:

import bioframe as bf

bf.overlap(df1, df2)

For these two input dataframes, with intervals all on the same chromosome:

overlap will return the following interval pairs as overlaps:

To merge all overlapping intervals in a dataframe, call:

import bioframe as bf

bf.merge(df1)

For this input dataframe, with intervals all on the same chromosome:

merge will return a new dataframe with these merged intervals:

See the guide for visualizations of other interval operations in bioframe.

File I/O

Bioframe includes utilities for reading genomic file formats into dataframes and vice versa. One handy function is read_table which mirrors pandas’s read_csv/read_table but provides a schema argument to populate column names for common tabular file formats.

jaspar_url = 'http://expdata.cmmt.ubc.ca/JASPAR/downloads/UCSC_tracks/2022/hg38/MA0139.1.tsv.gz'
ctcf_motif_calls = bioframe.read_table(jaspar_url, schema='jaspar', skiprows=1)

Tutorials

See this jupyter notebook for an example of how to assign TF motifs to ChIP-seq peaks using bioframe.

Citing

If you use bioframe in your work, please cite:

@article{bioframe_2022,
author = {Open2C and Abdennur, Nezar and Fudenberg, Geoffrey and Flyamer, Ilya and Galitsyna, Aleksandra and Goloborodko, Anton and Imakaev, Maxim and Venev, Sergey},
doi = {10.1101/2022.02.16.480748},
journal = {bioRxiv},
title = {{Bioframe: Operations on Genomic Intervals in Pandas Dataframes}},
year = {2022}
}

Project details


Download files

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

Source Distribution

bioframe-0.6.0.tar.gz (950.8 kB view details)

Uploaded Source

Built Distribution

bioframe-0.6.0-py2.py3-none-any.whl (143.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bioframe-0.6.0.tar.gz.

File metadata

  • Download URL: bioframe-0.6.0.tar.gz
  • Upload date:
  • Size: 950.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for bioframe-0.6.0.tar.gz
Algorithm Hash digest
SHA256 7998f6aa072ab9655354b64c511a093c9f1a181f2d994f0e884b9c48c4d0c313
MD5 53993aab160377a7e3124ad748a0d22a
BLAKE2b-256 6bfa5948eef6c623588edd022f34b0497b873d0b61a66b43ea4c73e27c506367

See more details on using hashes here.

File details

Details for the file bioframe-0.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: bioframe-0.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 143.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for bioframe-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 db2886d1e71906bef4be0fa38bf7101503d7dd2e83fb6f09b9768598fca28e55
MD5 a8d28b2735bdcd64183620920b8df8e1
BLAKE2b-256 3dfa80a336269e67cbada78cc00eb3b94554485d827c57ee77c309200832f912

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page