04edcd636175005f068147a9f69f6dca4c794fcd braney Fri Jun 20 11:41:02 2014 -0700 fix a bug that Angie found in bigBed track item search diff --git src/hg/lib/bigBedFind.c src/hg/lib/bigBedFind.c index 0069faa..d0c49c0 100644 --- src/hg/lib/bigBedFind.c +++ src/hg/lib/bigBedFind.c @@ -1,22 +1,23 @@ #include "common.h" #include "bPlusTree.h" #include "bbiFile.h" #include "bigBed.h" #include "hgFind.h" #include "trix.h" #include "trackHub.h" +#include "hubConnect.h" #include "hdb.h" static struct hgPos *bigBedIntervalListToHgPositions(struct bbiFile *bbi, char *term, struct bigBedInterval *intervalList, char *description) /* Given an open bigBed file, and an interval list, return a pointer to a list of hgPos structures. */ { struct hgPos *posList = NULL; char chromName[bbi->chromBpt->keySize+1]; int lastChromId = -1; struct bigBedInterval *interval; for (interval = intervalList; interval != NULL; interval = interval->next) { struct hgPos *hgPos; AllocVar(hgPos); slAddHead(&posList, hgPos); @@ -88,36 +89,40 @@ } return posList; } boolean findBigBedPosInTdbList(char *db, struct trackDb *tdbList, char *term, struct hgPositions *hgp) /* Given a list of trackDb entries, check each of them for a searchIndex */ { struct trackDb *tdb; boolean found = FALSE; for(tdb=tdbList; tdb; tdb = tdb->next) { char *indexField = trackDbSetting(tdb, "searchIndex"); + char *fileName = NULL; - struct sqlConnection *conn = NULL; - if (!trackHubDatabase(db)) - conn = hAllocConnTrack(db, tdb); - char *fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table); + if (isHubTrack(tdb->table)) + fileName = trackDbSetting(tdb, "bigDataUrl"); + else + { + struct sqlConnection *conn = hAllocConnTrack(db, tdb); + fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table); hFreeConn(&conn); + } if (!(indexField && fileName)) continue; struct slName *indexList = slNameListFromString(indexField, ','); struct hgPos *posList1 = NULL, *posList2 = NULL; char *trixFile = trackDbSetting(tdb, "searchTrix"); // if there is a trix file, use it to search for the term if (trixFile != NULL) posList1 = doTrixSearch(trixFile, indexList, fileName, term); // now search for the raw id's struct slName *oneIndex=indexList; for (; oneIndex; oneIndex = oneIndex->next) {