require(picante)
## Loading required package: picante
## Loading required package: ape
## Loading required package: vegan
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.0-9
## Loading required package: nlme
library(PhyloOrchard)
data(BinindaEmondsEtAl2007)
plot(BinindaEmondsEtAl2007[[1]], show.node.label = TRUE)
tree <- BinindaEmondsEtAl2007[[1]]
tree
##
## Phylogenetic tree with 4510 tips and 2108 internal nodes.
##
## Tip labels:
## Tachyglossus_aculeatus, Zaglossus_bruijni, Ornithorhynchus_anatinus, Anomalurus_beecrofti, Anomalurus_derbianus, Anomalurus_pelii, ...
##
## Rooted; includes branch lengths.
which(tree$tip.label %in% "Dipodomys_merriami")
## [1] 1407
which(tree$tip.label %in% "Chaetodipus_baileyi")
## [1] 1391
# get distance matrix
trx <- cophenetic(tree)
# distance between taxa
trx["Dipodomys_merriami", "Chaetodipus_baileyi"]
## [1] 69
# see prune.sample, normally this takes in a siteXspp matrix, have to fool
# it a bit here
d <- matrix(nrow = 1, ncol = 4)
colnames(d) <- c("Dipodomys_merriami", "Chaetodipus_baileyi", "Peromyscus_eremicus",
"Dipodomys_ordii")
# prune the tree
tree.p <- prune.sample(phylo = tree, samp = d)
plot(tree.p)