about summary refs log tree commit diff
path: root/docs
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-07 18:23:36 +0000
committerPjotr <wrk@bosa.lan>2026-11-07 18:23:36 +0000
commitc087e4186874921f48caefa2d8630f5bf05b3c0d (patch)
treedf827dd62afdb72476f89f31fa69cac5b5d4c92a /docs
parentf9ba0f12e3bf52919fc363c037fbf0a0deda8c17 (diff)
downloadgenenetwork4-c087e4186874921f48caefa2d8630f5bf05b3c0d.tar.gz
plot: take a posted result, and never re-run the mapping
The plot endpoints ran the mapping themselves, which meant the picture
could come from a different run than the one the caller was looking at,
and cost a scan to draw. They now take the mapping's own response -- the
JSON /compute/{rqtl,gemma} returned, posted back -- and hand it straight
to the plotter, which is what the scripts were written for
(`python3 plot-rqtl.py result.json -o out.svg --trait …`).

Validation replaces the run: `/plot/rqtl` needs `data.markers` with
positional 4+ column rows, `/plot/gemma` needs `data` rows *and*
`meta.columns` (its plotter reads the column names to find `p_lrt`), and
anything else is a 422 saying "post that response back". `/plot/rqtl`
also accepts just the `data` member; GEMMA cannot, and says why.

The mapping's `actions` suggestion now describes posting its own response
and carries no body -- duplicating a 21 000-row response into a
suggestion would double the envelope for nothing, and the caller already
holds it.

* src/routes/plot.rs: posted result, shape validation, `?trait`/`?title`
and `?bonferroni=false` passthrough to the scripts; no compute imports.
* src/routes/{rqtl,gemma}.rs: the plot suggestion loses its body.
* tests/plot.rs: canned results instead of real mappings -- the tests now
  need only the plotter, no Rscript or gemma; covers both engines, the
  bare-`data` form, and the 422 for a body that is a request.
* README.md, docs/www/ai-instruction.md (4a), docs/www/operator-checklist.md:
  "post the response back", and why GEMMA needs `meta.columns`.
Diffstat (limited to 'docs')
-rw-r--r--docs/www/ai-instruction.md16
-rw-r--r--docs/www/operator-checklist.md4
2 files changed, 12 insertions, 8 deletions
diff --git a/docs/www/ai-instruction.md b/docs/www/ai-instruction.md
index 8ef54f7..6735506 100644
--- a/docs/www/ai-instruction.md
+++ b/docs/www/ai-instruction.md
@@ -316,12 +316,16 @@ A mapping's response ends with what to do next:
 
 * **`next`: a PheWAS at the peak** the run found — a `GET` that returns
   200, so follow it (§4b). Present when the request named a `group`.
-* **`actions`: the same request, plotted** — `POST /plot/rqtl` or
-  `/plot/gemma`, whose reply is an **SVG document** (`image/svg+xml`),
-  not JSON: a Manhattan plot of what you just computed, with the
-  permutation thresholds as dashed lines (R/qtl) or a Bonferroni line
-  (GEMMA). The plotter's one-line peak summary rides back in the
-  `x-plot-summary` header. Send the suggested body as it stands.
+* **`actions`: a plot of what you just got** — `POST /plot/rqtl` or
+  `/plot/gemma`, which take **the mapping response you are holding**,
+  posted back as-is (not a compute request: nothing is recomputed).
+  The reply is an **SVG document** (`image/svg+xml`), not JSON: LOD with
+  the permutation thresholds as dashed lines (R/qtl), or `-log10(p_lrt)`
+  with a Bonferroni line (GEMMA), whose one-line peak summary rides back
+  in the `x-plot-summary` header. Post the whole response for both, or
+  just its `data` member for `/plot/rqtl`; `/plot/gemma` needs
+  `meta.columns` to find the `p_lrt` column. A body that is not a
+  mapping result is a `422` saying so.
 * **`actions`: the same scan with 100 permutations** (`nperm: 100`), when
   you did not already ask for permutations. It is a `POST`, which is why
   it is not a `next` link. Those 100 shuffles are what turn "this peak
diff --git a/docs/www/operator-checklist.md b/docs/www/operator-checklist.md
index 308d717..ed29456 100644
--- a/docs/www/operator-checklist.md
+++ b/docs/www/operator-checklist.md
@@ -197,8 +197,8 @@ not token.
 
 ## Plotting
 
-`POST /plot/rqtl` and `/plot/gemma` run the corresponding mapping and then
-the deployment's plotter: `scripts/plot-rqtl.py` / `scripts/plot-gemma.py`,
+`POST /plot/rqtl` and `/plot/gemma` take a **posted mapping response** --
+no mapping is re-run -- and hand it to the deployment's plotter: `scripts/plot-rqtl.py` / `scripts/plot-gemma.py`,
 executed by `PLOT_PYTHON` (default `python3`) -- so **python3 must be on
 the server process's `PATH`**, alongside `Rscript`/`gemma-wrapper` for the
 mapping itself. They return `image/svg+xml` rather than an envelope, and