Learn R Programming

rphast (version 1.6.9)

subtree: Subtree

Description

Get a subtree

Usage

subtree(tree, node, super.tree = FALSE)

Arguments

tree

A vector of character strings, each containing a newick tree

node

A vector of character strings, each representing the name of the node which will be the new root of the tree. If node is shorter than tree, values will be recycled, and a warning produced if length(tree) %% length(node) != 0

super.tree

A vector of logical values. If TRUE, then remove all nodes which are descendants of node, rather than keeping them.

Value

A vector of trees which have been pruned, removing all nodes which are not descendants of the given node.

Examples

Run this code
# NOT RUN {
trees <- c("((hg18, panTro2), mm9);",
           "((hg18:0.142679,(mm9:0.083220,rn4:0.090564):0.269385)
            :0.020666,canFam2:0.193569);")
trees <- name.ancestors(trees)
subtree(trees, c("hg18-panTro2", "mm9-rn4"))
# }

Run the code above in your browser using DataLab