RangesMatching-class         package:IRanges         R Documentation

_M_a_t_c_h_i_n_g_s _b_e_t_w_e_e_n _R_a_n_g_e_s

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

     The 'RangesMatching' class stores a set of matchings between the
     ranges in one 'Ranges' object and the ranges in another.
     Currently, 'RangesMatching' are used to represent the result of an
     'overlap' query, though other matching operations are imaginable.

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

     The 'as.matrix' method coerces a 'RangesMatching' to a two column
     'matrix' with one row for each matching, where the value in the
     first column is the index of a range in the first (query) 'Ranges'
     and the index of the matched subject range is in the second
     column. The 'matchMatrix' function returns the same thing, but use
     of 'as.matrix' is preferred.

     The 'as.table' method counts the number of matchings for each
     query range and outputs the counts as a 'table'.

     To transpose a 'RangesMatching' 'x', so that the subject and query
     are interchanged, call 't(x)'. This allows, for example, counting
     the number of subjects that matched using 'as.table'.

     To get the actual regions of intersection between the overlapping
     ranges, use the 'ranges' accessor.

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

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


      'as.matrix(x)': Coerces 'x' to a two column integer matrix, with
          each row representing a matching between a query index (first
          column) and subject index (second column).

      'as.table(x)': counts the number of matchings for each query
          range in 'x' and outputs the counts as a 'table'.

      't(x)': Interchange the query and subject in 'x', returns a
          transposed 'RangesMatching'.

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


      'matchMatrix(x)': A synonym for 'as.matrix', above.

      'ranges(x, query, subject)': returns a 'Ranges' holding the
          intersection of the ranges in the 'Ranges' objects 'query'
          and 'subject', which should be the same subject and query
          used to generate 'x'. Eventually, we might store the query
          and subject inside 'x', in which case the arguments would be
          redundant.

      'length(x)': get the number of matches

      'nrow(x)': get the number of subjects in the matching

      'ncol(x)': get the number of queries in the matching

      'dim(x)': get a two-element integer vector, essentially
          'c(nrow(x), ncol(x))'.


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

     Michael Lawrence

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

     'overlap', which generates an instance of this class.

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

       query <- IRanges(c(1, 4, 9), c(5, 7, 10))
       subject <- IRanges(c(2, 2, 10), c(2, 3, 12))
       tree <- IntervalTree(subject)
       matchings <- overlap(tree, query)

       as.matrix(matchings)

       as.table(matchings) # hits per query
       as.table(t(matchings)) # hits per subject

