5ad55adbb6a5cc72a393700130584aa87fef2c89
lrnassar
  Tue Jun 30 06:15:44 2026 -0700
varFreqs: add Top 3 source AFs to mouseOvers; audit excludes SGDP and SVatalog. refs #36642

Adds a Top 3 source AFs ranking to the varFreqsAffected and varFreqsBackground
mouseOvers. Alongside the pooled allele frequency, the mouseOver now lists the
three cohorts/arms with the highest per-source AF, formatted as
"Source (AF), Source (AF), Source (AF)". Disease cohorts with phenotype splits
carry the arm label (SPARK ASD, SCHEMA case, GREGoR unaffected); population
cohorts use the bare key. Per-population sub-ancestries are deliberately
excluded so a high sub-pop AF cannot crowd out actual project-level signals.

vcfToBigBed.py adds a top_n_source_afs helper, collects per-arm AFs into
affected_arm_afs / background_arm_afs, and emits two new fields
topAffectedSources and topBackgroundSources. AS schema field count 163 -> 165.

An AF-distribution sweep across all 28 source cohorts identified SGDP and
SVatalog as encoding allele counts per genotyped individual (small N, AF
defaults near 0.5), making their per-source AF unreliable for the ranking.
Adds a skip_top_ranking column (col 9) to databases.tsv, set to 1 for SGDP
and SVatalog, and gates the per-arm AF append in vcfToBigBed.py on this
flag. Both cohorts still contribute to pooled backgroundAC/AN/AF and still
appear in backgroundSources; they are only suppressed from the Top 3.

Description pages varFreqsAffected.html and varFreqsBackground.html document
the ranking; the latter also documents the SGDP/SVatalog exclusion. Build
documentation in varFreqs.txt is updated.

diff --git src/hg/makeDb/trackDb/human/varFreqs.ra src/hg/makeDb/trackDb/human/varFreqs.ra
index f056f6c92b0..bd38b65f641 100644
--- src/hg/makeDb/trackDb/human/varFreqs.ra
+++ src/hg/makeDb/trackDb/human/varFreqs.ra
@@ -6,31 +6,31 @@
 visibility hide
 superTrack on
 pennantIcon New red ../goldenPath/newsarch.html#TBD "Released TBD"
 
         track varFreqsAffected
         shortLabel Disease cohorts
         longLabel SNV Frequencies: variants in ~130,000 affected or case individuals (autism, schizophrenia, rare disease cohorts)
         type bigBed 9 +
         parent varFreqs on
         bigDataUrl /gbdb/$D/varFreqs/_affected/varFreqsAffected.bb
         tableBrowser off
         visibility pack
         itemRgb on
         maxWindowToDraw 5000000
         priority 0.11
-        mouseOver <b>Var:</b> ${name}<br><b>AA change:</b> ${aaChange}<br><b>Var type:</b> ${varType}<br><b>Conseq:</b> ${consequence}<br><b>Affected AF:</b> ${affectedAF}<br><b>Affected AC/AN:</b> ${affectedAC} / ${affectedAN}<br><b>Affected cohorts:</b> ${affectedCohorts}<br><b>Background AF:</b> ${backgroundAF}
+        mouseOver <b>Var:</b> ${name}<br><b>AA change:</b> ${aaChange}<br><b>Var type:</b> ${varType}<br><b>Conseq:</b> ${consequence}<br><b>Affected AF:</b> ${affectedAF}<br><b>Affected AC/AN:</b> ${affectedAC} / ${affectedAN}<br><b>Affected cohorts:</b> ${affectedCohorts}<br><b>Top affected by AF:</b> ${topAffectedSources}<br><b>Background AF:</b> ${backgroundAF}
         filterValues.affectedCohorts SPARK|SFARI SPARK WES,SFARI_WGS|SFARI SPARK WGS,GREGoR|GREGoR,SCHEMA|SCHEMA,GA4K|GA4K PacBio LR
         filterType.affectedCohorts multipleListOr
         filterLabel.affectedCohorts Affected/case cohort
         filterValues.backgroundSources AllOfUs|AllOfUs,SPARK|SFARI SPARK WES,SFARI_WGS|SFARI SPARK WGS,GenomeAsia|GenomeAsia SNVs,GenomeAsiaIndel|GenomeAsia Indels,NPM|NPM Singapore,KOVA|KOVA Korea,ToMMo|ToMMo Japan,FinnGen|FinnGen Finland,Saudi|Saudi,SweGen|SweGen Sweden,TOPMed|TOPMed,ABraOM|ABraOM Brazil,ALFA|ALFA,MGRB|MGRB Australia,HRC|HRC,SGDP|SGDP,HGDP1kG|gnomAD HGDP+1kG,GREGoR|GREGoR,SCHEMA|SCHEMA,CoLoRSdb|CoLoRSdb PacBio LR,SVatalog|SVatalog 101 10XG SR,Tishkoff180|Tishkoff 180 African WGS,WBBC|WBBC China,ChinaMAP|China ChinaMAP,GenomeIndia|GenomeIndia 9.7k WGS,GoNL|GoNL Netherlands ~13x SR
         filterType.backgroundSources multipleListOr
         filterLabel.backgroundSources Background source (population or unaffected)
         # Variant type and consequence filters
         filterValues.varType SNV|SNV,INS|Insertion,DEL|Deletion,MNV|MNV
         filterLabel.varType Variant Type
         filterValues.consequence missense|Missense,synonymous|Synonymous,stop_gained|Stop Gained,frameshift|Frameshift,splice_donor|Splice Donor,splice_acceptor|Splice Acceptor,intron|Intron,3_prime_utr|3' UTR,5_prime_utr|5' UTR,non_coding|Non-coding,.|Intergenic,others|Other
         filterType.consequence multipleListOr
         filterLabel.consequence Consequence
         # Length filters
         filterByRange.refLen on
         filterLabel.refLen Reference Length
@@ -624,31 +624,31 @@
         # filter.WBBCAC_Lingnan 0:2000000
         # filterLimits.WBBCAC_Lingnan 0:2000000
         skipEmptyFields on
 
         track varFreqsBackground
         shortLabel Population reference
         longLabel SNV Frequencies: variants in ~1.5 million individuals from population cohorts and unaffected or control arms
         type bigBed 9 +
         parent varFreqs on
         bigDataUrl /gbdb/$D/varFreqs/_background/varFreqsBackground.bb
         tableBrowser off
         visibility pack
         itemRgb on
         maxWindowToDraw 5000000
         priority 0.1
-        mouseOver <b>Var:</b> ${name}<br><b>AA change:</b> ${aaChange}<br><b>Var type:</b> ${varType}<br><b>Conseq:</b> ${consequence}<br><b>Background AF:</b> ${backgroundAF}<br><b>Background AC/AN:</b> ${backgroundAC} / ${backgroundAN}<br><b>Sources:</b> ${backgroundSources}<br><b>Affected AF:</b> ${affectedAF}
+        mouseOver <b>Var:</b> ${name}<br><b>AA change:</b> ${aaChange}<br><b>Var type:</b> ${varType}<br><b>Conseq:</b> ${consequence}<br><b>Background AF:</b> ${backgroundAF}<br><b>Background AC/AN:</b> ${backgroundAC} / ${backgroundAN}<br><b>Sources:</b> ${backgroundSources}<br><b>Top population sources by AF:</b> ${topBackgroundSources}<br><b>Affected AF:</b> ${affectedAF}
         filterValues.affectedCohorts SPARK|SFARI SPARK WES,SFARI_WGS|SFARI SPARK WGS,GREGoR|GREGoR,SCHEMA|SCHEMA,GA4K|GA4K PacBio LR
         filterType.affectedCohorts multipleListOr
         filterLabel.affectedCohorts Affected/case cohort
         filterValues.backgroundSources AllOfUs|AllOfUs,SPARK|SFARI SPARK WES,SFARI_WGS|SFARI SPARK WGS,GenomeAsia|GenomeAsia SNVs,GenomeAsiaIndel|GenomeAsia Indels,NPM|NPM Singapore,KOVA|KOVA Korea,ToMMo|ToMMo Japan,FinnGen|FinnGen Finland,Saudi|Saudi,SweGen|SweGen Sweden,TOPMed|TOPMed,ABraOM|ABraOM Brazil,ALFA|ALFA,MGRB|MGRB Australia,HRC|HRC,SGDP|SGDP,HGDP1kG|gnomAD HGDP+1kG,GREGoR|GREGoR,SCHEMA|SCHEMA,CoLoRSdb|CoLoRSdb PacBio LR,SVatalog|SVatalog 101 10XG SR,Tishkoff180|Tishkoff 180 African WGS,WBBC|WBBC China,ChinaMAP|China ChinaMAP,GenomeIndia|GenomeIndia 9.7k WGS,GoNL|GoNL Netherlands ~13x SR
         filterType.backgroundSources multipleListOr
         filterLabel.backgroundSources Background source (population or unaffected)
         # Variant type and consequence filters
         filterValues.varType SNV|SNV,INS|Insertion,DEL|Deletion,MNV|MNV
         filterLabel.varType Variant Type
         filterValues.consequence missense|Missense,synonymous|Synonymous,stop_gained|Stop Gained,frameshift|Frameshift,splice_donor|Splice Donor,splice_acceptor|Splice Acceptor,intron|Intron,3_prime_utr|3' UTR,5_prime_utr|5' UTR,non_coding|Non-coding,.|Intergenic,others|Other
         filterType.consequence multipleListOr
         filterLabel.consequence Consequence
         # Length filters
         filterByRange.refLen on
         filterLabel.refLen Reference Length