gpmap-v2¶
A typed, Rust-accelerated container and simulator toolkit for genotype-phenotype maps. Clean-break rewrite of harmslab/gpmap, with a locked schema, vectorized hot paths, and a PyO3 core for the operations that used to be inner Python loops.
-
Quickstart
Build a
GenotypePhenotypeMap, inspect its packed binary representation, and round-trip through JSON or CSV. -
Installation
Install from PyPI with
uvorpip. Source builds need a Rust toolchain. -
Concepts
The container model, the encoding table, and the schema contract that downstream consumers depend on.
-
Reference
Per-module API reference for the container, simulators, I/O, statistics, and exceptions.
What you get¶
- Fast. String-encoded genotypes are replaced with packed
uint8matrices. The encoding step (genotypes_to_binary) runs rayon-parallel in Rust. Construction is 5x faster than v1 at L=16 (65k genotypes), andbinary_packedis a free cached lookup afterward, with no repeated re-encoding on each access. - Typed. Full type hints, mypy-checked, strict mode.
- Safe. Cartesian-product enumeration is size-guarded out of the box via
SpaceTooLargeError. No more silent 10^26 allocations. - Stable surface. The container and
encoding_tableschema are locked inSCHEMA.mdfor downstream consumers. - Modern tooling.
uvplusmaturinpluspyproject.toml. Automated releases viapython-semantic-release. OIDC-based PyPI publishing.
Live demo¶
A multi-page Streamlit tour is published at gpmap-v2.streamlit.app; the source lives under examples/streamlit/ in the repo.
Status¶
Phase 1 port complete. Phase 2 Rust kernel (gpmap._rust) covers the dominant hot paths: encoding, enumeration, hamming reference distances. The schema in SCHEMA.md is the load-bearing contract that epistasis-v2 and gpgraph-v2 consume.
Next steps¶
Pick the page that matches what you want to do:
- Just want to wire it up and play? Quickstart.
- Already familiar with v1 and want the diffs? Migration notes.
- Building a downstream consumer that needs the binary representation? Encoding table reference.
- Need toy landscapes? Simulators guide.