cutreeshape {apTreeshape}R Documentation

Cut objects of class "treeshape"

Description

Prunes or cuts an object of class "treeshape" from a specificed internal node, either by specifying a top or bottom direction. This function returns either the top part or the bottom part of a tree.

Usage

cutreeshape(tree, node, type)

Arguments

tree

An object of class "treeshape".

node

An integer representing the node at which the tree will be pruned or cut. node should be in the range 1:(treesize-1).

type

A character string equals to either "top" or "bottom".

Details

If the type argument is "top", the tree is pruned from node. The resulting tips correspond to the ancestral branches present at the same height 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 Francois <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.5-0.1 Index]