TreeDist (version 2.7.0)

SPRDist: Approximate Subtree Prune and Regraft distance

Description

Approximate the Subtree Prune and Regraft (SPR) distance.

Usage

SPRDist(tree1, tree2 = NULL, symmetric = TRUE)

Value

SPRDist() returns a vector or distance matrix of distances between trees.

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 list tree1 using a fast algorithm based on Day (1985).

symmetric

Logical specifying whether to produce a better heuristic by calculating the minimum of SPRDist(t1, t2) and SPRDist(t2, t1), which are not guaranteed to be equal due to the heuristic nature of the approximation (see phangorn#97). Set to FALSE for the faster approximation, as implemented in "phangorn".

Details

SPRDist() is a wrapper for the function SPR.dist() in the phangorn package. It pre-processes trees to ensure that their internal representation does not cause the SPR.dist() function to crash R, and allows an improved (but slower) symmetric heuristic.

A memory leak is present in phangorn v2.5.5. To avoid a drain on system resources, install the latest version of phangorn with devtools::install_github("KlausVigo/phangorn").

See Also

Other tree distances: JaccardRobinsonFoulds(), KendallColijn(), MASTSize(), MatchingSplitDistance(), NNIDist(), NyeSimilarity(), PathDist(), Robinson-Foulds, TreeDistance()

Examples

Run this code
library("TreeTools", quietly = TRUE)

SPRDist(BalancedTree(7), PectinateTree(7))

SPRDist(BalancedTree(7), as.phylo(0:2, 7))
SPRDist(as.phylo(0:2, 7), PectinateTree(7))

SPRDist(list(bal = BalancedTree(7), pec = PectinateTree(7)),
        as.phylo(0:2, 7))

CompareAll(as.phylo(30:33, 8), SPRDist)

Run the code above in your browser using DataLab