Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cbgen-0.1.5.tar.gz (20.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cbgen-0.1.5-cp38-cp38-win_amd64.whl (542.1 kB view details)

Uploaded CPython 3.8Windows x86-64

cbgen-0.1.5-cp38-cp38-manylinux2010_x86_64.whl (525.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

cbgen-0.1.5-cp38-cp38-manylinux1_x86_64.whl (525.9 kB view details)

Uploaded CPython 3.8

cbgen-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl (448.1 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

cbgen-0.1.5-cp37-cp37m-win_amd64.whl (542.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

cbgen-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl (525.2 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

cbgen-0.1.5-cp37-cp37m-manylinux1_x86_64.whl (525.2 kB view details)

Uploaded CPython 3.7m

cbgen-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl (448.0 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

File details

Details for the file cbgen-0.1.5.tar.gz.

File metadata

  • Download URL: cbgen-0.1.5.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for cbgen-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ce4006675b9801e7a3a6389de23cfd5b8970cdae3cfd20b2ce0b28f871708aa3
MD5 46030780a274674833dc9356f8e96267
BLAKE2b-256 419dd0d730db482092b5b83444945c125cf48f47d443ebaaf94a81d7e47ae084

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 542.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1

File hashes

Hashes for cbgen-0.1.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2821e6bcf289af222f903df3ffed955ff9d32b67241caff5604e201392aa4625
MD5 5171b93485df479ad9710affadc075db
BLAKE2b-256 87cdb1e463b802bfd88c725a62e3d1960d68381382853d8c7bf01aece20d109c

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 525.9 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for cbgen-0.1.5-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 914c9b834970a53d31c4c860211b384db8de967d6ad2622fc73ccb1c7cd50255
MD5 ef14a32b43370536014d44b1cd6c33d3
BLAKE2b-256 ac9cb6526934632875588c09b0e43d98256b930ee4e026efcd3586ff9ee6dbac

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 525.9 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for cbgen-0.1.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 161e09367a2dc912a256e4ead9722ae8f0ae648f25a1c6304802e903fe96eaf7
MD5 3d793886179058ec15928d1bcc0f38cc
BLAKE2b-256 cea0a87887ffed8720a08be9282ad17aa107e934bebe463230528536a9a9b830

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 448.1 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4

File hashes

Hashes for cbgen-0.1.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 364ee9d25c6a43e53fcfa15a2976013b6125696df43a7b93e68af007453b54c2
MD5 8b6990e956ec340d325727612f3d8502
BLAKE2b-256 4e935339cf8e8f83126dc2e2e379d3698f6ab61752e6c62f090b0418511c3af8

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 542.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1

File hashes

Hashes for cbgen-0.1.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4dfeb01e900d3d8a001207f570e4a6dc7009e3c555b8c05f4bb8a93092bfafc2
MD5 65d0c8522c0018604940def8d9a07fcf
BLAKE2b-256 de78f8c8d586c0c00825e2a18274083412ad1abd120ab8c9dfb8ec454d5c9766

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 525.2 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for cbgen-0.1.5-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 dcfcac1f402b983a7a3d6dd2f9cd25c12a17095f593caa56c650c29410dedd49
MD5 fb476e448507306a1033187aff6702b9
BLAKE2b-256 43a57ba19bc8dfb97da395800151a3c6764361d98ed17f8afa245998c643ddb1

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 525.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for cbgen-0.1.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 41808ab246f9e24ccbe57cc6e402846fbbef6dec88b7a1cf2355a95844c929e9
MD5 3e5f3f1601d1fafa9f8d0551ce3049fb
BLAKE2b-256 0899e12e843c0ed1e6a624af810e618e557728a7379f77d5b9a4d238983482e7

See more details on using hashes here.

File details

Details for the file cbgen-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cbgen-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 448.0 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4

File hashes

Hashes for cbgen-0.1.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4299985a35377ea111ad7aa068a42befeb1d9bc5537baa14442616c92f97f0ce
MD5 50a825579aa09af24a28fbc09dfbc3d5
BLAKE2b-256 0c8b76558816c1e32d82a1f5a8c3b209c9b70d104029a40a51c528a0c98a4aaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page