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-0.1.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2821e6bcf289af222f903df3ffed955ff9d32b67241caff5604e201392aa4625 |
|
MD5 | 5171b93485df479ad9710affadc075db |
|
BLAKE2b-256 | 87cdb1e463b802bfd88c725a62e3d1960d68381382853d8c7bf01aece20d109c |
Hashes for cbgen-0.1.5-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 914c9b834970a53d31c4c860211b384db8de967d6ad2622fc73ccb1c7cd50255 |
|
MD5 | ef14a32b43370536014d44b1cd6c33d3 |
|
BLAKE2b-256 | ac9cb6526934632875588c09b0e43d98256b930ee4e026efcd3586ff9ee6dbac |
Hashes for cbgen-0.1.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 161e09367a2dc912a256e4ead9722ae8f0ae648f25a1c6304802e903fe96eaf7 |
|
MD5 | 3d793886179058ec15928d1bcc0f38cc |
|
BLAKE2b-256 | cea0a87887ffed8720a08be9282ad17aa107e934bebe463230528536a9a9b830 |
Hashes for cbgen-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 364ee9d25c6a43e53fcfa15a2976013b6125696df43a7b93e68af007453b54c2 |
|
MD5 | 8b6990e956ec340d325727612f3d8502 |
|
BLAKE2b-256 | 4e935339cf8e8f83126dc2e2e379d3698f6ab61752e6c62f090b0418511c3af8 |
Hashes for cbgen-0.1.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dfeb01e900d3d8a001207f570e4a6dc7009e3c555b8c05f4bb8a93092bfafc2 |
|
MD5 | 65d0c8522c0018604940def8d9a07fcf |
|
BLAKE2b-256 | de78f8c8d586c0c00825e2a18274083412ad1abd120ab8c9dfb8ec454d5c9766 |
Hashes for cbgen-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcfcac1f402b983a7a3d6dd2f9cd25c12a17095f593caa56c650c29410dedd49 |
|
MD5 | fb476e448507306a1033187aff6702b9 |
|
BLAKE2b-256 | 43a57ba19bc8dfb97da395800151a3c6764361d98ed17f8afa245998c643ddb1 |
Hashes for cbgen-0.1.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41808ab246f9e24ccbe57cc6e402846fbbef6dec88b7a1cf2355a95844c929e9 |
|
MD5 | 3e5f3f1601d1fafa9f8d0551ce3049fb |
|
BLAKE2b-256 | 0899e12e843c0ed1e6a624af810e618e557728a7379f77d5b9a4d238983482e7 |
Hashes for cbgen-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4299985a35377ea111ad7aa068a42befeb1d9bc5537baa14442616c92f97f0ce |
|
MD5 | 50a825579aa09af24a28fbc09dfbc3d5 |
|
BLAKE2b-256 | 0c8b76558816c1e32d82a1f5a8c3b209c9b70d104029a40a51c528a0c98a4aaa |