dc68ca87c184d7a6d4112e293073bddb34a9e913
hiram
Tue Mar 19 10:36:54 2019 -0700
full reporting of all track names in html display even when not in detail mode refs #18869
diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c
index 81847be..f9a2b0c 100644
--- src/hg/hubApi/hubApi.c
+++ src/hg/hubApi/hubApi.c
@@ -152,52 +152,74 @@
hashIncInt(countTracks, "superTrack child");
hashIncInt(countTracks, stripType);
hashIncInt(countTracks, "track count");
}
else if (isEmpty(tdb->type))
hashIncInt(countTracks, "no type specified");
else
{
hashIncInt(countTracks, stripType);
hashIncInt(countTracks, "track count");
}
freeMem(stripType);
// showCounts(countTracks);
}
+static void showSubTracks(struct trackDb *tdb, struct hash *countTracks)
+/* tdb has subtracks, show only subTracks, no details */
+{
+hPrintf("
\n");
+if (tdb->subtracks)
+ {
+ struct trackDb *tdbEl = NULL;
+ for (tdbEl = tdb->subtracks; tdbEl; tdbEl = tdbEl->next)
+ {
+ if (tdbIsCompositeView(tdbEl))
+ hPrintf("- %s : %s : composite view of parent: %s
\n", tdbEl->track, tdbEl->type, tdbEl->parent->track);
+ else
+ hPrintf("- %s : %s : subtrack of parent: %s
\n", tdbEl->track, tdbEl->type, tdbEl->parent->track);
+ hashCountTrack(tdbEl, countTracks);
+ if (tdbEl->subtracks)
+ showSubTracks(tdbEl, countTracks);
+ }
+ }
+hPrintf("
\n");
+}
+
static void trackSettings(struct trackDb *tdb, struct hash *countTracks)
/* process the settingsHash for a trackDb, recursive when subtracks */
{
hPrintf(" \n");
// if (tdb->children) haven't yet seen a track with children ?
// hPrintf(" - %s: has children
\n", tdb->track);
// else
// hPrintf(" - %s: NO children
\n", tdb->track);
struct hashEl *hel;
struct hashCookie hc = hashFirst(tdb->settingsHash);
while ((hel = hashNext(&hc)) != NULL)
{
if (sameWord("track", hel->name))
continue; // already output in header
if (isEmpty((char *)hel->val))
hPrintf(" - %s : <empty>
\n", hel->name);
else
hPrintf(" - %s : '%s'
\n", hel->name, (char *)hel->val);
}
if (tdb->subtracks)
{
struct trackDb *tdbEl = NULL;
+ if (debug)
hPrintf(" - has %d subtrack(s)
\n", slCount(tdb->subtracks));
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 int bbiBriefMeasure(char *type, char *bigDataUrl, char *bigDataIndex, long *chromCount, long *itemCount, struct dyString *errors)
/* check a bigDataUrl to find chrom count and item count */
{
int retVal = 0;
@@ -315,78 +337,84 @@
hPrintf(" %s : %s : ERROR: %s\n", tdb->track, tdb->type, errors->string);
}
else
{
if (startsWithWord("bigBed", tdb->type))
hPrintf(" %s : %s : %ld chroms : %ld item count\n", tdb->track, tdb->type, chromCount, itemCount);
else if (startsWithWord("bigWig", tdb->type))
hPrintf(" %s : %s : %ld chroms : %ld bases covered\n", tdb->track, tdb->type, chromCount, itemCount);
else
hPrintf(" %s : %s : %ld chroms : %ld count\n", tdb->track, tdb->type, chromCount, itemCount);
}
}
else
{
if (compositeContainer)
- hPrintf(" %s : %s : composite track container\n", tdb->track, tdb->type);
+ 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\n", tdb->track, tdb->type, tdb->parent->track);
- else if (! depthSearch)
+ else if (! depthSearch && bigDataUrl)
hPrintf(" %s : %s : %s\n", tdb->track, tdb->type, bigDataUrl);
else
hPrintf(" %s : %s\n", tdb->track, tdb->type);
}
if (allTrackSettings)
{
hPrintf(" \n");
trackSettings(tdb, countTracks); /* show all settings */
hPrintf("
\n");
}
+else if (tdb->subtracks)
+ {
+ showSubTracks(tdb, countTracks);
+ }
return;
} /* static void countOneTdb(struct trackDb *tdb,
* char *bigDataIndex, struct hash *countTracks)
*/
static void hubTrackList(struct trackDb *topTrackDb, struct trackHubGenome *genome)
/* process the track list in a hub to show all tracks */
{
hPrintf(" \n");
if (topTrackDb)
{
struct hash *countTracks = hashNew(0);
struct trackDb *tdb = NULL;
for ( tdb = topTrackDb; tdb; tdb = tdb->next )
{
char *bigDataIndex = NULL;
char *relIdxUrl = trackDbSetting(topTrackDb, "bigDataIndex");
if (relIdxUrl != NULL)
bigDataIndex = trackHubRelativeUrl(genome->trackDbFile, relIdxUrl);
countOneTdb(tdb, bigDataIndex, countTracks);
if (timeOutReached())
break;
} /* for ( tdb = topTrackDb; tdb; tdb = tdb->next ) */
- hPrintf(" - %d different track types
\n", countTracks->elCount);
+ hPrintf(" - %d different track types
\n",countTracks->elCount - 1);
/* add this single genome count to the overall multi-genome counts */
if (countTracks->elCount)
{
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)));
hPrintf(" - %d - %s
\n", ptToInt(hel->val), hel->name);
}
hPrintf("
\n");
}
}
else
hPrintf(" - no trackTopDb
\n");
hPrintf("
\n");
} /* static struct trackDb *hubTrackList() */
@@ -581,38 +609,41 @@
static void tracksForUcscDb(char *db)
/* scan the specified database for all tracks */
{
struct hash *countTracks = hashNew(0);
hPrintf("Tracks in UCSC genome: '%s'
\n", db);
struct trackDb *tdbList = obtainTdb(NULL, db);
struct trackDb *tdb;
hPrintf("
\n");
for (tdb = tdbList; tdb != NULL; tdb = tdb->next )
{
countOneTdb(tdb, NULL, countTracks);
if (timeOutReached())
break;
}
int trackCount = ptToInt(hashFindVal(countTracks, "track count"));
-hPrintf(" - %d total tracks counted, %d different track types
\n", trackCount, countTracks->elCount);
+/* elCount - 1 since the 'track count' element isn't a track */
+hPrintf(" - %d total tracks counted, %d different track types
\n", trackCount, countTracks->elCount - 1);
if (countTracks->elCount)
{
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;
hPrintf(" - %d - %s
\n", ptToInt(hel->val), hel->name);
}
hPrintf("
\n");
}
hPrintf("
\n");
hPrintf("\n");
} // static void tracksForUcscDb(char * db)
static void introductionText()
/* output explanation text */
{
char *scriptUri = getenv("SCRIPT_URI");
hPrintf("JSON data API interface to U.C. Santa Cruz genome browser data
\n");
hPrintf("Data access URL: %s
\n", scriptUri);
@@ -719,47 +750,44 @@
initGenbankTableNames(database);
char *docRoot = cfgOptionDefault("browser.documentRoot", DOCUMENT_ROOT);
int timeout = cartUsualInt(cart, "udcTimeout", 300);
if (udcCacheTimeout() < timeout)
udcSetCacheTimeout(timeout);
knetUdcInstall();
char *pathInfo = getenv("PATH_INFO");
/* nothing on incoming path, then display the WEB page instead */
if (sameOk("/",pathInfo))
pathInfo = NULL;
boolean commandError = FALSE;
+/*expect no more than MAX_PATH_INFO number of words*/
char *words[MAX_PATH_INFO];
if (isNotEmpty(pathInfo))
{
setupFunctionHash();
- /*expect no more than MAX_PATH_INFO number of words*/
struct hashEl *hel = parsePathInfo(pathInfo, words);
/* verify valid API command */
if (hel) /* have valid command */
{
hPrintDisable();
puts("Content-Type:application/json");
puts("\n");
- /* skip the first leading slash to simplify chopByChar parsing */
-// pathInfo += 1;
-// apiFunctionSwitch(hel, words);
void (*apiFunction)(char **) = hel->val;
(*apiFunction)(words);
return;
}
else
commandError = TRUE;
}
puts("Content-Type:text/html");
puts("\n");
(void) hubPublicLoadAll();
struct dbDb *dbList = ucscDbDb();
char **ucscDbList = NULL;