/fingerprint/man/distance.Rd

http://github.com/rajarshi/cdkr · Unknown · 132 lines · 119 code · 13 blank · 0 comment · 0 complexity · e9f884e1dbef6b317f39dccce522aa8c MD5 · raw file

  1. \name{distance}
  2. \alias{distance}
  3. \title{
  4. Calculates the Similarity or Dissimilarity Between Two Fingerprints
  5. }
  6. \description{
  7. A number of distance metrics can be calculated for binary
  8. fingerprints. Some of these are actually similarity metrics and
  9. thus represent the reverse of a distance metric.
  10. The following are distance (dissimilarity) metrics
  11. \itemize{
  12. \item Hamming
  13. \item Mean Hamming
  14. \item Soergel
  15. \item Pattern Difference
  16. \item Variance
  17. \item Size
  18. \item Shape
  19. }
  20. The following metrics are similarity metrics and so the distance can
  21. be obtained by subtracting the value fom 1.0
  22. \itemize{
  23. \item Tanimoto
  24. \item Dice
  25. \item Modified Tanimoto
  26. \item Simple
  27. \item Jaccard
  28. \item Russel-Rao
  29. \item Rodgers Tanimoto
  30. \item Cosine
  31. \item Achiai
  32. \item Carbo
  33. \item Baroniurbanibuser
  34. \item Kulczynski2
  35. \item Robust
  36. }
  37. Finally the method also provides a set of composite and asymmetric
  38. distance metrics
  39. \itemize{
  40. \item Hamann
  41. \item Yule
  42. \item Pearson
  43. \item Dispersion
  44. \item McConnaughey
  45. \item Stiles
  46. \item Simpson
  47. \item Petke
  48. }
  49. The default metric is the Tanimoto coefficient.
  50. }
  51. \usage{
  52. distance(fp1, fp2, method)
  53. }
  54. \arguments{
  55. \item{fp1}{
  56. An object of class \code{fingerprint} or \code{featvec}
  57. }
  58. \item{fp2}{
  59. An object of class \code{fingerprint} or \code{featvec}
  60. }
  61. \item{method}{
  62. The type of distance metric desired. Partial matching is
  63. supported and the deault is \code{tanimoto}. Alternative values are
  64. \itemize{
  65. \item \code{euclidean}
  66. \item \code{hamming}
  67. \item \code{meanHamming}
  68. \item \code{soergel}
  69. \item \code{patternDifference}
  70. \item \code{variance}
  71. \item \code{size}
  72. \item \code{shape}
  73. \item \code{jaccard}
  74. \item \code{dice}
  75. \item \code{mt}
  76. \item \code{simple}
  77. \item \code{russelrao}
  78. \item \code{rodgerstanimoto}
  79. \item \code{cosine}
  80. \item \code{achiai}
  81. \item \code{carbo}
  82. \item \code{baroniurbanibuser}
  83. \item \code{kulczynski2}
  84. \item \code{robust}
  85. \item \code{hamann}
  86. \item \code{yule}
  87. \item \code{pearson}
  88. \item \code{mcconnaughey}
  89. \item \code{stiles}
  90. \item \code{simpson}
  91. \item \code{petke}
  92. }
  93. If the two fingerprints are of class \code{featvec} then the following methods
  94. may be specified: \code{tanimoto}, \code{robust} and \code{dice}.
  95. }
  96. }
  97. \value{
  98. Numeric value representing the distance in the specified metric between the
  99. supplied fingerprint objects
  100. }
  101. \examples{
  102. # make a 2 fingerprint vectors
  103. fp1 <- new("fingerprint", nbit=6, bits=c(1,2,5,6))
  104. fp2 <- new("fingerprint", nbit=6, bits=c(1,2,5,6))
  105. # calculate the tanimoto coefficient
  106. distance(fp1,fp2) # should be 1
  107. # Invert the second fingerprint
  108. fp3 <- !fp2
  109. distance(fp1,fp3) # should be 0
  110. }
  111. \references{Fligner, M.A.; Verducci, J.S.; Blower, P.E.;
  112. A Modification of the Jaccard-Tanimoto Similarity Index for
  113. Diverse Selection of Chemical Compounds Using Binary Strings,
  114. \emph{Technometrics}, 2002, \emph{44}(2), 110-119
  115. Monve, V.; Introduction to Similarity Searching in
  116. Chemistry, \emph{MATCH - Comm. Math. Comp. Chem.}, 2004, \emph{51}, 7-38
  117. }
  118. \keyword{logic}
  119. \author{Rajarshi Guha \email{rajarshi.guha@gmail.com}}