Subtree

Description

Get a subtree

Usage

1
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.

Author(s)

Melissa J. Hubisz and Adam Siepel

Examples

1
2
3
4
5
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"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.