about summary refs log tree commit diff
path: root/scripts/plot-compare.py
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-11-20 14:39:17 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-11-20 14:39:17 +0000
commit7863db3ff8b124c43211572987359e2d69d0951f (patch)
tree262415e83264fb4b70be6c19ac326f4b3d57e8fb /scripts/plot-compare.py
parenta621bb36303ad6c45fee88e9d3700abd36799a26 (diff)
downloadgenenetwork4-7863db3ff8b124c43211572987359e2d69d0951f.tar.gz
gemma: "engine": "pangemma" runs the same workflow on an lmdb store
The pangemma workflow (cwl/gemma/gemma-loco-mdb.scm, committed but until now
unreachable: nothing pointed at it) is now selected per request.  It differs
from its gemma twin in the genotype input only -- pangemma reads the
chromosome from the store's key, so it needs neither `-g` BIMBAM nor the `-a`
annotation -- so the two run the same kinship-then-GWA scatter and answer the
same question:

  gemma    21,055 rows in 4.1 s    af and l_mle identical to pangemma
  pangemma 21,055 rows in 3.9 s    beta/se/p_lrt median |d| 2.6e-4/3.6e-5/1.3e-4,
                                   max 1.2e-3/5.4e-4/6.2e-4

(trait 10001, BXD.8, lmm 9, warm; pangemma builds its GRM in float32, which is
where that third decimal goes -- verified against the store itself: Gf,
198 samples, 21,056 markers, 21,056 geno records.)  At BXD.8 size there is
nothing to win; on HLC the same 23 chromosomes cost 141 s of cluster job time
against 958 s for gemma on BIMBAM, which is the point of the engine.

Selection is a request field, defaulting to gemma, so no existing caller
changes:

- GemmaEngine::{Gemma,Pangemma} carries the workflow's input list and the
  compiled-CWL suffix as well as the parse aliases (gemma-gn2, pangemma-lmdb);
  an unknown value is 422 invalid_engine, not a silent gemma.
- check_workflow_inputs now takes the engine's own list, so a stale workflow
  is still refused by name -- the mdb workflow declares `store` where the
  gemma one declares `genotype_file` and `snps_file`, and handing it the
  wrong one fails deep inside cwltool as "expected File but got null".
- The store is built once per genotype file, not per trait, by geno2mdb.py
  (GENO2MDB_CMD) into GEMMA_LMDB_CACHE_DIR, keyed on the genotype file's
  path, size and mtime plus the annotation's contents.  Gf always: exact for
  a mean-genotype panel, where Gb is exact only for integer calls.  Written
  aside and renamed, so a concurrent identical request sees no store or a
  complete one; two first-runs both build it, which the rename makes
  harmless rather than wrong.  Measured: 22.3 s cold (store built), 3.9 s
  warm, and a second trait on the same panel reuses the store.
- There is no fallback for this engine.  The in-process runner is
  gemma-wrapper on BIMBAM, so falling back would answer a different question
  under the requested engine's name: pangemma forces the ravanan route even
  when GEMMA_ENGINE=local, and its failures are returned as they are.

Also fixed on the way: GemmaError::CommandFailed said "gemma-wrapper (<step>)
failed" for every step, which blamed the wrapper for geno2mdb and ccwl
compile; the step now names its own tool ("gemma-wrapper gwa failed",
"geno2mdb failed").

Deployment knobs (README and docs/ravanan-slurm.md updated):
GEMMA_RAVANAN_WORKFLOW_MDB, GEMMA_RAVANAN_MANIFEST_MDB (a manifest naming
pangemma-git -- a manifest change needs a cold run, since ravanan keys a step
on (script, inputs)), GENO2MDB_CMD and GEMMA_LMDB_CACHE_DIR.

Deployed and verified on the production instance: both engines answer 200 on
the same request through ravanan on Slurm, and bin/monitor-gn4 --tier all is
50 ok / 0 failed.  One deployment detail worth recording: geno2mdb.py needs
numpy and python-lmdb, which the store script's own shebang interpreter does
not have, so the server now runs with PYTHONPATH pointing at the profile's
site-packages -- without it the engine answers 502 "No module named 'numpy'".
Diffstat (limited to 'scripts/plot-compare.py')
0 files changed, 0 insertions, 0 deletions