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 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') 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(); -- cgit 1.4.1