e2d7638b2848fe00bbf9b66bca395ec68a9ee9e6 braney Thu Oct 15 16:22:06 2015 -0700 first cut at bigMaf support #15935 diff --git src/hg/hgTracks/bigBedTrack.c src/hg/hgTracks/bigBedTrack.c index 625dfb8..7f0c810 100644 --- src/hg/hgTracks/bigBedTrack.c +++ src/hg/hgTracks/bigBedTrack.c @@ -42,40 +42,47 @@ if (!trackHubDatabase(database)) conn = hAllocConnTrack(database, track->tdb); fileName = bbiNameFromSettingOrTable(track->tdb, conn, track->table); hFreeConn(&conn); } #ifdef USE_GBIB_PWD #include "gbib.c" #endif bbi = track->bbiFile = bigBedFileOpen(fileName); } return bbi; } -struct bigBedInterval *bigBedSelectRange(struct track *track, - char *chrom, int start, int end, struct lm *lm) +struct bigBedInterval *bigBedSelectRangeExtra(struct track *track, + char *chrom, int start, int end, struct lm *lm, char *variableName) /* Return list of intervals in range. */ { struct bigBedInterval *result = NULL; /* protect against temporary network error */ struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { - struct bbiFile *bbi = fetchBbiForTrack(track); + struct bbiFile *bbi; + if (variableName == NULL) + bbi = fetchBbiForTrack(track); + else + { + char *fileName = trackDbSetting(track->tdb, variableName); + bbi = bigBedFileOpen(fileName); + } int maxItems = min(BIGBEDMAXIMUMITEMS, maximumTrackItems(track)); // do not allow it to exceed BIGBEDMAXIMUMITEMS for bigBed result = bigBedIntervalQuery(bbi, chrom, start, end, maxItems + 1, lm); if (slCount(result) > maxItems) { track->limitedVis = tvDense; track->limitedVisSet = TRUE; result = NULL; AllocArray(track->summary, insideWidth); if (bigBedSummaryArrayExtended(bbi, chrom, start, end, insideWidth, track->summary)) { char *denseCoverage = trackDbSettingClosestToHome(track->tdb, "denseCoverage"); if (denseCoverage != NULL) { double endVal = atof(denseCoverage); if (endVal <= 0) @@ -92,30 +99,37 @@ track->bbiFile = NULL; } errCatchEnd(errCatch); if (errCatch->gotError) { track->networkErrMsg = cloneString(errCatch->message->string); track->drawItems = bigDrawWarning; track->totalHeight = bigWarnTotalHeight; result = NULL; } errCatchFree(&errCatch); return result; } +struct bigBedInterval *bigBedSelectRange(struct track *track, + char *chrom, int start, int end, struct lm *lm) +/* Return list of intervals in range. */ +{ +return bigBedSelectRangeExtra(track, chrom, start, end, lm, NULL); +} + int bbExtraFieldIndex(struct trackDb *tdb, char* fieldName) /* return the index of a given extra field from the bbInterval * 0 is the name-field of bigBed and is used as an error code * as this is the default anyways */ { if (fieldName==NULL) return 0; // copied from hgc.c // get .as file for track struct sqlConnection *conn = NULL ; if (!trackHubDatabase(database)) conn = hAllocConnTrack(database, tdb); struct asObject *as = asForTdb(conn, tdb); hFreeConn(&conn); if (as == NULL)