rotateNodes {phytools} | R Documentation |
Rotates a node or set of nodes in a phylogenetic tree
Description
The function rotateNodes
is a simple wrapper for rotate
which rotates a set of nodes or all nodes.
The function rotate.multi
finds all possible rotations around a multifurcating node, given by node
. This will be an object of class "multiPhylo"
, assuming that the node specified is indeed a multifurcation.
The function allRotations
computes all possible rotated trees for a given input phylogeny. For a binary tree, this is generally two raised to the power of the number of internal nodes (so a very large number, if N is even modest in size).
Usage
rotateNodes(tree, nodes, polytom=c(1,2), ...)
rotate.multi(tree, node)
allRotations(tree)
Arguments
tree |
object of class |
nodes |
either a single node number to rotate, a vector of node numbers, or the string |
polytom |
a vector of mode numeric and length two specifying the two clades that should be exchanged in a polytomy (see |
node |
a single node to rotate (in the case of |
... |
optional arguments. |
Details
All three functions also address the problem that the product of multiple rotations from rotate
can be non-compliant with the implicit "phylo"
standard because the tip numbers in tree$edge
are not in numerical order 1:n
for n
tips.
Value
An object of class "phylo"
(i.e., a phylogenetic tree), in the case of rotateNodes
, or an object of class "multiPhylo"
for rotate.multi
or allRotations
.
Author(s)
Liam Revell liam.revell@umb.edu
References
Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.