SPRDist()
calculates an upper bound on the SPR distance between trees
using the heuristic method of deOliveira2008;textualTreeDist.
Other approximations are available
@e.g. @Hickey2008, @Goloboff2008SPR, @Whidden2018TreeDist.
Usage
SPRDist(tree1, tree2 = NULL, method = "deOliveira", symmetric)
# S3 method for class 'phylo'
SPRDist(tree1, tree2 = NULL, method = "deOliveira", symmetric)
# S3 method for class 'list'
SPRDist(tree1, tree2 = NULL, method = "deOliveira", symmetric)
# S3 method for class 'multiPhylo'
SPRDist(tree1, tree2 = NULL, method = "deOliveira", symmetric)
Arguments
- tree1, tree2
Trees of class
phylo
, with leaves labelled identically, or lists of such trees to undergo pairwise comparison. Where implemented,tree2 = NULL
will compute distances between each pair of trees in the listtree1
using a fast algorithm based on Day1985;textualTreeDist.- method
Character specifying which method to use to approximate the SPR distance. Currently defaults to
"deOliveira"
, the only available option; a new method will eventually become the default.- symmetric
Ignored (redundant after fix of phangorn#97).
See also
Exact calculation with TBRDist
functions USPRDist()
and ReplugDist()
.
phangorn function SPR.dist()
employs
the deOliveira2008;textualTreeDist algorithm but can crash
when sent trees of certain formats, and tends to have a longer running time.
Other tree distances:
JaccardRobinsonFoulds()
,
KendallColijn()
,
MASTSize()
,
MatchingSplitDistance()
,
NNIDist()
,
NyeSimilarity()
,
PathDist()
,
Robinson-Foulds
,
TreeDistance()
Examples
library("TreeTools", quietly = TRUE)
# Compare single pair of trees
SPRDist(BalancedTree(7), PectinateTree(7))
#> [1] 2
# Compare all pairs of trees
SPRDist(as.phylo(30:33, 8))
#> 1 2 3 4
#> 1 1 1 1
#> 2 1 1 1
#> 3 1 1 1
#> 4 1 1 1
# Compare each tree in one list with each tree in another
SPRDist(BalancedTree(7), as.phylo(0:2, 7))
#> [1] 2 2 2
SPRDist(as.phylo(0:2, 7), PectinateTree(7))
#> [1] 1 2 2
SPRDist(list(bal = BalancedTree(7), pec = PectinateTree(7)),
as.phylo(0:2, 7))
#> [,1] [,2] [,3]
#> bal 2 2 2
#> pec 1 2 2