From 314dbfd4b834cd7ad30e808587cd1ec3dc30feec Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 17 Nov 2026 10:54:50 +0000 Subject: main: drop the startup Guile example; param: refuse LOCO on PLINK input Two things that made pangemma unsafe to call, both found by driving it from gemma-wrapper. main() called gemmaguile::start_test(), which loaded src/guile/examples.scm relative to the working directory and printed four lines of example output: elem 0 = 1.000000 elem 1 = 2.200000 ... So the binary only ran from the source root -- anywhere else the load threw "open-file: No such file or directory", the process produced no output at all and still exited 0, which a caller reads as success -- and even from the right directory those four lines went to stdout, where gemma-wrapper's --json reply lives. The Guile interpreter is still initialised for the version banner; the example belongs in a test. CheckParam had the PLINK LOCO guard commented out, so `-bfile ... -loco 1` silently computed the *full* K: measured on example/mouse_hs1940, `-loco 1` and `-loco 2` return the same matrix, in this build and in GEMMA 0.98.6 alike. A run that looks like a LOCO scan is then N identical full-data scans, and nothing says so. It is an error now, naming the two paths that do work (BIMBAM -g, and the lmdb store, which carries the chromosome in the key). Checked with the rebuilt binary: -h and -gk now work from any directory with no stray stdout, the BXD GRM is identical to before (max |diff| 0 against gemma 0.98.6), the lmdb LOCO path still gives 636 identical rows for chr 1, and gemma-wrapper no longer prints its spurious "GEMMA version is out of date" warning -- it reads the 0.98.5 out of the banner and records none. --- src/main.cpp | 8 +++++++- src/param.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index ee6d597..284f36a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,13 @@ int main(int argc, char *argv[]) { gsl_set_error_handler (&gemma_gsl_error_handler); gemmaguile::global_start_guile(); - gemmaguile::start_test(); + // No start_test() here: it loaded src/guile/examples.scm relative to the + // working directory and printed 'elem 0 = 1.000000 ...' to stdout on every + // run, so gemma only started from the source root (elsewhere the load threw + // and the process still exited 0, with no output), and a caller parsing + // stdout -- gemma-wrapper's JSON, for one -- got four stray lines. The + // Guile binding is still initialised for the version banner below, and the + // example is still runnable from a test, not from main(). if (argc <= 1) { cGemma.PrintHeader(); diff --git a/src/param.cpp b/src/param.cpp index 96a9cd2..e2a61ea 100644 --- a/src/param.cpp +++ b/src/param.cpp @@ -946,7 +946,13 @@ void PARAM::CheckParam(void) { if (!loco.empty()) { enforce_msg((a_mode >= 1 && a_mode <= 4) || a_mode == 9 || a_mode == 21 || a_mode == 22, "LOCO only works with LMM and K"); - // enforce_msg(file_bfile.empty(), "LOCO does not work with PLink (yet)"); + // PLINK input cannot do LOCO: the check used to be commented out, and + // measured against this build and GEMMA 0.98.6, '-bfile ... -loco 1' and + // '-loco 2' return the same K -- -loco is ignored without a word, so a run + // that looks like a LOCO scan is really N identical full-data scans. An + // error is the only honest answer; BIMBAM (-g) and the lmdb store both work. + enforce_msg(file_bfile.empty(), + "LOCO does not work with PLINK (-bfile): use BIMBAM (-g) or an lmdb store"); enforce_msg(file_gxe.empty(), "LOCO does not support GXE (yet)"); if (!is_mdb) enforce_msg(!file_anno.empty(), "Without mdb LOCO requires annotation file (-a switch)"); -- cgit 1.4.1