about summary refs log tree commit diff
path: root/test/python
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-09 14:31:27 +0000
committerPjotr <wrk@bosa.lan>2026-11-09 14:31:27 +0000
commit002cdc41a54f6b398933f9e536217ec433a17eac (patch)
treee6cff1ba06cf1ec25348503c80961a1173aa70ed /test/python
parenta698c48ee204cd68efc479b01132ae9c037213bb (diff)
downloadgenenetwork4-002cdc41a54f6b398933f9e536217ec433a17eac.tar.gz
compute: add /compute/fitqtl for effect sizes at named markers
`/compute/rqtl` answers "where" -- scanone gives a LOD per marker -- but not
"how much": a scan statistic is not a fitted model. R/qtl's `fitqtl` fits
one, and reports the QTL's effect, its standard error, the model LOD and the
variance explained. That is what a table of effects needs, and it is a
separate endpoint because it is a separate question, asked about a handful
of markers (a scan's peaks) rather than a genome: `fitqtl` fits one model
per marker, so a genome-wide version would be thousands of fits. Cap: 100
markers per request.

Rows are positional:

  marker, chr, pos, lod, pct_var, additive, se, t, p

`additive` is fitqtl's estimate for the QTL term -- R/qtl codes the QTL
genotype +-1, so it is half the difference between the two homozygote
classes, the same convention GeneNetwork's published `additive` uses.

**Two independent checks that the numbers are right.** On BXD trait 10001
(`BXD.4`), at the scan's peak:

* `lod` = 2.930985, and `/compute/rqtl`'s scanone gives 2.930985 at the same
  marker -- identical to every digit the CSV carries, because they are the
  same cross and the same phenotype. That parity is now an integration test;
* `additive` = 2.394472, against the value genenetwork.org publishes for that
  trait (`/api/v_pre1/trait/BXD/10001` -> 2.394444), which is 28 ppm away --
  and that published number came from qtlreaper, a different engine.

* scripts/qtl_fitqtl.R (new): reads the same `.geno` and two-column
  phenotype file as `rqtl_wrapper.R` (which is a verbatim copy of GN3's
  script and so not extended), builds the cross the same way, fits
  `fitqtl` at each named marker with `get.ests=TRUE`, and writes one CSV
  row per marker -- plus a one-line summary naming the strongest fit.
  `calc.genoprob(step=0)`: marker-level probabilities are all a
  marker-level fit needs.
* src/fitqtl.rs (new): runs it, parses the CSV into positional rows (`chr`
  stays text, it can be `X`), keeps the command line for `notes`.
* src/routes/fitqtl.rs (new): the endpoint -- same alignment rules as
  `/compute/rqtl` (by name onto the panel, parents/F1s excluded unless
  asked), the same `normalize`/`winsor_*` pipeline (effects come out on
  that scale), and the same R/qtl gate, so a fitqtl request and a scan
  queue against one another rather than competing for cores.
* src/config.rs: `FITQTL_SCRIPT_PATH` (default `scripts/qtl_fitqtl.R`).
* tests/fitqtl.rs: the fixture (columns, sign of the effect, notes), the
  LOD parity against scanone, and the refusals (no markers, both genotype
  inputs).
* README.md, docs/www/SKILL.md: the endpoint, what each column means, and
  when to reach for it instead of the scan.

305 tests pass; the same four as before do not.
Diffstat (limited to 'test/python')
0 files changed, 0 insertions, 0 deletions