Skip to main content

Read and write the PLINK BED format, simply and efficiently.

Project description

PyPI version PyPI version Build Status PyPI

Read and write the PLINK BED format, simply and efficiently.

This is the Python README. For Rust, see README-rust.md.

Features:

  • Fast multi-threaded Rust engine.
  • Supports all Python indexing methods. Slice data by individuals (samples) and/or SNPs (variants).
  • Used by PySnpTools, FaST-LMM, and PyStatGen.
  • Supports PLINK 1.9.

Install

pip install bed-reader

Usage

Read genomic data from a .bed file.

>>> import numpy as np
>>> from bed_reader import open_bed, sample_file
>>>
>>> file_name = sample_file("small.bed")
>>> bed = open_bed(file_name)
>>> val = bed.read()
>>> print(val)
[[ 1.  0. nan  0.]
 [ 2.  0. nan  2.]
 [ 0.  1.  2.  0.]]
>>> del bed

Read every second individual and SNPs (variants) from 20 to 30.

>>> file_name2 = sample_file("some_missing.bed")
>>> bed2 = open_bed(file_name2)
>>> val2 = bed2.read(index=np.s_[::2,20:30])
>>> print(val2.shape)
(50, 10)
>>> del bed2

List the first 5 individual (sample) ids, the first 5 SNP (variant) ids, and every unique chromosome. Then, read every genomic value in chromosome 5.

>>> with open_bed(file_name2) as bed3:
...     print(bed3.iid[:5])
...     print(bed3.sid[:5])
...     print(np.unique(bed3.chromosome))
...     val3 = bed3.read(index=np.s_[:,bed3.chromosome=='5'])
...     print(val3.shape)
['iid_0' 'iid_1' 'iid_2' 'iid_3' 'iid_4']
['sid_0' 'sid_1' 'sid_2' 'sid_3' 'sid_4']
['1' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '2' '20' '21' '22'
 '3' '4' '5' '6' '7' '8' '9']
(100, 6)

Project Links

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

bed_reader-0.2.23.tar.gz (2.4 MB view details)

Uploaded Source

Built Distributions

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

bed_reader-0.2.23-cp310-none-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.10Windows x86-64

bed_reader-0.2.23-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.5+ x86-64

bed_reader-0.2.23-cp310-cp310-macosx_10_7_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10macOS 10.7+ x86-64

bed_reader-0.2.23-cp39-none-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.9Windows x86-64

bed_reader-0.2.23-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.5+ x86-64

bed_reader-0.2.23-cp39-cp39-macosx_10_7_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9macOS 10.7+ x86-64

bed_reader-0.2.23-cp38-none-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.8Windows x86-64

bed_reader-0.2.23-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.5+ x86-64

bed_reader-0.2.23-cp38-cp38-macosx_10_7_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8macOS 10.7+ x86-64

bed_reader-0.2.23-cp37-none-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.7Windows x86-64

bed_reader-0.2.23-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.5+ x86-64

bed_reader-0.2.23-cp37-cp37m-macosx_10_7_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.7mmacOS 10.7+ x86-64

File details

Details for the file bed_reader-0.2.23.tar.gz.

File metadata

  • Download URL: bed_reader-0.2.23.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.10

File hashes

Hashes for bed_reader-0.2.23.tar.gz
Algorithm Hash digest
SHA256 b5aba5ed0781bcc9559ae9739d66418f6f6a13ab6b5bfee7cf4038782937904e
MD5 0432883fa5af23d2c364220a5b9da4c5
BLAKE2b-256 b4ae6c0b0677b033bc606fbd439dbe2e026c169b7d6b3e45ca5fd21d0bad5a6b

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp310-none-win_amd64.whl.

File metadata

  • Download URL: bed_reader-0.2.23-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.10

File hashes

Hashes for bed_reader-0.2.23-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 8288bdd5ff2ecafe170344833683164f06293fbaef8ddec8d27e84229fab7038
MD5 962faf4df19a08e94254e56f9bfd2528
BLAKE2b-256 656917e7124bb4e14e7b0b00fa068fdb53b2b68b17f80581dddf37811576e856

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 07c189709b5319ffcb336a67dbaed108fc1931e89afac49ee08e6be04c4b589f
MD5 5dd66eca23ee3f35231c22369b72f0ce
BLAKE2b-256 f02387569317213e8a0f3738eac535b37cd3f32267951ef6078e0b1ad01b3a3c

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 3c55da52436668a2b08a8c41c00e26a853ed36392d9a22d78c663fe8deb3c3df
MD5 d7383b17f01d789099a3ed44b6cfcfe9
BLAKE2b-256 631e9904205c40d35f644318cdbd743f17cc2ba87b8e91894a9f6fb131c6a184

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp39-none-win_amd64.whl.

File metadata

  • Download URL: bed_reader-0.2.23-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.10

File hashes

Hashes for bed_reader-0.2.23-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 01020a15a9ab9e2a1f49c8b6279bc9270e7f59dd5ea96d526416d79033b29335
MD5 5e9f5b864733d47e3d95bd8ef016e59f
BLAKE2b-256 cb610bcfd903c266c078401ef21ac7d6ab76174ebcaf8a049505b5e866962ac4

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1318d60b10694f0785160b2be0c12c4e95626d5a56069f14b33bfbd64bc82e8d
MD5 034d786525a712dc3b34c602d3f9f95a
BLAKE2b-256 5d13f9eda6ac86f110f95cd8262247666086ae149f58995f56121fc9fcf727ca

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 57f1158f3f17537ea04b32e140bc41a62233ef03d68f5d5a5361b24f408636e4
MD5 6821731f3bef33e40271f0d18e3ffeab
BLAKE2b-256 764df1d30f4c2b75810ad58a6406bae5f3eb3bb6c2887cc23dfbcd978f176d73

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp38-none-win_amd64.whl.

File metadata

  • Download URL: bed_reader-0.2.23-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.10

File hashes

Hashes for bed_reader-0.2.23-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 f1494c5b17d2d8bcc5b7224c4d17c57275d11eee7c0adad4bfcc7fde597d782e
MD5 a4769014bf6766e2f2a94a7fcaa13246
BLAKE2b-256 ffc5262d97584ae92a2bff32d836b1e9484fa4ec451466cc7a9d590039facd38

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4bce2c1a62d944e27855d2b804926cba5dd47a2d0da40e6aac973c8eefa35979
MD5 18c1efb688f848cf35a5aea38049b3f5
BLAKE2b-256 3c2bde14750485a6e83627e8acea13890091ae6592796fb3d95c53b6b04726be

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 0772d9eda5a3337c533ff1ee8fb653f98a8ca095a5149bd709ca5c708b8f1994
MD5 6a7418a8e0eb0c8e7d306ebc14f80cde
BLAKE2b-256 a2503d952af9dcbb6f97305b3cf0e461b9c9b3c96051802825f1e2c9430ca47b

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp37-none-win_amd64.whl.

File metadata

  • Download URL: bed_reader-0.2.23-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.10

File hashes

Hashes for bed_reader-0.2.23-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 7484a6cd9eb3886dba30b79d1cfa7f2c8db754f67624009660ba5c1418e41588
MD5 187e55352702d3b2855c45328206bd16
BLAKE2b-256 09769926ff5754fb22144682a6d02b53df20681a0e885ebeffc7e1f6b3968514

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 99710fabd0fb2e6429700151ed7f2e5a9b4c0c91fa67316da6f2c92d3552c6dd
MD5 7b9acfcf6a5bb74458a68e3da2db56f4
BLAKE2b-256 9034bddeee3f3af4f59b5f09b43c6a13125a84da38dbc34fbdf50dfece1e5f91

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.23-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.23-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 7c37466eac0e20597fbd7458f4f80897c08dfa07d26c72914e9d419659eae08f
MD5 2e7ffaa7644a6b057b7b59dcfa5a90d0
BLAKE2b-256 299e1baba5e6839865a3ec447e8e4c0342aea2a3f69ad9d0006e8e1e208dbe6a

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