about summary refs log tree commit diff
path: root/test/python/server_test_case.py
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-09 19:35:41 +0000
committerPjotr <wrk@bosa.lan>2026-11-09 19:35:41 +0000
commit8dfb6fe64aa815dbe836a461458fa12208d77c2a (patch)
tree293c07a566ba02bf134d9b69468d1fd8c9572c68 /test/python/server_test_case.py
parentadb75296ecd9ef24f4abed0f45a6b8f6dd657d9b (diff)
downloadgenenetwork4-8dfb6fe64aa815dbe836a461458fa12208d77c2a.tar.gz
qtl2: the engine script and its packaging
Phase 0 of the R/qtl2 work, so the engine can be exercised before any
endpoint exists. `r-qtl2` (0.42 in this channel) plus `r-digest`/`r-jsonlite`
go into the dev shell's propagated inputs; without them R has to be handed a
list of 594 store paths by hand to load qtl2 at all.

`scripts/qtl2_scan.R` is written for this API rather than copied from
GeneNetwork3's `scripts/rqtl2_wrapper.R`, which cannot be trusted as a
reference: its `"LMM"` and `"LOCO"` branches call `scan1` with identical
arguments, its covariates are a `covar <- NULL; # TODO` stub, and its only
tests mock the file-writing helpers -- nothing ever reads a cross.

The script reads a qtl2 control file, a two-column phenotype file and
optional covariates, and writes `marker,chr,pos,lod` (Mb, so the shape
matches /compute/rqtl and /plot/rqtl draws it unchanged). Genotype
probabilities and the kinship matrices are cached in --cache-dir keyed by
the control file's content, because a DO cross costs 536 s of genotype
probabilities on four cores against 11 s of kinship.

Four things the cross-file plumbing cost, all found by running it:

* `read_cross2` joins the control file's directory onto whatever paths it
  finds, so an absolute path becomes `<dir>/<absolute>` and dies. The server
  has to write the control file *beside* its data;
* our generated genotypes are markers-in-rows, which needs
  `"geno_transposed": true` -- without it qtl2 reads the individuals as
  markers (93 individuals appear as 93 extra markers, and every marker is
  "not in both genotypes and maps");
* the genotype strings need a `"genotypes"` map (the GN letters
  @mat/@het/@pat -> A/H/B -> 1/2/3); without it every value is "treated as
  missing" and the scan comes back flat (peak LOD 0.14);
* with those fixed, a cross converted from `genotype/BXD.4.geno` scans in
  ~1 s and agrees with /compute/rqtl on the same panel and trait: qtl2's LMM
  peaks on chr8 at ~111 Mb, LOD 3.50, where R/qtl's HK `scanone` peaks on
  chr8 at ~69 Mb, LOD 2.93 -- same chromosome, different model, which is the
  cross-check the plan asks for.

Not yet: the Rust side (`src/qtl2.rs`), the `/compute/qtl2` route, the
genotypes-listing `qtl2` flag and the converter that writes the control
file. Those are Phase 1-3.
Diffstat (limited to 'test/python/server_test_case.py')
0 files changed, 0 insertions, 0 deletions