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.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54dd5e64a013e293e01a3be9ed89e2330bed0c4d2eef77765ddd5a1bab466098 |
|
MD5 | 875dcb3b7a68f04ecbe7baa019a4c25f |
|
BLAKE2b-256 | 9da7ce0342b4cec0209c6648c714805601b25107a4126b1ff5ad3c3500cea8f2 |
Hashes for cbgen-0.1.6-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05f9592030b1e5f631fe4058ec153f26f2b8c68b0bb62c718e3cae326aa61509 |
|
MD5 | d7abdb9aa228e19cbda7dd6c3b4671ed |
|
BLAKE2b-256 | c010d86360651d36e99be19dbd25fa3e9ce4d5257b0e794a41c34e00cd6390cb |
Hashes for cbgen-0.1.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 836373f0a232097c9af10e73f88bf55020a979e4bc93e8d03cb182c6efb0b4d4 |
|
MD5 | da16857116d0b158072dc2cd3c042aff |
|
BLAKE2b-256 | ff5aa205c4861dd21be31aaee05503915319fd93d0e7c27893b5bc42ef5805ae |
Hashes for cbgen-0.1.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdbbd4677619980f7ab06d46d103914d016747a60a2c62af841768a88cede622 |
|
MD5 | 668f19ac131006220eab660f9b417b87 |
|
BLAKE2b-256 | 397420b459787a37bd65808af064d5a91e99523fdb3f3f0548a21656829a7e6c |
Hashes for cbgen-0.1.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba5c5c0f1835ed603c06e6c4a70a7a8cb4d31a47dc9653426a207861f4af4301 |
|
MD5 | 0d014b65c459b3334580157c8737602a |
|
BLAKE2b-256 | 635d9f2186f1cfea272fb4790a757ea5b89d79448ad486477fdd86e62c49c91a |
Hashes for cbgen-0.1.6-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 953d50f25219f03b4b6bde282b3435ec61d8e44f9e4e7c782434abc4b86e1141 |
|
MD5 | 3a6e6152b063ee6a10b5a876701b9dcf |
|
BLAKE2b-256 | d41d04f998c6f916c0c731dceff1932d6f14c5fa420f80d9b3f081de29c500af |
Hashes for cbgen-0.1.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 877453e95909c423f30641765d0ab324867a5393f43127396d24b391b96342bc |
|
MD5 | 84dd0ed75141dd314abd40a84c3a11a2 |
|
BLAKE2b-256 | bca864f5c1e0ea319129a7d8ad1d498b4da89f46cb94f5efba275a8ed59db559 |
Hashes for cbgen-0.1.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d21b56e2d31e9b95b59eb50005d8098428599b05e57706dcba06bbfb4b84bbea |
|
MD5 | b855c4efaf4c6e07c2400354b1ae2280 |
|
BLAKE2b-256 | 075aca56051be895cff25b49e4eb93321d4da41f9613904d914978d8df494cb7 |