How to find particular types of overlap with GenomicRanges
1
0
Entering edit mode
khauser130d ▴ 50
@khauser130d-8880
Last seen 9.0 years ago
United Kingdom

I'm looking to create 3 Hits objects with GenomicRanges. I've depicted these below.

findOverlaps(..., type="start")is not adequate for returning hit1 since it misses the overlaps where the starts are not exactly aligned. Although maxgap would help with this, I'm unsure how to use it in this instance since the value of maxgap will depend on the width of each interval. Likewise for findOverlaps(..., type="end") and findOverlaps(..., type="equal") for hit2 and hit3, respectively. No within overlaps should be captured by any of the Hits objects.

Is there a simple way to do this with GenomicRanges?

http://imgur.com/6wjPOz6

Image

r genomicranges iranges • 1.7k views
ADD COMMENT
0
Entering edit mode

Hi, sorry but your question is not really clear to me. From what I understand: hit1 overlap over the start position but not the end position; hit2 overlap over the end but not the start; hit3 overlap both start and end. Is it correct?

I suspect you may use the resize function to get GRanges objects with the start and end positions (e.g. my.start = resize(myreads, width=1, fix='start') and so on), and use them for the intersections.

ADD REPLY
4
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States

The constraints are not perfectly clear to me, but maybe you want something like:

hit1 <- resize(blue, 1L) %over% red
hit2 <- resize(blue, 1L, "end") %over% red
hit3 <- hit1 & hit2

That will yield logical vectors that filter the blue ranges. You can invert those to select the red ones, or use findOverlaps to get the full hits.

ADD COMMENT

Login before adding your answer.

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