[BioC] IRanges: Trying to cut overlapping intervals into pieces

Elizabeth Purdom epurdom at stat.berkeley.edu
Sat Jan 24 07:24:57 CET 2009


Hi,

I am trying to take overlapping intervals and return a set of intervals 
that are not overlapping but cover all of the region (and mantain the 
intervals that don't overlap). In particular, I don't want to merge 
intervals that overlap together (i.e. the reduce function in IRanges)-- 
I want to cut them up into distinct regions. For example, if I have 
intervals:
[1,6], [4,8], [7,10]
I want to get back the set of adjacent intervals:
[1,3],[4,6],[7,8],[9,10]
The options I find that look like they perhaps do this (intersect or 
setdiff?) seem to be related to the 'normal' ranges class; but this 
class requires a gap between intervals -- no adjacent intervals -- which 
is not what I want. Is there a nice way to do this with IRanges (or a 
not so nice one, but fast)?

Similarly, is there a 'reduce' version that doesn't merge adjacent 
intervals but only truly overlapping ones? There are a lot of annotation 
examples where you wouldn't not want to merge adjacent intervals (e.g. UTRs)

Thanks for any assistance!
Elizabeth Purdom
Division of Biostatistics
UC, Berkeley



More information about the Bioconductor mailing list