disjoin               package:IRanges               R Documentation

Making Ranges disjoint

Description:

     Functions for making 'Ranges' disjoint, where no ranges overlap
     another.

Usage:

       disjoin(x, ...)
       disjointBins(x, ...)

Arguments:

       x: The 'Ranges' instance, possibly overlapping intervals.

     ...: Additional arguments for methods

Details:

     The 'disjoin' method returns a disjoint 'Ranges', by finding the
     union of the end points in 'x'. In other words, the result
     consists of a range for every interval, of maximal length, over
     which the set of overlapping ranges in 'x' is the same and at
     least of size 1.

     'disjointBins' segregates 'x' into a set of bins so that the
     ranges in each bin are disjoint. Lower-indexed bins are filled
     first. The method returns an integer vector indicating the bin
     index for each range.

Author(s):

     M. Lawrence

See Also:

     'reduce' for making normal ranges, a subset of disjoint ranges,
     where there must be a gap of length >= 1 between each range.

Examples:

       ir <- IRanges(c(1, 1, 4, 10), c(6, 3, 8, 10))
       disjoin(ir) # IRanges(c(1, 4, 7, 10), c(3, 6, 8, 10))

       disjointBins(IRanges(1, 5)) # 1L
       disjointBins(IRanges(c(3, 1, 10), c(5, 12, 13))) # c(2L, 1L, 2L)

