Skip to main content

CI PyPI Python 3.11+ NumPy Hypothesis License: GPL-3.0 Buy Me a Coffee

JAMMA

JAMMA (Highly-Accelerated Multi-method Mixed-Model Association) -- a modern Python and C reimplementation of GEMMA for large-scale GWAS.

  • Drop-in GEMMA replacement: Same CLI flags, same file formats, same results. Change one word in your pipeline.
  • Numerical equivalence: Validated against GEMMA -- 100% significance agreement, 100% effect direction agreement
  • Fast: Up to 41x faster than GEMMA 0.98.5 (LOCO mode); 16-32x on single-pass LMM. Against a GEMMA built with Apple Accelerate rather than OpenBLAS, roughly 25x and 9.8-13.6x
  • Memory-safe: Pre-flight memory checks prevent OOM crashes before allocation
  • Cross-platform: Runs on Linux, macOS, and Windows with NumPy and vendor BLAS
  • Optimized for Intel: Best performance on Intel CPUs with MKL BLAS. Runs well on Apple Silicon (Accelerate BLAS). Other architectures (AMD, ARM Linux) work correctly but with less BLAS optimization
  • Pure Python + C extensions (OpenMP SIMD): NumPy stack with vendor BLAS dispatch (MKL-ILP64, Accelerate-ILP64) via jlinalg C layer for eigendecomposition and OpenMP-parallel Wald tests
  • Large-scale ready: Optional numpy-mkl ILP64 wheels (numpy 2.4.6+) for >46k sample eigendecomposition

Installation

macOS (13.3+)

pip install jamma

That's it. macOS Accelerate BLAS handles large matrices natively (Accelerate-ILP64).

Windows (10+), Windows Server (2016+) and Linux (Intel/AMD)

Install numpy-mkl first -- standard numpy uses 32-bit BLAS integers which overflow at ~46k samples. Pre-built ILP64 wheels are available for Python 3.11-3.14:

pip install psutil loguru threadpoolctl click progressbar2 bed-reader
pip install numpy \
  --index-url https://michael-denyer.github.io/numpy-mkl \
  --force-reinstall --upgrade
pip install jamma --no-deps

From Git (latest development version):

pip install psutil loguru threadpoolctl click progressbar2 bed-reader
pip install numpy \
  --index-url https://michael-denyer.github.io/numpy-mkl \
  --force-reinstall --upgrade
pip install git+https://github.com/michael-denyer/jamma.git --no-deps

Why --no-deps? JAMMA depends on numpy>=2.0.0, so a normal pip install jamma will pull in standard numpy and overwrite the ILP64 build. --no-deps prevents this; you install the runtime dependencies manually instead.

See the User Guide for ILP64 verification steps.

Platform Support

Platform BLAS ILP64 Notes
Linux x86_64 MKL (optimal) numpy-mkl Best performance
ARM Linux OpenBLAS -- Works correctly
ARM Mac (M1+) Accelerate native Excellent performance
Intel Mac (macOS 13.3+) Accelerate native Full support
Windows x86_64 (10+) MKL (optimal) numpy-mkl Best performance
Windows Server x86_64 (2016+) MKL (optimal) numpy-mkl Best performance

See the User Guide for BLAS backend details.

Quick Start

# Compute kinship matrix (centered relatedness)
jamma -gk 1 -bfile data/my_study -o output
# Output: output/output.cXX.npy (binary, fast)
# Add --legacy-text for GEMMA-compatible text format

# Run LMM association (Wald test)
jamma -lmm 1 -bfile data/my_study -k output/output.cXX.npy -o results

# Multiple phenotypes (eigendecomp computed once, reused)
jamma -lmm 1 -bfile data/my_study -k output/output.cXX.npy -n "1 2 3" -o results

Output files:

  • output.cXX.npy -- Kinship matrix (binary NumPy format; .cXX.txt with --legacy-text)
  • results.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

The reader auto-detects format, so existing .cXX.txt files still work as -k input.

GEMMA CLI Parity

JAMMA supports GEMMA's core GWAS flags (-gk, -lmm, -bfile, -k, -c, -o, -n, -loco, -snps, -hwe) with identical names and semantics. Existing GEMMA commands work by changing gemma to jamma:

GEMMA JAMMA
gemma -gk 1 -bfile study -o out jamma -gk 1 -bfile study -o out
gemma -lmm 1 -bfile study -k kinship.cXX.txt -o results jamma -lmm 1 -bfile study -k kinship.cXX.txt -o results
gemma -lmm 4 -bfile study -k k.txt -c covars.txt -o results jamma -lmm 4 -bfile study -k k.txt -c covars.txt -o results
  • Reads and writes GEMMA .assoc.txt and .cXX.txt formats
  • Accepts PLINK binary .bed/.bim/.fam files (same as GEMMA)
  • Output columns match GEMMA (mode-dependent -- see User Guide)
  • Also supports binary .npy format for kinship (faster I/O); use --legacy-text for GEMMA text format

Python API

The gwas() function handles the full pipeline -- data loading, kinship computation, eigendecomposition, and LMM association -- in a single call. You don't need to compute a kinship matrix separately unless you want to reuse it across runs.

from jamma import gwas

# Simplest usage: computes kinship internally, no separate kinship step needed
result = gwas("data/my_study")
print(f"Tested {result.n_snps_tested} SNPs in {result.timing['total_s']:.1f}s")

# Or supply a pre-computed kinship matrix to skip recomputation
result = gwas("data/my_study", kinship_file="data/kinship.cXX.npy")

# Compute kinship from scratch and save it for reuse
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)

# LOCO analysis (leave-one-chromosome-out)
result = gwas("data/my_study", loco=True)

# LOCO with eigen caching: writes a per-chromosome eigen cache to output_dir
result = gwas("data/my_study", loco=True, write_eigen=True, output_dir="output")
# Reusing a LOCO eigen cache on a later run is CLI-only — the cache is a set of
# per-chromosome files keyed by directory, so point --eigen-dir at the same dir:
#   jamma -lmm 1 -bfile data/my_study -loco --eigen-dir output -o result

# Multi-phenotype with eigendecomp reuse (Python API)
result = gwas("data/my_study", write_eigen=True, phenotype_column=1)
result = gwas("data/my_study", eigenvalue_file="output/result.eigenD.npy",
              eigenvector_file="output/result.eigenU.npy", phenotype_column=2)
# Or use the CLI for automatic multi-phenotype: jamma -lmm 1 ... -n "1 2 3"

# SNP filtering
result = gwas("data/my_study", kinship_file="k.txt", snps_file="snps.txt", hwe=0.001)

See the User Guide for the low-level component API (kinship, eigendecomposition, LMM runners).

Memory Safety

Unlike GEMMA, JAMMA includes pre-flight memory checks that prevent out-of-memory crashes:

  • 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. See the User Guide for the programmatic memory estimation API.

Performance

JAMMA v6.0.0 on mouse_hs1940 (1,940 samples x 12,226 SNPs), Apple M5 Pro (18 cores), Accelerate-ILP64, GEMMA 0.98.5. Best observed across 3 rounds of best-of-3, end-to-end wall clock:

Operation GEMMA (OpenBLAS) GEMMA (Accelerate) JAMMA NumPy JAMMA NumPy+C JAMMA NumPy+C (stream) C speedup vs GEMMA (OB) vs GEMMA (Accel)
Kinship (-gk 1) 1.1s 1.2s 195ms 195ms -- 1.0x 5.6x 6.2x
LMM Wald (-lmm 1) 7.1s 4.2s 2.4s 430ms 541ms 5.6x 16.5x 9.8x
LMM All (-lmm 4) 13.0s 7.4s 3.6s 580ms 695ms 6.2x 22.4x 12.8x
LMM Wald+4cov (-lmm 1 -c) 26.9s 11.4s 5.8s 836ms 945ms 6.9x 32.2x 13.6x
LOCO Wald (-loco) 2m14s 1m21s -- 3.3s -- -- ~41x ~25x

v6.0.0 measures within +/-2% of v5.6.0 on every row here, so the version change carries no performance cost.

See Performance for benchmark methodology, the v6.0.0 against v5.6.0 comparison, and large-scale (125k) results.

Supported Features

Current

  • Kinship matrix computation -- centered (-gk 1) and standardized (-gk 2)
  • Univariate LMM Wald test (-lmm 1)
  • Likelihood ratio test (-lmm 2)
  • Score test (-lmm 3)
  • All tests mode (-lmm 4)
  • LOCO kinship -- leave-one-chromosome-out analysis (-loco)
  • Binary .npy I/O -- default for kinship and eigen files; --legacy-text for GEMMA text format
  • Multi-phenotype support -- -n "1 2 3" with single eigendecomposition reuse
  • Eigendecomposition reuse -- manual via -d/-u/-eigen, automatic in multi-phenotype mode
  • LOCO eigen caching -- --eigen-dir saves/loads per-chromosome eigen files across runs
  • Phenotype column selection (-n)
  • SNP subset selection for association and kinship (-snps/-ksnps)
  • HWE QC filtering (-hwe)
  • Pre-computed kinship input (-k)
  • Covariate support (-c)
  • PLINK binary format (.bed/.bim/.fam) with input dimension validation
  • Large-scale streaming I/O (>100k samples via numpy-mkl ILP64 -- numpy 2.4.6+)
  • Lambda optimization bounds (-lmin/-lmax)
  • Individual weights for kinship (-widv)
  • Categorical covariates with one-hot encoding (-cat)
  • Pre-flight memory checks (fail-fast before OOM)
  • RSS memory logging at workflow boundaries
  • Incremental result writing
  • In-place mean imputation for missing genotypes (per-chunk, zero-copy)
  • Early sample filtering -- kinship accumulated at filtered size when phenotype missingness is present
  • jlinalg C layer: vendor BLAS dispatch for eigendecomposition (DSYEVD default, DSYEVR O(n) workspace fallback under memory pressure), DSYRK, DGEMM
  • Optional C extension: OpenMP-parallel Wald tests (auto-fallback to pure Python)

Planned

  • Multivariate LMM (mvLMM)

Architecture

JAMMA uses NumPy for data loading and kinship. Eigendecomposition uses jlinalg.eigh which dispatches to vendor DSYEVD (default) or DSYEVR (O(n) workspace, under memory pressure) via the jlinalg C layer. LMM association uses a NumPy backend with an optional C extension for OpenMP-parallel Wald/Score/LRT tests. Mode is auto-selected based on available memory: batch runner when genotypes fit in RAM, streaming runner (two-pass disk I/O) for large datasets.

flowchart TD
    subgraph ENTRY["ENTRY"]
        CLI["CLI / gwas()"]
        PIPE["PipelineRunner"]
        CLI --> PIPE
    end

    subgraph IO["DATA LOADING"]
        LOAD["Load PLINK +<br/>Phenotypes"]
    end

    subgraph CORE["CORE COMPUTATION"]
        KIN["Kinship<br/>(DGEMM, chunked)"]
        EIG["Eigendecomposition<br/>(jlinalg.eigh → DSYEVD/DSYEVR)"]
        KIN --> EIG
    end

    subgraph ASSOC["ASSOCIATION TESTING"]
        MEM{"Memory<br/>budget?"}
        NP["Batch Runner<br/>(genotypes in RAM)"]
        NPS["Streaming Runner<br/>(two-pass disk I/O)"]
        CEXT{"C extension?"}
        C["C Extension<br/>OpenMP + SIMD"]
        PY["Pure Python<br/>fallback"]
        MEM -->|fits| NP
        MEM -->|large| NPS
        NP --> CEXT
        NPS --> CEXT
        CEXT -->|yes| C
        CEXT -->|no| PY
    end

    RES["AssocResult<br/>(.assoc.txt)"]

    PIPE --> LOAD --> CORE
    EIG --> ASSOC
    C --> RES
    PY --> RES

    style ENTRY fill:#1a1a2e,stroke:#53a8b6,color:#eee,stroke-width:2px
    style IO fill:#1a1a2e,stroke:#53a8b6,color:#eee,stroke-width:2px
    style CORE fill:#0f3460,stroke:#f5b461,color:#eee,stroke-width:2px
    style ASSOC fill:#0f3460,stroke:#e94560,color:#eee,stroke-width:2px

    style CLI fill:#53a8b6,stroke:#3d8a96,color:#fff
    style PIPE fill:#53a8b6,stroke:#3d8a96,color:#fff
    style LOAD fill:#53a8b6,stroke:#3d8a96,color:#fff

    style KIN fill:#f5b461,stroke:#d4943f,color:#1a1a2e
    style EIG fill:#f5b461,stroke:#d4943f,color:#1a1a2e

    style MEM fill:#e94560,stroke:#c73550,color:#fff
    style NP fill:#7b68ae,stroke:#5a4d8a,color:#fff
    style NPS fill:#7b68ae,stroke:#5a4d8a,color:#fff
    style CEXT fill:#e94560,stroke:#c73550,color:#fff
    style C fill:#2ecc71,stroke:#27ae60,color:#1a1a2e
    style PY fill:#95a5a6,stroke:#7f8c8d,color:#1a1a2e

    style RES fill:#2ecc71,stroke:#27ae60,color:#1a1a2e

Core algorithms (likelihood.py, prepare_common.py) are shared between batch and streaming runners. See jlinalg Architecture for the C vendor BLAS dispatch layer.

See Code Map for the full architecture diagram with source links.

Documentation

Requirements

  • Python 3.11+
  • NumPy 2.4.6+

License

GPL-3.0 (same as GEMMA).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jamma-7.0.0.tar.gz (75.4 MB view details)

Uploaded Source

Built Distributions

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

jamma-7.0.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (702.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

jamma-7.0.0-cp313-cp313-macosx_14_0_arm64.whl (518.4 kB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

jamma-7.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (702.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

jamma-7.0.0-cp312-cp312-macosx_14_0_arm64.whl (518.4 kB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

jamma-7.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (699.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

jamma-7.0.0-cp311-cp311-macosx_14_0_arm64.whl (519.0 kB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

File details

Details for the file jamma-7.0.0.tar.gz.

File metadata

  • Download URL: jamma-7.0.0.tar.gz
  • Upload date:
  • Size: 75.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for jamma-7.0.0.tar.gz
Algorithm Hash digest
SHA256 aa055cb6348bd839524d5a35e8f6e37c4e9ad521e27d95b0d18bd0b1df2cfdfc
MD5 5ee20223e4003bc54b398782b71555d5
BLAKE2b-256 c0cb2922651ca38073e828371ab65bbe0c5059f4c1cb54939a33ed4eb912437c

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamma-7.0.0.tar.gz:

Publisher: build-wheels.yml on michael-denyer/jamma

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

File details

Details for the file jamma-7.0.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for jamma-7.0.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6f8a3fd654da9c8c21a5f167d7f0b4daf4021357706d2a4ebc4231917d782d92
MD5 324a5c24e162d5007c4be01e59db41a9
BLAKE2b-256 28dea1db457059eefab9d35e3b84d67eb3d7a801ea5181de87505c682ca88853

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamma-7.0.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on michael-denyer/jamma

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

File details

Details for the file jamma-7.0.0-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for jamma-7.0.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9b1e25ffebb693adf1344b0823bfc3f46c2100ddf6bf2b314d1cdcfa20507844
MD5 bdc839834eed8c8a560ec2d2010cc4b2
BLAKE2b-256 dfbb517e950e03972655ca4c268d18bf357653d22b597bba870b856025f27e0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamma-7.0.0-cp313-cp313-macosx_14_0_arm64.whl:

Publisher: build-wheels.yml on michael-denyer/jamma

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

File details

Details for the file jamma-7.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for jamma-7.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6f0da7f5ca2697391daf4be84b93069c70086f6837a3e834c820dc419adcd850
MD5 59c21baa6b3d1cc49daa0975087ad3b3
BLAKE2b-256 366601fbbb777b5a5525058ca0a66ad7cce90f6bc57ac19119c8aa1d735d67ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamma-7.0.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on michael-denyer/jamma

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

File details

Details for the file jamma-7.0.0-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for jamma-7.0.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 51ea715dc9ef05c5af939fd8b8345ca69d5745150d394bd172678f50695be2ed
MD5 e23f055a5b743b45b9490e7088aa80e1
BLAKE2b-256 dfd6166ed6fb5300e41fbb67dac9be0bd61bcb943b085276b877cb7ad65e6249

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamma-7.0.0-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: build-wheels.yml on michael-denyer/jamma

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

File details

Details for the file jamma-7.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for jamma-7.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cdd71bcfad4b42913f6bb46125eeec5d2ac61a0d5eb5c0a9d1254386ff255c85
MD5 8d7a43e6e4514cd6778b3ae64fd27442
BLAKE2b-256 93fc846dc89f0c7e149b2499b14ddb3cd7a5c05f297e37deffcb030c2b7ba63b

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamma-7.0.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on michael-denyer/jamma

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

File details

Details for the file jamma-7.0.0-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for jamma-7.0.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 02a709aca94b7826b8086bbb4b38df004e8bc95b5446150d1a49904c0b775c8c
MD5 331e5781e89a87ebf800a77b6e5bdc11
BLAKE2b-256 fa3698383c18af3cad0640f78915b4d0901d07ecd76d32d3eb54130fd880a0d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamma-7.0.0-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: build-wheels.yml on michael-denyer/jamma

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

Release history Release notifications | RSS feed

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