a865b66cfeec6dea62ccdcd5a22c69e9a27335b6 hiram Wed Apr 3 12:01:04 2019 -0700 using new browser styles and allow genePred to print refs #18869 diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c index ac9a8c0..2c9c371 100644 --- src/hg/hubApi/hubApi.c +++ src/hg/hubApi/hubApi.c @@ -1,18 +1,19 @@ /* hubApi - access mechanism to hub data resources. */ #include "dataApi.h" #include "botDelay.h" +#include "jsHelper.h" /* +------------------+------------------+------+-----+---------+-------+ | 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 | | +------------------+------------------+------+-----+---------+-------+ */ @@ -24,58 +25,61 @@ int botDelay = 0; boolean debug = FALSE; /* can be set in URL debug=1, to turn off: debug=0 */ #define delayFraction 0.03 /* 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 */ 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"); slAddHead(&supportedTypes, el); el = newSlName("bigNarrowPeak"); slAddHead(&supportedTypes, el); el = newSlName("bigGenePred"); slAddHead(&supportedTypes, el); +el = newSlName("genePred"); +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 ? */ @@ -656,72 +660,78 @@ { hPrintf("
  • \n"); } else if (tdb->subtracks) { showSubTracks(NULL, db, tdb, countTracks, chromName, chromSize, NULL); } return; } /* static void countOneTdb(char *db, struct trackDb *tdb, * struct hash *countTracks, char *chromName, * unsigned chromSize) */ -static unsigned largestChrom(char *db, char **nameReturn) +static unsigned largestChrom(char *db, char **nameReturn, int *chromCount) /* return the length and get the chrom name for the largest chrom * from chromInfo table. For use is sample getData URLs */ { char query[1024]; struct sqlConnection *conn = hAllocConn(db); sqlSafef(query, sizeof(query), "select chrom,size from chromInfo order by size desc limit 1"); struct sqlResult *sr = sqlGetResult(conn, query); char **row = sqlNextRow(sr); unsigned length = 0; if (row) { *nameReturn = cloneString(row[0]); length = sqlLongLong(row[1]); } sqlFreeResult(&sr); +if (chromCount) + { + sqlSafef(query, sizeof(query), "select count(*) from chromInfo"); + *chromCount = sqlQuickNum(conn, query); + } hFreeConn(&conn); return length; } static void hubTrackList(struct trackHub *hub, struct trackDb *topTrackDb, struct trackHubGenome *genome) /* process the track list in a hub to show all tracks */ { hPrintf("