6eacdcdb29afdeefa7ba7a5ec1e52e13e86680f9 hiram Wed Apr 10 14:45:45 2019 -0700 better layout for selection menus and now returning errors properly refs #18869 diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c index 40b1708..a81f253 100644 --- src/hg/hubApi/hubApi.c +++ src/hg/hubApi/hubApi.c @@ -27,42 +27,42 @@ #define delayFraction 0.03 /* default is to list all trackDb entries, composite containers too. * This option will limit to only the actual track entries with data */ boolean trackLeavesOnly = FALSE; /* set by CGI parameter 'trackLeavesOnly' */ /* Global only to this one source file */ static struct cart *cart; /* CGI and other variables */ static struct hash *oldVars = NULL; static struct hash *trackCounter = NULL; static long totalTracks = 0; static boolean measureTiming = FALSE; /* set by CGI parameters */ static boolean allTrackSettings = FALSE; /* checkbox setting */ static char **shortLabels = NULL; /* public hub short labels in array */ -// struct hubPublic *publicHubList = NULL; static int publicHubCount = 0; static char *defaultHub = "Plants"; -// static char *defaultHubUrl = " http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt"; static char *defaultDb = "ce11"; static long enteredMainTime = 0; /* will become = clock1000() on entry */ /* to allow calculation of when to bail out, taking too long */ static long timeOutSeconds = 100; static boolean timedOut = FALSE; static char *urlPrefix = ""; /* initalized to support self references */ + + /* supportedTypes will be initialized to a known supported set */ static struct slName *supportedTypes = NULL; - /* will be initialized to a known supported set */ + static void initSupportedTypes() /* initalize the list of supported track types */ { struct slName *el = newSlName("bed"); slAddHead(&supportedTypes, el); el = newSlName("wig"); slAddHead(&supportedTypes, el); el = newSlName("broadPeak"); slAddHead(&supportedTypes, el); el = newSlName("narrowPeak"); slAddHead(&supportedTypes, el); el = newSlName("bigBed"); slAddHead(&supportedTypes, el); el = newSlName("bigWig"); @@ -217,54 +217,54 @@ boolean superChild = tdbIsSuperTrackChild(tdb); unsigned start = chromSize / 4; unsigned end = start + 10000; if (end > chromSize) end = chromSize; char *genome = NULL; if (hub) genome = hub->genomeList->name; if (db) { if (hub) { char urlReference[2048]; - safef(urlReference, sizeof(urlReference), " (sample getData)%s\n", urlPrefix, hub->url, genome, tdb->track, chrom, start, end, errorPrint); + safef(urlReference, sizeof(urlReference), " (sample data)%s\n", urlPrefix, hub->url, genome, tdb->track, chrom, start, end, errorPrint); if (tdb->parent) hPrintf("
  • %s: %s subtrack of parent: %s%s
  • \n", tdb->track, tdb->type, tdb->parent->track, urlReference); else hPrintf("
  • %s: %s%s
  • \n", tdb->track, tdb->type, urlReference); } else { char urlReference[2048]; - safef(urlReference, sizeof(urlReference), " (sample getData)%s\n", urlPrefix, db, chrom, tdb->track, start, end, errorPrint); + safef(urlReference, sizeof(urlReference), " (sample data)%s\n", urlPrefix, db, chrom, tdb->track, start, end, errorPrint); if (superChild) hPrintf("
  • %s: %s superTrack child of parent: %s%s
  • \n", tdb->track, tdb->type, tdb->parent->track, urlReference); else if (tdb->parent) hPrintf("
  • %s: %s subtrack of parent: %s%s
  • \n", tdb->track, tdb->type, tdb->parent->track, urlReference); else hPrintf("
  • %s: %s%s
  • \n", tdb->track, tdb->type, urlReference ); } } else if (hub) { char urlReference[2048]; - safef(urlReference, sizeof(urlReference), " (sample getData)%s\n", urlPrefix, hub->url, genome, tdb->track, chrom, start, end, errorPrint); + safef(urlReference, sizeof(urlReference), " (sample data)%s\n", urlPrefix, hub->url, genome, tdb->track, chrom, start, end, errorPrint); if (tdb->parent) hPrintf("
  • %s: %s subtrack of parent: %s%s
  • \n", tdb->track, tdb->type, tdb->parent->track, urlReference); else hPrintf("
  • %s: %s%s
  • \n", tdb->track, tdb->type, urlReference); } else hPrintf("
  • %s : %s not db hub track ?
  • \n", tdb->track, tdb->type); } static void hubSampleUrl(struct trackHub *hub, struct trackDb *tdb, long chromCount, long itemCount, char *chromName, unsigned chromSize, char *genome, char *errorString) { unsigned start = chromSize / 4; @@ -283,31 +283,31 @@ char countsMessage[512]; countsMessage[0] = 0; if (chromCount > 0 || itemCount > 0) { if (allowedBigBedType(tdb->type)) safef(countsMessage, sizeof(countsMessage), " : %ld chroms : %ld item count ", chromCount, itemCount); else if (startsWithWord("bigWig", tdb->type)) safef(countsMessage, sizeof(countsMessage), " : %ld chroms : %ld bases covered ", chromCount, itemCount); else safef(countsMessage, sizeof(countsMessage), " : %ld chroms : %ld count ", chromCount, itemCount); } if (isSupportedType(tdb->type)) { char urlReference[2048]; - safef(urlReference, sizeof(urlReference), "(sample getData)%s\n", urlPrefix, hub->url, genome, tdb->track, chromName, start, end, errorPrint); + safef(urlReference, sizeof(urlReference), "(sample data)%s\n", urlPrefix, hub->url, genome, tdb->track, chromName, start, end, errorPrint); if (allowedBigBedType(tdb->type)) hPrintf("
  • %s: %s%s%s
  • \n", tdb->track, tdb->type, countsMessage, urlReference); else if (startsWithWord("bigWig", tdb->type)) hPrintf("
  • %s: %s%s%s
  • \n", tdb->track, tdb->type, countsMessage, urlReference); else hPrintf("
  • %s: %s%s%s
  • \n", tdb->track, tdb->type, countsMessage, urlReference); } else { if (allowedBigBedType(tdb->type)) hPrintf("
  • %s: %s%s
  • \n", tdb->track, tdb->type, countsMessage); else if (startsWithWord("bigWig", tdb->type)) hPrintf("
  • %s: %s%s
  • \n", tdb->track, tdb->type, countsMessage); else @@ -549,34 +549,32 @@ for (tdbEl = tdb->subtracks; tdbEl; tdbEl = tdbEl->next) { hPrintf("
  • subtrack: %s of parent: %s : type: '%s'
  • \n", tdbEl->track, tdbEl->parent->track, tdbEl->type); hashCountTrack(tdbEl, countTracks); trackSettings(tdbEl, countTracks); } } hPrintf(" \n"); } static void hubCountOneTdb(struct trackHub *hub, char *db, struct trackDb *tdb, char *bigDataIndex, struct hash *countTracks, char *chromName, unsigned chromSize, char *genome) { char *bigDataUrl = trackDbSetting(tdb, "bigDataUrl"); -// char *compositeTrack = trackDbSetting(tdb, "compositeTrack"); boolean compositeContainer = tdbIsComposite(tdb); boolean compositeView = tdbIsCompositeView(tdb); -// char *superTrack = trackDbSetting(tdb, "superTrack"); boolean superChild = tdbIsSuperTrackChild(tdb); boolean depthSearch = cartUsualBoolean(cart, "depthSearch", FALSE); hashCountTrack(tdb, countTracks); long chromCount = 0; long itemCount = 0; struct dyString *errors = newDyString(1024); /* if given a chromSize, it belongs to a UCSC db and this is *not* an * assembly hub, otherwise, look up a chrom and size in the bbi file */ if (! (compositeContainer || compositeView) ) { if (chromSize < 1 || depthSearch) @@ -835,45 +833,52 @@ /* follow the pointers from the trackHub to trackHubGenome and around * in a circle from one to the other to find all hub resources */ { long totalAssemblyCount = 0; struct trackHubGenome *genome = hubTop->genomeList; hPrintf("

    genome sequences (and tracks) present in this track hub

    \n"); if (NULL == genome) { hPrintf("

    odd error, can not find a gnomeList ? at url: '%s'

    \n", hubTop->url); return; } + +// testing /list/tracks?db=ce11 +// testing /list/tracks? hubUrl genome=_araTha1 + hPrintf("