Calculate relative position of one range with respect to another
0
0
Entering edit mode
4 weeks ago
Andrew • 0

If I have two GRanges objects is there is an easy way to get the relative position of one range with respect to the other in a strand specific manner?

For example, if the first range is chr1:100-110:- and the second range is chr1:101-105:- then relative to the “start” of the first, the start of the second is 5 (110 - 105). However, if they were both on the positive strand, then the relative start of the second with respect to the first would be 1 (101 - 100).

Given that this can become a complicated calculation to keep track of (e.g. features on opposite strands; different chromosomes, which would be an error; features with missing strand info; or relative to other positions, such as end or center; etc.), I was hoping there’s something in GenomicRanges or IRanges that can do this, but I haven’t been able to find anything.

Bioconductor IRanges GenomicRanges R • 135 views