8efbcad3f2816dec50b5671a4445d2e6943f7f91 max Mon Apr 13 07:57:41 2026 -0700 Use light gray for monomorphic strVar loci (het=0), distinct from no-data gray, refs #36652 Add a separate color for loci where heterozygosity is exactly 0 (single allele observed) across all four strVar subtracks: light gray (200,200,200). This distinguishes them from the existing medium gray (128,128,128) used when no allele frequency data is available. Previously het=0 was lumped into the dark blue "nearly monomorphic" bin. Also expand the itemRgb field description in all four .as files to list the full color scheme. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> diff --git src/hg/makeDb/scripts/webstr/webstrToBed.py src/hg/makeDb/scripts/webstr/webstrToBed.py index f26bab2b5d8..8178fbef8c4 100644 --- src/hg/makeDb/scripts/webstr/webstrToBed.py +++ src/hg/makeDb/scripts/webstr/webstrToBed.py @@ -8,47 +8,50 @@ webstrToBed.py <inputDir> > webstr.bed """ import csv import gzip import sys from collections import defaultdict HET_BINS = [ (0.1, "0,0,180"), # het < 0.1: dark blue (nearly monomorphic) (0.3, "70,130,230"), # het 0.1-0.3: medium blue (low diversity) (0.5, "180,130,200"), # het 0.3-0.5: light purple (moderate diversity) (0.7, "230,100,80"), # het 0.5-0.7: salmon (high diversity) (999, "180,0,0"), # het >= 0.7: dark red (very high diversity) ] -NO_DATA_COLOR = "128,128,128" # gray when no allele freq data +NO_DATA_COLOR = "128,128,128" # medium gray when no allele freq data +MONOMORPHIC_COLOR = "200,200,200" # light gray when het == 0 (fixed allele) def truncateMotif(motif, maxLen=25): """Truncate motif to maxLen characters with '..' in the middle.""" if len(motif) <= maxLen: return motif keepLen = maxLen - 2 leftLen = (keepLen + 1) // 2 rightLen = keepLen - leftLen return motif[:leftLen] + ".." + motif[-rightLen:] def hetToColor(het): """Map heterozygosity value to an RGB color string.""" if het < 0: return NO_DATA_COLOR + if het == 0: + return MONOMORPHIC_COLOR for threshold, color in HET_BINS: if het < threshold: return color return HET_BINS[-1][1] def computeHet(af): """Compute expected heterozygosity from allele freqs pooled across populations. Pools allele frequencies weighted by sample count, then computes het = 1 - sum(p_i^2). """ if af is None: return -1.0 totalN = 0