cutreeshape {apTreeshape}R Documentation

Cut objects of class "treeshape"

Description

Prunes or cuts an object of class "treeshape" from a specifized internal node, either by specifying a top or bottom direction. This function returns the top part or the bottom part of a tree. The tree is cut from the root to a given node, or from a given node to the tips.

Usage

cutreeshape(tree, node, type)

Arguments

tree An object of class "treeshape".
node An integer representing the node in which the tree will be cut. node should be in the range 1:(treesize-1).
type A character string equals to either "top" or "bottom".

Details

If the type specified is "top", the tree is pruned from the height of node. The resulting tips correspond to the ancestral branches present at the same time as the given node. New tip labels are assigned to the tips.

If the type specified is "bottom", the subtree under node is returned. The tips are not renamed (they keep their former names) and the specified node is the root of the new tree.

Value

An object of class "treeshape"

Author(s)

Michael Blum <michael.blum@imag.fr>
Nicolas Bortolussi <nicolas.bortolussi@imag.fr>
Eric Durand <eric.durand@imag.fr>
Olivier François <olivier.francois@imag.fr>

See Also

tipsubtree

Examples


## Data set provided with the library. Type help(cytochromc) for more infos.
data(carnivora.treeshape)  
data(hivtree.treeshape)

## Examples of "bottom" cutting:
bottom.tree=cutreeshape(carnivora.treeshape, 3, "bottom")
plot(carnivora.treeshape, bottom.tree)
bottom.tree=cutreeshape(carnivora.treeshape, 8, "bottom")
plot(carnivora.treeshape, bottom.tree)
  
## Examples of "top" pruning:
top.tree=cutreeshape(hivtree.treeshape, 158, "top")
plot(hivtree.treeshape, top.tree)

[Package apTreeshape version 1.0.0 Index]