292360924f7bf02e0dca2795fc11faee8c7ec85e angie Thu Feb 7 10:06:10 2013 -0800 Passing an item's coords as the range to bigBedIntervalQuery worksfor retrieving the item -- except when the item is an insertion (length=0). In that case, the search range must be expanded to 2 bases, one base to the left of an item and one base to the right, so starts and ends will overlap. diff --git src/hg/hgc/bigBedClick.c src/hg/hgc/bigBedClick.c index 2449cda..7e6dbae 100644 --- src/hg/hgc/bigBedClick.c +++ src/hg/hgc/bigBedClick.c @@ -7,31 +7,38 @@ #include "hCommon.h" #include "hgColors.h" #include "bigBed.h" #include "hui.h" static void bigBedClick(char *fileName, struct trackDb *tdb, char *item, int start, int end, int bedSize) /* Handle click in generic bigBed track. */ { boolean showUrl = FALSE; char *chrom = cartString(cart, "c"); /* Open BigWig file and get interval list. */ struct bbiFile *bbi = bigBedFileOpen(fileName); struct lm *lm = lmInit(0); -struct bigBedInterval *bbList = bigBedIntervalQuery(bbi, chrom, start, end, 0, lm); +int ivStart = start, ivEnd = end; +if (start == end) + { + // item is an insertion; expand the search range from 0 bases to 2 so we catch it: + ivStart = max(0, start-1); + ivEnd++; + } +struct bigBedInterval *bbList = bigBedIntervalQuery(bbi, chrom, ivStart, ivEnd, 0, lm); /* Get bedSize if it's not already defined. */ if (bedSize == 0) { bedSize = bbi->definedFieldCount; showUrl = TRUE; } char *scoreFilter = cartOrTdbString(cart, tdb, "scoreFilter", NULL); int minScore = 0; if (scoreFilter) minScore = atoi(scoreFilter); /* Find particular item in list - matching start, and item if possible. */