[Bioc-sig-seq] stringDist; hamming

Ludo Pagie lpagie at xs4all.nl
Mon Jun 21 16:15:48 CEST 2010


Hi all,

I want to calculate hamming distance between equal length
strings, ie, number of substution differences between two
strings.
>From the helppage of 'stringDist' I think the following should
return the same results but they don't. What am I doing/seeing
wrong?

words <- c("lazy", "hazy", "dasy")
sapply(words, neditStartingAt,'lazy',starting.at=1)
lazy hazy dasy
   0    1    2
stringDist(words,method='hamming')
     1 2
     2 1
     3 1 1

I want the result as returned by neditStartingAt, clearly.

> sessionInfo()
R version 2.12.0 Under development (unstable) (2010-06-17
r52313)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8       LC_NAME=C
[9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets
methods   base

other attached packages:
[1] Biostrings_2.17.7 IRanges_1.7.7

loaded via a namespace (and not attached):
[1] Biobase_2.9.0 tools_2.12.0



More information about the Bioc-sig-sequencing mailing list