6c19a52350eb826034160d10f751358437bedd93
angie
  Wed Aug 2 12:04:54 2017 -0700
Root names of split table sets, e.g. intronEst for chr*_intronEst, were falling into the !hTableExists check in maybeGetHti and were mistakenly given hti with root name as table name.  Instead of assuming that any 'table' that does not exist as a table is bigWig, check for bigWig similarly to the way we check for other bigFile types and create a more accurate hti.  refs #19930

diff --git src/hg/hgTables/bigWig.c src/hg/hgTables/bigWig.c
index 910ef75..0b412cf 100644
--- src/hg/hgTables/bigWig.c
+++ src/hg/hgTables/bigWig.c
@@ -69,30 +69,43 @@
  * 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 hTableInfo *bigWigToHti(char *table)
+/* Get fields of bigWig into hti structure. */
+{
+struct hTableInfo *hti;
+AllocVar(hti);
+hti->rootName = cloneString(table);
+hti->isPos= TRUE;
+safecpy(hti->chromField, sizeof(hti->chromField), "chrom");
+safecpy(hti->startField, sizeof(hti->startField), "chromStart");
+safecpy(hti->endField, sizeof(hti->endField), "chromEnd");
+return hti;
+}
+
 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)
     {
     struct bbiInterval *next, *newList = NULL;
     for (iv = ivList; iv != NULL; iv = next)