x <- "GACGGATTATG"
y <- "GATCGGAATAG"
## Levenshtein distance
d <- stringDist(x, y)
## optimal global alignment
traceBack(d)
## Optimal global alignment score
d <- stringSim(x, y)
## optimal global alignment
traceBack(d)
## Optimal local alignment score
d <- stringSim(x, y, global = FALSE)
## optimal local alignment
traceBack(d, global = FALSE)
Run the code above in your browser using DataLab