subXString            package:Biostrings            R Documentation

_F_a_s_t _s_u_b_s_t_r_i_n_g _e_x_t_r_a_c_t_i_o_n

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

     Functions for fast substring extraction.

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

       subXString(x, start=NA, end=NA, length=NA)
       substr(x, start=NA, stop=NA)
       substring(text, first=NA, last=NA)

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

       x: An XString object for 'subXString'. A character vector, an
          XStringViews or an XString object for 'substr' or
          'substring'. 

   start: A numeric vector. 

     end: A numeric vector. 

  length: A numeric vector. 

    stop: A numeric vector. 

    text: A character vector, an XStringViews or an XString object. 

   first: A numeric vector. 

    last: A numeric vector. 

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

     'subXString' provides a very efficient way to extract a substring
     from an XString object. For example, extracting a 100Mb substring
     from Human chromosome 1 (250Mb) with 'subXString' is almost
     instantaneous and has almost no memory footprint. In fact, the
     cost in time and memory of a call to 'subXString' doesn't depend
     on the length of the original object or on the length of the
     extracted object. The "trick" behind this "feature" is very
     simple: 'subXString' does NOT copy the sequence data.

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

     [TODO]

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

     H. Pages

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

     'letter', 'views', XString-class, XStringViews-class

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

       subXString("AxyxyxBC", 7)
       s <- BString("AxyxyxBC")
       subXString(s, 7)  # same as subXString("AxyxyxBC", 7)
       subXString(s, , 7)
       subXString(s, , 7, 3)
       identical(subXString(s), s) # TRUE

       v <- views(s, c(6, 4,-1, NA), c(7, 6, 1, 1))
       ## 2 equivalent ways of keeping the last letter of each view
       views(subject(v), end(v), end(v))

       ## 2 equivalent ways of making the views wider
       views(subject(v), start(v)-3, end(v)+3)

