From 1f85e4aec9841c806b0baf5b64d64228426e66d1 Mon Sep 17 00:00:00 2001
From: Boxiang Liu
Date: Tue, 7 Jul 2026 18:20:03 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20regional=20plot=20frontend=20=E2=80=94?=
=?UTF-8?q?=20Plotly=20Locus=20View=20on=20the=20gene=20page=20(#27)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #27. Wires the #25 backend into the gene page as a LocusZoom-style Plotly
plot, styled to Liu Fei's mockup (#23).
- gene.html: blue/slate palette; tissue + LD-population selectors; a Plotly
scattergl of position vs −log10(p) colored by r² (first paint from
/api/gene/{key}/regional); click a point to re-pick the lead (/api/ld,
client-side re-color); genome-wide-significance line; LD legend + caveat.
- viz.py: lead marker -> orange #f97316 (per Liu Fei), was purple.
- web.py: gene page passes the tissue list to the selector.
- Template-render tested; 100% coverage. Verified live: /gene/TP53 renders the
plot UI with 25 real tissues.
Co-Authored-By: Claude Opus 4.8 (1M context)
---
src/locusview/templates/gene.html | 137 ++++++++++++++++++++++++++++--
src/locusview/viz.py | 2 +-
src/locusview/web.py | 1 +
tests/test_web.py | 11 ++-
4 files changed, 144 insertions(+), 7 deletions(-)
diff --git a/src/locusview/templates/gene.html b/src/locusview/templates/gene.html
index 1f2756b..1fb4149 100644
--- a/src/locusview/templates/gene.html
+++ b/src/locusview/templates/gene.html
@@ -4,14 +4,34 @@
{{ gene.symbol }} — locusview
+
@@ -22,6 +42,39 @@ {{ gene.symbol }}
(strand {{ gene.strand }}) · internal gene id {{ gene.gene_id }}
+ Regional plot
+
+
+
+ Tissue
+
+ {% for d in datasets %}{{ d.tissue }} {% endfor %}
+
+
+
+ LD population
+
+ {% for p in ["EUR", "AFR", "AMR", "EAS", "SAS"] %}{{ p }} {% endfor %}
+
+
+
+
+
+ lead (click any point to re-pick)
+ 0.8–1.0
+ 0.6–0.8
+ 0.4–0.6
+ 0.2–0.4
+ 0.0–0.2
+ no LD data
+
+
+ LD = 1000G phase 3 (selected population) — a single-population approximation and a visual aid to
+ locus structure, not part of the association inference. The dotted line is genome-wide
+ significance (5×10−8 ).
+
+
+
eQTLs
Showing eQTLs from {{ n_tissues }} of {{ total_tissues }} datasets (bounded for the MVP).
@@ -55,5 +108,79 @@
eQTLs
{% endif %}
locusview v{{ version }}
+
+