**4.2k**wrote:

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

**9.6k**• written 12 months ago by Benilton Carvalho •

**4.2k**