subBString            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:

       subBString(x, start=NA, end=NA, length=NA)
       subviews(x, start=NA, end=NA, width=NA, check.limits=TRUE)
       substr(x, start=NA, stop=NA)
       substring(text, first=NA, last=NA)

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

       x: A 'BString' (or derived) object for 'subBString'. A
          'BStringViews' object for 'subviews'. A character vector, a
          'BStringViews' or a 'BString' object for 'substr' or
          'substring'. 

   start: A numeric vector. 

     end: A numeric vector. 

  length: A numeric vector. 

   width: A numeric vector. 

check.limits: A single logical indicating whether or not an error
          should be raised if the 'BStringViews' object to be returned
          contains "out of limit" views (default is 'TRUE'). With
          'check.limits=FALSE' then "out of limit" views are padded
          with spaces. 

    stop: A numeric vector. 

    text: A character vector, a 'BStringViews' or a 'BString' object. 

   first: A numeric vector. 

    last: A numeric vector. 

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

     'subBString' provides a very efficient way to extract a substring
     from a BString (or derived) object. For example, extracting a
     100Mb substring from Human chromosome 1 (250Mb) with 'subBString'
     is almost instantaneous and has almost no memory footprint. In
     fact, the cost in time and memory of a call to 'subBString'
     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: 'subBString' does NOT copy the sequence data.

     For 'subviews', the start/end values must be given relatively to
     'x' views.

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

     [TODO]

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

     'letter', 'views', BString-class, DNAString-class,
     RNAString-class, AAString-class, BStringViews-class

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

       subBString("AxyxyxBC", 7)
       s <- BString("AxyxyxBC")
       subBString(s, 7)  # same as subBString("AxyxyxBC", 7)
       subBString(s, , 7)
       subBString(s, , 7, 3)
       identical(subBString(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))
       subviews(v, end=width(v), width=1)

       ## 2 equivalent ways of making the views wider
       views(subject(v), start(v)-3, end(v)+3)
       subviews(v, -2, end=width(v)+3, check.limits=FALSE)

