95208355e2c667d194b29ee78c8ca8a09c2c2596
max
  Fri Jul 17 08:51:28 2026 -0700
lrSv: add NIH CARD long-read SV subtrack (cardSv)

#Preview2 week - bugs introduced now will need a build patch to fix
Add the NIH CARD Long-Read Initiative structural-variant catalogue (351
post-mortem brain samples: 205 NABEC European ancestry, 146 HBCC
African/African-admixed) as a new subtrack of the Long-read SVs container.
The provider bigBed is re-derived into the shared lrSv schema: signed svLen
made positive (reference span), an explicit insLen added, the single
DUP:TANDEM folded to DUP, and colors remapped to the container's shared
svColor() palette. All 228,855 provider records are carried through 1:1.
Adds the converter and autoSql, the trackDb stanza with filters consistent
with the sibling subtracks, a full description page, a summary row and blurb
on the container page, and a makeDoc section. refs #36258

diff --git src/hg/makeDb/doc/hg38/lrSv.txt src/hg/makeDb/doc/hg38/lrSv.txt
index d2dd215b6bf..af8d46bee31 100644
--- src/hg/makeDb/doc/hg38/lrSv.txt
+++ src/hg/makeDb/doc/hg38/lrSv.txt
@@ -627,15 +627,48 @@
 #       /hive/data/genomes/hg38/chrom.sizes apr.hg38.bb
 #   (cpc1 has no CPX rows, so it was unaffected.)
 #
 # searchIndex was removed from colorsDbSv, lrSv1kLin and lrSvAll: the bigBeds
 #   were built without -extraIndex=name, so by-name search never worked.
 #
 # KimPD (kwanhoSv) was removed from databases.tsv so it no longer flows into
 #   the lrSvAll merge (it is preliminary, unpublished and has breakend
 #   artifacts up to 190 Mb). The subtrack stays on dev/alpha until published.
 #
 # Re-run the merge after the source rebuilds. It now also skips byte-identical
 # duplicate source rows instead of summing their allele counts, which had
 # inflated the per-database and total AC columns.
 python3 ~/kent/src/hg/makeDb/scripts/lrSv/lrSvMergeAll.py
 # 2,682,104 input variants -> 2,317,508 merged (13.6% dedup), 14 databases
+
+##########
+# 2026-07-16 Claude max
+
+# cardSv: SVs from the NIH CARD Long-read Initiative, 351 post-mortem brain
+# samples (205 NABEC European ancestry, 146 HBCC African/African-admixed).
+# Paper: Billingsley et al. 2024, bioRxiv 2024.12.16.628723, PMID 39764002.
+# NAPU pipeline: Kolmogorov et al. 2023, Nat Methods, PMID 37710018.
+#
+# The NIH CARD group distributes a ready-made display bigBed on GitHub. It does
+# not follow the lrSv conventions (signed svLen, no insLen, ColorBrewer colors),
+# so it is re-derived into the shared schema by lrSvCardBbToBed.py.
+
+cd /hive/data/genomes/hg38/bed/lrSv/card
+base=https://raw.githubusercontent.com/meredith705/card_genome_browserTrack/main/hg38
+curl -sL $base/NIH_CARD_longReadSVs.bb -o NIH_CARD_longReadSVs.bb
+
+bigBedToBed NIH_CARD_longReadSVs.bb stdin \
+  | python3 $HOME/kent/src/hg/makeDb/scripts/lrSv/lrSvCardBbToBed.py /dev/stdin cardSv.bed
+# CARD: 228,855 input records written; by type: DEL=101,570, DUP=1,
+#       INS=126,853, INV=431
+# CARD: 32 records with svLen or insLen > 1 Mb kept (large ONT/assembly calls)
+bedSort cardSv.bed cardSv.sorted.bed
+bedToBigBed -type=bed9+ -as=$HOME/kent/src/hg/makeDb/scripts/lrSv/lrSvCard.as \
+    -tab cardSv.sorted.bed /hive/data/genomes/hg38/chrom.sizes cardSv.bb
+
+# All 228,855 provider records are carried through 1:1 (no rows dropped). The
+# provider bigBed itself is a subset of the ~234,905 SVs reported in the paper.
+# A handful of very large calls (INS up to 92 Mb, several multi-Mb INV/DEL) are
+# almost certainly ONT/assembly artifacts but are kept, not silently dropped.
+# svLen is stored as the reference span (1 bp for INS); the inserted-sequence
+# length lives in insLen. AC is the genotyped carrier count (= nabecCount +
+# hbccCount). Not added to the lrSvAll merge for now.