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.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00559d698a0f8f564e49cc9ea04ca1b210571ae6bcedff85dc759bb4592b2143 |
|
MD5 | 38fd72b201a4c4b06b3cfe96225e1252 |
|
BLAKE2b-256 | d2f1b453e16b900262d9827057d59d3fea26d44f3cdf483b67cedeb314007314 |
Hashes for cbgen-0.1.3-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3a1307af574a49879b3dc64aa7f9aeba897db3270446c33b1a2cf233b49176e |
|
MD5 | 1baea2e3dc813652188578fe250f67c1 |
|
BLAKE2b-256 | 0ca70f7ce098ab4f07108f059b76f7cfc4bf847a05eb9352faa11029a528dfde |
Hashes for cbgen-0.1.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e62a6a52ff7a09e0aba28eaa775926ad305774e1a941741c012ec484f92acfcd |
|
MD5 | 10e20cb80c7d889aed5410f005b3a781 |
|
BLAKE2b-256 | 408a7c579bd1b0837ef095bf594a95368f6acaad2a1e771e02ede02eb27c4ef7 |
Hashes for cbgen-0.1.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 137671964d66aec40af1a51613f5a5851cc7a86fe05d93cc3f043fc0b8798930 |
|
MD5 | 931d9dd52ca5598f3a006d18c3d1c1d5 |
|
BLAKE2b-256 | 76c253a08c8ed4da5aded5b9accbb8703e3d060c9edc7e22bcde74788583bd10 |
Hashes for cbgen-0.1.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b57f8e5d0a69bdb669d4be3724b5c5f2cbdcc94cbaa0332c3fcfff8806afd9ad |
|
MD5 | 5271b83880d90f3e7f3fe34ddf3c3532 |
|
BLAKE2b-256 | 5c3c34df7e934a71ed72a5377e86bfeeb863a96c107cf0177b7d6945adea59da |
Hashes for cbgen-0.1.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7475817afda91ed9f527e16c41097b5c15f9d1fc77fe86d13725b4d3a689a482 |
|
MD5 | e08a5f7a99d5fbd698b4aa5c154a1600 |
|
BLAKE2b-256 | 092e697134fd905f59be95bcd4053edaba4789e6f44f1f9d87b557271a06f748 |
Hashes for cbgen-0.1.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d9a480f32323248a9546dd78bb6469b6724c2db1c31252debf6e1d1c73cace |
|
MD5 | 78520424a30d655287ee07bae72bcf27 |
|
BLAKE2b-256 | 56083340d1e4402045737f0b502e41bcb0d3ac498c9ed5740e31eee6d5a84dc3 |
Hashes for cbgen-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4450a1e5c999b8705118dd47ebdfa33eb66adabc6a2c5812b91fc4b8725860b |
|
MD5 | 897ab1b0e76cbf16d50bc9350a149158 |
|
BLAKE2b-256 | 9f514539214ef8425aa530871958e9aa52dffb635f6978f0480cf76532de1765 |