Skip to main content

HomoeoGWAS

Subgenome-aware trait architecture and homoeolog-interaction analysis for allopolyploid crops.

CI License Python Version Tests DOI

Current release: v2.1.4, on PyPI. A patch release: the optional MCP interface is pinned to mcp<2, whose 2.x series renamed the server API, and the documentation describes every input and output file. No statistical code changed since v2.1.0. See the release notes, the release history below and the changelog.

HomoeoGWAS runs GWAS on allopolyploid crops (wheat, cotton, rapeseed, oat, peanut, strawberry, …) by modelling each subgenome explicitly. A new species is added through a single YAML config — no framework code changes. The only requirement is that the subgenomes are distinguishable (a homoeologous chromosome naming or a chrom_map).

It combines:

  1. Subgenome-partitioned linear mixed model — y = Xβ + u_A + u_B [+ u_D …] + ε, with a per-subgenome GRM fit by REML and an optional leave-one-chromosome-out (LOCO) correction.
  2. Gene-resolution homoeolog-group interaction tests — one engine for 2, 3 or 4+ copies, with pair omniB as the primitive and kinship-preserving bootstrap min-P as the experiment-wide calibration. omniB combines minor-burden, PC1 and kernel-Hadamard evidence while retaining all three components for interpretation.
  3. Evidence-aware outputs — the per-subgenome variance fingerprint, interaction rankings, prediction comparison and a result audit that distinguishes internal discovery from replication.
  4. Scalable per-SNP scanning — streaming CPU and optional CUDA backends for panels with tens of millions of markers.

The global K_hom kernel and phenotype-independent external priors remain optional research extensions. They are not required for the primary variance partition or interaction workflow and should not be treated as discovery evidence without a frozen benchmark.

Quick start

# 1. Install the current release (CPU)
python -m pip install "homoeogwas==2.1.4"
# Contributors may instead use: python -m pip install -e ".[dev]"

# 2. Verify the install end-to-end (~2 s): synthesise a tiny dataset + run a fit
homoeogwas demo --keep            # prints acceptance checks + lists the outputs

# 3. Run on your own data
homoeogwas validate -c my_run.yaml    # check config + input paths first
homoeogwas fit -c my_run.yaml -o results/my_run
homoeogwas audit results/my_run       # validity, uncertainty and evidence limits

# (Optional) GPU extras for the per-SNP scan
python -m pip install "homoeogwas[gpu]==2.1.4"

The same release is available from GitHub: python -m pip install "homoeogwas @ https://github.com/Shipeng-Yang/HomoeoGWAS/archive/refs/tags/v2.1.4.tar.gz".

See examples/minimal/ for the demo dataset + an annotated config, and the I/O contract for input/output formats. Main CLI subcommands: split, validate, fit, predict, interact, follow-up, registry, audit, plot, locus, rplot, design, prep-snps, and prep-homoeologs.

Freeze several species in one production registry

HomoeoGWAS can generate, validate, resume, audit and index multiple species through one species-independent registry:

homoeogwas registry validate -c analyses/cross_species_interaction_inventory.yaml
homoeogwas registry run -c analyses/cross_species_interaction_inventory.yaml --dry-run

Species are metadata. New two-, three- and four-copy interaction runs use the same pair-edge group omniB engine; see the registry guide.

Stability and functional evidence for formal discoveries

After a canonical group omniB run, one species-independent command reproduces the formal discoveries, performs deterministic material deletion, optionally deletes environments, merges redundant units into reporting regions, and joins provenance-bound annotation, expression, QTL, literature or functional evidence:

homoeogwas follow-up results/my_interaction \
  --material-folds 20 --n-jobs 16 \
  --environment-col environment \
  --evidence analyses/my_trait.evidence.yaml

The deletion analyses are candidate-only internal sensitivity checks, not a new discovery family or independent replication. The command requires the full audited family and writes an immutable identity-bound dossier, so edited rankings and stale output files fail closed. See the follow-up guide.

Run it by talking to an AI agent (no YAML, no coding)

You do not have to write config files. HomoeoGWAS ships an agent interface: tell an AI coding agent your data files and which trait you care about, and the agent writes the configs, runs the analysis, and explains the results for you. This is the fastest way for a breeder or bioinformatician to get going.

You just say, in plain language:

"Run a subgenome-stratified GWAS on my wheat. Genotypes are in data/A.bed, data/B.bed, data/D.bed; phenotype is pheno.tsv, sample column id, trait heading_date. Then plot it."

The agent collects only those biological inputs and does the rest. Three ways to connect, pick whichever matches the agent you already use:

# ── Option A · Claude Code (zero setup) ───────────────────────────────────────
# The skill is bundled at .claude/skills/homoeogwas/. Open this repo in Claude
# Code and just ask in plain language — the `homoeogwas` skill auto-activates.

# ── Option B · Any MCP client (Cursor, Cline, Windsurf, Claude Desktop, …) ─────
# Install the current release with the MCP dependency:
python -m pip install "homoeogwas[mcp]==2.1.4"
homoeogwas mcp                    # starts the MCP server (stdio)
# Then register this server in your client's MCP config. Minimal entry:
#   {"mcpServers": {"homoeogwas": {"command": "homoeogwas", "args": ["mcp"]}}}
#   ^ replace "command" with an absolute path if `homoeogwas` is not on PATH,
#     e.g. "/home/you/miniconda3/envs/poly/bin/homoeogwas"

# ── Option C · Any other LLM/agent (ChatGPT, Gemini, a custom bot) ────────────
# Point it at AGENTS.md in the repo root — that file IS the full, canonical
# spec the agent follows. No plugin needed; the agent reads it and drives the CLI.

AGENTS.md is the single source of truth; the Claude skill and the MCP server both defer to it, so all three routes behave identically. Under the hood the agent calls the same src/homoeogwas/workflow.py engine (high-level inputs → auto-generated YAML → run → summary), and it blocks on common mistakes (wrong chromosome naming, missing homoeolog map, …) before wasting a run.

No GPU? You're fine — CPU is the default. The versioned CPU installation above runs everything on CPU; the agent uses --backend auto, which silently picks GPU only if one is present and otherwise falls back to CPU with identical results. A GPU is purely optional acceleration for the genome-wide per-SNP scan — never a requirement. So tell the agent "use CPU" (or just say nothing) and it works on any laptop:

# Force CPU explicitly if you like (this is also the no-GPU auto behaviour):
homoeogwas fit -c run.yaml --backend cpu     # any machine, no GPU needed
homoeogwas fit -c run.yaml --backend auto    # GPU if available, else CPU (default)
homoeogwas fit -c run.yaml --backend gpu     # opt-in acceleration; needs CUDA

Containers

# Docker — CPU (bundles plink2 + bcftools, so split/VCF -> fit all work)
docker build -t homoeogwas:cpu .
docker run --rm homoeogwas:cpu demo
docker run --rm -v "$PWD":/work -w /work homoeogwas:cpu fit -c run.yaml

# Docker — GPU (per-SNP scan; CUDA 12.1)
docker build -f Dockerfile.gpu -t homoeogwas:gpu .
docker run --rm --gpus all -v "$PWD":/work -w /work homoeogwas:gpu fit -c run.yaml --backend gpu

# Apptainer / Singularity (HPC, no root) — convert the Docker image
apptainer build homoeogwas.sif docker-daemon://homoeogwas:cpu
apptainer run homoeogwas.sif demo

Pass --build-arg PIP_INDEX_URL=<mirror> to build through a faster pip mirror.

How it works

One genotype set goes in and is split by subgenome. It feeds two analyses:

  • Workflow 1 — subgenome-stratified mixed model. One kinship matrix per subgenome, a multi-kernel REML fit that partitions trait variance among the subgenomes (PVE), and a leave-one-chromosome-out per-SNP scan.
  • Workflow 2 — homoeolog interaction. Homoeologous genes are grouped, every pair of copies (an edge) is tested with omniB, which combines minor-burden, PC1 and kernel-Hadamard encodings, and all edges or groups form one experiment-wide bootstrap-minP family with a kinship-preserving null.

homoeogwas audit then labels every result as computationally valid, an internal discovery, or in need of replication.

HomoeoGWAS workflow: inputs, the additive model, the homoeolog-group interaction test with experiment-wide error control, and the audited output

One interaction contract across ploidies

New interaction runs use one master group_id,gene_<S>... table and canonical mode: group. A two-copy group has one pair edge, a three-copy group has three, and a four-copy group has six. Edge omniB is the shared statistical primitive; group omniB is ACAT over the group's pair edges. All directions share one all-subgenome null model and one bootstrap-minP family—never separate AB/AD/BD runs followed by a factor correction.

The generated config is <out_dir>/configs/interact.generated.group.omnib.yaml. It declares one primary unit: edge for formal homoeolog-pair discoveries, or group for formal within-group omnibus evidence. The other layer and the three omniB components are localization only unless family_scope: joint calibrates their union once. Legacy pairwise/triad omniB configs remain readable. Formal canonical output is INT-only; raw-scale sensitivity cannot inherit discovery fields.

A four-copy group therefore uses six supported pair interactions. HomoeoGWAS never fits or claims a direct fourth-order coefficient. See the interaction input contract and the strawberry example.

Adding a new species

Any allopolyploid is supported through configuration alone:

  1. Copy an existing configs/species/*.yaml and edit subgenomes, the chromosome naming / chrom_map, the reference assembly path, and ploidy. The schema in src/homoeogwas/species_config.py validates it.
  2. homoeogwas split --species-yaml <yaml> --vcf <in.vcf.gz> -o ... splits the markers into per-subgenome genotype sets.
  3. homoeogwas fit --config <run.yaml> runs the mixed-model scan. Interaction analysis additionally needs SNP-to-gene and homoeolog mappings; four copies become six pair edges in one group family, never one four-way test.

No Python is edited at any step. Diploids can run the mixed model, but they do not have a cross-subgenome homoeolog interaction.

Tested species

The framework has been run end-to-end on six allopolyploid crops, from tetraploid to octoploid, through the same code path; this list is illustrative, not a limit on supported species.

Species Subgenomes Reference assembly
Wheat (Triticum aestivum) AABBDD (6n) IWGSC RefSeq v1.0
Cotton (Gossypium hirsutum) AADD (4n) HBAU NDM8
Rapeseed (Brassica napus) AACC (4n) Darmor v4.1
Peanut (Arachis hypogaea) AABB (4n) NDH108 (PeanutPan)
Oat (Avena sativa) AACCDD (6n) OT3098 v2
Strawberry (Fragaria × ananassa) octoploid (4 subgenomes) NIHHS Seolhyang

Package layout

src/homoeogwas/
├── cli.py               # command-line interface
├── species_config.py    # species YAML schema
├── species_split.py     # VCF -> per-subgenome genotype sets
├── grm.py, grm_cache.py # per-subgenome and LOCO kinship matrices
├── lmm.py               # multi-kernel REML mixed model
├── scan.py              # per-SNP scan (streaming CPU, parallel chunks, optional GPU)
├── gp.py                # GBLUP prediction + cross-validation
├── prep.py              # SNP-to-gene maps and homoeolog tables
├── interact.py          # homoeolog interaction entry point
├── omnib_family.py      # edge/group omniB scores and bootstrap scoring
├── group_family.py      # homoeolog groups and their pair edges
├── parallel.py          # forked worker pool for bootstrap blocks
├── followup.py          # stability and evidence follow-up
├── audit.py             # evidence/status audit of finished runs
├── run_registry.py      # multi-species production registry
├── plots.py             # publication figures from finished runs
├── workflow.py          # high-level orchestration used by the agent tools
└── mcp_server.py        # MCP server for AI agents

Testing

pytest -m "not gpu and not slow"   # CPU suite; external-tool/GPU tests may skip
pytest -m "not slow"               # + GPU tests (needs torch)
pytest                             # full suite incl. simulation benchmarks

CI runs ruff + the CPU test suite on Python 3.10 / 3.11 / 3.12.

Status

HomoeoGWAS is research software under active development. A preprint describing the methods and their applications is in preparation and will be posted on bioRxiv; this page will link to it once it is available.

Citation

Until the preprint is available, please cite the software release you used:

@software{homoeogwas,
  author  = {Yang, Shipeng},
  title   = {HomoeoGWAS: subgenome-aware trait architecture and homoeolog-interaction
             analysis for allopolyploid crops},
  year    = {2026},
  version = {2.1.4},
  url     = {https://github.com/Shipeng-Yang/HomoeoGWAS}
}

See CITATION.cff for machine-readable metadata.

Release history

Full details are in the changelog and the release notes.

Version Date Main changes
v2.1.4 2026-11-05 MCP extra pinned to mcp<2; documentation of every input and output file, the workflow figure and the current algorithm. Released on PyPI.
v2.1.3 2026-11-03 Deterministic input guards: duplicated homoeolog genes can only be waived by the data owner, sample-ID join loss and ID-normalisation mismatches, protein-FASTA alphabet checks and bounded DIAMOND runs, PLINK-file and chromosome-name preflight, raw trial-average warning; report_card JSON per result. Released on PyPI.
v2.1.2 2026-10-13 Phenotype screen for extreme values; homoeolog tables that repeat a gene across groups stop at preflight.
v2.1.1 2026-10-13 smooth_pc4 interaction runs from generated configs and MCP tools; CSI indexes in split for wheat-length chromosomes.
v2.1.0 2026-10-05 Heteroscedasticity-robust bootstrap null for group omniB (null_variance: smooth_pc4, the default for agent-run analyses); scan.n_jobs runs streaming scan chunks in parallel with output identical to the serial scan; MCP audit_results and summarize_results; a group is tested only when all of its pair edges are estimable.
v2.0.1 2026-08-29 One interaction contract across ploidies: pair edges as the shared primitive for 2-, 3- and 4-copy groups with one bootstrap-minP family; component-aware rankings, homoeogwas audit and follow-up stability checks; process-based parallel workers; BIM-bound marker manifests.
v2.0.0 2026-07-25 Breaking: corrected the multiplicity of triad/clique burden scans (groups with three or more copies), non-estimable tests reported as missing instead of p = 1, strict JSON output, and exactly one alpha-spending procedure per run.
v1.0.2 2026-06-21 Optional dominance adjustment for the homoeolog interaction test.
v1.0.1 2026-06-12 First PyPI release (features as v1.0.0).
v1.0.0 2026-06-12 First public release: subgenome-stratified mixed-model GWAS, VCF splitting, homoeolog interaction test, plotting, input-preparation tools and the agent interface (AGENTS.md, skill, MCP server).

License

MIT — see LICENSE.

Metadata

Release files for homoeogwas 2.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for homoeogwas 2.1.4
File Size Uploaded Provenance Actions
homoeogwas-2.1.4.tar.gz 590.9 kB Without provenance Details for homoeogwas-2.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for homoeogwas 2.1.4
File Interpreter ABI Platform Actions
homoeogwas-2.1.4-py3-none-any.whl Python 3 none any Details for homoeogwas-2.1.4-py3-none-any.whl

Total release size: 940.4 kB

Release files / homoeogwas-2.1.4.tar.gz

Download URL homoeogwas-2.1.4.tar.gz
Size 590.9 kB
Tags Source
SHA-256 checksum
How to use checksums
42a2de3939872027e544af7fc248293fdf895936886e2741bbd2c776f340cc39
BLAKE2b-256 checksum
How to use checksums
381b658f0b1e561a1f361eda1a668bf209ceac4ac001841133a52ae31c69e4ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / homoeogwas-2.1.4-py3-none-any.whl

Download URL homoeogwas-2.1.4-py3-none-any.whl
Size 349.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33966fb728000f35f5c805d3adfa8d6c593e4bb03fc73cc8637602b125ad65b5
BLAKE2b-256 checksum
How to use checksums
7989d1cc0635e49a78fe1f06463f49964f2783ebe3164b1b3f1b957e28cd71c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for homoeogwas 2.1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page