ec3a6524ca5074c26e5b0addc2310071259cc93b hiram Sun Apr 28 09:42:45 2019 -0700 eliminating the db= argument everywhere, only need genome= refs #18869 diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c index 96a4533..b258dca 100644 --- src/hg/hubApi/hubApi.c +++ src/hg/hubApi/hubApi.c @@ -233,31 +233,31 @@ if (db) { if (hub) { char urlReference[2048]; safef(urlReference, sizeof(urlReference), " <a href='%s/getData/track?hubUrl=%s;genome=%s;track=%s;maxItemsOutput=5%s' target=_blank>(sample data)%s</a>\n", urlPrefix, hub->url, genome, tdb->track, extraFlags, errorPrint); if (tdb->parent) hPrintf("<li><b>%s</b>: %s subtrack of parent: %s%s</li>\n", tdb->track, tdb->type, tdb->parent->track, urlReference); else hPrintf("<li><b>%s</b>: %s%s</li>\n", tdb->track, tdb->type, urlReference); } else { char urlReference[2048]; - safef(urlReference, sizeof(urlReference), " <a href='%s/getData/track?db=%s;track=%s;maxItemsOutput=5%s' target=_blank>(sample data)%s</a>\n", urlPrefix, db, tdb->track, extraFlags, errorPrint); + safef(urlReference, sizeof(urlReference), " <a href='%s/getData/track?genome=%s;track=%s;maxItemsOutput=5%s' target=_blank>(sample data)%s</a>\n", urlPrefix, db, tdb->track, extraFlags, errorPrint); if (superChild) hPrintf("<li><b>%s</b>: %s superTrack child of parent: %s%s</li>\n", tdb->track, tdb->type, tdb->parent->track, urlReference); else if (tdb->parent) hPrintf("<li><b>%s</b>: %s subtrack of parent: %s%s</li>\n", tdb->track, tdb->type, tdb->parent->track, urlReference); else hPrintf("<li><b>%s</b>: %s%s</li>\n", tdb->track, tdb->type, urlReference ); } } else if (hub) { char urlReference[2048]; safef(urlReference, sizeof(urlReference), " <a href='%s/getData/track?hubUrl=%s;genome=%s;track=%s;maxItemsOutput=5%s' target=_blank>(sample data)%s</a>\n", urlPrefix, hub->url, genome, tdb->track, extraFlags, errorPrint); if (tdb->parent) @@ -827,42 +827,38 @@ { if (isNotEmpty(val)) hPrintf("<li><b>%s</b>: '%s'</li>\n", tag, val); else hPrintf("<li><b>%s</b>: <empty></li>\n", tag); } static void genomeList(struct trackHub *hubTop) /* 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("<h4>genome sequences (and tracks) present in this track hub</h4>\n"); +hPrintf("<h4>genome sequences (and tracks) present in this track hub (<a href='%s/list/hubGenomes?hubUrl=%s' target=_blank>JSON example list hub genomes)</a></h4>\n", urlPrefix, hubTop->url); if (NULL == genome) { hPrintf("<h4>odd error, can not find a gnomeList ? at url: '%s'</h4>\n", hubTop->url); return; } - -// testing /list/tracks?db=ce11 -// testing /list/tracks? hubUrl genome=_araTha1 - hPrintf("<ul>\n"); long lastTime = clock1000(); for ( ; genome; genome = genome->next ) { ++totalAssemblyCount; char urlReference[2048]; if (isNotEmpty(genome->twoBitPath)) { hPrintf("<li><b>Assembly genome</b> '%s' <b>twoBitPath</b>: '%s'</li>\n", genome->name, genome->twoBitPath); char *chromName = NULL; struct chromInfo *ci = trackHubAllChromInfo(genome->name); unsigned chromSize = largestChromInfo(ci, &chromName); char sizeString[64]; sprintLongWithCommas(sizeString, chromSize); hPrintf("<li><b>Sequence count</b> %d, <b>largest</b>: %s at %s bases</li>\n", slCount(ci), chromName, sizeString); @@ -981,31 +977,31 @@ static void tracksForUcscDb(char *db) /* scan the specified database for all tracks */ { struct hash *countTracks = hashNew(0); char *chromName = NULL; int chromCount = 0; unsigned chromSize = largestChrom(db, &chromName, &chromCount); char countString[64]; sprintLongWithCommas(countString, chromCount); char sizeString[64]; sprintLongWithCommas(sizeString, chromSize); hPrintf("<h4>Tracks in UCSC genome: '%s', chrom count: %s, longest chrom: %s : %s</h4>\n", db, countString, chromName, sizeString); char urlReference[2048]; -safef(urlReference, sizeof(urlReference), " <a href='%s/list/tracks?db=%s' target=_blank>JSON output: list tracks</a>", urlPrefix, db); +safef(urlReference, sizeof(urlReference), " <a href='%s/list/tracks?genome=%s' target=_blank>JSON output: list tracks</a>", urlPrefix, db); hPrintf("<h4>%s</h4>\n", urlReference); struct trackDb *tdbList = obtainTdb(NULL, db); struct trackDb *tdb; hPrintf("<ul>\n"); for (tdb = tdbList; tdb != NULL; tdb = tdb->next ) { countOneTdb(db, tdb, countTracks, chromName, chromSize, NULL); if (timeOutReached()) break; } int trackCount = ptToInt(hashFindVal(countTracks, "track count")); /* elCount - 1 since the 'track count' element isn't a track */ hPrintf(" <li>%d total tracks counted, %d different track types</li>\n", trackCount, countTracks->elCount - 1); if (countTracks->elCount) @@ -1222,38 +1218,39 @@ hPrintf("</td></tr></table>\n"); /* how does debug carry forward ? */ // if (debug) // cgiMakeHiddenVar("debug", "1"); } static void apiRequest(char *pathInfo) { hPrintDisable(); /*expect no more than MAX_PATH_INFO number of words*/ char *words[MAX_PATH_INFO]; /* can immediately verify valid parameters right here right now */ char *start = cgiOptionalString("start"); char *end = cgiOptionalString("end"); -char *db = cgiOptionalString("db"); +char *db = cgiOptionalString("genome"); +char *hubUrl = cgiOptionalString("hubUrl"); struct dyString *errorMsg = newDyString(128); -if (isNotEmpty(db)) +if (isEmpty(hubUrl) && isNotEmpty(db)) { struct sqlConnection *conn = hAllocConnMaybe(db); if (NULL == conn) - dyStringPrintf(errorMsg, "can not find database db='%s' for endpoint '%s'", db, pathInfo); + dyStringPrintf(errorMsg, "can not find genome genome='%s' for endpoint '%s'", db, pathInfo); else hFreeConn(&conn); } if (isNotEmpty(start) || isNotEmpty(end)) { long long llStart = -1; long long llEnd = -1; struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { if (isNotEmpty(start)) llStart = sqlLongLong(start); if (isNotEmpty(end)) llEnd = sqlLongLong(end); }