stringDist            package:Biostrings            R Documentation

_S_t_r_i_n_g _D_i_s_t_a_n_c_e/_A_l_i_g_n_m_e_n_t _S_c_o_r_e _M_a_t_r_i_x

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

     Computes the Levenshtein edit distance or pairwise alignment score
     matrix for a set of strings.

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

     stringDist(x, method = "levenshtein", ignoreCase = FALSE, diag = FALSE, upper = FALSE, ...)
     ## S4 method for signature 'XStringSet':
     stringDist(x, method = "levenshtein", ignoreCase = FALSE, diag = FALSE,
                        upper = FALSE, type = "global", quality = PhredQuality(22L),
                        substitutionMatrix = NULL, fuzzyMatrix = NULL, gapOpening = 0,
                        gapExtension = -1)
     ## S4 method for signature 'QualityScaledXStringSet':
     stringDist(x, method = "quality", ignoreCase = FALSE,
                        diag = FALSE, upper = FALSE, type = "global", substitutionMatrix = NULL,
                        fuzzyMatrix = NULL, gapOpening = 0, gapExtension = -1)

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

       x: a character vector or an 'XStringSet' object.

  method: calculation method. One of '"levenshtein"', '"quality"', or
          '"substitutionMatrix"'.

ignoreCase: logical value indicating whether to ignore case during
          scoring.

    diag: logical value indicating whether the diagonal of the matrix
          should be printed by 'print.dist'.

   upper: logical value indicating whether the diagonal of the matrix
          should be printed by 'print.dist'.

    type: type of alignment. One of '"global"', '"local"', and
          '"overlap"', where '"global"' = align whole strings with end
          gap penalties, '"local"' = align string fragments,
          '"overlap"' = align whole strings without end gap penalties.
          This argument is ignored if 'method == "levenshtein"'.

 quality: object of class 'XStringQuality' representing the quality
          scores for 'x' that are used in a quality-based method for
          generating a substitution matrix. This argument is ignored if
          'method != "quality"'.

substitutionMatrix: symmetric substitution matrix for a non-quality
          based alignment. This argument is ignored if 'method !=
          "substitutionMatrix"'.

fuzzyMatrix: fuzzy match matrix for quality-based alignments. It takes
          values between 0 and 1; where 0 is an unambiguous mismatch, 1
          is an unambiguous match, and values in between represent a
          fraction of "matchiness".

gapOpening: penalty for opening a gap in the alignment. This argument
          is ignored if 'method == "levenshtein"'.

gapExtension: penalty for extending a gap in the alignment. This
          argument is ignored if 'method == "levenshtein"'.

     ...: optional arguments to generic function to support additional
          methods.

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

     Uses the underlying pairwiseAlignment code to compute the
     distance/alignment score matrix.

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

     Returns an object of class '"dist"'.

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

     P. Aboyoun

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

     dist, agrep, pairwiseAlignment, substitution.matrices

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

       stringDist(c("lazy", "HaZy", "crAzY"))
       stringDist(c("lazy", "HaZy", "crAzY"), ignoreCase = TRUE)

       data(phiX174Phage)
       plot(hclust(stringDist(phiX174Phage), method = "single"))

       data(srPhiX174)
       stringDist(srPhiX174[1:4])
       stringDist(srPhiX174[1:4], method = "quality",
                  quality = SolexaQuality(quPhiX174[1:4]),
                  gapOpening = -10, gapExtension = -4)

