coverage {IRanges}R Documentation

Coverage across a set of ranges

Description

Counts the number of times a position is represented in a set of ranges.

Usage

  coverage(x, start=NA, end=NA, ...)
  ## S4 method for signature 'IRanges':
  coverage(x, start=NA, end=NA, weight=1L)

Arguments

x An IRanges or MaskCollection object.
start A single integer specifying the position in x where to start the extraction of the coverage.
end A single integer specifying the position in x where to end the extraction of the coverage.
weight An integer vector specifying how much each element in x counts.
... Further arguments to be passed to or from other methods.

Value

An XRleInteger object representing the coverage of x in the interval specified by the start and end arguments. An integer value called the "coverage" can be associated to each position in x, indicating how many times this position is covered by the ranges stored in x. Note that the positions in the returned XInteger object are to be interpreted as relative to the interval specified by the start and end arguments.

See Also

XRleInteger-class, IRanges-class, MaskCollection-class

Examples

  x <- IRanges(start=c(-2L, 6L, 9L, -4L, 1L, 0L, -6L, 10L),
               width=c( 5L, 0L, 6L,  1L, 4L, 3L,  2L,  3L))
  coverage(x, start=-6, end=20)  # 'start' and 'end' must be specified for
                                 # an IRanges object.
  coverage(shift(x, 2), start=-6, end=20)
  coverage(restrict(x, 1, 10), start=-6, end=20)
  coverage(reduce(x), start=-6, end=20)
  coverage(gaps(x, start=-6, end=20), start=-6, end=20)

  mask1 <- Mask(mask.width=29, start=c(11, 25, 28), width=c(5, 2, 2))
  mask2 <- Mask(mask.width=29, start=c(3, 10, 27), width=c(5, 8, 1))
  mask3 <- Mask(mask.width=29, start=c(7, 12), width=c(2, 4))
  mymasks <- append(append(mask1, mask2), mask3)
  coverage(mymasks)

[Package IRanges version 1.0.16 Index]