PySnpTools
PySnpTools is a library for reading and manipulating genetic data.
Main Features:
-
New: GPU standardization and kernels. PySnpTools reads genotypes on the CPU, then transfers them to CuPy, the NumPy-compatible GPU array library, for GPU standardization and kernel construction. A main use is FaST-LMM's single-kernel
single_snp, which ran over 10 times as fast with float32 on an RTX 3060 as with the default CPU float64, in a synthetic benchmark with 14,925 individuals and 100,000 SNPs. See also the GPU workflow notebook. -
SnpReader: Efficiently read genetic PLINK formats including *.bed/bim/fam files. Also, efficiently read parts of files, read kernel data, and standardize data. Features include multi-threaded BED reading, cluster-ready BED data, on-the-fly SNP generation, and larger in-memory data.
-
DistReader: Efficiently work with unphased BGEN format and other diploid, biallelic distribution data. Also, efficiently read parts of files. See Distribution IPython Notebook.
-
util: In one line, intersect and re-order IIDs from snpreader and other sources. Also, efficiently extract a submatrix from an ndarray.
-
IntRangeSet: Efficiently manipulate ranges of integers - for example, genetic position - with set operators including union, intersection, and set difference.
-
mapreduce1: Run loops locally, on multiple processors, or on any cluster.
-
filecache: Read and write files locally or from/to any remote storage.
Install
pip install pysnptools
Requires Python 3.11.5 or later. Core Python 3.15 support excludes HDF5, BGEN, and CuPy because their required wheels are not currently available together.
Install the cupy extra to use an NVIDIA GPU.
pip install "pysnptools[cupy]"
GPU support requires NVIDIA CUDA on x86-64 Windows or Linux, including WSL2.
Python 3.15 is currently CPU-only: CuPy has no Python 3.15 wheel yet, so
pip install "pysnptools[cupy]" fails there. Install pysnptools without the
extra on Python 3.15. See the GPU guide for driver and CUDA setup.
HDF5 support is optional. To read or write HDF5 files, install:
pip install pysnptools[hdf5]
Existing HDF5 users upgrading from an earlier release should install this extra.
If you need support for BGEN files, instead do:
pip install pysnptools[bgen]
Documentation
- Main Documentation with examples. It includes links to tutorial slides, notebooks, and video.
- Project Home and Full Annotated Bibliography
Code
Contacts
- Email the developers at fastlmm-dev@python.org.
- Join the user discussion and announcement list (or use web sign up).
- Open an issue on GitHub.
Testing
PySnpTools has two test runners. Run pytest from the repository root for
pytest tests and doctests in Python modules, reStructuredText, and Markdown.
Run python -m pysnptools.test for the legacy unittest suite, which assembles
reader, standardizer, utility, optional-format, and doctest checks. These runners
cover overlapping but different sets of tests.
Two doctest examples in pysnptools.distreader.bgen require external QCTool v2:
Bgen.genwrite and Bgen.write. Install QCTool v2 from the official QCTool
site, then set QCTOOLPATH to the
command or executable path used to launch it. For example, on Linux or macOS:
export QCTOOLPATH=/absolute/path/to/qctool
On Windows, install QCTool in WSL and set QCTOOLPATH to the WSL launch command
and Linux executable path, as described in the Bgen.write API documentation.
The BGEN doctest fails with a message naming qctool when this configuration is
missing; it does not silently skip.
Metadata
Release files for pysnptools 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 | Provenance | Actions |
|---|---|---|---|---|
| pysnptools-1.1.0.tar.gz | 281.5 kB | With provenance | Details for pysnptools-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysnptools-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pysnptools-1.1.0-py3-none-any.whl |
Total release size: 623.6 kB
Release files / pysnptools-1.1.0.tar.gz
| Download URL | pysnptools-1.1.0.tar.gz |
|---|---|
| Size | 281.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ad701d442055952591143de58174d9a85a44994f4875857734cd5d7fe734d45
|
|
BLAKE2b-256 checksum How to use checksums |
7ff512d99021823340460ab6bb5ff78a2e9c98f2f1a0d26978a2e666527c7ed1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / pysnptools-1.1.0-py3-none-any.whl
| Download URL | pysnptools-1.1.0-py3-none-any.whl |
|---|---|
| Size | 342.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf0845a13f671596a7fb36eb1c01099cc80e7e4dec792d4d3df30debee4eb5f3
|
|
BLAKE2b-256 checksum How to use checksums |
3ed4fa8dd735bc9dd03b167eeaeaf8cf1911a2908a93e83fe1a9f66f2e8b6d0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for pysnptools 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pysnptools-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.