feel confused when identifying overlapping regions by intersect method
1
0
Entering edit mode
fjia304 • 0
@fjia304-20072
Last seen 5.2 years ago

gr1 <- GRanges(Rle(c("chr1", "chr2", "chr1")), IRanges (c(1,3,5), width =5)) gr2 <- GRanges(Rle(c("chr2", "chr1", "chr2")), IRanges(c(2,3,4), width=4)) intersect(gr1,gr2)

I wish to find the overlapping regions. Below are the results

GRanges object with 2 ranges and 0 metadata columns: seqnames ranges strand <rle> <iranges> <rle> [1] chr1 3-6 * [2] chr2 3-7 *


seqinfo: 2 sequences from an unspecified genome; no seqlengths

Why the overlapping region in chr1 is 3-6 rather than 3-7 ?

GenomicRanges overlaps intersect • 887 views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States

It might help to print out the input objects. The gr1 object has chr1:1-5 and chr1:5-9 (so its span is chr1:1-9), while gr2 has chr1:3-6. Note that the end is start + width - 1L, since the end is inclusive.

ADD COMMENT
0
Entering edit mode

Thanks Michael. Now I understand the rules. Appreciated so much.

ADD REPLY

Login before adding your answer.

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