phyloprunr: Pruning algorithm to maximise Phylogenetic Diversity for a...

Description Usage Arguments Details Value References

View source: R/phyloprunr.R


A pruning algorithm that seeks to maximise Phylogenetic Diversity (PD) for a set of species of a given size. The algorithm proceeds in a step-wise fashion, removing species that contribute the least to PD until the desired set size is achieved.


phyloprunr(phy, size, iterations = 1, trees = TRUE)



is a rooted phylogenetic tree with branch lengths stored as a phylo object (as in the ape package).


is the number of tips (species/OTUs) to prune the tree to.


is the number of iterations of the algorithm (to resolve ties). Default is 1.


is a logical, indicating whether sub-trees (TRUE - default) or only species lists/tip labels (FALSE) should be returned for each set that maximises PD.


phyloprunr takes a phylogenetic tree (rooted and with branch lengths) and determines the optimal set of tips (species/OTUs) of a given size that maximises Phylogenetic Diversity (PD). The algorithm determines step-wise which tip contributes the least to PD (has the shortest terminal branch) and then removes it, adjusting the terminal branch lengths of the remaining tips (to accommodate the tip removal) as it goes. The algorithm will continue until the stipulated set size is achieved. The resulting set is the set that maximises PD for its size. At each step, ties are resolved by choosing at random from the available options. For this reason, the user can repeat the algorithm (using the iterations argument) to generate several equally optimal sets. For a fully resolved ultrametric tree, there will be 2^(n-k) possible solutions (where n is the number of tips and k is the desired set size), so a large number of iterations of the algorithm may be needed to explore the range of possible solutions. The algorithm is descibed in Minh et al. (2006).


If trees = TRUE, a multiphylo object (see ape package) is returned, consisting of one tree for each iteration of the algorithm. If trees = FALSE, a list of length iterations is returned where each element is a vector of tip labels / species names corresponding to an optimal set.


davidnipperess/PDcalc documentation built on July 1, 2018, 3:59 p.m.