e8bc6082872e9d16854282dd7affdc703b736023 hiram Tue Apr 9 13:43:48 2019 -0700 add sample getData for superTrack child refs #18869 diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c index dde4f4a..5756eb3 100644 --- src/hg/hubApi/hubApi.c +++ src/hg/hubApi/hubApi.c @@ -164,34 +164,32 @@ char *stripType = cloneString(tdb->type); if (startsWith("chain ", tdb->type)) stripType = cloneString("chain"); else if (startsWith("netAlign ", tdb->type)) stripType = cloneString("netAlign"); else if (startsWith("genePred ", tdb->type)) stripType = cloneString("genePred"); else if (startsWith("bigWig ", tdb->type)) stripType = cloneString("bigWig"); else if (startsWith("wigMaf ", tdb->type)) stripType = cloneString("wigMaf"); else if (startsWith("wig ", tdb->type)) stripType = cloneString("wig"); else stripType = cloneString(tdb->type); -// char *compositeTrack = trackDbLocalSetting(tdb, "compositeTrack"); boolean compositeContainer = tdbIsComposite(tdb); boolean compositeView = tdbIsCompositeView(tdb); -// char *superTrack = trackDbLocalSetting(tdb, "superTrack"); boolean superChild = tdbIsSuperTrackChild(tdb); if (compositeContainer) hashIncInt(countTracks, "composite container"); else if (compositeView) hashIncInt(countTracks, "composite view"); else if (superChild) { hashIncInt(countTracks, "superTrack child"); hashIncInt(countTracks, stripType); hashIncInt(countTracks, "track count"); } else if (isEmpty(tdb->type)) hashIncInt(countTracks, "no type specified"); else { @@ -200,56 +198,59 @@ } freeMem(stripType); } static void sampleUrl(struct trackHub *hub, char *db, struct trackDb *tdb, char *chrom, unsigned chromSize, char *errorString) /* print out a sample getData URL */ { char errorPrint[2048]; errorPrint[0] = 0; if (isNotEmpty(errorString)) { safef(errorPrint, sizeof(errorPrint), " ERROR: %s", errorString); } +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); 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); - if (tdb->parent) + 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); 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); } @@ -583,31 +584,36 @@ } } if (depthSearch && bigDataUrl) { if (isSupportedType(tdb->type)) hubSampleUrl(hub, tdb, chromCount, itemCount, chromName, chromSize, genome, errors->string); } else { if (compositeContainer) hPrintf("
  • %s: %s : composite track container has %d subtracks
  • \n", tdb->track, tdb->type, slCount(tdb->subtracks)); else if (compositeView) hPrintf("
  • %s: %s : composite view of parent: %s
  • \n", tdb->track, tdb->type, tdb->parent->track); else if (superChild) - hPrintf("
  • %s: %s : superTrack child of parent: %s (sample getData)
  • \n", tdb->track, tdb->type, tdb->parent->track); + { + if (isSupportedType(tdb->type)) + hubSampleUrl(hub, tdb, chromCount, itemCount, chromName, chromSize, genome, errors->string); + else + hPrintf("
  • %s: %s : superTrack child of parent: %s
  • \n", tdb->track, tdb->type, tdb->parent->track); + } else if (! depthSearch && bigDataUrl) { if (isSupportedType(tdb->type)) { hubSampleUrl(hub, tdb, chromCount, itemCount, chromName, chromSize, genome, errors->string); } } else { if (isSupportedType(tdb->type)) { hubSampleUrl(hub, tdb, chromCount, itemCount, chromName, chromSize, genome, errors->string); } else hPrintf("
  • %s: %s (what is this)
  • \n", tdb->track, tdb->type); @@ -624,44 +630,47 @@ hubSubTracks(hub, db, tdb, countTracks, chromCount, itemCount, chromName, chromSize, genome, errors->string); } return; } /* static void hubCountOneTdb(char *db, struct trackDb *tdb, * char *bigDataIndex, struct hash *countTracks, * char *chromName, unsigned chromSize) */ static void countOneTdb(char *db, struct trackDb *tdb, struct hash *countTracks, char *chromName, unsigned chromSize, char *errorString) /* for this tdb in this db, count it up and provide a sample */ { 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); if (compositeContainer) hPrintf("
  • %s: %s : composite track container has %d subtracks
  • \n", tdb->track, tdb->type, slCount(tdb->subtracks)); else if (compositeView) hPrintf("
  • %s: %s : composite view of parent: %s
  • \n", tdb->track, tdb->type, tdb->parent->track); else if (superChild) + { + if (isSupportedType(tdb->type)) + sampleUrl(NULL, db, tdb, chromName, chromSize, errorString); + else hPrintf("
  • %s: %s : superTrack child of parent: %s
  • \n", tdb->track, tdb->type, tdb->parent->track); + } else if (! depthSearch && bigDataUrl) hPrintf("
  • %s: %s : %s
  • \n", tdb->track, tdb->type, bigDataUrl); else { if (isSupportedType(tdb->type)) sampleUrl(NULL, db, tdb, chromName, chromSize, errorString); else hPrintf("
  • %s: %s
  • \n", tdb->track, tdb->type); } if (allTrackSettings) { hPrintf("
  • \n"); @@ -720,47 +729,47 @@ if (isNotEmpty(genome->name)) defaultGenome = genome->name; char *chromName = NULL; unsigned chromSize = 0; int chromCount = 0; if (isEmpty(genome->twoBitPath)) chromSize = largestChrom(defaultGenome, &chromName, &chromCount); hubCountOneTdb(hub, defaultGenome, tdb, bigDataIndex, countTracks, chromName, chromSize, defaultGenome); if (timeOutReached()) break; } /* for ( tdb = topTrackDb; tdb; tdb = tdb->next ) */ hPrintf("
  • %d different track types
  • \n",countTracks->elCount - 1); /* add this single genome count to the overall multi-genome counts */ if (countTracks->elCount) { - hPrintf("
    1. \n"); + hPrintf("
      • \n"); struct hashEl *hel, *helList = hashElListHash(countTracks); slSort(&helList, hashElCmpIntValDesc); for (hel = helList; hel; hel = hel->next) { if (sameOk("track count", hel->name)) continue; int prevCount = ptToInt(hashFindVal(trackCounter, hel->name)); if (differentStringNullOk("track count", hel->name)) totalTracks += ptToInt(hel->val); hashReplace(trackCounter, hel->name, intToPt(prevCount + ptToInt(hel->val))); if (isSupportedType(hel->name)) hPrintf("
      • %d - %s - supported
      • \n", ptToInt(hel->val), hel->name); else hPrintf("
      • %d - %s
      • \n", ptToInt(hel->val), hel->name); } - hPrintf("
  • \n"); + hPrintf(" \n"); } } else hPrintf("
  • no trackTopDb ?
  • \n"); hPrintf(" \n"); } /* static struct trackDb *hubTrackList() */ static void hubAssemblySettings(struct trackHub *hub, struct trackHubGenome *genome) /* display all the assembly 'settingsHash' */ { struct trackDb *tdb = obtainTdb(genome, NULL); hPrintf("
  • \n"); } hPrintf("\n"); } /* static void genomeList (hubTop) */ static char *urlFromShortLabel(char *shortLabel) /* this is not a fair way to get the URL since shortLabel's are not * necessarily unique. This is temporary. TBD: need to always use URL * and then get the shortLabel */ { char hubUrl[1024]; char query[1024]; struct sqlConnection *conn = hConnectCentral(); // Build a query to select the hubUrl for the given shortLabel sqlSafef(query, sizeof(query), "select hubUrl from %s where shortLabel='%s'", @@ -970,43 +979,43 @@ hPrintf("

    Tracks in UCSC genome: '%s', chrom count: %s, longest chrom: %s : %s

    \n", db, countString, chromName, sizeString); struct trackDb *tdbList = obtainTdb(NULL, db); struct trackDb *tdb; hPrintf("\n"); } hPrintf("\n"); hPrintf("

    \n"); } // static void tracksForUcscDb(char * db) static void initUrlPrefix() /* set up urlPrefix for self referenes */ { char *httpHost = getenv("HTTP_HOST"); if (isEmpty(httpHost)) urlPrefix = ""; else { if (! startsWith("hgwdev-api", httpHost))