about INCLUSIVE INTERSECTION of GRANGES
2
0
Entering edit mode
Bogdan ▴ 670
@bogdan-2367
Last seen 14 months ago
Palo Alto, CA, USA

Dear all,

would appreciate your help with a simple question :

I am working with a set of GRanges : eg : (chr1: 100 - 200) and  (chr1: 200 - 300)

and 

I would like to get the OVERLAP/ INTERSECTION only the GRanges within a special interval :

eg : (chr1 : 0 - 250), in an INCLUSIVE WAY,

namely only the interval (chr1: 100 - 200), that is completely included in the region (chr1 : 0 - 250) ..

is there any function in GRanges I could quickly use in this regard ? thank you and happy weekend !

-- bogdan

 

Grange • 1.4k views
ADD COMMENT
4
Entering edit mode
@herve-pages-1542
Last seen 6 days ago
Seattle, WA, United States

Hi Bogdan,

gr <- GRanges("chr1", IRanges(c(100, 200), c(200, 300)))
my_region <- GRanges("chr1", IRanges(0, 250))
gr %within% my_region
## [1]  TRUE FALSE

Note that %within% is just a shortcut for:

overlapsAny(gr, my_region, type="within")
## [1]  TRUE FALSE

See ?findOverlaps for more information.

H.

ADD COMMENT
0
Entering edit mode
Bogdan ▴ 670
@bogdan-2367
Last seen 14 months ago
Palo Alto, CA, USA

HI Herve, thank you very much !

ADD COMMENT

Login before adding your answer.

Traffic: 405 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