View source: R/PhyloDistance.R
PhyloDistance | R Documentation |
Calculates distance between two unrooted phylogenies using a variety of metrics.
PhyloDistance(dend1, dend2,
Method=c("CI", "RF", "KF", "JRF"),
RawScore=FALSE, JRFExp=2)
dend1 |
An object of class |
dend2 |
An object of class |
Method |
Method to use for calculating tree distances. The following values are supported: |
RawScore |
If |
JRFExp |
|
This function implements a variety of tree distances, specified by the value of Method
. The following values are supported, along with links to documentation pages for each function:
"RF"
: Robinson-Foulds Distance
"CI"
: Clustering Information Distance
"JRF"
: Jaccard-Robinson-Foulds Distance, equivalent to the Nye Distance Metric when JRFVal=1
"KF"
: Kuhner-Felsenstein Distance
Information on each of these algorithms, how scores are calculated, and references to literature can be found at the above links. Method "CI"
is selected by default due to recent work showing this method as the most robust tree distance metric under general conditions.
Returns a normalized distance, with 0 indicating identical trees and 1 indicating
maximal difference. If the trees have no leaves in common, the function will return 1
if RawScore=FALSE
, or c(0,NA,NA)
if RawScore=TRUE
.
If RawScore=TRUE
, returns a vector of the components used to calculate the distance. This is typically a length 3 vector, but specific details can be found on the description for each algorithm linked above.
Note that this function requires the input dendrograms to be labeled alike (ex.
leaf labeled abc
in dend1
represents the same species as
leaf labeled abc
in dend2
).
Labels can easily be modified using dendrapply
.
Aidan Lakshman ahl27@pitt.edu
Robinson-Foulds Distance
Clustering Information Distance
Jaccard-Robinson-Foulds Distance
Kuhner-Felsenstein Distance
# making some toy dendrograms
set.seed(123)
dm1 <- as.dist(matrix(runif(64, 0.5, 5), ncol=8))
dm2 <- as.dist(matrix(runif(64, 0.5, 5), ncol=8))
tree1 <- as.dendrogram(hclust(dm1))
tree2 <- as.dendrogram(hclust(dm2))
# Robinson-Foulds Distance
PhyloDistance(tree1, tree2, Method="RF")
# Clustering Information Distance
PhyloDistance(tree1, tree2, Method="CI")
# Kuhner-Felsenstein Distance
PhyloDistance(tree1, tree2, Method="KF")
# Nye Distance Metric
PhyloDistance(tree1, tree2, Method="JRF", JRFExp=1)
# Jaccard-Robinson-Foulds Distance
PhyloDistance(tree1, tree2, Method="JRF", JRFExp=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.