about summary refs log tree commit diff
path: root/docs
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 /docs
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 'docs')
-rw-r--r--docs/www/SKILL.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/www/SKILL.md b/docs/www/SKILL.md
index 401772f..0f26fe0 100644
--- a/docs/www/SKILL.md
+++ b/docs/www/SKILL.md
@@ -139,6 +139,16 @@ header (peak and, for GEMMA, the Bonferroni line).
   ("each maternal-allele copy lowers the trait by X" / the other way) and
   remember it is *this run* on these samples, not the `additive` in trait info,
   which came from the published mapping.
+* `/compute/fitqtl`: **how big** an effect is, not just where. Give it the
+  marker names a scan found (its peaks) and it fits R/qtl's `fitqtl` at
+  each: columns `marker, chr, pos, lod, pct_var, additive, se, t, p`. Use it
+  after `/compute/rqtl` whenever the user asks "how much does this QTL
+  matter" — `additive` is half the difference between the two homozygote
+  classes (the same convention GeneNetwork's published additive uses),
+  `pct_var` the variance explained, and `p` the model's p-value. At most 100
+  markers per call; markers that cannot be fitted are absent, not zero.
+  Its `lod` at a marker matches `/compute/rqtl`'s LOD at that marker, so the
+  two are consistent — quote the scan for "where", this for "how much".
 * `/plot/rqtl`, `/plot/gemma`: post the compute reply back, receive an
   `image/svg+xml` plot. Do not draw your own.
 * Options (all optional, add to the posted body; full list in