Skip to main content

Python bindings to UCSC Big Binary (bigWig/bigBed) file library

Project description

pybbi

Python interface to Jim Kent's big binary file (bbi) [1] library from the UCSC Genome Browser source tree using Cython.

This provides read-level access to local and remote bigWig and bigBed files but no write capabilitites. The main feature is fast retrieval of range queries into numpy arrays.

Installation

Wheels for pybbi are available on PyPI for Pythons 3.5, 3.6, 3.7, 3.8 on Linux and Mac OSX.

$ pip install pybbi

API

Introspection

These accept a local file path or URL.

  • bbi.is_bbi(path) --> bool
  • bbi.is_bigwig(path) --> bool
  • bbi.is_bigbed(path) --> bool
  • bbi.chromsizes(path) --> OrderedDict
  • bbi.zooms(path) --> list
  • bbi.info(path) --> dict

Array output

These accept either a bigWig or bigBed file path / URL. The signal of a bigBed file is the genomic coverage of its intervals.

For a single range query:

  • bbi.fetch(path, chrom, start, end, [bins [, missing [, oob, [, summary]]]]) --> 1D numpy array

For a list of equal-length segments (i.e. to produce a stacked heatmap):

  • bbi.stackup(path, chroms, starts, ends, [bins [, missing [, oob, [, summary]]]]) --> 2D numpy array

Summary querying is supported by specifying the number of bins for coarsegraining. The summary statistic can be one of: 'mean', 'min', 'max', 'cov', or 'std'. (default = 'mean').

Missing data can be filled with a custom fill value, missing (default = 0).

Out-of-bounds ranges (i.e. start less than zero or end greater than the chromosome length) are permitted because of their utility e.g., for generating vertical heatmap stacks centered at specific genomic features. A separate custom fill value, oob can be provided for out-of-bounds positions (default = NaN).

Interval output

Accepts either a bigWig or bigBed file path / URL.

  • bbi.fetch_intervals(path, chrom, start, end) --> iterator

See the docstrings for complete documentation.

Related projects

  • libBigWig: Alternative C library for bigWig and bigBed files by Devon Ryan
  • pyBigWig: Python bindings for libBigWig by the same author
  • bw-python: Alternative Python wrapper to libBigWig by Brent Pederson
  • bx-python: Python bioinformatics library from James Taylor's group that includes tools for bbi files.

This library provides bindings to the reference UCSC bbi library code. Check out @dpryan79's libBigWig for an alternative and dedicated C library for big binary files. pyBigWig also provides numpy-based retrieval and bigBed support.

References

[1]: http://bioinformatics.oxfordjournals.org/content/26/17/2204.full

From source

If wheels for your platform or Python version aren't available or you want to develop, you'll need to install pybbi from source. The source distribution on PyPI ships with (slightly modified) kent utils source, which will compile before the extension module is built.

Requires

  • Linux/MacOS
  • C compiler, zlib, pthreads, libpng, openssl, make
  • Python 2.7/3.4+
  • numpy and cython

On fresh Ubuntu instance, you'll need build-essential, make, zlib1g-dev, libssl-dev, libpng16-dev. It seems to work on the Windows Subsystem for Linux too.

On a Centos/RedHat (rpm) system you'll need gcc, make, zlib-devel, openssl-devel, libpng-devel.

For development, clone the repo and install in editable mode:

$ git clone https://github.com/nvictus/pybbi.git
$ cd pybbi
$ pip install -e .

Troubleshooting

On OSX, you may get errors about missing header files (e.g., png.h, openssl/sha.h), which even if installed may not be located in standard include locations. Either create the required symlinks or update the C_INCLUDE_PATH environment variable accordingly before installing pybbi.

export C_INCLUDE_PATH="/usr/local/include/libpng:/usr/local/opt/openssl/include:$C_INCLUDE_PATH"

Notes

Unfortunately, Kent's C source is not well-behaved library code, as it is littered with error calls that call exit(). pybbi will catch and pre-empt common input errors, but if somehow an internal error does get raised, it will terminate your interpreter instance.

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

pybbi-0.2.3.tar.gz (21.4 MB view details)

Uploaded Source

Built Distributions

pybbi-0.2.3-cp38-cp38-manylinux2010_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

pybbi-0.2.3-cp38-cp38-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pybbi-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

pybbi-0.2.3-cp37-cp37m-macosx_10_6_intel.whl (1.4 MB view details)

Uploaded CPython 3.7m macOS 10.6+ intel

pybbi-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

pybbi-0.2.3-cp36-cp36m-macosx_10_6_intel.whl (1.4 MB view details)

Uploaded CPython 3.6m macOS 10.6+ intel

pybbi-0.2.3-cp35-cp35m-manylinux2010_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

pybbi-0.2.3-cp35-cp35m-macosx_10_6_intel.whl (1.4 MB view details)

Uploaded CPython 3.5m macOS 10.6+ intel

File details

Details for the file pybbi-0.2.3.tar.gz.

File metadata

  • Download URL: pybbi-0.2.3.tar.gz
  • Upload date:
  • Size: 21.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3.tar.gz
Algorithm Hash digest
SHA256 9892ae15ef8d24ebc92d218d9941085b93e14405ac315319107f17ddba85672c
MD5 d3d29357b5426c8aad384a1f1c9bdf30
BLAKE2b-256 7b35ff299af5099115fd07f07a31bdb504195b94b9221def6dc0db7a037e7ea8

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1b09e50a06aebbdbcb3dc0379b75962c3b26e4b80093de02d25a63ed7d81c7d7
MD5 7d0eeed9a3ccde42b1f4a36f41a2e9ab
BLAKE2b-256 8073751c30a439015a115417c5588c244b4fdd4dc1bc7e12b90b1928bd1d228a

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3e9fe97536027a9e51c0cce755fc2fa142ef06c329455b56928d13c8519081c6
MD5 f0344e6c80b52f7e52be63de6b4b72d4
BLAKE2b-256 fc112f276e2e9165efe2a08689babf340891e90c076ac09bebc0f6af181ed087

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ae462eec910bebbf1fb0b46bab1b49358efc08aa90e59b57702f193a7a09ed4e
MD5 a6d1604cfc8294166e3ee08ad789c2cc
BLAKE2b-256 4dce86bbbd65755f6d35fca17953e6f2fb081314f4666790588572e5cd1b3c43

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp37-cp37m-macosx_10_6_intel.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 e94d502687359d19b16de340c3bc4e400dee9e1ceffc2dd4cc384f9a274ae09e
MD5 7050acd1b4a4992b8936ebe33d3edc31
BLAKE2b-256 d53cce2ddead977d4c627ae015493a843b019e9878eaf24054f4059c336e8c12

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 16d0f7eee6f81c395859c2d35b9c23ea0304933983fe5e4521cb961dba6286e7
MD5 1b92113c9cb588c41f3ba4ed9bcef786
BLAKE2b-256 d01b33e6744ba396e37b90ef4e05e33f9b3c64376a0ec1d34724ea385105818f

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 4379f7560483ae01b855317e0adead5f083c853dc261ee0fb95b75d3b77c15b7
MD5 203fc4394566f356040057f10f956976
BLAKE2b-256 28e1b2514a31a4912f441c91b6a9198cf57bafeeaa5b65bc5a303ac82edad46e

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 33422f5dbdcf002bbffbc2386f9b4758133807fbb6059060d575ae5405c2bcdd
MD5 152fb5c0b39901f608d1574572eb554b
BLAKE2b-256 c87ac0857c1d981a3e46087a73a3e7feafebda7909e4ae80e147e374bbe8893c

See more details on using hashes here.

File details

Details for the file pybbi-0.2.3-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: pybbi-0.2.3-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.5m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pybbi-0.2.3-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 bbbc473a9e516f587a9c42679742e8073cee4542610467ea251c71a947e8f8be
MD5 a89e4a9aa9618dacdd557acb09a34cdf
BLAKE2b-256 92ab979e1cc438c2eb2099e5116e0bf3cfd88e022fdaec92c97fc90bb95490c5

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