align-utils            package:Biostrings            R Documentation

_U_t_i_l_i_t_y _f_u_n_c_t_i_o_n_s _r_e_l_a_t_e_d _t_o _s_e_q_u_e_n_c_e _a_l_i_g_n_m_e_n_t

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

     A variety of different functions used to deal with sequence
     alignments.

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

       nedit(x) # also nmatch and nmismatch

       mismatchTable(x, shiftLeft=0L, shiftRight=0L, ...)
       mismatchSummary(x, ...)
       ## S4 method for signature 'AlignedXStringSet0':
       coverage(x, start=NA, end=NA, shift=0L, width=NULL, weight=1L)
       ## S4 method for signature 'PairwiseAlignedFixedSubject':
       coverage(x, start=NA, end=NA, shift=0L, width=NULL, weight=1L)
       compareStrings(pattern, subject)
       ## S4 method for signature 'PairwiseAlignedFixedSubject':
       consensusMatrix(x, baseOnly=FALSE, freq=FALSE,
                       gapCode="-", endgapCode="-")

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

       x: A 'character' vector or matrix, 'XStringSet', 'XStringViews',
          'PairwiseAlignedXStringSet', or 'list' of FASTA records
          containing the equal-length strings. 

shiftLeft, shiftRight: Non-positive and non-negative integers
          respectively that specify how many preceding and succeeding
          characters to and from the mismatch position to include in
          the mismatch substrings. 

     ...: Further arguments to be passed to or from other methods. 

start, end, shift, width: See '?coverage'. 

  weight: An integer vector specifying how much each element in 'x'
          counts. 

pattern, subject: The strings to compare. Can be of type 'character',
          'XString', 'XStringSet', 'AlignedXStringSet', or, in the case
          of 'pattern', 'PairwiseAlignedXStringSet'. If 'pattern' is a
          'PairwiseAlignedXStringSet' object, then 'subject' must be
          missing. 

baseOnly: 'TRUE' or 'FALSE'. If 'TRUE', the returned vector only
          contains frequencies for the letters in the "base" alphabet
          i.e. "A", "C", "G", "T" if 'x' is a "DNA input", and "A",
          "C", "G", "U" if 'x' is "RNA input". When 'x' is a BString
          object (or an XStringViews object with a BString subject, or
          a BStringSet object), then the 'baseOnly' argument is
          ignored. 

    freq: If 'TRUE', then letter frequencies (per position) are
          reported, otherwise counts. 

gapCode, endgapCode: The codes in the appropriate 'alphabet' to use for
          the internal and end gaps. 

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

     'mismatchTable':  a data.frame containing the positions and
     substrings of the mismatches for the 'AlignedXStringSet' or
     'PairwiseAlignedXStringSet' object.

     'mismatchSummary':  a list of data.frame objects containing counts
     and frequencies of the mismatches for the 'AlignedXStringSet' or
     'PairwiseAlignedFixedSubject' object.

     'compareStrings' combines two equal-length strings that are
     assumed to be aligned into a single character string containing
     that replaces mismatches with '"?"', insertions with '"+"', and
     deletions with '"-"'.

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

     'pairwiseAlignment', 'consensusMatrix', XString-class,
     XStringSet-class, XStringViews-class, AlignedXStringSet-class,
     PairwiseAlignedXStringSet-class, match-utils

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

       ## Compare two globally aligned strings
       string1 <- "ACTTCACCAGCTCCCTGGCGGTAAGTTGATC---AAAGG---AAACGCAAAGTTTTCAAG"
       string2 <- "GTTTCACTACTTCCTTTCGGGTAAGTAAATATATAAATATATAAAAATATAATTTTCATC"
       compareStrings(string1, string2)

       ## Create a consensus matrix
       nw1 <-
         pairwiseAlignment(AAStringSet(c("HLDNLKGTF", "HVDDMPNAL")), AAString("SMDDTEKMSMKL"),
           substitutionMatrix = "BLOSUM50", gapOpening = -3, gapExtension = -1)
       consensusMatrix(nw1)

       ## Examine the consensus between the bacteriophage phi X174 genomes
       data(phiX174Phage)
       phageConsmat <- consensusMatrix(phiX174Phage, baseOnly = TRUE)
       phageDiffs <- which(apply(phageConsmat, 2, max) < length(phiX174Phage))
       phageDiffs
       phageConsmat[,phageDiffs]

