Skip to content

Instantly share code, notes, and snippets.

@pauca
Last active June 19, 2017 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauca/ccc129ddb309bd052056eaf376f843b2 to your computer and use it in GitHub Desktop.
Save pauca/ccc129ddb309bd052056eaf376f843b2 to your computer and use it in GitHub Desktop.
binary distances R ( tanimoto)
# http://www.sequentix.de/gelquest/help/distance_measures.htm
bdist <- function( x, y , method ){
a <- sum( x == 1 & y == 1)
b <- sum( x == 1 & y == 0)
c <- sum( x == 0 & y == 1)
d <- sum( x == 0 & y == 0)
switch(method,
tanimoto = (a+d)/(a+2*(b+c)+d),
stop("Method not implemented")
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment