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.34.tar.gz (6.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.34-cp310-none-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.10Windows x86-64

bed_reader-0.2.34-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

bed_reader-0.2.34-cp310-cp310-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.10macOS 10.7+ x86-64

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

Uploaded CPython 3.9Windows x86-64

bed_reader-0.2.34-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

bed_reader-0.2.34-cp39-cp39-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.9macOS 10.7+ x86-64

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

Uploaded CPython 3.8Windows x86-64

bed_reader-0.2.34-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

bed_reader-0.2.34-cp38-cp38-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.8macOS 10.7+ x86-64

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

Uploaded CPython 3.7Windows x86-64

bed_reader-0.2.34-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

bed_reader-0.2.34-cp37-cp37m-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.7mmacOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: bed_reader-0.2.34.tar.gz
  • Upload date:
  • Size: 6.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for bed_reader-0.2.34.tar.gz
Algorithm Hash digest
SHA256 ec9f41a8df02d750c79adb7ace2adf0c1263de38c4db9ecdf0b2a0e40628b567
MD5 9c1f0cb04b14d79b65b949fc8282f10a
BLAKE2b-256 d3a77890a4a6cfda9a8ab02111a37ea5cb8f959e6f48489b9141e3b2f5527516

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bed_reader-0.2.34-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.2 CPython/3.10.11

File hashes

Hashes for bed_reader-0.2.34-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 8edcccf99a4914ea1d2c024d41533f079b706104818b7ea3d0e97bfeb583ea3b
MD5 7bda974057c8658815ba2e4c197594b5
BLAKE2b-256 127fe63d1b8fdc5456b46781aa600f64e824c909fad5472f667a07ab1b17ba2f

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.34-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa62c2594d3d4992e0cdef1d7d93f02ebcc45a4dd59e015bb393f5711ee1930c
MD5 3dbed0f7c2318c9ee33e9c611e019e4d
BLAKE2b-256 ae5634a52d318bd586ec6d4ca77cb43f3d34716d0cee5cefc7bf7bc370366fa4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 6251f419b7a6aefaccaf37bf46abb1bb3185e06e5cca5ae3713b111384ffbdae
MD5 ef71673286c9a9edf2d06f24e391eb5d
BLAKE2b-256 e5e93d52be15f08d3794693dd2e0228a52a3d1663e34f4fde2c2f52beef3af04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bed_reader-0.2.34-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.2 CPython/3.10.11

File hashes

Hashes for bed_reader-0.2.34-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 a66a72491e3cb2ec3dbfcfb8709a966c3ff266f6d0d8ccf13779612acc8c74ad
MD5 c16e076db2b0e9b69962480ec085f441
BLAKE2b-256 570ffc03f495a0ffb9f3faa1de6f643004c94e9479910bae3b43d98be03b8515

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.34-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26cd5cb04ba20333ba3555d913d8074b0e51ab0e15ccf9e11b3477e7a2730506
MD5 a2af99da9c08cd0d4281f996f26c2eae
BLAKE2b-256 ad88a62bde67581f560e2594b812c62cf4c420e63ee242e74549326e88695ba7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 e1bdaa63a5e80b319a7c6ae140c33cc4e3e6c5dbf681e47b95be56027218a704
MD5 8de3ee5c25d2bb6a96c8d85f46a9488a
BLAKE2b-256 b952c0e8d0458773b763403b4b2f789c9c74759db84d8f0ba9f5859f9055e717

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bed_reader-0.2.34-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.2 CPython/3.10.11

File hashes

Hashes for bed_reader-0.2.34-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 f7cd5156d23a47e3db29c2ec8f91dbbbbcffca4bc824a3f535c5acf3db7ce631
MD5 31df2195d504f042241bc4e8c92d5a36
BLAKE2b-256 c537b0d26369a5243473a12a5a661ea9ff27ec1eb87c9602e8434870cc4318cb

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.34-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d2273685ab181b1d054535b911c9cd02c7ec70fe2918f96463b3778256fdbb18
MD5 058bca4deb8290e43e6aeb09dcd149b8
BLAKE2b-256 39b0b41cc6ca9ae4656a326e232d357f8e3b747001523c3c58eeb8e95103b527

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 dbf554252ffc9869f1672ca77edb988054511617d50ba0dc733e759e54ed8b73
MD5 7c11fb16f3ac6732fb26195e41e8298b
BLAKE2b-256 9101d1958c47659f1ecea81ceaa7fe78e27567b196b18b7746b96eefaf25c59e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bed_reader-0.2.34-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.2 CPython/3.10.11

File hashes

Hashes for bed_reader-0.2.34-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 3d159a62e40e97e630e330fcabe183d8e0f813cd93f82289bde084b693b5a98f
MD5 d15f37b035c9b38c31bdeb2097673173
BLAKE2b-256 085f13ba6707650630406ef99bf47fc2e5f7b1a2f6a2eb89f2c424ac900e6196

See more details on using hashes here.

File details

Details for the file bed_reader-0.2.34-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2ab014f724a4b0743322b00c5bd7426ae3ce3d14972e35118856edba49813ae
MD5 18440e81c75a1d25ccdcd7a24bf71f19
BLAKE2b-256 f14d0c6e0b8c9bf74bc9c1a19ad9c599dcb4cae16048139fd477e4536bc63a71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bed_reader-0.2.34-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 79eeec78dd2e85cd2f128bb730ccdeb0477e6ee90626b66f021e3dc5b1462489
MD5 efac70dac0ed6e357e8c121dafa92743
BLAKE2b-256 860d54239321306f66d7712a8978323c8d2b0380c1689a98305ae04a908ef99f

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