046c975630f6576722e8cbfa843e68f6068d854e hiram Thu Mar 21 15:06:42 2019 -0700 somewhat better for sample data URLs refs #18869 diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c index 76ff73b..e03035b 100644 --- src/hg/hubApi/hubApi.c +++ src/hg/hubApi/hubApi.c @@ -3,31 +3,35 @@ /* +------------------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+------------------+------+-----+---------+-------+ | hubUrl | longblob | NO | PRI | NULL | | | shortLabel | varchar(255) | NO | | NULL | | | longLabel | varchar(255) | NO | | NULL | | | registrationTime | varchar(255) | NO | | NULL | | | dbCount | int(10) unsigned | NO | | NULL | | | dbList | blob | YES | | NULL | | | descriptionUrl | longblob | YES | | NULL | | +------------------+------------------+------+-----+---------+-------+ */ -/* Global Variables */ +/* Global Variables for all modules */ + +int maxItemsOutput = 1000; /* can be set in URL maxItemsOutput=N */ + +/* Global only to this one source file */ static boolean debug = FALSE; /* can be set in URL debug=1 */ 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 *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; @@ -43,40 +47,40 @@ 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"); slAddHead(&supportedTypes, el); el = newSlName("bigNarrowPeak"); slAddHead(&supportedTypes, el); el = newSlName("bigGenePred"); slAddHead(&supportedTypes, el); -el = newSlName("bigPsl"); -slAddHead(&supportedTypes, el); -el = newSlName("bigBarChart"); -slAddHead(&supportedTypes, el); -el = newSlName("bigInteract"); -slAddHead(&supportedTypes, el); -el = newSlName("bigMaf"); -slAddHead(&supportedTypes, el); -el = newSlName("bigChain"); -slAddHead(&supportedTypes, el); +// el = newSlName("bigPsl"); +// slAddHead(&supportedTypes, el); +// el = newSlName("bigBarChart"); +// slAddHead(&supportedTypes, el); +// el = newSlName("bigInteract"); +// slAddHead(&supportedTypes, el); +// el = newSlName("bigMaf"); +// slAddHead(&supportedTypes, el); +// el = newSlName("bigChain"); +// slAddHead(&supportedTypes, el); slNameSort(&supportedTypes); } static boolean isSupportedType(char *type) /* is given type in the supportedTypes list ? */ { boolean ret = FALSE; if (startsWith("wigMaf", type)) /* not wigMaf at this time */ return ret; struct slName *el; for (el = supportedTypes; el; el = el->next) { if (startsWith(el->name, type)) { ret = TRUE; @@ -188,75 +192,93 @@ 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 sampleUrl(char *db, struct trackDb *tdb, char *chrom, long long chromSize) +static void sampleUrl(struct trackHub *hub, char *db, struct trackDb *tdb, char *chrom, long long chromSize) /* print out a sample getData URL */ { 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) + { + if (tdb->parent) + hPrintf("
  • %s : %s subtrack of parent: %s (sample getData)
  • \n", tdb->track, tdb->type, tdb->parent->track, urlPrefix, hub->url, genome, chrom, tdb->track, start, end ); + else + hPrintf("
  • %s : %s (sample getData)
  • \n", tdb->track, tdb->type, urlPrefix, hub->url, genome, chrom, tdb->track, start, end ); + } + else + { if (tdb->parent) hPrintf("
  • %s : %s subtrack of parent: %s (sample getData)
  • \n", tdb->track, tdb->type, tdb->parent->track, urlPrefix, db, chrom, tdb->track, start, end ); else hPrintf("
  • %s : %s (sample getData)
  • \n", tdb->track, tdb->type, urlPrefix, db, chrom, tdb->track, start, end ); } + } +else if (hub) + { + if (tdb->parent) + hPrintf("
  • %s : %s subtrack of parent: %s (sample getData)
  • \n", tdb->track, tdb->type, tdb->parent->track, urlPrefix, hub->url, genome, chrom, tdb->track, start, end ); else - hPrintf("
  • %s : %s not db track
  • \n", tdb->track, tdb->type); + hPrintf("
  • %s : %s (sample getData)
  • \n", tdb->track, tdb->type, urlPrefix, hub->url, genome, chrom, tdb->track, start, end ); + } +else + hPrintf("
  • %s : %s not db hub track ?
  • \n", tdb->track, tdb->type); } -static void showSubTracks(char *db, struct trackDb *tdb, struct hash *countTracks, +static void showSubTracks(struct trackHub *hub, char *db, struct trackDb *tdb, struct hash *countTracks, char *chromName, long long chromSize) /* tdb has subtracks, show only subTracks, no details */ { hPrintf("
  • \n"); } static void trackSettings(struct trackDb *tdb, struct hash *countTracks) /* process the settingsHash for a trackDb, recursive when subtracks */ { hPrintf("