TBR {TreeSearch} | R Documentation |
Tree bisection and reconnection (TBR)
Description
TBR
performs a single random TBR iteration.
Usage
TBR(tree, edgeToBreak = NULL, mergeEdges = NULL)
TBRMoves(tree, edgeToBreak = integer(0))
## S3 method for class 'phylo'
TBRMoves(tree, edgeToBreak = integer(0))
## S3 method for class 'matrix'
TBRMoves(tree, edgeToBreak = integer(0))
TBRSwap(
parent,
child,
nEdge = length(parent),
edgeToBreak = NULL,
mergeEdges = NULL
)
RootedTBR(tree, edgeToBreak = NULL, mergeEdges = NULL)
RootedTBRSwap(
parent,
child,
nEdge = length(parent),
edgeToBreak = NULL,
mergeEdges = NULL
)
Arguments
tree |
A bifurcating tree of class |
edgeToBreak |
(optional) integer specifying the index of an edge to bisect/prune,
generated randomly if not specified.
Alternatively, set to |
mergeEdges |
(optional) vector of length 1 or 2, listing edge(s) to be joined:
In SPR, this is where the pruned subtree will be reconnected.
In TBR, these edges will be reconnected (so must be on opposite
sides of |
parent |
Integer vector corresponding to the first column of the edge
matrix of a tree of class |
child |
Integer vector corresponding to the second column of the edge
matrix of a tree of class |
nEdge |
(optional) Number of edges. |
Details
Branch lengths are not (yet) supported.
All nodes in a tree must be bifurcating; ape::collapse.singles and ape::multi2di may help.
Value
TBR()
returns a tree in phyDat
format that has undergone one
TBR iteration.
TBRMoves()
returns a multiPhylo
object listing all trees one
TBR move away from tree
, with edges and nodes in preorder,
rooted on the first-labelled tip.
TBRSwap()
returns a list containing two elements corresponding
to the rearranged parent
and child
parameters.
Functions
-
TBRSwap()
: faster version that takes and returns parent and child parameters -
RootedTBR()
: Perform TBR rearrangement, retaining position of root -
RootedTBRSwap()
: faster version that takes and returns parent and child parameters
Author(s)
Martin R. Smith (martin.smith@durham.ac.uk)
References
The TBR algorithm is summarized in Felsenstein J (2004). Inferring phylogenies. Sinauer Associates, Sunderland, Massachusetts.
See Also
RootedTBR()
: useful when the position of the root node should be retained.
Other tree rearrangement functions:
NNI()
,
SPR()
Examples
library("ape")
tree <- rtree(20, br=NULL)
TBR(tree)