| stringSim | R Documentation | 
The function can be used to compute similarity scores between strings.
stringSim(x, y, global = TRUE, match = 1, mismatch = -1, gap = -1, minSim = 0)
| x | character vector, first string | 
| y | character vector, second string | 
| global | logical; global or local alignment | 
| match | numeric, score for a match between symbols | 
| mismatch | numeric, score for a mismatch between symbols | 
| gap | numeric, penalty for inserting a gap | 
| minSim | numeric, used as required minimum score in case of local alignments | 
The function computes optimal alignment scores for global (Needleman-Wunsch) and local (Smith-Waterman) alignments with constant gap penalties.
Scoring and trace-back matrix are computed and saved in form of attributes 
"ScoringMatrix" and "TraceBackMatrix". 
The characters in the trace-back matrix reflect insertion of a gap in 
string y (d: deletion), match (m), mismatch (mm), 
and insertion of a gap in string x (i). In addition stop
indicates that the minimum similarity score has been reached.
stringSim returns an object of S3 class "stringSim" inherited 
from class "dist"; cf. dist.
The function is mainly for teaching purposes.
For distances between strings and string alignments see also Bioconductor package Biostrings.
Matthias Kohl Matthias.Kohl@stamats.de
R. Merkl and S. Waack (2009). Bioinformatik Interaktiv. Wiley.
dist, stringDist 
x <- "GACGGATTATG" y <- "GATCGGAATAG" ## optimal global alignment score d <- stringSim(x, y) d attr(d, "ScoringMatrix") attr(d, "TraceBackMatrix") ## optimal local alignment score d <- stringSim(x, y, global = FALSE) d attr(d, "ScoringMatrix") attr(d, "TraceBackMatrix")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.