5bf51515b69bd518b2154df5476bc7ed319e33bd markd Sun Mar 22 21:05:42 2026 -0700 Add bigMethyl to the list of valid tracktyopes to check. Generate a warning rather than error for halSnake tracks when when HAL support is not compiled in. Added danger comments about duplicated track name checking diff --git src/hg/utils/hubCheck/hubCheck.c src/hg/utils/hubCheck/hubCheck.c index 318507c9d9d..76e133330a4 100644 --- src/hg/utils/hubCheck/hubCheck.c +++ src/hg/utils/hubCheck/hubCheck.c @@ -790,57 +790,76 @@ (tdb->parent != NULL && (tdbIsComposite(tdb->parent) || tdbIsCompositeView(tdb->parent)))) { errAbort("Track \"%s\" is declared container multiWig and has parent \"%s\"." " Container multiWig tracks cannot be children of composites or views", tdb->track, tdb->parent->track); } } else if (tdb->subtracks != NULL) { errAbort("Track \"%s\" has children tracks (e.g: \"%s\"), but is not a " "compositeTrack, container, view or superTrack", tdb->track, tdb->subtracks->track); } } +static char *VALID_TRACK_TYPES[] = { + "bam", "bigBarChart", "bigBed", "bigChain", "bigGenePred", "bigInteract", + "bigLolly", "bigMaf", "bigMethyl", "bigNarrowPeak", "bigPsl", "bigRmsk", + "bigWig", "halSnake", "hic", "longTabix", "vcfPhasedTrio", "vcfTabix", NULL}; + +static bool isValidTrackType(char *trackType) +/* check that a track type is valid */ +{ +// **** DANGER, WILL ROBINSON! **** +// There is also code in trackHub.c that checks track names. +// both places must be changed or common code created. +for (int i = 0; VALID_TRACK_TYPES[i] != NULL; i++) + if (sameString(trackType, VALID_TRACK_TYPES[i])) + return TRUE; +return FALSE; +} + +static char *getValidTrackTypesMsg() +/* return descriptions of valid track types */ +{ +struct dyString *msg = dyStringNew(256); +for (int i = 0; VALID_TRACK_TYPES[i] != NULL; i++) + { + if (i > 0) + dyStringAppend(msg, ", "); + dyStringAppend(msg, VALID_TRACK_TYPES[i]); + } +return dyStringCannibalize(&msg); +} + boolean checkTypeLine(struct trackHubGenome *genome, struct trackDb *tdb, struct dyString *errors, struct trackHubCheckOptions *options) { boolean retVal = FALSE; struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { char *type = trackDbRequiredSetting(tdb, "type"); char *splitType[4]; int numWords = chopByWhite(cloneString(type), splitType, sizeof(splitType)); char *trackType = splitType[0]; boolean isParentTrack = (tdbIsComposite(tdb) || tdbIsCompositeView(tdb) || tdbIsContainer(tdb)); - if (!isParentTrack && - // these are the valid trackDb types for hub data tracks: - !(sameString("bigNarrowPeak", trackType) || sameString("bigBed", trackType) || - sameString("bigGenePred", trackType) || sameString("bigPsl", trackType)|| - sameString("bigChain", trackType)|| sameString("bigMaf", trackType) || - sameString("bigBarChart", trackType) || sameString("bigInteract", trackType) || - sameString("bigLolly", trackType) || sameString("bigRmsk", trackType) || - sameString("bigWig", trackType) || sameString("longTabix", trackType) || - sameString("vcfTabix", trackType) || sameString("vcfPhasedTrio", trackType) || - sameString("bam", trackType) || sameString("hic", trackType) - #ifdef USE_HAL - || sameString("halSnake", trackType) - #endif - )) + if (!isParentTrack && !isValidTrackType(trackType)) { - errAbort("error: unrecognized type \"%s\" for track \"%s\". Valid types include: bigWig, bigBed, bigGenePred, bigPsl, bigChain, bigMaf, bigBarChart, bigInteract, vcfTabix, bam, hic, and longTabix. See https://genome.ucsc.edu/goldenPath/help/trackDb/trackDbHub.html#type for the full list.", trackType, tdb->track); + errAbort("error: unrecognized type \"%s\" for track \"%s\". Valid types are: %s. " + "See https://genome.ucsc.edu/goldenPath/help/trackDb/trackDbHub.html#type for the more incornation list.", + trackType, tdb->track, getValidTrackTypesMsg()); } if (sameString(splitType[0], "bigBed")) { if (numWords > 1 && (strchr(splitType[1], '+') || strchr(splitType[1], '.'))) { errAbort("error in type line \"%s\" for track \"%s\". " "A space is needed after the \"+\" or \".\" character.", type, tdb->track); } if (numWords > 2 && (!sameString(splitType[2], "+") && !sameString(splitType[2], "."))) { errAbort("error in type line \"%s\" for track \"%s\". " "Only \"+\" or \".\" is allowed after bigBed numFields setting.", type, tdb->track); } }