AnnotatedList-class         package:IRanges         R Documentation

_A_n_n_o_t_a_t_e_d _L_i_s_t_s

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

     The class 'AnnotatedList' extends 'TypedList' to contain two
     optional metadata elements: a list with arbitrary annotations, and
     a data frame with local metadata on each element.

_D_e_t_a_i_l_s:

     Data analysis should not occur in a vacuum: every dataset floats
     in a sea of metadata, describing the observed features, as well as
     the experimental design and methodology. Some metadata is local to
     an experiment, such as its design, while other information, such
     as the layout of a microarray chip, transcends individual
     experiments.

     The list structure is fundamental to computationally representing
     datasets. For example, the 'data.frame' is a list of column
     vectors. The 'AnnotatedList' is a list that additionally aims to
     store local metadata and reference global annotation resources.

     This is implemented by adding two optional components on top of
     the underlying 'TypedList':

     _m_e_t_a_d_a_t_a A list, possibly empty, containing arbitrary annotations.
          For example, the name of the genome might be stored in a
          character vector as an element named "genome".

     _e_l_e_m_e_n_t_M_e_t_a_d_a_t_a A data frame of class 'XDataFrame' (or 'NULL')
          with a row for each element and a column for each metadata
          variable. This is for storing metadata local to the
          experiment, such as experimental design, or chromosome-wide
          statistics for datasets of genomic features.


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

     In the following code snippets, 'x' is a 'TypedList' object.


      'metadata(x)', 'metadata(x) <- value': Get or set the list
          holding arbitary R objects as annotations. May be, and often
          is, empty.

      'elementMetadata(x), elementMetadata(x) <- value': Get or set the
          'XDataFrame' holding local metadata on each element. The rows
          are named according to the names of the elements. Optional,
          may be 'NULL'.


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


      'AnnotatedList(elements = list(), metadata = NULL,
          elementMetadata = NULL)': Constructs an instance of an
          'AnnotatedList' containing the elements in the ordinary list
          'elements'. The parameters 'metadata' and 'elementMetadata'
          correspond to the components described above.


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

     Michael Lawrence

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

     'RangesList' and 'XDataFrame' both extend this class.

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

       ## demonstrated on RangesList objects, a subtype of AnnotatedList

       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))
       collection <- RangesList(range1, range2)

       ## access 'metadata' component
       metadata(collection)$genome <- "hg18"
       metadata(collection)

       ## set some element metadata
       elementMetadata(collection) <- XDataFrame(chrom = c("chr1", "chr2"))
       elementMetadata(collection)

