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.5-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a5bf201e955c568e0edb51a361fddd074d9808f9fac5d15491950ef195f7371 |
|
MD5 | 66df289d04dfa5e9668a747739c09677 |
|
BLAKE2b-256 | 74099c33b661aa4bf2fc925cb49555b5d66534158b7d13c866b0214546e60b88 |
Hashes for cbgen-1.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53124602372cccc42cc013c0e2bd2f4e61a70e5ec76728a393477ad096049bc4 |
|
MD5 | b5511da238fe18d803e9416d0b31bac8 |
|
BLAKE2b-256 | 5b31a3993019c461f48bd511128bdaa9919c5208798a920f7c1b49cbe4829b88 |
Hashes for cbgen-1.0.5-cp312-cp312-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | feda0f9c9b2ce3202b629fcb97991990935dd496df0823068dcc28851cd9143d |
|
MD5 | 1498f23122f155268447923f79d1595e |
|
BLAKE2b-256 | 2b3cd727724ea4e5d9690ef86c36e4755636738c629774f52ffe85e6f4826fb4 |
Hashes for cbgen-1.0.5-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48f564a9bd4da96132de92b79368ddbafb58c98b7ea336ee48aa6bb1fcb5085c |
|
MD5 | 6d91b06bde9cb825b38658afe3c726c8 |
|
BLAKE2b-256 | 9015a698bb266cbd9d5ef3d1dec7dd4f87040a0cf5cb4a1fa7d6a9a2a62c8c9a |
Hashes for cbgen-1.0.5-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf31b3985b498507c35aed117c6031bb6e446a896f98c1f49b69e0b62dc9d21e |
|
MD5 | eb4a224817fbe45ed75e08357baca0a6 |
|
BLAKE2b-256 | fdfacbc340ba678ac3907459383d6b7c2a4ae45be69bcc7f1554d52f52234c40 |
Hashes for cbgen-1.0.5-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35ced0081f3ce77639b5c87e277a4608bef487227078e72e937fc0c42ba039bf |
|
MD5 | 2b1ee221db6f4514fefbc89e48985497 |
|
BLAKE2b-256 | 544731f927494b2970940fe10a69ee07e8bdb87ac151a477cd8f1a5155c30582 |
Hashes for cbgen-1.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d93c96211fa55fab601fd825f21cf6998015b5473c7eaa19f79d34b7da31a9a |
|
MD5 | 574bfdc5c39546fcdcf1c172b12cd56c |
|
BLAKE2b-256 | b1cdf9b0722a300a20d06b9a3595c4689b1f27d6a1764f03b4a54a2824c252b9 |
Hashes for cbgen-1.0.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ccd47d35cb7b307c3aa2d21de8229f6e208b2cb16058db3ebf2b8f2a5d61b50 |
|
MD5 | 0fd3fa7c0429bc7c11e2fe5d50448d98 |
|
BLAKE2b-256 | eea02f5487200c1289a19b01ec1f7af78ebdceb22ef49e1118d80fa0369633f8 |
Hashes for cbgen-1.0.5-cp311-cp311-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87d111e37e6db411bbcdc6f84a8c64c7b586bd6e0f566604b046884083d5ac14 |
|
MD5 | 2c9d3872ff10d832c644f2d8d1ac8e29 |
|
BLAKE2b-256 | 2565ec4ed31db91144f7e48e6bd94425b71ffe0a592ee61ce8400fd372dfb76e |
Hashes for cbgen-1.0.5-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37e6238485090f02ddc741b1592157e8ce91d7ebcb7cdef08637c47d35723202 |
|
MD5 | b0fb7866208899a3d8562a01e5fc51b6 |
|
BLAKE2b-256 | a1c51d4e838583a1e31e0c188008539db3608931be41d04faf0ac1dfb3057e49 |
Hashes for cbgen-1.0.5-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2dea12868f1597cd8792b6b1e04a729a41a787448faed523e17c9875ad31767 |
|
MD5 | fa9c9de4383884ec3f82465dc9b59ab8 |
|
BLAKE2b-256 | 510defe1091232618c5f00e4205027f73acac3c689eb4061037376d532564a4e |
Hashes for cbgen-1.0.5-cp310-cp310-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9737330eca2b99d1440422e84eb99a67a06ac205c5b9a4f1d9a9e50469d66b2 |
|
MD5 | 63e62481ea2404c631726a70141f0cb5 |
|
BLAKE2b-256 | ecd51cc7fe9cd3dffd5042f5052fe9bb7e1f16ce43cc6ddc243c0f7073c64c01 |
Hashes for cbgen-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99cddcb2afa5588c86ce02da0e449868f8c1a865238c041e4df09ba1711960bd |
|
MD5 | 8de65750171936164853c55e632db6dc |
|
BLAKE2b-256 | 71b989fb471b056f8e2316b96493a0bc3452a55d849044cfbc03336fd921c96c |
Hashes for cbgen-1.0.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bce84deeafc3e259850fbd3407e8ea4ab991f9cd04b35d47212dde2b04332eb |
|
MD5 | eb3b65bf8ce4a76db5439cb6391128b6 |
|
BLAKE2b-256 | de61521098296b479986c4210f7aaeea1e5780563e4396db7038506e017116b1 |
Hashes for cbgen-1.0.5-cp310-cp310-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f50c2c48afb1955d29974a7de34fc49189f7ff2c41ab7ae1466367fe06f45cc |
|
MD5 | 8ffafe7cfc8b3e0d6223f9153a448601 |
|
BLAKE2b-256 | c63c637787958e2b899f301135ab8a21299ded53d961a81536e45767fd1fc875 |
Hashes for cbgen-1.0.5-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a216baff30ef54a67a1beff597aeb6bb40e1ea5e13ef15530dee4a8a5cf7ea0f |
|
MD5 | a0c102adf08b0988e8cd0ca001b42d7c |
|
BLAKE2b-256 | a172f05ea97bf6428823fb388d157fd25cded08d6f1c187d306835d312ffe986 |
Hashes for cbgen-1.0.5-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc13679ba72117e2f5507399a37322a22b42bb712123abcaeb863e167dee9fd0 |
|
MD5 | b6cc28065a0944888d552fa8007ac648 |
|
BLAKE2b-256 | 0a2eebb12a70f3ad57e2287337d92379ec150915f7301deb0ba213aedb74697a |
Hashes for cbgen-1.0.5-cp39-cp39-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae355df5433ff631a1af3da70f477ad8829a14ee0703bfa9912beb51eeb73041 |
|
MD5 | bdb20b04a7d216d044ab0556981d65a3 |
|
BLAKE2b-256 | 5276bbf335d268c025ee59f2690e59f727bf9c8fb17fc084f2af58470c7e0f63 |
Hashes for cbgen-1.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaea455e47698cec4739ef2c303bfbca44b5416628a757cb7b1b81cd4fe9ebf5 |
|
MD5 | f8634ed9b1b199c38f3ffb3a5266a71c |
|
BLAKE2b-256 | d7483e433e8b816b16267726c634b6b6b4aa472cf93773d107af9039d0420401 |
Hashes for cbgen-1.0.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85934947c9866b49c57204f915bfa977c08e2732a796553ccf2a5ad384311219 |
|
MD5 | 2390d7d7d41749aa74b2eaa2c305ccbb |
|
BLAKE2b-256 | 47178a1eb297c169566b73dd63c25e1435c34e9c10b4ef42cb776b5aba7372f3 |
Hashes for cbgen-1.0.5-cp39-cp39-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15c8ecf10290baa5cea73bb54700e2a03a78a33b8ebbb244661cf116aec7fa70 |
|
MD5 | 89ff0ca419ab0cd6b47153f3f2500482 |
|
BLAKE2b-256 | 3616e41ad54d17514fc66bb2c612cfe899ce1633c671a43700e0c1122571d148 |
Hashes for cbgen-1.0.5-cp39-cp39-macosx_13_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19c4dbbd50f2e50e8d74b0dcd1d2b399dba0f0a47e4ebe4be219f7da952bb778 |
|
MD5 | d061b3113aee13bf5aee0ded4b7d442c |
|
BLAKE2b-256 | 6d83edb59a601105b6e5d0ed185ffcb8798e31e0e915c2250f3d4ad026cf20fb |