Skip to main content

High-performance Python library for fitting high-order epistatic interactions in genotype-phenotype maps.

Project description

epistasis-v2

High-performance Python library for fitting high-order epistatic interactions in genotype-phenotype maps. A clean-break rewrite of harmslab/epistasis.

Status: alpha. Phase 1 port complete; Phase 2 Rust kernel and Phase 3 FWHT / sparse paths still to come.

What changed from v1

  • Rust hot-path kernels via PyO3 (epistasis._core) instead of a shipped Cython .c blob.
  • uv + maturin build. pyproject.toml only; no setup.py.
  • Python 3.10 through 3.13. Older interpreters dropped.
  • Type hints on the public API; mypy --strict in CI.
  • Composition over @use_sklearn MRO injection. Concrete models hold an sklearn estimator as an attribute and forward calls explicitly, which unlocks modern sklearn (>=1.2) that broke the v1 trick when normalize= was removed.
  • Walsh-Hadamard fast-path for Hadamard-encoded OLS fits (Phase 3, not yet landed).
  • Sparse design matrix path for Lasso / ElasticNet at high order (Phase 3).
  • Coordinated rewrite of the gpmap dependency as gpmap-v2. Consumes binary_packed (uint8 2D) and encoding_table with site_index instead of the deprecated genotype_index.
  • No backward compatibility with v1. Pin the v1 package if you need that behavior.

Repository layout

epistasis-v2/
├── pyproject.toml          uv + maturin build, ruff + mypy + pytest config
├── Cargo.toml              Rust workspace
├── python/epistasis/       Python source (installed as `epistasis`)
├── crates/epistasis-core/  Rust crate, exposed as `epistasis._core`
├── tests/                  pytest suite
├── benches/                pytest-benchmark + criterion (Phase 2+)
├── docs/                   Sphinx docs (Phase 5)
├── .github/workflows/      CI (lint, test, matrix) + release (semantic-release, maturin wheels, PyPI OIDC)
├── CHANGELOG.md            generated by python-semantic-release
└── CONTRIBUTING.md         commit conventions, dev workflow

Installation (dev)

Requires Python >= 3.10 and a Rust toolchain. gpmap-v2 is pulled from PyPI.

uv sync
uv run maturin develop --release
uv run pytest

For lint and type-check:

uv run ruff check .
uv run ruff format --check .
uv run mypy python/epistasis

Current progress

Phase 0 (scaffold) and Phase 1 (port) complete.

Ported modules:

  • epistasis.mapping (sites, coefficients, EpistasisMap)
  • epistasis.matrix (encoded vectors, design matrix, NumPy backend)
  • epistasis.exceptions (EpistasisError, XMatrixError, FittingError)
  • epistasis.utils (genotypes_to_X)
  • epistasis.models.base (AbstractEpistasisModel, EpistasisBaseModel)
  • epistasis.models.linear (EpistasisLinearRegression with analytic coefficient standard errors, EpistasisRidge, EpistasisLasso, EpistasisElasticNet)
  • epistasis.models.nonlinear (EpistasisNonlinearRegression, FunctionMinimizer; power and spline variants deferred)
  • epistasis.models.classifiers (EpistasisLogisticRegression; LDA, QDA, Gaussian Process, and GMM deferred)
  • epistasis.simulate (simulate_linear_gpm, simulate_random_linear_gpm)
  • epistasis.stats (Pearson, R^2, RMSD, SS residuals, AIC, split_gpm)
  • epistasis.validate (k_fold, holdout)
  • epistasis.sampling.bayesian (BayesianSampler via emcee 3)

Pending:

  • Rust kernels for build_model_matrix, encode_vectors, FWHT fast path (Phase 2)
  • Sparse design matrix path for Lasso / ElasticNet (Phase 3)
  • power.py and spline.py nonlinear variants
  • Remaining classifier implementations if demand surfaces
  • ReadTheDocs build

Contributing

See CONTRIBUTING.md. Commits follow Conventional Commits; releases and the changelog are automated by python-semantic-release.

License

Unlicense (public domain). See UNLICENSE.

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

epistasis_v2-1.0.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distributions

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

epistasis_v2-1.0.0-cp310-abi3-win_amd64.whl (121.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

epistasis_v2-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (237.5 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

epistasis_v2-1.0.0-cp310-abi3-macosx_11_0_arm64.whl (219.0 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

epistasis_v2-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl (224.9 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file epistasis_v2-1.0.0.tar.gz.

File metadata

  • Download URL: epistasis_v2-1.0.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for epistasis_v2-1.0.0.tar.gz
Algorithm Hash digest
SHA256 25fa4926109199722f128e59267a02ffa97847883f253a00aaed73e32e598f94
MD5 d589b2a846cbdb3e0468c6de40df4f75
BLAKE2b-256 ba589df4fea881338b38073e2e346904c2bb7f69ac75fe15a634ff4c9cfb0d58

See more details on using hashes here.

Provenance

The following attestation bundles were made for epistasis_v2-1.0.0.tar.gz:

Publisher: release.yml on lperezmo/epistasis-v2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epistasis_v2-1.0.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: epistasis_v2-1.0.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 121.1 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for epistasis_v2-1.0.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 830dbceffefda48e41f23ecca79b4f1b7904f3cf5b6ef3fefbbb174390d0e93b
MD5 3e0e4cd9d7ba9b1e66ddd9f09471dcb7
BLAKE2b-256 e50cd13f0627f755dc90b7c3a6a49f1252e592d1c1c83fd7daf614500ef51a58

See more details on using hashes here.

Provenance

The following attestation bundles were made for epistasis_v2-1.0.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on lperezmo/epistasis-v2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epistasis_v2-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for epistasis_v2-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bed444f1b8888f753c42aedbc921259b0c6e396c40e94cb575417e6f7a17c75b
MD5 32f2b6efbb641479b503aef89d1fbd04
BLAKE2b-256 f54d3fbd831ed7bb3dc20dd4201d8361d1aeddedb551d3730bf2c380cdb3cd9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for epistasis_v2-1.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on lperezmo/epistasis-v2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epistasis_v2-1.0.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for epistasis_v2-1.0.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1608c80c1bf0a4ce55617d60eb89b80196d0ee77d77afa9765033a41ca024170
MD5 02d8524229dee80eacd6d425d4ff9cee
BLAKE2b-256 37c8a2e9e6854af37a43f0a64fe862a818798f77e4855806bea7da3059af865e

See more details on using hashes here.

Provenance

The following attestation bundles were made for epistasis_v2-1.0.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on lperezmo/epistasis-v2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epistasis_v2-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for epistasis_v2-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cf28eb0859b8150822951c38546e0387dfe76c9b2b43b6c87760f5aa2bcef519
MD5 8156a5ce886a357554c180f888de6210
BLAKE2b-256 9e0de57d9f816fb5c3d26ee13a4394d2075abc80a3aaa7ed3711a40c6e32364a

See more details on using hashes here.

Provenance

The following attestation bundles were made for epistasis_v2-1.0.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on lperezmo/epistasis-v2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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