coverage               package:IRanges               R Documentation

_C_o_v_e_r_a_g_e _a_c_r_o_s_s _a _s_e_t _o_f _r_a_n_g_e_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

       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. 

_V_a_l_u_e:

     An Rle 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.

_S_e_e _A_l_s_o:

     Rle-class, IRanges-class, MaskCollection-class

_E_x_a_m_p_l_e_s:

       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)

