7bec995472122739bf0f076de2603708059c65ce
lrnassar
  Wed May 13 17:23:37 2026 -0700
Adding NMDetective-AI subtracks (bigWig + bigBed) under the NMD Escape superTrack. refs #33737

Two new subtracks slotted between NMD Escape RefSeq and NMDetective-A
(priorities 1.7 and 1.8):
- nmdDetectiveAi    - position-averaged predictions (bigWig)
- nmdDetectiveAiBed - per-stop-gain predictions, one item per (transcript,
codon, mutant codon), with diverging Okabe-Ito
coloring and a pre-rendered mouseover

Predictions are from Veiner et al. (bioRxiv 10.64898/2026.03.24.714003),
covering MANE Select transcripts at Gencode v46. Verdict bins in the
bigBed mouseover use the GMM-derived thresholds reported in the paper's
Methods (-0.17 / +0.43), not symmetric +/- 0.3. Description page covers
the +0.5 / -0.5 anchor convention, threshold derivation, and the
pre-print status.

diff --git src/hg/makeDb/doc/hg38/nmd.txt src/hg/makeDb/doc/hg38/nmd.txt
index f7f5d65e39c..01a949610a4 100644
--- src/hg/makeDb/doc/hg38/nmd.txt
+++ src/hg/makeDb/doc/hg38/nmd.txt
@@ -141,15 +141,57 @@
 #######################################################################
 # Lindeboom et al. NMDetective scores (2025-03-23 max/Claude)
 # NMD efficiency predictions from Lindeboom et al. 2016, Nat Genet.
 # Four bedGraph custom track files downloaded to:
 #   /hive/data/genomes/hg38/bed/nmd/lindeboom/
 # Data downloaded from https://figshare.com/articles/dataset/NMDetective/7803398
 # Custom track data in the session links from that page
 # - NMDetectiveA.ct  - Random forest prediction of NMD efficiency
 # - NMDetectiveB.ct  - Decision tree prediction of NMD efficiency
 # - nmdDectA-ptc.ct  - Random forest, first out-of-frame PTC
 # - nmdDectB-ptc.ct  - Decision tree, first out-of-frame PTC
 
 # Convert bedGraph custom tracks to bigWig and symlink from /gbdb:
 cd /hive/data/genomes/hg38/bed/nmd/lindeboom/
 bash ~/kent/src/hg/makeDb/scripts/nmd/lindeboomToBigWig.sh
+
+#######################################################################
+# NMDetective-AI per-stop-gain predictions (2026-05-13 max)
+# Deep-learning NMD efficiency predictions for every possible stop-gain SNV
+# in MANE Select transcripts (Gencode v46). From Veiner et al., NMDetective-AI
+# manuscript (pre-print as of 2026-05). Source files from the Vejni/NMDetectiveAI
+# GitHub repo:
+#   https://github.com/Vejni/NMDetectiveAI/blob/main/manuscript/supplementary/files/
+# Two files supplied by Marcell Veiner:
+#   NMDetectiveAI_MANE.bw.gz  - bigWig, position-averaged predictions
+#   NMDetectiveAI_MANE.bed.gz - BED, one row per stop-gain mutation per transcript
+
+mkdir -p /hive/data/genomes/hg38/bed/nmd/nmdDetectAi && cd /hive/data/genomes/hg38/bed/nmd/nmdDetectAi
+
+# Download from the supplementary files dir of the GitHub repo
+# (filenames as-is; gunzip in place)
+gunzip -k NMDetectiveAI_MANE.bed.gz NMDetectiveAI_MANE.bw.gz
+
+# Recolor/rescore the BED via a small Python helper. The raw file has
+# itemRgb=0,0,0 and score=int(prediction*1000); we replace these with a
+# diverging Okabe-Ito ramp (blue = NMD-evading, vermillion = NMD-triggering,
+# grey near zero) and a 0-1000 score linear in the [-1.2, 1.5] prediction
+# range. The helper also appends a pre-rendered mouseover HTML column whose
+# verdict bins use the binarization thresholds from the Veiner et al. Methods
+# section (3-component GMM on gnomAD predictions): pred <= -0.17 = evading,
+# -0.17 < pred < +0.43 = intermediate, pred >= +0.43 = triggering.
+python3 ~/kent/src/hg/makeDb/scripts/nmd/nmdDetectAi/makeBigBed.py \
+    NMDetectiveAI_MANE.bed nmdDetectAi.bed
+
+bedSort nmdDetectAi.bed nmdDetectAi.sorted.bed
+bedToBigBed nmdDetectAi.sorted.bed ../../../chrom.sizes nmdDetectAi.bb \
+    -tab -type=bed9+7 -as=${HOME}/kent/src/hg/makeDb/scripts/nmd/nmdDetectAi/nmdDetectAi.as
+
+# bigWig used as-is from the upstream file
+ln -sf /hive/data/genomes/hg38/bed/nmd/nmdDetectAi/NMDetectiveAI_MANE.bw \
+    /gbdb/hg38/nmd/nmdDetectAi.bw
+ln -sf /hive/data/genomes/hg38/bed/nmd/nmdDetectAi/nmdDetectAi.bb \
+    /gbdb/hg38/nmd/nmdDetectAi.bb
+
+# Counts (2026-05-13 build):
+#   bigBed: 4,099,055 stop-gain items at 3 bp (codon) resolution
+#   bigWig: prediction range -1.104 .. 1.487 (different scale from NMDetective-A/B)