swap.nodes {phybase}R Documentation

Swap two nodes

Description

The function swapps two subtrees.

Usage

swap.nodes(inode, jnode, name, nodematrix)

Arguments

inode the root node of the first subtree
jnode the root node of the second subtree
name the species names
nodematrix the tree node matrix

Value

nodes the tree node matrix after swapping
treestr the tree string after swapping

Note

The function is unable to swap two overlapped subtrees.

Author(s)

Liang Liu lliu@oeb.harvard.edu

See Also

del.node

Examples

treestr<-"((((H:0.00402,C:0.00402):0.00304,G:0.00707):0.00929,O:0.01635):0.1,W:0.12);"
nodematrix<-read.tree.nodes(treestr)$nodes
spname<-read.tree.nodes(treestr)$names
swap.nodes(1,2,spname,nodematrix)

[Package phybase version 1.1 Index]