diff options
Diffstat (limited to 'scripts')
| -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) |
