about summary refs log tree commit diff
path: root/tests/plot.rs
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-11 14:05:30 +0000
committerPjotr <wrk@bosa.lan>2026-11-11 14:05:30 +0000
commit83b30cabe99757f44a80988027594871540b8f50 (patch)
tree98cf2b1e969ad358ae956304dc84e827135a3240 /tests/plot.rs
parent9cb59caa1f13ee44ed6fcf7bc6526a87311e8e9f (diff)
downloadgenenetwork4-83b30cabe99757f44a80988027594871540b8f50.tar.gz
plot/gemma: no reference line by default; Bonferroni is one more labelled line
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.
Diffstat (limited to 'tests/plot.rs')
-rw-r--r--tests/plot.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/plot.rs b/tests/plot.rs
index 594fc73..85d60c7 100644
--- a/tests/plot.rs
+++ b/tests/plot.rs
@@ -360,8 +360,11 @@ async fn a_gemma_plot_takes_labelled_thresholds_from_another_engine() {
     assert_eq!(plain.status(), StatusCode::OK);
     let bytes = plain.into_body().collect().await.unwrap().to_bytes();
     let svg = String::from_utf8_lossy(&bytes).to_string();
-    assert!(svg.contains("Bonferroni"), "GEMMA's own line is there");
-    assert!(!svg.contains("bulklmm"), "and nothing claims to be BulkLMM's");
+    assert!(
+        !svg.contains("Bonferroni") && !svg.contains("bulklmm"),
+        "no reference line unless one is asked for: a line on a plot is an annotation, \
+         not part of the result"
+    );
 
     // With them: drawn and named.
     let with = common::post_json_with_token(
@@ -376,7 +379,20 @@ async fn a_gemma_plot_takes_labelled_thresholds_from_another_engine() {
     let svg = String::from_utf8_lossy(&bytes);
     assert!(svg.contains("bulklmm alpha 0.10: 3.50"), "labelled with its source");
     assert!(svg.contains("bulklmm alpha 0.05: 3.65"), "and the second one");
-    assert!(svg.contains("Bonferroni"), "GEMMA's line is still drawn beside them");
+    assert!(!svg.contains("Bonferroni"), "and nothing else unless it is asked for");
+
+    // GEMMA's own convention line is one more opt-in labelling.
+    let with_bonferroni = common::post_json_with_token(
+        "POST /plot/gemma?bonferroni=true",
+        "/plot/gemma?bonferroni=true",
+        &token,
+        &envelope,
+    )
+    .await;
+    assert_eq!(with_bonferroni.status(), StatusCode::OK);
+    let bytes = with_bonferroni.into_body().collect().await.unwrap().to_bytes();
+    let svg = String::from_utf8_lossy(&bytes);
+    assert!(svg.contains("Bonferroni"), "asked for, and labelled as such");
 
     // A threshold that is not a number is refused, not silently dropped.
     let bad = common::post_json_with_token(