# cbgen
Python wrapper around a BGEN library.
([cbgen documentation](https://cbgen.readthedocs.io)).
[BGEN](https://www.well.ox.ac.uk/~gav/bgen_format/) 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](https://github.com/limix/bgen), 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
```bash
pip install cbgen
```
## Usage example
```python
>>> 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
* [Carl Kadie](https://github.com/CarlKCarlK)
* [Danilo Horta](https://github.com/horta)
## License
This project is licensed under the [MIT License](https://raw.githubusercontent.com/limix/cbgen/main/LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/limix/cbgen",
"name": "cbgen",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "bgen,reader,genetics",
"author": "Carl Kadie",
"author_email": "carlk@msn.com",
"download_url": "https://files.pythonhosted.org/packages/f3/32/949bb4c95c1c7800fd188f1d074e4c570ecc038a364a6e545edd7365d744/cbgen-1.0.4.tar.gz",
"platform": null,
"description": "# cbgen\n\nPython wrapper around a BGEN library.\n([cbgen documentation](https://cbgen.readthedocs.io)).\n\n[BGEN](https://www.well.ox.ac.uk/~gav/bgen_format/) is a file format for\nstoring large genetic datasets. It supports both unphased genotypes and phased\nhaplotype data with variable ploidy and number of alleles. It was designed to\nprovide a compact data representation without sacrificing variant access\nperformance. This Python package is a wrapper around the [bgen\nlibrary](https://github.com/limix/bgen), a low-memory footprint reader that\nefficiently reads bgen files. It fully supports the bgen format specifications:\n1.2 and 1.3; as well as their optional compressed formats.\n\n## Installation\n\n```bash\npip install cbgen\n```\n\n## Usage example\n\n```python\n>>> import cbgen\n>>>\n>>> bgen = cbgen.bgen_file(cbgen.example.get(\"haplotypes.bgen\"))\n>>> bgen.create_metafile(\"haplotypes.bgen.metafile\")\n>>> mf = cbgen.bgen_metafile(\"haplotypes.bgen.metafile\")\n>>> print(mf.npartitions)\n1\n>>> print(mf.nvariants)\n4\n>>> print(mf.partition_size)\n4\n>>> part = mf.read_partition(0)\n>>> gt = bgen.read_genotype(part.variants.offset[0])\n>>> print(gt.probability)\n[[1. 0. 1. 0.]\n [0. 1. 1. 0.]\n [1. 0. 0. 1.]\n [0. 1. 0. 1.]]\n>>> mf.close()\n>>> bgen.close()\n```\n\n## Authors\n\n* [Carl Kadie](https://github.com/CarlKCarlK)\n* [Danilo Horta](https://github.com/horta)\n\n## License\n\nThis project is licensed under the [MIT License](https://raw.githubusercontent.com/limix/cbgen/main/LICENSE).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python wrapper around a BGEN library",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://github.com/limix/cbgen",
"Repository": "https://github.com/limix/cbgen"
},
"split_keywords": [
"bgen",
"reader",
"genetics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "956bada13b4e0a84512f089e6d32dd698e982029ed14db1e87e0e7c9803b9db2",
"md5": "4bce7b490a1d21be35085297d50a65fc",
"sha256": "8000b8e9998a73a7958c0627080b9ff89ab95193424e376bf22b9bee2fed9a3d"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp310-cp310-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "4bce7b490a1d21be35085297d50a65fc",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 425206,
"upload_time": "2023-05-10T18:50:21",
"upload_time_iso_8601": "2023-05-10T18:50:21.275195Z",
"url": "https://files.pythonhosted.org/packages/95/6b/ada13b4e0a84512f089e6d32dd698e982029ed14db1e87e0e7c9803b9db2/cbgen-1.0.4-cp310-cp310-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "904efdc4c80e09d4719660eab085c84e267b33253d91b92ac80acb91dc5f8a76",
"md5": "8caa7a1585e7dc8c1f0b8c130ea35c77",
"sha256": "21759e763e43a28e5f7eea592e1bdbab4390cf470d9d27e347cc73be11bbf583"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "8caa7a1585e7dc8c1f0b8c130ea35c77",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 513177,
"upload_time": "2023-05-10T18:50:23",
"upload_time_iso_8601": "2023-05-10T18:50:23.318117Z",
"url": "https://files.pythonhosted.org/packages/90/4e/fdc4c80e09d4719660eab085c84e267b33253d91b92ac80acb91dc5f8a76/cbgen-1.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e2088644a6a6f4249b48a842932bfda7b01449ee9ae6e9b290bdd895b00e74fb",
"md5": "9344d0c2c79eaff56d5ab14bda172512",
"sha256": "0a43deb1c8dd88ce9620af0ae137ce112f9a33a89f6ce12c1b9d6931f06f04a9"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "9344d0c2c79eaff56d5ab14bda172512",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 585303,
"upload_time": "2023-05-10T18:50:25",
"upload_time_iso_8601": "2023-05-10T18:50:25.944508Z",
"url": "https://files.pythonhosted.org/packages/e2/08/8644a6a6f4249b48a842932bfda7b01449ee9ae6e9b290bdd895b00e74fb/cbgen-1.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "09a632dbbd567d67ff4945723941d0929501b3dfb2e6af9714f97eb45d6f2724",
"md5": "ddbae50061f27b8c1998b1815fe5fef7",
"sha256": "53dfdc1695255a8021b4439d37580b905e085988f6818f2dd070db13012b0570"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "ddbae50061f27b8c1998b1815fe5fef7",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8",
"size": 232638,
"upload_time": "2023-05-10T18:50:28",
"upload_time_iso_8601": "2023-05-10T18:50:28.740060Z",
"url": "https://files.pythonhosted.org/packages/09/a6/32dbbd567d67ff4945723941d0929501b3dfb2e6af9714f97eb45d6f2724/cbgen-1.0.4-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e1385181a2d094273abdf35e7191d97e55e9048a6682bc8646c7f2c4cd429b23",
"md5": "c8c29afd14d4721711ba68cb1d1810e7",
"sha256": "ad64512f393f419530f4bb4bc3e097030b1ec1a18b8c80432eadd80919a1e1dd"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp311-cp311-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "c8c29afd14d4721711ba68cb1d1810e7",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 562021,
"upload_time": "2023-05-10T18:50:30",
"upload_time_iso_8601": "2023-05-10T18:50:30.287507Z",
"url": "https://files.pythonhosted.org/packages/e1/38/5181a2d094273abdf35e7191d97e55e9048a6682bc8646c7f2c4cd429b23/cbgen-1.0.4-cp311-cp311-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bec41bfb0d26756829266fd36160565bcdd3afabc3b92fcca25546893c1ebce3",
"md5": "09136b443297900a69ee062b636456d1",
"sha256": "9111afd9964611358716445824e8135aa41d835ada00ed318b22d7ec42939460"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "09136b443297900a69ee062b636456d1",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 679132,
"upload_time": "2023-05-10T18:50:32",
"upload_time_iso_8601": "2023-05-10T18:50:32.287459Z",
"url": "https://files.pythonhosted.org/packages/be/c4/1bfb0d26756829266fd36160565bcdd3afabc3b92fcca25546893c1ebce3/cbgen-1.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7c4bad67cbc7f162128ddda9794c9021b6cbb171657e82c218cdd1133fcf2213",
"md5": "ee693fd790bf9840f8d60dd952942fc6",
"sha256": "9f57fa012d87ddaab9411134f4d933250f193f38e249a555f7477ec14eda5670"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "ee693fd790bf9840f8d60dd952942fc6",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 775297,
"upload_time": "2023-05-10T18:50:34",
"upload_time_iso_8601": "2023-05-10T18:50:34.323067Z",
"url": "https://files.pythonhosted.org/packages/7c/4b/ad67cbc7f162128ddda9794c9021b6cbb171657e82c218cdd1133fcf2213/cbgen-1.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a46d18006ad4ab36f3428d82c59e08cdaf051bfbab6b387b1562044ef7a4d679",
"md5": "ebbe9888ff84120c4bfdc7d08a618264",
"sha256": "555bd2915ca463ddd058861a94f1677a0785c89e8ebae626a6967200ff23f7f6"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp311-cp311-win_amd64.whl",
"has_sig": false,
"md5_digest": "ebbe9888ff84120c4bfdc7d08a618264",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.8",
"size": 305220,
"upload_time": "2023-05-10T18:50:36",
"upload_time_iso_8601": "2023-05-10T18:50:36.057647Z",
"url": "https://files.pythonhosted.org/packages/a4/6d/18006ad4ab36f3428d82c59e08cdaf051bfbab6b387b1562044ef7a4d679/cbgen-1.0.4-cp311-cp311-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0ecd57391ebde5da6e0648dc41de77525a0a66e3e756f0e458ada57b7c41c2be",
"md5": "c05532bbeefb1ce8f41215e84576239a",
"sha256": "d2405466550b34510a05039ac9e61a7200ec058b936de4f196a087c724a0ecc3"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp38-cp38-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "c05532bbeefb1ce8f41215e84576239a",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 151571,
"upload_time": "2023-05-10T18:50:37",
"upload_time_iso_8601": "2023-05-10T18:50:37.913333Z",
"url": "https://files.pythonhosted.org/packages/0e/cd/57391ebde5da6e0648dc41de77525a0a66e3e756f0e458ada57b7c41c2be/cbgen-1.0.4-cp38-cp38-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ca7f884c30be291f67598cb4b8198c639641efbacf80980ee4bca122373e1d4a",
"md5": "57b0319e52037de754b1b0ef1438731e",
"sha256": "e304205c61d8488012754a9d759a096848ba8b5ab4d21e29970aa75223276bb4"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "57b0319e52037de754b1b0ef1438731e",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 181282,
"upload_time": "2023-05-10T18:50:39",
"upload_time_iso_8601": "2023-05-10T18:50:39.105588Z",
"url": "https://files.pythonhosted.org/packages/ca/7f/884c30be291f67598cb4b8198c639641efbacf80980ee4bca122373e1d4a/cbgen-1.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8430991f15882969a5c53d270fa20f3be4bdd70984cde90f48e8ddb8b1f4bd1c",
"md5": "fb2ba1a28b810e22d3a4ca68da95c3ad",
"sha256": "2c0bd48da53437f3d5758dd6b735f3f901767bd1745c8118838471b4f1327c2d"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "fb2ba1a28b810e22d3a4ca68da95c3ad",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 205324,
"upload_time": "2023-05-10T18:50:40",
"upload_time_iso_8601": "2023-05-10T18:50:40.454591Z",
"url": "https://files.pythonhosted.org/packages/84/30/991f15882969a5c53d270fa20f3be4bdd70984cde90f48e8ddb8b1f4bd1c/cbgen-1.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c21ecbe7c95bb3f8e9855ca9822a09502a72260fed8e6149902c60a49f5fd3aa",
"md5": "5a3a08a55a815d70e36a9b3b3c818b93",
"sha256": "3e26380d99da26ba13927de21c611e2050440dc3b63feb2aa02a807fe39e6c30"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp38-cp38-win_amd64.whl",
"has_sig": false,
"md5_digest": "5a3a08a55a815d70e36a9b3b3c818b93",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 87471,
"upload_time": "2023-05-10T18:50:42",
"upload_time_iso_8601": "2023-05-10T18:50:42.316668Z",
"url": "https://files.pythonhosted.org/packages/c2/1e/cbe7c95bb3f8e9855ca9822a09502a72260fed8e6149902c60a49f5fd3aa/cbgen-1.0.4-cp38-cp38-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "afbad82c7f9ca49494e9269e456351dfeca72e73d4c6b770dc6eb88d5945e41c",
"md5": "fb8448f928f8a7954ec08070a6e4fa74",
"sha256": "a861dbb51b5daa907435cf65a289067c47e0c224743d5605e8d9addeb77c9d39"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp39-cp39-macosx_11_0_x86_64.whl",
"has_sig": false,
"md5_digest": "fb8448f928f8a7954ec08070a6e4fa74",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 288385,
"upload_time": "2023-05-10T18:50:43",
"upload_time_iso_8601": "2023-05-10T18:50:43.734788Z",
"url": "https://files.pythonhosted.org/packages/af/ba/d82c7f9ca49494e9269e456351dfeca72e73d4c6b770dc6eb88d5945e41c/cbgen-1.0.4-cp39-cp39-macosx_11_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b53e8b8821a4e315b2de1ba0a12fcef0afdd27ce9ed17fb9c0668643513e5b17",
"md5": "4169caa94414a68132db7481adba54bb",
"sha256": "8a7c34cb6f6085139d731f45e0cf81f081a3d4d0a57786dbe0640bd0f108ae7a"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "4169caa94414a68132db7481adba54bb",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 347225,
"upload_time": "2023-05-10T18:50:45",
"upload_time_iso_8601": "2023-05-10T18:50:45.598622Z",
"url": "https://files.pythonhosted.org/packages/b5/3e/8b8821a4e315b2de1ba0a12fcef0afdd27ce9ed17fb9c0668643513e5b17/cbgen-1.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "35bbe0f654daa392485fab5039b9a25382b6ec38e947e2907fe9c0d6392262f5",
"md5": "c0d93f6a98b157cec6e3071b0dffb06a",
"sha256": "7d6e68bacbd6b54310b3edd970f16a988b0d8c6c7961739c190bb2b14a35e028"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "c0d93f6a98b157cec6e3071b0dffb06a",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 395304,
"upload_time": "2023-05-10T18:50:46",
"upload_time_iso_8601": "2023-05-10T18:50:46.838141Z",
"url": "https://files.pythonhosted.org/packages/35/bb/e0f654daa392485fab5039b9a25382b6ec38e947e2907fe9c0d6392262f5/cbgen-1.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bad19a277844016c6e218c97df13518a4557c724ae976e5c3df15e1a6da07433",
"md5": "ad3027ef26fb8b5775cd4c18b1179351",
"sha256": "2be084688e2e6afaf50cef75d5821b8433f44574c70093a5e67f73d92fa9bb9d"
},
"downloads": -1,
"filename": "cbgen-1.0.4-cp39-cp39-win_amd64.whl",
"has_sig": false,
"md5_digest": "ad3027ef26fb8b5775cd4c18b1179351",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8",
"size": 160054,
"upload_time": "2023-05-10T18:50:49",
"upload_time_iso_8601": "2023-05-10T18:50:49.055463Z",
"url": "https://files.pythonhosted.org/packages/ba/d1/9a277844016c6e218c97df13518a4557c724ae976e5c3df15e1a6da07433/cbgen-1.0.4-cp39-cp39-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f332949bb4c95c1c7800fd188f1d074e4c570ecc038a364a6e545edd7365d744",
"md5": "b8cd852139e7666afd80089efbbc3d71",
"sha256": "60719737ca40cc69577ed0c58b86a507638f311173ae21ae92fc185cc2b304a5"
},
"downloads": -1,
"filename": "cbgen-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "b8cd852139e7666afd80089efbbc3d71",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12619,
"upload_time": "2023-05-10T18:50:50",
"upload_time_iso_8601": "2023-05-10T18:50:50.787687Z",
"url": "https://files.pythonhosted.org/packages/f3/32/949bb4c95c1c7800fd188f1d074e4c570ecc038a364a6e545edd7365d744/cbgen-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-10 18:50:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "limix",
"github_project": "cbgen",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cbgen"
}