Python wrapper around bgen library
Project description
cbgen
Python wrapper around a BGEN library. (cbgen documentation).
BGEN is a file format for storing large genetic datasets. It supports both unphased genotypes and phased haplotype data with variable ploidy and number of alleles. It was designed to provide a compact data representation without sacrificing variant access performance. This Python package is a wrapper around the bgen library, a low-memory footprint reader that efficiently reads bgen files. It fully supports the bgen format specifications: 1.2 and 1.3; as well as their optional compressed formats.
Installation
pip install cbgen
Usage example
>>> import cbgen
>>>
>>> bgen = cbgen.bgen_file(cbgen.example.get("haplotypes.bgen"))
>>> bgen.create_metafile("haplotypes.bgen.metafile")
>>> mf = cbgen.bgen_metafile("haplotypes.bgen.metafile")
>>> print(mf.npartitions)
1
>>> print(mf.nvariants)
4
>>> print(mf.partition_size)
4
>>> part = mf.read_partition(0)
>>> gt = bgen.read_genotype(part.variants.offset[0])
>>> print(gt.probability)
[[1. 0. 1. 0.]
[0. 1. 1. 0.]
[1. 0. 0. 1.]
[0. 1. 0. 1.]]
>>> mf.close()
>>> bgen.close()
Authors
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for cbgen-0.1.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18bfa97bcee8268471c3c070470a165649e46743e5b182e08d2cf11657bb4972 |
|
MD5 | 8bd17c9944aecc316706aaa33798a6ac |
|
BLAKE2b-256 | 17ec043abd9da3da98935abf1f113576de663ba283cd438150e5cf76a5975691 |
Hashes for cbgen-0.1.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c0a6f30986c982446fde15433aa753e1a6c842e8b75b74e43e501409d6aff19 |
|
MD5 | 4a139c7ddc0b87cfdc42777aa9be2cc5 |
|
BLAKE2b-256 | 5bb632be2a13792ceab2d47874cfe8008c914670663ba97d96fdc847f84278c0 |
Hashes for cbgen-0.1.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56ff3ebd7c92cd9019311bab8adb33c5f136df9b31f0ffd94cffd8cc2d4fb90e |
|
MD5 | 8625babfef42c603f882a3487051f7b3 |
|
BLAKE2b-256 | bef439e6ce6130a0ca5d34ebe7eb73925a8ab97b787d6be51f9c45571f4b4411 |
Hashes for cbgen-0.1.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d422789c5ca03ccc91b7f68159514885923179836e42f6fbd63a436efb03ec0 |
|
MD5 | d7997894d68790eac66bac8f835b8c3c |
|
BLAKE2b-256 | 9693cbd5158d30edf09b257c719f28669a6c14eede1f17e14c085b98dbc74782 |
Hashes for cbgen-0.1.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcd4e3b0380214e330b988000401790035da1322f0022ac57464120c76256a95 |
|
MD5 | 500f5abdfe6e0743dadbc1d60681f88a |
|
BLAKE2b-256 | 05806885177c1142cc125e4d32d1a9bd22a83db4942c3bcc661ec47f414dbcf9 |
Hashes for cbgen-0.1.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aace9cd5cc8aa69280433d44fdb4eaf1be7dcbddfe41e2bf56af1474fa65916 |
|
MD5 | d785bcb9b6dc893a14cbf165b445e244 |
|
BLAKE2b-256 | 6a9e1f6ace07d49b27faab3ffa6167e4dbf40dc17cb45132b33b500a4ba345d6 |
Hashes for cbgen-0.1.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b12b8cfdbb954c8b76bd95a33ff54bf9bdd5bd73a9ce6320b4ff3753fd709aae |
|
MD5 | 8b0aa598a44fbafeeb467a48d841176c |
|
BLAKE2b-256 | 4c0cf04739b4f91b2ae814d71e7b52e8645bbb02139671dc210724e07d923b3d |
Hashes for cbgen-0.1.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0d2056eb25710bf5a68a40a25c4bf19bf9cabb0f251a5aec39557e73d276170 |
|
MD5 | ae177117e3bdb9aff4c8a7686bc0b8a2 |
|
BLAKE2b-256 | 98199987b344b7fb50200ab432347b51d4c8a0ea8a21a290dce8fc75abed6f47 |