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.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9f4092967e0679700331fc870cdb2e767aa7fbc62af2ce794943cc1de94c016 |
|
MD5 | 16fa19ba2f391a35451e2200449c4628 |
|
BLAKE2b-256 | 528844997180bc882dcab2c93c0817940dac87d70e007a7772cf47db95710737 |
Hashes for cbgen-1.0.1-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c0939c010521156cc80d0cc37b9e1bd8e21fabac8731c5c49dec98b793fbb09 |
|
MD5 | 934ac16e5e3eae34ceef1b2f5723f00d |
|
BLAKE2b-256 | 89ebd6ef546c20bbe0e8055d510f3aeb4e3963d3edce6f3650a62e58aa85707c |
Hashes for cbgen-1.0.1-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df828228f36010d2ed1b511db7585d7a5dd48476706a861c281e0c1a29e28350 |
|
MD5 | cf23f5aeaa96730855350beeb617a31f |
|
BLAKE2b-256 | 5db8c402a88f3e314b3944a77e57f94a6cedc234196b8d812796c7c4a1cddf2f |
Hashes for cbgen-1.0.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 066303cf386e20a1f758011bab68a45e56861c92bc411d26c3cdd2dc8ea2ed9f |
|
MD5 | 1b5d73cce66ea492dfe950472648446b |
|
BLAKE2b-256 | e4a3a993816b12a8c495116fdfe22988c0a24108f27d06007f76981ccb2f854f |
Hashes for cbgen-1.0.1-cp39-cp39-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea7fbf347e84db11ba8da5ddfe0bd207de05375c7323636299c3bdcc7c1dadc8 |
|
MD5 | f007b907577a9a5fd9acd9614426235a |
|
BLAKE2b-256 | 04c427adc1ef0cd462df59c8208d71ee38640683d89deec6fabfb7c1f690206b |
Hashes for cbgen-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 399ae7826493f0f3547828915a474ca98acd865af370a632788fbffce9f1e7df |
|
MD5 | e7dc53e5679f6a3284a2c1a144526b40 |
|
BLAKE2b-256 | 3534437680360ab72bd4c2626a014a7573c7b1453676329a3a74874fbb165099 |
Hashes for cbgen-1.0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b612e9428f1d2fff0db654e4f577410979422c25b83aa9d19bfe622dafbc7d96 |
|
MD5 | 37c1d1a5c7c68edec4bdbdc1b0b00895 |
|
BLAKE2b-256 | a185dde8669eb47e1f753d936be47cbc77c8fa0c08fcdbb763720a0ce7a86aee |
Hashes for cbgen-1.0.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81eaacdc8b59f6c4298060f447082ab4dd7fc4d0ed049594d8b5e76ff0cfe654 |
|
MD5 | 0b2655c7ab10d6456499451f75f514e7 |
|
BLAKE2b-256 | 26c479e9265405b607e78a4d10d8214f41137c99480cbe40fa6ea13f2ad2d9c0 |
Hashes for cbgen-1.0.1-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 099e90e2df99cc9904ca84fdfb0c3f9034f77059acd74b47412a80efd7e61704 |
|
MD5 | 4ef5049e2865265e6c35fe2cc8184b78 |
|
BLAKE2b-256 | 13d03105a1c50b366428c586e784744e64fc74cee7151ca649126d2d60f69fb9 |
Hashes for cbgen-1.0.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 677a8a486b400629135b5e455b5ee093acc3e23c2a4ea0cf2d297e9f84de4f02 |
|
MD5 | 0678f8c43d24daaf94cd518be4a01c60 |
|
BLAKE2b-256 | 2e23b163c071ad008d8ff4d9d56aa5342195c5f6b5b5b0d6e7cd1965f08e3f6e |
Hashes for cbgen-1.0.1-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a5c13eefbd53a20cf5d037574cd5c39d98cae569bfcef97971cc5a30ff19241 |
|
MD5 | 41d22257149776067889359ca6fd9ab6 |
|
BLAKE2b-256 | a9adfc8a0d0781d21a3c21f06acb13a6209c6fd984368235dccf9d72df3db6fb |
Hashes for cbgen-1.0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f0e98da8757b6a70878fa8e6e7490e057a3699c8a363ad7bce40d1223903b36 |
|
MD5 | 6f629c8aa2feda7dc0bde3dab6a8f981 |
|
BLAKE2b-256 | 86c1fb3c3a85e9ac44cef8ef2d82deca9e783ed33c3daa1750c12c7595f457a4 |
Hashes for cbgen-1.0.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09c5b7a09f0f92bb1a34b273748ef1e0b5b882620f58d64088ca4285a58dc367 |
|
MD5 | 3da44747ea49c124240626c74e8e606b |
|
BLAKE2b-256 | fcef684a4f36fbbe1f68655d151b350f4e83a86acf5e5d8375ae7a0aa0085ef6 |
Hashes for cbgen-1.0.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb281d72ceb6382b20a7c13da6e77afc33478b31502dc319857fe90276ac300a |
|
MD5 | 3306a386e927d0d58c63d57452bfb22b |
|
BLAKE2b-256 | 1e55e8d8fd0baea74bfeb63eb2fad3e20d5fc612097c7a0bd2a7a413cc649eef |
Hashes for cbgen-1.0.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78242a7406c7e9ae6d8c08939df88b6ce324c9b711125b3fa9484cdb074ad043 |
|
MD5 | 84c998555e631e9c18f347c8e478c06b |
|
BLAKE2b-256 | a41bb2e10880ac8d3039174d85579d1c65debbeac2946662d0507c1641f38ad8 |
Hashes for cbgen-1.0.1-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cade2883edf3eeecbb6c2b4dc839a7c27deb9ab49013b5c4549b057be31b436 |
|
MD5 | ff5720fe4442fe1330d1e10ac7c92c84 |
|
BLAKE2b-256 | 2dc680951cfd029b98bee3ecf599f6ac07bd79c870e8724f501d3c37b7018081 |
Hashes for cbgen-1.0.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cd40895d7a43cf58cd87220ad4099f20c2dc430b61df9ba134ae789d7a7056c |
|
MD5 | 7ef067ad1552b8a9480a4fb1aa00cc3d |
|
BLAKE2b-256 | 85d5b4b97937842badb3554c62b9485fa82b45096db58d6606eb07677cf33e9a |
Hashes for cbgen-1.0.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c117e50d79a66ed283870f18672819793de2f33ad5ef705232596c71312b7202 |
|
MD5 | 7f42e316402282a4e37c8353c1de26f0 |
|
BLAKE2b-256 | 7f00a714a33f654bedae21979ffb16a1ec5948b3d44f4bd14684b8591eca3f2c |
Hashes for cbgen-1.0.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7500f5f5671041624aa47aee01faa08cc10e2a23b1dd7eb46811d5d72878cd09 |
|
MD5 | 8ae1112d756f39aa258f17409ad76b04 |
|
BLAKE2b-256 | 3731bfcc3d9bf5c6768630f256dbd40fe4691896d64d3681851e2ed745be0d98 |