Python wrapper around a 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.4-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 555bd2915ca463ddd058861a94f1677a0785c89e8ebae626a6967200ff23f7f6 |
|
MD5 | ebbe9888ff84120c4bfdc7d08a618264 |
|
BLAKE2b-256 | a46d18006ad4ab36f3428d82c59e08cdaf051bfbab6b387b1562044ef7a4d679 |
Hashes for cbgen-1.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f57fa012d87ddaab9411134f4d933250f193f38e249a555f7477ec14eda5670 |
|
MD5 | ee693fd790bf9840f8d60dd952942fc6 |
|
BLAKE2b-256 | 7c4bad67cbc7f162128ddda9794c9021b6cbb171657e82c218cdd1133fcf2213 |
Hashes for cbgen-1.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9111afd9964611358716445824e8135aa41d835ada00ed318b22d7ec42939460 |
|
MD5 | 09136b443297900a69ee062b636456d1 |
|
BLAKE2b-256 | bec41bfb0d26756829266fd36160565bcdd3afabc3b92fcca25546893c1ebce3 |
Hashes for cbgen-1.0.4-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad64512f393f419530f4bb4bc3e097030b1ec1a18b8c80432eadd80919a1e1dd |
|
MD5 | c8c29afd14d4721711ba68cb1d1810e7 |
|
BLAKE2b-256 | e1385181a2d094273abdf35e7191d97e55e9048a6682bc8646c7f2c4cd429b23 |
Hashes for cbgen-1.0.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53dfdc1695255a8021b4439d37580b905e085988f6818f2dd070db13012b0570 |
|
MD5 | ddbae50061f27b8c1998b1815fe5fef7 |
|
BLAKE2b-256 | 09a632dbbd567d67ff4945723941d0929501b3dfb2e6af9714f97eb45d6f2724 |
Hashes for cbgen-1.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a43deb1c8dd88ce9620af0ae137ce112f9a33a89f6ce12c1b9d6931f06f04a9 |
|
MD5 | 9344d0c2c79eaff56d5ab14bda172512 |
|
BLAKE2b-256 | e2088644a6a6f4249b48a842932bfda7b01449ee9ae6e9b290bdd895b00e74fb |
Hashes for cbgen-1.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21759e763e43a28e5f7eea592e1bdbab4390cf470d9d27e347cc73be11bbf583 |
|
MD5 | 8caa7a1585e7dc8c1f0b8c130ea35c77 |
|
BLAKE2b-256 | 904efdc4c80e09d4719660eab085c84e267b33253d91b92ac80acb91dc5f8a76 |
Hashes for cbgen-1.0.4-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8000b8e9998a73a7958c0627080b9ff89ab95193424e376bf22b9bee2fed9a3d |
|
MD5 | 4bce7b490a1d21be35085297d50a65fc |
|
BLAKE2b-256 | 956bada13b4e0a84512f089e6d32dd698e982029ed14db1e87e0e7c9803b9db2 |
Hashes for cbgen-1.0.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2be084688e2e6afaf50cef75d5821b8433f44574c70093a5e67f73d92fa9bb9d |
|
MD5 | ad3027ef26fb8b5775cd4c18b1179351 |
|
BLAKE2b-256 | bad19a277844016c6e218c97df13518a4557c724ae976e5c3df15e1a6da07433 |
Hashes for cbgen-1.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d6e68bacbd6b54310b3edd970f16a988b0d8c6c7961739c190bb2b14a35e028 |
|
MD5 | c0d93f6a98b157cec6e3071b0dffb06a |
|
BLAKE2b-256 | 35bbe0f654daa392485fab5039b9a25382b6ec38e947e2907fe9c0d6392262f5 |
Hashes for cbgen-1.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a7c34cb6f6085139d731f45e0cf81f081a3d4d0a57786dbe0640bd0f108ae7a |
|
MD5 | 4169caa94414a68132db7481adba54bb |
|
BLAKE2b-256 | b53e8b8821a4e315b2de1ba0a12fcef0afdd27ce9ed17fb9c0668643513e5b17 |
Hashes for cbgen-1.0.4-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a861dbb51b5daa907435cf65a289067c47e0c224743d5605e8d9addeb77c9d39 |
|
MD5 | fb8448f928f8a7954ec08070a6e4fa74 |
|
BLAKE2b-256 | afbad82c7f9ca49494e9269e456351dfeca72e73d4c6b770dc6eb88d5945e41c |
Hashes for cbgen-1.0.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e26380d99da26ba13927de21c611e2050440dc3b63feb2aa02a807fe39e6c30 |
|
MD5 | 5a3a08a55a815d70e36a9b3b3c818b93 |
|
BLAKE2b-256 | c21ecbe7c95bb3f8e9855ca9822a09502a72260fed8e6149902c60a49f5fd3aa |
Hashes for cbgen-1.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c0bd48da53437f3d5758dd6b735f3f901767bd1745c8118838471b4f1327c2d |
|
MD5 | fb2ba1a28b810e22d3a4ca68da95c3ad |
|
BLAKE2b-256 | 8430991f15882969a5c53d270fa20f3be4bdd70984cde90f48e8ddb8b1f4bd1c |
Hashes for cbgen-1.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e304205c61d8488012754a9d759a096848ba8b5ab4d21e29970aa75223276bb4 |
|
MD5 | 57b0319e52037de754b1b0ef1438731e |
|
BLAKE2b-256 | ca7f884c30be291f67598cb4b8198c639641efbacf80980ee4bca122373e1d4a |
Hashes for cbgen-1.0.4-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2405466550b34510a05039ac9e61a7200ec058b936de4f196a087c724a0ecc3 |
|
MD5 | c05532bbeefb1ce8f41215e84576239a |
|
BLAKE2b-256 | 0ecd57391ebde5da6e0648dc41de77525a0a66e3e756f0e458ada57b7c41c2be |