Skip to content

Instantly share code, notes, and snippets.

@clarle
Last active October 12, 2015 05:58
Show Gist options
  • Save clarle/3981383 to your computer and use it in GitHub Desktop.
Save clarle/3981383 to your computer and use it in GitHub Desktop.
Neighbor joining script
library(ape)
m = c(0, 13, 8, 20, 21, 13, 0, 9, 16, 17, 8, 9, 0, 15, 16, 20, 16, 15, 0, 13, 21, 17, 16, 13, 0)
dim(m) = c(5, 5)
colnames(m) = c('A', 'B', 'C', 'D', 'E')
rownames(m) = colnames(m)
d = as.dist(m)
tr = nj(d)
plot(tr, cex=2, tip.color=rainbow(6))
axisPhylo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment