a1dcdda03cad5b931d17066789091a64f8dceca6 max Tue Nov 22 16:05:21 2016 -0800 adding bigDataIndex support to the table browser, refs #18420 diff --git src/hg/hgTables/bigWig.c src/hg/hgTables/bigWig.c index 9a70eb8..69281631 100644 --- src/hg/hgTables/bigWig.c +++ src/hg/hgTables/bigWig.c @@ -22,50 +22,64 @@ #include "bbiFile.h" #include "bigWig.h" #include "hubConnect.h" #include "hgTables.h" boolean isBigWigTable(char *table) /* Return TRUE if table corresponds to a bigWig file. */ { struct trackDb *tdb = hashFindVal(fullTableToTdbHash, table); if (tdb) return tdbIsBigWig(tdb); else return trackIsType(database, table, curTrack, "bigWig", ctLookupName); } -char *bigFileNameFromCtOrHub(char *table, struct sqlConnection *conn) -/* If table is a custom track or hub track, return the bigDataUrl setting; +static char *settingFromCtOrHub(char *table, struct sqlConnection *conn, char *settingName, boolean mustBeInHub) +/* If table is a custom track or hub track, return a setting; * otherwise return NULL. Do a freeMem on returned string when done. */ { -char *fileName = NULL; +char *settingVal = NULL; if (isCustomTrack(table)) { struct customTrack *ct = ctLookupName(table); if (ct != NULL) - fileName = cloneString(trackDbSetting(ct->tdb, "bigDataUrl")); + settingVal = cloneString(trackDbSetting(ct->tdb, settingName)); } else { struct trackDb *tdb = hashFindVal(fullTableToTdbHash, table); assert(tdb != NULL); - fileName = cloneString(trackDbSetting(tdb, "bigDataUrl")); - if (isHubTrack(table)) // if it's a native track, we'll assume it has a table with the name - assert(fileName != NULL); + settingVal = cloneString(trackDbSetting(tdb, settingName)); + if (mustBeInHub && isHubTrack(table)) // if it's a native track, we'll assume it has a table with the name + assert(settingVal != NULL); + } +return settingVal; +} + +char *bigFileNameFromCtOrHub(char *table, struct sqlConnection *conn) +/* If table is a custom track or hub track, return the bigDataUrl setting; + * otherwise return NULL. Do a freeMem on returned string when done. */ +{ +return settingFromCtOrHub(table, conn, "bigDataUrl", TRUE); } -return fileName; + +char *bigDataIndexFromCtOrHub(char *table, struct sqlConnection *conn) +/* If table is a custom track or hub track, return the bigDataIndex setting; + * otherwise return NULL. Do a freeMem on returned string when done. */ +{ +return settingFromCtOrHub(table, conn, "bigDataIndex", FALSE); } char *bigWigFileName(char *table, struct sqlConnection *conn) /* Return file name associated with bigWig. This handles differences whether it's * a custom or built-in track. Do a freeMem on returned string when done. */ { if (isCustomTrack(table) || isHubTrack(table)) return bigFileNameFromCtOrHub(table, conn); struct trackDb *tdb = hashMustFindVal(fullTableToTdbHash, table); return tdbBigFileName(conn, tdb); } struct bbiInterval *intersectedFilteredBbiIntervalsOnRegion(struct sqlConnection *conn, struct bbiFile *bwf, struct region *region, enum wigCompare filterCmp, double filterLl, double filterUl, struct lm *lm)