# defaults compare intersection of internal ranges:
dna <- DNAStringSet(c("ANGCT-","-ACCT-"))
d <- DistanceMatrix(dna)
# d[1,2] is 1 base in 4 = 0.25
# compare the entire sequence ranges:
dna <- DNAStringSet(c("ANGCT-","-ACCT-"))
d <- DistanceMatrix(dna, includeTerminalGaps=TRUE,
penalizeGapGapMatches=TRUE)
# d[1,2] is now 3 bases in 6 = 0.50
# compare union of internal ranges:
dna <- DNAStringSet(c("ANGCT-","-ACCT-"))
d <- DistanceMatrix(dna, includeTerminalGaps=TRUE,
penalizeGapGapMatches=FALSE)
# d[1,2] is now 2 bases in 5 = 0.40
# gap ("-") and unknown (".") characters are interchangeable:
dna <- DNAStringSet(c("ANGCT.",".ACCT-"))
d <- DistanceMatrix(dna, includeTerminalGaps=TRUE,
penalizeGapGapMatches=FALSE)
# d[1,2] is still 2 bases in 5 = 0.40
Run the code above in your browser using DataLab