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 Distribution
Built Distributions
Hashes for cbgen-1.0.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edb10649ee5f2a8b04d878a6b22a45353d78b657de56236706b5967a7e6c6c9d |
|
MD5 | 660a87712064037474cdb7c9343f2c23 |
|
BLAKE2b-256 | e3c8b3c1f4f44833e95a451d8834b2f3242ccb39de1144c621ab3f7309432973 |
Hashes for cbgen-1.0.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d4ffb205f6aff4d8becffb001c9d9739a8bfc3eef8bb4fd0a76e7159a8b366b |
|
MD5 | ab512d54a9a11a847090df0afb10a511 |
|
BLAKE2b-256 | b0418a570e8297148badd0d070744f994fc29e9edefa347aefd8850b2e0972b0 |
Hashes for cbgen-1.0.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f256765477c72732d43d746c1cd9e407d775816294edb03a88a14a15a7504b28 |
|
MD5 | 894be50c3f8eb0f89c284c06f6bccae8 |
|
BLAKE2b-256 | e219a6e750ebfa9ca637faf9d72b7bc2655e3d0ea238836036f763a04cb5a2ab |
Hashes for cbgen-1.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdeca7fcbe47871e18e40ff20379c0888a45138710695e29849b84bdefb1ad87 |
|
MD5 | 5b7b7d6ed876301a15557d4548e4346b |
|
BLAKE2b-256 | 1ef1433e4ba6cc15fd6d1f460f2522da180e458119f2316722d91e29739f7680 |
Hashes for cbgen-1.0.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fa1793115008e82cafbc654ce503a17723002182e6eed4ec84530f672b4d4b2 |
|
MD5 | 549d7df2e0a0df2b4bfe0b8a34767b68 |
|
BLAKE2b-256 | 4c0cf13b6001ce09bc2d01b28c9c5f900965bba263355c1e56b7831ca5183442 |
Hashes for cbgen-1.0.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39f131404aa3141a81f253d49ed15a03c34f640246226b357b090225b9701bd0 |
|
MD5 | 6cdcb7f42ba8d061e29e459b3e937cf9 |
|
BLAKE2b-256 | 910a227ecaf5c1df97b81449892e7aa61f02aca02195d1aa56738ab2fc971d43 |
Hashes for cbgen-1.0.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c115036f63e3564fc79af78992d1913c1616d818baa22a5ec33930dcb374952 |
|
MD5 | f9ab81d0d0ed7243967af76c0d03c5ba |
|
BLAKE2b-256 | 43864aedb39e626416e42fe9db5c036609c37ec06d8330b33df2052792aff146 |
Hashes for cbgen-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 146657c6959ff726d6ce8caa0e9821515067fe716176013a5742513c3182e516 |
|
MD5 | fbfcf99941ea5d867789c5e5b2b810ea |
|
BLAKE2b-256 | a5df206a4f6149ae6262e0b758e0733d7dc960edb98249e5eb8d79c96c03461a |
Hashes for cbgen-1.0.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69b3c4f657b3cb18347a2d49ddb22ce87fd1c7f275d30a7e11ae37b27e62cbd3 |
|
MD5 | e0369c011f7eb4d00a7bdf2a43d02471 |
|
BLAKE2b-256 | 395611ce7179c04e0f5f4a674cef55d5cf6fbfe6e4b42d0b4805fa3c86fbee57 |
Hashes for cbgen-1.0.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45cea9b8b16f3f0f483fc31ba1ab7c668aac9cc7266d9c09d5e327c6942d3f61 |
|
MD5 | 4a632430104f6178a196d6f8037e7491 |
|
BLAKE2b-256 | 12452573313d5f8ef26df63fc627b2772af4c4831cec5db84d4f07390a59efde |
Hashes for cbgen-1.0.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d98612eaf0e99f30983044a373b8b0cf06a9b586fbe156446305d48dc2bbb704 |
|
MD5 | 063f834ff3d3bb5936f82019c78e4038 |
|
BLAKE2b-256 | fa8f2df97fbdf65544bd0854145cfbd6918553d6b38fa74f63590b62e7e13fe5 |
Hashes for cbgen-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d18cd0ba540d0ca53d749990c4c59f8d84a1247cd4ee6c4b873f04457ca726c |
|
MD5 | a85889ae784d127eb7b5fb84372034a5 |
|
BLAKE2b-256 | 403da9ccecf68b7ca636ef13bca994e66dd4d4c5754b65620232f3ecfaef82a8 |