Read and write the PLINK BED format, simply and efficiently.
This is the Python README. For Rust, see README-rust.md.
Highlights
- 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.
- Read data locally or from the cloud, efficiently and directly.
Install
Full version: With all optional dependencies:
pip install bed-reader[samples,sparse]
Minimal version: Depends only on numpy:
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)
From the cloud: open a file and read data for one SNP (variant) at index position 2.
>>> with open_bed("https://raw.githubusercontent.com/fastlmm/bed-sample-files/main/small.bed") as bed:
... val = bed.read(index=np.s_[:,2], dtype="float64")
... print(val)
[[nan]
[nan]
[ 2.]]
Project Links
Release files for bed-reader 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bed_reader-1.1.0.tar.gz | 2.9 MB | Details |
Built distributions (wheels)
Total release size: 154.9 MB
Release files / bed_reader-1.1.0.tar.gz
| Download URL | bed_reader-1.1.0.tar.gz |
|---|---|
| Size | 2.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e467f254e0efae545e2fcdc0f2045896a946f6680536a7f9751bfc26c0fc582
|
|
BLAKE2b-256 checksum How to use checksums |
988f8a9ee04b01fb0d5fcb3271fac84583e98ab5305caf1a5eb405f19da3ca53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp314-cp314-win_amd64.whl
| Download URL | bed_reader-1.1.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5220a55bfae566294661305e26656f4bf940eadb07b87050a4c4e622b5d26fad
|
|
BLAKE2b-256 checksum How to use checksums |
e1bc52b457f0401a04807d7d71c01f4ef65a3a57bcbfd41f20ae1f06adb20dbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | bed_reader-1.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
12137b04b4d7d83bdb5057e1100c4fcd5c3d8cd5f804b6df91a300cdc40f3d2e
|
|
BLAKE2b-256 checksum How to use checksums |
57f0237329d982130e446b9d19a3a856350ee0b6dd84af1ea4dade45f3ed3dce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | bed_reader-1.1.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
391c494abdd6f42a29f245fdf865cf58c9dcfa810b567a176e014afec87bf6b1
|
|
BLAKE2b-256 checksum How to use checksums |
b86c96b20dea334781ea6ddc7e2f572f278d8062c42b8dd9bf5708a3102dd935
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | bed_reader-1.1.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1e05034cdc0730716ed40b6a135159cf0273298dabf5b368210a736aad23f2d7
|
|
BLAKE2b-256 checksum How to use checksums |
10bd52bc4fef8889032a487181f27ce7d4aef02e4e8e64286c3aa747ce89e43a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | bed_reader-1.1.0-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
84f787be8d8e0f30fbb116edd81ead59210c1cd72011aadaa1e2fe8e3cee6ae8
|
|
BLAKE2b-256 checksum How to use checksums |
4763199411198528ba3c086b8ceb8dc09817b2711d6f5e6d89071c7a6b94f8eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp313-cp313-win_amd64.whl
| Download URL | bed_reader-1.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8a276d2ac5cb819ac42c6477daaeecba5636d4783e06429edbae88205d86b57a
|
|
BLAKE2b-256 checksum How to use checksums |
0408623c53c7021708377feb1cbebe5272006497dcfdaa792c146db3b853e8f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | bed_reader-1.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
0487b71e855027f0ae59c1b738721e03f88d77b498966fe2b677ea1583822413
|
|
BLAKE2b-256 checksum How to use checksums |
1c01677f13ec01ce29114b09a98452c791340a7b46593427b9e392d5e217aefc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | bed_reader-1.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
16931201f3399db8e334f647422e1ad8921952cc35df3f1fd3d852cb91c3106c
|
|
BLAKE2b-256 checksum How to use checksums |
552344e824469b2274668b2b25de233251a026481530c7718ddb0a66c7ddcd5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | bed_reader-1.1.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ce39191ec7018b6ea0fa0a6f3119d806644b55cf8669e8b2d183612d9f2c3119
|
|
BLAKE2b-256 checksum How to use checksums |
48dcb43fe645a438ed2f911712282133cfb58ca0d846d3733ea1ee181b2c46a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | bed_reader-1.1.0-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
e36db9d6d238b972f9911c144e0b262a35a79adc8519dabb4d2770fa11b4d45b
|
|
BLAKE2b-256 checksum How to use checksums |
3e2ebf7047ed63a9f6f1ff66b9a43fa1e37faf6589efa72697051e104a013343
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp312-cp312-win_amd64.whl
| Download URL | bed_reader-1.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7d460eda9af70ffbf8fea51dc592ecb9c39fd1c4845b631f89191de3e35bf984
|
|
BLAKE2b-256 checksum How to use checksums |
20002af29e21e64a5f2646876cd5de063fc34ec974fd830e4e62a00f3a5faa9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | bed_reader-1.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
bb8debf781217eaed41e27cab2a972124d622fdf36a5dbcce4663fa41f63d26c
|
|
BLAKE2b-256 checksum How to use checksums |
260548b7fda52be2389008cdbe2eabc7c2bb969c640288158a7100bf81c1d9a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | bed_reader-1.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
061af90517b15f8e3b34495e0ef48ca82b561f4222c759b4988672f6bac79c55
|
|
BLAKE2b-256 checksum How to use checksums |
2fbbeff33a51d15ee83ae65945aa7b0641171156a6af0f384ae17ad172e26604
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | bed_reader-1.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9134b7d43e2be55983743f60433b82bc6372605a227cb3c0a8fb7e283ba9f876
|
|
BLAKE2b-256 checksum How to use checksums |
be7851c1b9419cf99d6d60f6495bc1c7a499ab13144eb6b50496685d8fb9a127
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | bed_reader-1.1.0-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ee5c30a632c6ddc2f15668ccca371e4ff1cd5e6ec61781743b332a390077eb36
|
|
BLAKE2b-256 checksum How to use checksums |
734629f3a7c4afa5189dcec231c9d7fbccacfeaba24f45706ac4b4b36c0d6969
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp311-cp311-win_amd64.whl
| Download URL | bed_reader-1.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b34293b35d36835aedd501c6f5204a74c26d6ddd034875b0d9becb60ba5b582b
|
|
BLAKE2b-256 checksum How to use checksums |
c6497a614ace561003694b13a852417f5d0e53891df95704877b9c0e848bab14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | bed_reader-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e248f9ced626e6ced4d870a0024ce3d7ace9afecb66a8a59e4d5f0bde3da1929
|
|
BLAKE2b-256 checksum How to use checksums |
eb965f514975e3b25be77e7b59a1e86e6db6947e486b67499d0b76846a37bdc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | bed_reader-1.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
fe4d02b299683e78fa6eef83d882484ed88d7c5f35d8b4f8dd1fcc298d15744d
|
|
BLAKE2b-256 checksum How to use checksums |
8529fcf2c15e6220716ba3723e75532497c2bd8c8cd387f92de90c57305662d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | bed_reader-1.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0bfd8129965697c50d7d3ecb5a3fa39568ef3f1963acfc6a35a0cdd681b532fd
|
|
BLAKE2b-256 checksum How to use checksums |
974cc8978ec90f95f8b99b049d5ce83f55dfcbc80c2eb75915e3ac023edb1886
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | bed_reader-1.1.0-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
051a77a0f4c9fc0ac53ef4348438f67aaec873d638714b67ecc3209970027a5c
|
|
BLAKE2b-256 checksum How to use checksums |
73b7fb88cdc2283b6f6fca7e985584cab9a2fe666779c7f7d6c1062d0357e6b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp310-cp310-win_amd64.whl
| Download URL | bed_reader-1.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
46908927c7ad54184648f4f4fe853a74ea79a6dcc45aab407e6f7db2c9acbda7
|
|
BLAKE2b-256 checksum How to use checksums |
320fed9b75bd08c5b699feba797e755923fdba7cbdecf3f1e6d7168b7281c7ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | bed_reader-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e3476035f062e92a6da9b98174be3ea657aee89d0c1ad647143991333ba533a5
|
|
BLAKE2b-256 checksum How to use checksums |
4336921ac6c4faddac5f7cf3a59e79d679487e257a7291eb40d9792659788928
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | bed_reader-1.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
267af75acfb55025835e93483fdc2a415aae2a6149fefd101f56fde373c2767c
|
|
BLAKE2b-256 checksum How to use checksums |
47cbd22e1fa47621ce4658a84a6cb3d6e3135bfdacce3d5f1f0e2bcba421ec47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | bed_reader-1.1.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
03615687e3a6f92f0cdceaee2abdc6e0ed3e0e9f46123feb7e097072578b8b02
|
|
BLAKE2b-256 checksum How to use checksums |
68475a0ce739aea4ca59f9f01eef688c32f981ea2047b7c5f7b89bde575cc65c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / bed_reader-1.1.0-cp310-cp310-macosx_10_12_x86_64.whl
| Download URL | bed_reader-1.1.0-cp310-cp310-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.10 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
5466583302050760f995c91119297c75381fb76d8d263bcbac149dd55982417a
|
|
BLAKE2b-256 checksum How to use checksums |
0183fad8eb1b56d1de0b177d5d58f052b599cacac629f498fdc00d87af0ce771
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|