Dear Bioconductor,
I think it is possible that recent modifications to IRanges and GenomicRanges broke our bumphunter package.
bumphunter does a very simple test that amounts to this:
R> x <- data.frame(start = c(2, 4, 7, 10, 13, 17, 19, 22, 24), end = c(3, 5, 9, 12, 16, 18, 20, 23, 26), chr = 'chr1') R> subject <- data.frame(start = c(1, 4, 7, 11, 14, 21, 25), end = c(3, 6, 9, 12, 15, 22, 27), chr = 'chr1') grx <- makeGRangesFromDataFrame(x) grs <- makeGRangesFromDataFrame(subject) IRanges::nearest(ranges(grx), ranges(grs))
This is the result with GenomicRanges 1.29.12 and IRanges 2.11.12 - looks right - [4,5] is in [4,6]
> IRanges::nearest(ranges(grx), ranges(grs)) [1] 1 2 3 4 5 5 6 6 7
This is the result with GenomicRanges 1.29.13 and IRanges 2.11.15 - looks wrong - [4,5] is in [2,3]
> IRanges::nearest(ranges(grx), ranges(grs)) [1] 1 1 2 3 4 5 6 6 7
More output for clarification:
> ranges(grx)
IRanges object with 9 ranges and 0 metadata columns:
          start       end     width
      <integer> <integer> <integer>
  [1]         2         3         2
  [2]         4         5         2
  [3]         7         9         3
  [4]        10        12         3
  [5]        13        16         4
  [6]        17        18         2
  [7]        19        20         2
  [8]        22        23         2
  [9]        24        26         3
> ranges(grs)
IRanges object with 7 ranges and 0 metadata columns:
          start       end     width
      <integer> <integer> <integer>
  [1]         1         3         3
  [2]         4         6         3
  [3]         7         9         3
  [4]        11        12         2
  [5]        14        15         2
  [6]        21        22         2
  [7]        25        27         3
Can you help us, please? Our package is flunking build on Bioconductor 3.5 and 3.6.
thanks,
- Sam

Confused. How can the distance between [4,5] and [2,3] be zero? The documentation for nearest-methods {IRanges} says:
x and y overlap => distance(x, y) == 0
or
x and y overlap or are adjacent <=> distance(x, y) == 0
[4,5] and [2,3] do not overlap and they are not adjacent.
What is the definition of distance( [x,y], [u,v] )?
thanks,
- Sam
Aha, now I get it. These aren't points on the real line; they're segments.
|--1--|--2--|--3--|--4--|--5--|--6--|
So |--2--|--3--| is adjacent to |--4--|--5--|
Exactly. This is why the width of a range with a single point is 1, not 0. I call it the "Lego-block model". All the ranges operations should behave according to that model.
H.