Non overlapping granges (or opposite of subsetByOverlaps)
3
0
Entering edit mode
vinod.acear ▴ 50
@vinodacear-8884
Last seen 4.2 years ago
India

I have two granges (gr1 and gr2)  in which all ranges of gr2 overlaps with ranges of gr1. How can i find granges of gr1 that are not overlaping with gr2?  i.e.  black color output given on the link http://bedops.readthedocs.org/en/latest/_images/reference_setops_bedops_difference_ab@2x.png

granges genomicranges iranges subsetByOverlaps • 9.7k views
ADD COMMENT
2
Entering edit mode
@steve-lianoglou-2771
Last seen 20 months ago
United States

 

I believe "setdiff" should do what you want. Browse through this intro vignette for more info: http://www.bioconductor.org/packages/release/bioc/vignettes/GenomicRanges/inst/doc/GenomicRangesIntroduction.pdf

 

ADD COMMENT
0
Entering edit mode

Thanks Steve ,  it worked

ADD REPLY
0
Entering edit mode

Thanks Steve ,  it worked

ADD REPLY
0
Entering edit mode

Thanks Steve ,  it worked

ADD REPLY
0
Entering edit mode

Thanks Steve ,  it worked

ADD REPLY
2
Entering edit mode
@doublehelix31-18729
Last seen 5.9 years ago
Germany, Freiburg, University of Freibu…

    subsetByOverlaps(gr1, gr2, invert = TRUE)

does it.

ADD COMMENT
0
Entering edit mode

subsetByOverlaps(gr1, gr2, invert = TRUE), is the better option if you want to keep your metadata columns!

ADD REPLY
1
Entering edit mode
@herve-pages-1542
Last seen 3 hours ago
Seattle, WA, United States

Hi,

FWIW subsetByOverlaps(gr1, gr2) is equivalent to gr1[gr1 %over% gr2] so you would get the opposite with gr1[!(gr1 %over% gr2)]. This is not what you seem to want though: you seem to want setdiff() (thanks Steve). Just wanted to clarify the difference.

H.

ADD COMMENT

Login before adding your answer.

Traffic: 669 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6