TreeTools (version 1.4.1)

DropTip: Drop tips from tree

Description

DropTip() removes specified tips from a phylogenetic tree, collapsing incident branches.

Usage

DropTip(tree, tip)

# S3 method for phylo DropTip(tree, tip)

# S3 method for multiPhylo DropTip(tree, tip)

Arguments

tree

A tree of class phylo.

tip

Character vector specifying labels of leaves in tree to be dropped, or integer vector specifying the indices of leaves to be dropped. Specifying the index of an internal node will drop all descendants of that node.

Value

DropTip() returns a tree of class phylo, in Preorder, with the requested leaves removed.

Details

This function is more robust than ape::drop.tip() as it does not require any particular internal node numbering schema. It is not presently as fast, though it is ripe for optimization; if you are finding this function is a rate-limiting step, please get in touch and I'll prioritise writing a faster implementation.

See Also

Other tree manipulation: AddTip(), CollapseNode(), ConsensusWithout(), EnforceOutgroup(), LeafLabelInterchange(), MakeTreeBinary(), RenumberTips(), RenumberTree(), Renumber(), RootTree(), SingleTaxonTree(), SortTree(), Subtree()

Examples

Run this code
# NOT RUN {
tree <- BalancedTree(8)
plot(tree)
plot(DropTip(tree, c('t4', 't5')))

# }

Run the code above in your browser using DataCamp Workspace