Question: feel confused when identifying overlapping regions by intersect method
0
gravatar for fjia304
6 months ago by
fjia3040
fjia3040 wrote:

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 ?

ADD COMMENTlink modified 6 months ago by Michael Lawrence11k • written 6 months ago by fjia3040
Answer: feel confused when identifying overlapping regions by intersect method
0
gravatar for Michael Lawrence
6 months ago by
United States
Michael Lawrence11k wrote:

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 COMMENTlink written 6 months ago by Michael Lawrence11k

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

ADD REPLYlink written 6 months ago by fjia3040
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 233 users visited in the last hour