d3752edc12da1bf08427946150f564dbdd5d2254 angie Thu Oct 24 13:55:51 2019 -0700 bigDbSnp track handler code - initial commit. refs #23283 * dnautil: Added trimRefAltLeft to get left-justified trimming (a la VCF not HGVS). * bigBedClick: do hReplaceGbdb up front in parseDetailsTablUrls instead of waiting until endpoint. * trackDbCustom.c: consolidating type-handling for wig/bigWig vs. bigBed-based big*. diff --git src/hg/lib/trackDbCustom.c src/hg/lib/trackDbCustom.c index 5eb97b3..e5f9f41 100644 --- src/hg/lib/trackDbCustom.c +++ src/hg/lib/trackDbCustom.c @@ -220,43 +220,42 @@ struct hashEl *hel; struct hashCookie hc = hashFirst(overTd->overrides); while ((hel = hashNext(&hc)) != NULL) { overrideField(td, overTd, hel->name); } } static boolean packableType(char *type) /* Return TRUE if we can pack this type. */ { char *t = cloneString(type); char *s = firstWordInLine(t); boolean canPack = (sameString("psl", s) || sameString("chain", s) || sameString("bed", s) || sameString("genePred", s) || - sameString("bigBed", s) || sameString("makeItems", s) || - sameString("bigMaf", s) || sameString("bigGenePred", s) || - sameString("bigBarChart", s) || sameString("bigGenePred", s) || + sameString("makeItems", s) || sameString("expRatio", s) || sameString("wigMaf", s) || sameString("factorSource", s) || sameString("bed5FloatScore", s) || sameString("bed6FloatScore", s) || sameString("altGraphX", s) || sameString("bam", s) || sameString("bedDetail", s) || sameString("bed8Attrs", s) || sameString("gvf", s) || sameString("vcfTabix", s) || sameString("vcf", s) || sameString("pgSnp", s) || sameString("narrowPeak", s) || sameString("broadPeak", s) || sameString("bigLolly", s) || sameString("peptideMapping", s) || sameString("barChart", s) || - sameString("interact", s) || sameString("bigInteract", s) + sameString("interact", s) || + (!startsWithWord("bigWig", s) && startsWith("big", s)) ); freeMem(t); return canPack; } void trackDbPolish(struct trackDb *bt) /* Fill in missing values with defaults. */ { if (bt->shortLabel == NULL) bt->shortLabel = cloneString(bt->track); if (bt->longLabel == NULL) bt->longLabel = cloneString(bt->shortLabel); if (bt->altColorR == 0 && bt->altColorG == 0 && bt->altColorB == 0) @@ -680,102 +679,101 @@ printf("%s (%s)<BR>\n", freeze, origAssembly); } } } eCfgType cfgTypeFromTdb(struct trackDb *tdb, boolean warnIfNecessary) /* determine what kind of track specific configuration is needed, warn if not multi-view compatible */ { eCfgType cType = cfgNone; char *type = tdb->type; assert(type != NULL); if(startsWith("wigMaf", type) || startsWith("bigMaf", type)) cType = cfgWigMaf; -else if(startsWith("wig", type)) +else if(startsWith("wig", type) || startsWith("mathWig", type) || startsWith("bigWig", type) || + startsWith("bedGraph", type) || startsWith("bamWig", type)) cType = cfgWig; else if(startsWith("bigGenePred", type)) cType = cfgGenePred; -else if(startsWith("mathWig", type)) - cType = cfgWig; -else if(startsWith("bigWig", type)) - cType = cfgWig; +else if(startsWith("chain",type) || startsWith("bigChain",type)) + cType = cfgChain; +else if (startsWith("psl", type) || startsWith("bigPsl", type)) + cType = cfgPsl; +else if (sameWord("barChart", type) || sameWord("bigBarChart", type)) + cType = cfgBarChart; +else if (sameWord("interact", type) || sameWord("bigInteract", type)) + cType = cfgInteract; +else if (startsWith("bigLolly", type)) + cType = cfgLollipop; +else if (sameWord("bigDbSnp", type)) + cType = cfgBigDbSnp; else if(startsWith("longTabix", type)) cType = cfgLong; -else if(startsWith("bedGraph", type)) - cType = cfgWig; else if (startsWith("netAlign", type) || startsWith("net", tdb->track)) // SPECIAL CASE from hgTrackUi which might not be needed cType = cfgNetAlign; else if(sameWord("bed5FloatScore", type) || sameWord("bed5FloatScoreWithFdr",type)) { if (bedScoreHasCfgUi(tdb)) cType = cfgBedScore; } else if (encodePeakHasCfgUi(tdb)) cType = cfgPeak; else if (startsWithWord("genePred",type) && !startsWith("encodeGencodeRaceFrags", tdb->track)) // SPECIAL CASE should fix in trackDb! cType = cfgGenePred; else if (sameWord("bedLogR",type) || sameWord("peptideMapping", type)) cType = cfgBedScore; -else if (startsWith("bed ", type) || startsWith("bigBed", type) || startsWith("bedDetail", type)) +// This is a catch-all for big* types that are not special-cased above. big* types after this +// point are assumed to be flavors of bigBed. +else if (startsWith("bed ", type) || startsWith("big", type) || startsWith("bedDetail", type)) { if (trackDbSetting(tdb, "bedFilter") != NULL) cType = cfgBedFilt; - else + else if (!startsWith("big", type) || startsWith("bigBed", type)) { char *words[3]; int wordCount = chopLine(cloneString( type), words); if (( ((wordCount > 1) && (atoi(words[1]) >= 5)) || trackDbSetting(tdb, "scoreMin") != NULL) && // Historically needed 'bed n .' but encode didn't follow bed n . ( (wordCount >= 3) || (!tdbIsTrackUiTopLevel(tdb) && trackDbSettingClosestToHome(tdb, "wgEncode")))) { cType = cfgBedScore; if (!bedScoreHasCfgUi(tdb)) cType = cfgNone; // FIXME: UGLY SPECIAL CASE should be handled in trackDb! else if (startsWith("encodeGencodeIntron", tdb->track)) cType = cfgNone; } } + else + cType = cfgBedScore; } -else if(startsWith("chain",type) || startsWith("bigChain",type)) - cType = cfgChain; -else if (startsWith("bamWig", type)) - cType = cfgWig; else if (startsWith("bam", type)) cType = cfgBam; -else if (startsWith("psl", type) || startsWith("bigPsl", type)) - cType = cfgPsl; else if (sameWord("vcfTabix",type) || sameWord("vcf", type)) cType = cfgVcf; else if (sameWord("halSnake",type)) cType = cfgSnake; -else if (sameWord("barChart", type) || sameWord("bigBarChart", type)) - cType = cfgBarChart; -else if (sameWord("interact", type) || sameWord("bigInteract", type)) - cType = cfgInteract; -else if (startsWith("bigLolly", type)) - cType = cfgLollipop; else if (sameWord("hic", type)) cType = cfgHic; // TODO: Only these are configurable so far if (cType == cfgNone && warnIfNecessary) { if (!startsWith("bed ", type) && !startsWith("bedDetail", type) && !startsWith("bigBed", type) && !startsWith("gvf", type) && !sameString("pgSnp", type) && subgroupFind(tdb, "view", NULL)) warn("Track type \"%s\" is not yet supported in multi-view composites for %s.",type,tdb->track); } return cType; } int configurableByAjax(struct trackDb *tdb, eCfgType cfgTypeIfKnown)