17d809124b98f15c9f2c77694526b6ab95faed4e
angie
  Thu Feb 7 09:59:52 2013 -0800
For #8886 (Denisova tracks) Pauline found that some data tables appearedempty in the Table Browser.  Turns out that insertion items (length=0) were
dropped by bigbedIntervalQuery because it required a positive rangeIntersection.
Fix: instead, compare start and end coords of search range and item.
Note: In order to catch an insertion item, the search range has to encompass
the item (>=1 base to left and >=1 base to right).

diff --git src/lib/bigBed.c src/lib/bigBed.c
index 0448e9e..ca265c2 100644
--- src/lib/bigBed.c
+++ src/lib/bigBed.c
@@ -82,31 +82,31 @@
 	    {
 	    /* Read next record into local variables. */
 	    bits32 chr = memReadBits32(&blockPt, isSwapped);	// Read and discard chromId
 	    bits32 s = memReadBits32(&blockPt, isSwapped);
 	    bits32 e = memReadBits32(&blockPt, isSwapped);
 	    int c;
 	    dyStringClear(dy);
 	    while ((c = *blockPt++) >= 0)
 		{
 		if (c == 0)
 		    break;
 		dyStringAppendC(dy, c);
 		}
 
 	    /* If we're actually in range then copy it into a new  element and add to list. */
-	    if (chr == chromId && rangeIntersection(s, e, start, end) > 0)
+	    if (chr == chromId && s < end && e > start)
 		{
 		++itemCount;
 		if (maxItems > 0 && itemCount > maxItems)
 		    break;
 
 		lmAllocVar(lm, el);
 		el->start = s;
 		el->end = e;
 		if (dy->stringSize > 0)
 		    el->rest = lmCloneString(lm, dy->string);
 		slAddHead(&list, el);
 		}
 	    }
 	if (maxItems > 0 && itemCount > maxItems)
 	    break;