about summary refs log tree commit diff
path: root/test/python/test_envelope.py
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-09 19:58:04 +0000
committerPjotr <wrk@bosa.lan>2026-11-09 19:58:04 +0000
commit832bf0a6f3961b7ad43635d5770939acba55fb7b (patch)
tree77675385a2b41a0a3cc5d5c018b713b0935c0eef /test/python/test_envelope.py
parent8dfb6fe64aa815dbe836a461458fa12208d77c2a (diff)
downloadgenenetwork4-832bf0a6f3961b7ad43635d5770939acba55fb7b.tar.gz
fix: DOL maps again on both engines, and the four stale tests
DOL (200 individuals, 112 913 markers, one genotype version) failed on
R/qtl with "There are missing chromosome IDs" and on GEMMA with a bare
wrapper bail-out. Two unrelated causes, both in our own code.

**R/qtl: a genotype code collided with a chromosome name.** DOL's header
says `@unk:X` -- X is the code for a missing genotype -- and the wrapper
passed that to `read.csv(na.strings=...)` for the *whole* file, so every
marker on the X chromosome lost its chromosome ID and `read.cross.csv`
refused the map. The unknown code now applies to the genotype columns
only. DOL scans: 112 913 markers in 42 s, where before it never got past
reading the file. Same fix in scripts/qtl_fitqtl.R, which shares the read.

**GEMMA: its leave-one-chromosome-out run cannot fit the Y.** With LOCO the
DOL panel is scanned per chromosome, and the Y run dies inside BLAS --
`Enforce failed for N>0 in src/fastblas.cpp ... fast_cblas_dgemm` -- taking
the whole request with it (a 502 whose detail is the wrapper's banner).
The mitochondrial chromosome has the same shape of problem. `prepare` for
the GEMMA engine now writes the bimbam pair without the Y and M markers
(cached beside the individual subset, line-aligned so the geno and snps
stay in step), and the note says what was left out: "46 Y/M markers left
out (GEMMA's LOCO cannot fit them)". DOL maps: 106 515 rows in 49 s.

**And the four tests that had been failing since before this work**, all
stale expectations rather than product bugs:

* `benchmark_questions` pinned two traits to "page 2" of a 100-per-page
  search when they rank ~190th and ~219th of 246 -- one re-index pushes
  them over. It now walks up to three pages and asserts presence and LOD,
  not the page; and the helper `search()` pages, because a benchmark row
  can name a trait that ranks outside the first hundred of its own query.
* `no_db_mode_degrades_gracefully` asserted exactly one hit for "alcohol"
  from the index alone. The index grew; the behaviour under test is that
  the search still answers, within the limit, with the database-backed
  fields null. That is what it asserts now.
* `search_proxy_scenarios` and `search_parity_replay` never pinned the
  engine they test, so an ambient `SEARCH_ENGINE=native` made the proxy
  scenarios answer from the local index: a 200 where a 422 was expected,
  and "expected 2 upstream calls, got 0" for every replayed query. Both now
  set `SEARCH_ENGINE=forward`.

* src/genotypes.rs: `DEGENERATE_CHROMOSOMES`, `drop_degenerate_chromosomes`,
  `Prepared.markers_dropped`.
* src/routes/gemma.rs: also the 500 that `eb5320d` introduced -- counting
  parents/F1s from `panel - keep` instead of subtracting the exclusion
  *set*, whose length can exceed the panel (subtract overflow).
* scripts/rqtl_wrapper.R, scripts/qtl_fitqtl.R: na.strings scoped to the
  genotype columns.
* tests/{benchmark,no_db,search,search_parity}.rs: as above.

Verified through the API on DOL trait 10003: R/qtl 112 913 rows, GEMMA
106 515 rows. gemma/rqtl/fitqtl suites green (14, 10, 4).
Diffstat (limited to 'test/python/test_envelope.py')
0 files changed, 0 insertions, 0 deletions