JAMMA: JAX-Accelerated Mixed Model Association
Project description
|
|
JAMMAJAX-Accelerated Mixed Model Association — A modern Python reimplementation of GEMMA for genome-wide association studies (GWAS).
|
Installation
pip install jamma
Or with uv:
uv add jamma
Quick Start
# Compute kinship matrix (centered relatedness)
jamma -o output gk -bfile data/my_study -gk 1
# Run LMM association (Wald test)
jamma -o results lmm -bfile data/my_study -k output/output.cXX.txt -lmm 1
Output files match GEMMA format exactly:
output.cXX.txt— Kinship matrixresults.assoc.txt— Association results (chr, rs, ps, n_miss, allele1, allele0, af, beta, se, logl_H1, l_remle, p_wald)results.log.txt— Run log
Python API
One-call GWAS (recommended)
from jamma import gwas
# Full pipeline: load data → kinship → eigendecomp → LMM → results
result = gwas("data/my_study", kinship_file="data/kinship.cXX.txt")
print(f"Tested {result.n_snps_tested} SNPs in {result.timing['total_s']:.1f}s")
# Compute kinship from scratch and save it
result = gwas("data/my_study", save_kinship=True, output_dir="output")
# With covariates and LRT test
result = gwas("data/my_study", kinship_file="k.txt", covariate_file="covars.txt", lmm_mode=2)
Low-level API
from jamma.io import load_plink_binary
from jamma.kinship import compute_centered_kinship
from jamma.lmm import run_lmm_association_streaming
from jamma.lmm.eigen import eigendecompose_kinship
# Load PLINK data
data = load_plink_binary("data/my_study")
# Compute kinship
kinship = compute_centered_kinship(data.genotypes)
# Eigendecompose for LMM
eigenvalues, eigenvectors = eigendecompose_kinship(kinship)
# Run association (streaming from disk)
results = run_lmm_association_streaming(
bed_path="data/my_study",
phenotypes=phenotypes,
kinship=kinship,
chunk_size=5000,
)
Memory Safety
Unlike GEMMA, JAMMA includes pre-flight memory checks that prevent out-of-memory crashes:
from jamma.core.memory import estimate_workflow_memory
# Check memory requirements BEFORE loading data
estimate = estimate_workflow_memory(n_samples=200_000, n_snps=95_000)
print(f"Peak memory: {estimate.total_gb:.1f}GB")
print(f"Available: {estimate.available_gb:.1f}GB")
print(f"Sufficient: {estimate.sufficient}")
Key features:
- Pre-flight checks before large allocations (eigendecomposition, genotype loading)
- RSS memory logging at workflow boundaries
- Incremental result writing (no memory accumulation)
- Safe chunk size defaults with hard caps
GEMMA will silently OOM and get killed by the OS. JAMMA fails fast with clear error messages.
Performance
Benchmark on mouse_hs1940 (1,940 samples × 12,226 SNPs):
| Operation | GEMMA | JAMMA | Speedup |
|---|---|---|---|
Kinship (-gk 1) |
6.5s | 0.9s | 7.1x |
LMM (-lmm 1) |
19.5s | 4.7s | 4.2x |
| Total | 26.0s | 5.6s | 4.6x |
Supported Features
Current
- Kinship matrix computation (
-gk 1) - Univariate LMM Wald test (
-lmm 1) - Likelihood ratio test (
-lmm 2) - Score test (
-lmm 3) - All tests mode (
-lmm 4) - Pre-computed kinship input (
-k) - Covariate support (
-c) - PLINK binary format (
.bed/.bim/.fam) - Streaming I/O for 200k+ samples
- JAX acceleration (CPU/GPU)
- Pre-flight memory checks (fail-fast before OOM)
- RSS memory logging at workflow boundaries
- Incremental result writing
Planned
- Multivariate LMM (mvLMM)
Documentation
- Why JAMMA? — Key differentiators from GEMMA
- User Guide — Installation, usage examples, CLI reference
- Code Map — Architecture diagrams and source navigation
- Equivalence Proof — Mathematical proofs and empirical validation against GEMMA
- GEMMA Divergences — Known differences from GEMMA
- Performance — Bottleneck analysis, scale validation, configuration guide
Requirements
- Python 3.11+
- JAX 0.8.0+
- NumPy 1.26+
License
GPL-3.0 (same as GEMMA)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jamma-1.5.0.tar.gz.
File metadata
- Download URL: jamma-1.5.0.tar.gz
- Upload date:
- Size: 77.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40f0cf5ef8803824faaa22d1e440ab443a2ad5e1c3f432e9cce0fd31116e778b
|
|
| MD5 |
057c84d37a868478601d276fabbae147
|
|
| BLAKE2b-256 |
aad9f807cf0c5ac4cd0e90af379b5d8b5560c0d95372b86e446c04aff81f6f82
|
Provenance
The following attestation bundles were made for jamma-1.5.0.tar.gz:
Publisher:
publish.yml on michael-denyer/jamma
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jamma-1.5.0.tar.gz -
Subject digest:
40f0cf5ef8803824faaa22d1e440ab443a2ad5e1c3f432e9cce0fd31116e778b - Sigstore transparency entry: 938599088
- Sigstore integration time:
-
Permalink:
michael-denyer/jamma@a473511f2b451b5393237937677738b074ae108a -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/michael-denyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a473511f2b451b5393237937677738b074ae108a -
Trigger Event:
release
-
Statement type:
File details
Details for the file jamma-1.5.0-py3-none-any.whl.
File metadata
- Download URL: jamma-1.5.0-py3-none-any.whl
- Upload date:
- Size: 97.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbb4b724da84f72b856f8f8e777538b04762822f8cf99fe0579a17f05236d6a8
|
|
| MD5 |
1db2bf9839ed859ac2020bfbb0c49739
|
|
| BLAKE2b-256 |
28dc7745d07d1db4db960b35f0b013778d0e3896421a2c8646475eb590d4d394
|
Provenance
The following attestation bundles were made for jamma-1.5.0-py3-none-any.whl:
Publisher:
publish.yml on michael-denyer/jamma
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jamma-1.5.0-py3-none-any.whl -
Subject digest:
cbb4b724da84f72b856f8f8e777538b04762822f8cf99fe0579a17f05236d6a8 - Sigstore transparency entry: 938599104
- Sigstore integration time:
-
Permalink:
michael-denyer/jamma@a473511f2b451b5393237937677738b074ae108a -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/michael-denyer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a473511f2b451b5393237937677738b074ae108a -
Trigger Event:
release
-
Statement type: