9358ec5d40af122594470fa05e1adc23e33f2cba braney Mon Nov 14 14:17:26 2011 -0800 add an option to hubCheck to not check all the tracks, just check the trackDb. Useful in crawling the hubs to pull the trackDb's into the udc cache where they can be parsed. #5088 diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c index 49411e9..71743eb 100644 --- src/hg/lib/trackHub.c +++ src/hg/lib/trackHub.c @@ -437,75 +437,81 @@ freez(&bigDataUrl); } errCatchEnd(errCatch); if (errCatch->gotError) { retVal = 1; dyStringPrintf(errors, "%s", errCatch->message->string); } errCatchFree(&errCatch); } return retVal; } static int hubCheckGenome(struct trackHub *hub, struct trackHubGenome *genome, - struct dyString *errors) + struct dyString *errors, boolean checkTracks) /* Check out genome within hub. */ { struct errCatch *errCatch = errCatchNew(); struct trackDb *tdbList = NULL; int retVal = 0; if (errCatchStart(errCatch)) tdbList = trackHubTracksForGenome(hub, genome); errCatchEnd(errCatch); if (errCatch->gotError) { retVal = 1; dyStringPrintf(errors, "%s", errCatch->message->string); } errCatchFree(&errCatch); +if (!checkTracks) + return retVal; + struct trackDb *tdb; for (tdb = tdbList; tdb != NULL; tdb = tdb->next) retVal |= hubCheckTrack(hub, genome, tdb, errors); verbose(2, "%d tracks in %s\n", slCount(tdbList), genome->name); return retVal; } -int trackHubCheck(char *hubUrl, struct dyString *errors) +int trackHubCheck(char *hubUrl, struct dyString *errors, boolean checkTracks) /* hubCheck - Check a track data hub for integrity. Put errors in dyString. - * return 0 if hub has no errors, 1 otherwise */ + * return 0 if hub has no errors, 1 otherwise + * if checkTracks is TRUE, individual tracks are checked + */ + { struct errCatch *errCatch = errCatchNew(); struct trackHub *hub = NULL; int retVal = 0; if (errCatchStart(errCatch)) hub = trackHubOpen(hubUrl, ""); errCatchEnd(errCatch); if (errCatch->gotError) { retVal = 1; dyStringPrintf(errors, "%s", errCatch->message->string); } errCatchFree(&errCatch); if (hub == NULL) return 1; verbose(2, "hub %s\nshortLabel %s\nlongLabel %s\n", hubUrl, hub->shortLabel, hub->longLabel); verbose(2, "%s has %d elements\n", hub->genomesFile, slCount(hub->genomeList)); struct trackHubGenome *genome; for (genome = hub->genomeList; genome != NULL; genome = genome->next) { - retVal |= hubCheckGenome(hub, genome, errors); + retVal |= hubCheckGenome(hub, genome, errors, checkTracks); } trackHubClose(&hub); return retVal; }