about summary refs log tree commit diff
path: root/scripts/plot-gemma.py
AgeCommit message (Collapse)Author
7 daysplot/gemma: no reference line by default; Bonferroni is one more labelled linePjotr
A line on a plot is an annotation, not part of the result, so the default is now no line at all. GEMMA's Bonferroni becomes opt-in like any other: ?bonferroni=true GEMMA's own line, labelled ?thresholds=3.65&threshold_labels=… another engine's, labelled (nothing) just the scan Which means a reader sees exactly the lines someone chose, each with its source in the label -- and the accidental "this plot says significant" impression of a default convention line is gone. The plotter's summary and its <desc> no longer mention Bonferroni unless it was drawn. tests/plot.rs: the plain plot has neither line; with thresholds the two BulkLMM lines are labelled and Bonferroni is absent; with ?bonferroni=true GEMMA's own line appears.
7 daysplot/gemma: draw thresholds computed elsewhere, labelled with their sourcePjotr
GEMMA has no permutation test here, so its plot carries a Bonferroni line. A threshold from /compute/bulklmm belongs to a different null and must not look like GEMMA's, so it is passed in and named: POST /plot/gemma?thresholds=3.50,3.65 &threshold_labels=bulklmm%20alpha%200.10,bulklmm%20alpha%200.05 Each is drawn dashed in the series colour with "label: value" beside the line, with GEMMA's Bonferroni line still there, and the plotter's x-plot-summary names the reference lines it drew. A threshold that is not a positive number is a 422 invalid_threshold rather than a silent omission. /compute/bulklmm's reply offers that href already, with its alpha 0.05 threshold filled in -- so "same values, two models, one picture" is one link from the scan, and the labels keep the two nulls apart. tests/plot.rs: the plain plot has no bulklmm line; with thresholds both are drawn and labelled; a non-numeric threshold is refused.
10 daysplot: draw a mapping, and suggest it from the mappingPjotr
The two plotters Pjotr added (scripts/plot-rqtl.py, plot-gemma.py) turn a saved mapping response into an SVG Manhattan panel. They are now endpoints, and the mapping that produces the response suggests them: POST /plot/rqtl same body as /compute/rqtl -> image/svg+xml POST /plot/gemma same body as /compute/gemma -> image/svg+xml Taking the mapping's own body rather than the mapping's output means one call gets you the picture, and the plot cannot describe a run you did not do: the handlers call the compute handlers and hand the resulting envelope to the script, exactly as the scripts' docstrings describe (they read `data.markers`, `data.permutation` and the notes' strain counts). The mapping is re-run, but through the engines' own caches -- seconds on BXD. The reply is an SVG, not the JSON envelope: an image is not JSON, and the plotter's one-line peak summary rides back in `x-plot-summary` so a caller that cannot see the picture still learns where the peak is. Both compute responses gain the matching suggestion: `actions` carries "the same request, plotted" (built from the request that ran, like the permutation suggestion), so an assistant can map, look, and only then decide whether the peak is worth the 100-permutation run. * src/plot.rs: run the configured script over the envelope, read the SVG back, clean up; a missing script is a 502 naming interpreter and script, not a panic. * src/routes/plot.rs: the two handlers (token-gated), delegating to compute_rqtl/compute_gemma so validation and alignment stay in one place; `x-plot-summary` sanitised into a header. * src/routes/{rqtl,gemma}.rs: the plot suggestion, before the permutation one. * src/config.rs: PLOT_PYTHON, RQTL_PLOTTER, GEMMA_PLOTTER. * tests/plot.rs: the suggestion resolves to a complete SVG with a peak summary, and an invalid mapping request is the mapping's own 422. * tests/{rqtl,phewas}.rs: find suggestions by href rather than position. * README.md, docs/www/ai-instruction.md (4a), docs/www/operator-checklist.md (new "Plotting": python3 must be on the server's PATH).