060ada2535fca719656219c1214a3e1c16490693 tdreszer Wed Nov 9 16:06:41 2011 -0800 Moved as code in hgTables down to lib and access it from hgc and hgTrackUi. This is to remove 'extraFields' support as per Jim's request in redmine 5883 and 5582 diff --git src/hg/hgTables/bigWig.c src/hg/hgTables/bigWig.c index ad80fdc..e98bfcf 100644 --- src/hg/hgTables/bigWig.c +++ src/hg/hgTables/bigWig.c @@ -9,77 +9,74 @@ #include "cheapcgi.h" #include "cart.h" #include "web.h" #include "bed.h" #include "hdb.h" #include "trackDb.h" #include "customTrack.h" #include "wiggle.h" #include "hmmstats.h" #include "correlate.h" #include "bbiFile.h" #include "bigWig.h" #include "hubConnect.h" #include "hgTables.h" -static char const rcsid[] = "$Id: bigWig.c,v 1.7 2010/06/03 18:53:59 kent Exp $"; - boolean isBigWigTable(char *table) /* Return TRUE if table corresponds to a bigWig file. */ { -if (isHubTrack(table)) - { struct trackDb *tdb = hashFindVal(fullTrackAndSubtrackHash, table); - return startsWithWord("bigWig", tdb->type); - } +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; * otherwise return NULL. Do a freeMem on returned string when done. */ { char *fileName = NULL; if (isCustomTrack(table)) { struct customTrack *ct = ctLookupName(table); if (ct != NULL) fileName = cloneString(trackDbSetting(ct->tdb, "bigDataUrl")); } else if (isHubTrack(table)) { struct trackDb *tdb = hashFindVal(fullTrackAndSubtrackHash, table); assert(tdb != NULL); fileName = cloneString(trackDbSetting(tdb, "bigDataUrl")); assert(fileName != NULL); } return fileName; } 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. */ { -char *fileName = bigFileNameFromCtOrHub(table, conn); -if (fileName == NULL) +struct trackDb *tdb = NULL; +if (isCustomTrack(table)) // Why isn't custom track in fullTrackAndSubtrackHash? { - char query[256]; - safef(query, sizeof(query), "select fileName from %s", table); - fileName = sqlQuickString(conn, query); + struct customTrack *ct = ctLookupName(table); + tdb = ct->tdb; } -return fileName; +else + tdb = hashMustFindVal(fullTrackAndSubtrackHash, 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) /* Get list of bbiIntervals (more-or-less bedGraph things from bigWig) out of bigWig file * and if necessary apply filter and intersection. Return list which is allocated in lm. */ { char *chrom = region->chrom; int chromSize = hChromSize(database, chrom); struct bbiInterval *iv, *ivList = bigWigIntervalQuery(bwf, chrom, region->start, region->end, lm); /* Run filter if necessary */ if (filterCmp != wigNoOp_e) {