6e0d7083fa223488bc745093350e449a30ad38f2 chmalee Tue Jul 30 09:11:59 2019 -0700 Prepending genome name to track ids in hubCheck html output to force uniqueness, found by running on vgp hub diff --git src/hg/utils/hubCheck/hubCheck.c src/hg/utils/hubCheck/hubCheck.c index 7d7a632..af819cb 100644 --- src/hg/utils/hubCheck/hubCheck.c +++ src/hg/utils/hubCheck/hubCheck.c @@ -718,84 +718,86 @@ if (metaPairs != NULL) { printf("%s\n", trackHubSkipHubName(tdb->track)); struct slPair *pair; for(pair = metaPairs; pair; pair = pair->next) { printf("\t%s : %s\n", pair->name, (char *)pair->val); } printf("\n"); } slPairFreeValsAndList(&metaPairs); } struct trackDb *tempTdb = NULL; -char *idName, *textName, *parentName = NULL; +char *textName, *parentName = NULL; +char idName[512]; struct errCatch *errCatch = errCatchNew(); boolean trackIsContainer = (tdbIsComposite(tdb) || tdbIsCompositeView(tdb) || tdbIsContainer(tdb)); // first get down into the subtracks if (tdb->subtracks != NULL) { for (tempTdb = tdb->subtracks; tempTdb != NULL; tempTdb = tempTdb->next) retVal |= hubCheckTrack(hub, genome, tempTdb, options, errors); } +// for when assembly hubs have tracks with the same name, prepend assembly name to id +safef(idName, sizeof(idName), "%s_%s", trackHubSkipHubName(genome->name), trackHubSkipHubName(tdb->track)); + if (options->htmlOut) { - dyStringPrintf(errors, "trackData['%s'] = [", trackHubSkipHubName(tdb->track)); + dyStringPrintf(errors, "trackData['%s'] = [", idName); } if (errCatchStart(errCatch)) { hubCheckParentsAndChildren(tdb); if (trackIsContainer) retVal |= hubCheckCompositeSettings(genome, tdb, errors, options); if (tdbIsSubtrack(tdb)) retVal |= hubCheckSubtrackSettings(genome, tdb, errors, options); if (options->checkFiles) hubCheckBigDataUrl(hub, genome, tdb); } errCatchEnd(errCatch); if (errCatch->gotError) { trackDbErrorCount += 1; retVal = 1; if (!options->htmlOut) dyStringPrintf(errors, "%s", errCatch->message->string); } errCatchFree(&errCatch); if (options->htmlOut) { if (trackIsContainer) { for (tempTdb = tdb->subtracks; tempTdb != NULL; tempTdb = tempTdb->next) { - idName = trackHubSkipHubName(tempTdb->track); textName = trackHubSkipHubName(tempTdb->longLabel); parentName = trackHubSkipHubName(tdb->track); dyStringPrintf(errors, "%s,", makeFolderObjectString(idName, textName, parentName, "TRACK", TRUE, retVal)); } } else if (!retVal) { // add "Error" to the trackname to force uniqueness for the jstree - idName = trackHubSkipHubName(tdb->track); dyStringPrintf(errors, "{icon: 'fa fa-plus', " "id:'%sError', text:'No trackDb configuration errors', parent:'%s'}", idName, idName); } dyStringPrintf(errors, "];\n"); } return retVal; } int hubCheckGenome(struct trackHub *hub, struct trackHubGenome *genome, struct trackHubCheckOptions *options, struct dyString *errors) /* Check out genome within hub. */ { struct errCatch *errCatch = errCatchNew(); @@ -848,31 +850,33 @@ { if (options->htmlOut) { // if we haven't already found an error then open up the array if (!openedGenome) { dyStringPrintf(errors, "trackData['%s'] = [", genomeName); openedGenome = TRUE; } } // use different dyString for the actual errors generated by each track tdbCheckVal = hubCheckTrack(hub, genome, tdb, options, tdbDyString); genomeErrorCount += tdbCheckVal; if (options->htmlOut) { - char *name = trackHubSkipHubName(tdb->track); + // when assembly hubs have tracks with the same name, prepend assembly name to id + char name[512]; + safef(name, sizeof(name), "%s_%s", trackHubSkipHubName(genome->name), trackHubSkipHubName(tdb->track)); dyStringPrintf(errors, "%s", makeFolderObjectString(name, tdb->longLabel, genomeName, "TRACK", TRUE, tdbCheckVal ? TRUE : FALSE)); if (tdb->next != NULL) dyStringPrintf(errors, ","); } } if (options->htmlOut) dyStringPrintf(errors, "];\n"); dyStringPrintf(errors, "%s", tdbDyString->string); return genomeErrorCount; } int trackHubCheck(char *hubUrl, struct trackHubCheckOptions *options, struct dyString *errors)