db1681c559128800c65ce174dc010343e6ea38d2 angie Thu Oct 31 13:45:12 2019 -0700 bigDbSnp freqSource dropdown: clarify that 'GnomAD' is GnomAD genomes, thx Ana. refs #23283 diff --git src/hg/lib/hui.c src/hg/lib/hui.c index f6c57f6..37c1ecc 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -4315,38 +4315,51 @@ boolean option = cartUsualBooleanClosestToHome(cart, tdb, FALSE, suffix, defaultOn); char cartVar[1024]; safef(cartVar, sizeof cartVar, "%s.%s", tdb->track, suffix); cgiMakeCheckBox(cartVar, option); printf(" %s ", desc); } static void freqSourceSelect(struct cart *cart, struct trackDb *tdb, char *name) /* Make a select input for preferred source of allele frequencies from * trackDb setting freqSourceOrder. */ { char *freqSourceOrder = cloneString(trackDbSetting(tdb, "freqSourceOrder")); if (isEmpty(freqSourceOrder)) return; int fsCount = countSeparatedItems(freqSourceOrder, ','); +char *values[fsCount]; +chopCommas(freqSourceOrder, values); char *menu[fsCount]; -chopCommas(freqSourceOrder, menu); +int i; +for (i = 0; i < fsCount; i++) + { + // Change label of GnomAD to "GnomAD genomes" for clarity when "GnomAD_exomes" is present. + if (sameString(values[i], "GnomAD") && stringIx("GnomAD_exomes", values) >= 0) + menu[i] = "GnomAD genomes"; + else + { + menu[i] = cloneString(values[i]); + strSwapChar(menu[i], '_', ' '); + } + } boolean parentLevel = isNameAtParentLevel(tdb, name); char *freqProj = cartOptionalStringClosestToHome(cart, tdb, parentLevel, "freqProj"); puts("<b>Frequency source/project to use for Minor Allele Frequency (MAF):</b>"); char cartVar[1024]; safef(cartVar, sizeof cartVar, "%s.freqProj", name); -cgiMakeDropList(cartVar, menu, ArraySize(menu), freqProj); +cgiMakeDropListWithVals(cartVar, menu, values, ArraySize(menu), freqProj); puts("<br>"); } static struct trackDb *tdbOrAncestorByName(struct trackDb *tdb, char *name) /* For reasons Angie cannot fathom, if a composite or view is passed to cfgByCfgType then * cfgByCfgType passes a leaf subtrack to its callees like bigDbSnpCfgUi. That is why we * see so many calls to isNameAtParentLevel, which returns true if the tdb was originally * at the composite or view level, which we can only tell by comparing with the original track name. * labelMakeCheckBox, called by many handlers in hgTrackUi that must be always top-level * (or have a special handler that bypasses cfgByCfgType like refSeqComposite), * is blissfully unaware of this. It uses the same tdb for looking in cart ClosestToHome * and for making the HTML element's cart var name, trusting that the correct tdb has been * handed to it. * So in order for a callee of cfgByCfgType to call labelMakeCheckBox with the correct tdb, * we need to walk back up comparing name like isNameAtParentLevel does.