Hi everyone,
I'm wondering if the following is the expected behaviour for setdiff
:
gr1 <- GRanges('a', IRanges(c(1, 3), c(2, 9))) gr2 <- GRanges('a', IRanges(20, 30)) gr3 <- GRanges('a', IRanges(c(1, 4), c(2, 9))) diff1 <- setdiff(gr1, gr2) diff2 <- setdiff(gr3, gr2)
My expectation was to get gr1
back, given that the intersection between gr1
and gr2
is empty. But the resulting object diff1
is reduce(gr1)
. Just to be clear, I expected to get something analogous to diff2
.
Many thanks, benilton
Many thanks! Understanding that ranges are seen as sets of integers was key!