diff options
| author | Pjotr <wrk@bosa.lan> | 2026-11-11 14:49:16 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-11-11 14:49:16 +0000 |
| commit | 8bb9c54d2eb7b4ae2d330a588eff32feceb4324f (patch) | |
| tree | 80cfb0bd569ca02452538b7a3c7b6f5733c6faf8 /scripts/plot-bulklmm.py | |
| parent | 492e0c5e8988fda87d361cef4f29639c5f0d0b72 (diff) | |
| download | genenetwork4-8bb9c54d2eb7b4ae2d330a588eff32feceb4324f.tar.gz | |
plot/bulklmm: the 0.05 and 0.01 lines, never 0.10 unless asked
Checked what the plot actually draws: it has never drawn the alpha 0.10
line -- the plotter matches 0.05 and 0.01 only. What lists all three is the
reply's notes ("alpha 0.01: LOD 4.58, alpha 0.05: 3.65, alpha 0.1: 3.50"),
which is where the 0.10 came from.
Still, the point stands on its own: 0.10 is the loosest bar in the set and
drawing it invites reading it as the line to clear. So the defaults are
stated and pinned -- 0.05 and 0.01 on the plot, 0.10 only on request
(?all_thresholds=true, or an explicit ?thresholds=) -- alongside GEMMA's
Bonferroni, which is opt-in for the same reason: a reference line is an
annotation, not a result.
tests/bulklmm.rs counts the lines: exactly two by default, and no
alpha 0.10 label.
Diffstat (limited to 'scripts/plot-bulklmm.py')
| -rwxr-xr-x | scripts/plot-bulklmm.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/plot-bulklmm.py b/scripts/plot-bulklmm.py index 51c24f8..67ef418 100755 --- a/scripts/plot-bulklmm.py +++ b/scripts/plot-bulklmm.py @@ -22,6 +22,11 @@ def main(): ap.add_argument("-o", "--out", default="bulklmm_lod.svg") ap.add_argument("--trait", default="", help="trait label for the title") ap.add_argument("--title", default=None, help="override the title text") + ap.add_argument("--all-thresholds", action="store_true", + help="also draw the loosest line the reply reports (alpha 0.10); the default " + "is the genome-wide 0.05 and the stricter 0.01") + ap.add_argument("--threshold", action="append", default=[], + help="extra reference line as VALUE[:LABEL]") a = ap.parse_args() doc = json.load(open(a.result)) @@ -36,6 +41,10 @@ def main(): # Thresholds: the endpoint writes them into `notes` as "alpha 0.05: LOD 3.81". notes = " ".join(doc.get("notes", [])) + # Two lines by default: the genome-wide 0.05 and the stricter 0.01. The + # reply also reports 0.10, but that is the loosest bar in the set and + # drawing it invites reading it as the one to clear -- it is available on + # request (--all-thresholds) and as an explicit --threshold. thresholds = [] for match in re.finditer(r"alpha ([0-9.]+): LOD ([0-9]+(?:\.[0-9]+)?)", notes): alpha, lod = float(match.group(1)), float(match.group(2)) @@ -43,6 +52,11 @@ def main(): thresholds.append((lod, "genome-wide (alpha 0.05)", "6 3")) elif abs(alpha - 0.01) < 1e-9: thresholds.append((lod, "alpha 0.01", "3 3")) + elif a.all_thresholds and abs(alpha - 0.1) < 1e-9: + thresholds.append((lod, "alpha 0.10", "1 4")) + for spec in a.threshold: + value, _, label = spec.partition(":") + thresholds.append((float(value), label.strip() or "threshold", "2 4")) seed = re.search(r"seed (\d+)", notes) h2 = re.search(r"heritability h2 = ([\d.eE+-]+)", notes) nperm = re.search(r"from (\d+) rotations", notes) |
