RangesList-class           package:IRanges           R Documentation

_L_i_s_t _o_f _R_a_n_g_e_s

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

     An extension of 'AnnotatedList' that holds only 'Ranges' objects.
     Useful for storing ranges over a set of spaces (e.g. chromosomes),
     each of which requires a separate 'Ranges' object. As an
     'AnnotatedList', 'RangesList' may be annotated with its universe
     identifier (e.g. a genome) in which all of its spaces exist.

_A_c_c_e_s_s_o_r_s:

     In the code snippets below, 'x' is a 'RangesList' object. 

     All of these accessors collapse over the spaces:

      'start(x)': Get the starts of the ranges.

      'end(x)': Get the ends of the ranges.

      'width(x)': Get the widths of the ranges.

      'space(x)': Gets the spaces of the ranges as a character vector.
          This is equivalent to 'names(x)', except each name is
          repeated according to the length of its element.


     These accessors are for the 'universe' identifier:

      'universe(x)': gets the name of the universe as a single string,
          if one has been specified, 'NULL' otherwise.

      'universe(x) <- value': sets the name of the universe to 'value',
          a single string or 'NULL'.


_C_o_n_s_t_r_u_c_t_o_r:


      'RangesList(..., universe = NULL)': Each 'Ranges' in '...'
          becomes an element in the new 'RangesList', in the same
          order. This is analogous to the 'list' constructor, except
          every argument in '...' must be derived from 'Ranges'. The
          universe is specified by the 'universe' parameter, which
          should be a single string or NULL, to leave unspecified. 


_S_u_b_s_e_t_t_i_n_g:

     In the code snippets below, 'x' is a 'RangesList' object.


      'x[i]': Subset 'x' by index 'i', with the same semantics as a
          basic 'TypedList', except 'i' may itself be a 'RangesList',
          in which case only the ranges in 'x' that overlap with those
          in 'i' are kept. See the 'overlap' method for more details.


_C_o_e_r_c_i_o_n:

     In the code snippets below, 'x' and 'from' are a 'RangesList'
     object.


      'as.data.frame(x, row.names = NULL, optional = FALSE)': Coerces
          'x' to a 'data.frame'. Essentially the same as calling
          'as.data.frame(unlist(x))'.

      'as(from, "RangedData")': Coerces 'from' to a 'RangedData' with
          zero columns and the same ranges as in 'from'.

      'as(from, "IRangesList")': Coerces 'from', to an 'IRangesList',
          requiring that all 'Ranges' elements are coerced to internal
          'IRanges' elements. This is a convenient way to ensure that
          all 'Ranges' have been imported into R (and that there is no
          unwanted overhead when accessing them).


_A_r_i_t_h_m_e_t_i_c _O_p_e_r_a_t_i_o_n_s:

     Any arithmetic operation, such as 'x + y', 'x * y', etc, where 'x'
     is a 'RangesList', is performed identically on each element.
     Currently, 'Ranges' supports only the '*' operator, which zooms
     the ranges by a numeric factor.

_A_u_t_h_o_r(_s):

     Michael Lawrence

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

       range1 <- IRanges(start=c(1,2,3), end=c(5,2,8))
       range2 <- IRanges(start=c(15,45,20,1), end=c(15,100,80,5))
       named <- RangesList(one = range1, two = range2)
       length(named) # 2
       start(named) # same as start(c(range1, range2))
       names(named) # "one" and "two"
       named[[1]] # range1
       unnamed <- RangesList(range1, range2)
       names(unnamed) # NULL

       # subset by RangesList
       range1 <- IRanges(start=c(1,2,3), end=c(5,2,8))
       range2 <- IRanges(start=c(1,15,20,45), end=c(5,15,100,80))
       collection <- RangesList(one = range1, range2)
       collection[RangesList()] # empty elements
       collection[RangesList(IRanges(4, 6), IRanges(50, 70))]
       collection[RangesList(IRanges(50, 70), one=IRanges(4, 6))]

       # same as list(range1, range2)
       as.list(RangesList(range1, range2))

       # coerce to data.frame
       as.data.frame(named)

       # set the universe
       universe(named) <- "hg18"
       universe(named)
       RangesList(range1, range2, universe = "hg18")

       ## zoom in 2X
       collection * 2

