From de07aabd384d3adabf2b095b0a76a09efd81de45 Mon Sep 17 00:00:00 2001 From: Pjotr Date: Mon, 9 Nov 2026 11:52:57 +0000 Subject: plot: say which trait a plot is, not just draw it Two traits over the same panel really do draw two different pictures -- verified on BXD.4, where all 20 chromosomes' polylines differ and the peaks are LOD 2.93 at chr8 69.4 Mb (mCV24409492) against LOD 4.78 at chr8 95.7 Mb (rs3666069) -- but you could not tell from the title: every plot came out headed **"trait rqtl: LOD along the genome"**, because `/plot/rqtl` labelled it from `?trait=` and nothing else, defaulting to "rqtl". The only visible difference was the peak annotation, and a caller posting the saved response back (which is the documented way) could not know the label was missing. The response now names what it mapped: `/compute/rqtl` writes `Trait: ` as its **first** note, and `/plot/rqtl` and `/plot/gemma` take the title's label from that note when `?trait=` was not given. The `POST /plot/rqtl` suggestion in `actions` also carries `?trait=`, so a caller that posts only `data` still gets the right title. * src/routes/rqtl.rs: the `Trait:` note, ahead of the column note; the plot suggestion's href names the trait. * src/routes/plot.rs: `trait_from_document`, used by both plot endpoints. * tests/plot.rs: `two_traits_draw_two_different_plots` -- two canned responses differing only in LOD, asserting each title names its own trait from its own note, each annotates its own peak and not the other's, and every polyline differs. That is the regression this is about: a plot that reused anything between requests would draw the first trait's shape for the second. * tests/{rqtl,phewas}.rs: the plot suggestion is now matched by prefix, with the trait asserted. * README.md, docs/www/ai-instruction.md: where the title comes from, and to post the whole response (or add `?trait=`) if you post only `data`. --- docs/www/ai-instruction.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/www/ai-instruction.md b/docs/www/ai-instruction.md index d1d26e6..81b17e4 100644 --- a/docs/www/ai-instruction.md +++ b/docs/www/ai-instruction.md @@ -427,7 +427,10 @@ A mapping's response ends with what to do next: 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. + mapping result is a `422` saying so. The title names the trait, read + from the response's own `Trait: ...` note — post the whole response and + two traits' plots are told apart at a glance; post only `data` and add + `?trait=` yourself, or every one of them is titled the same. * **`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 -- cgit 1.4.1