Learn R Programming

TreeSearch (version 0.2.2)

TBR: TBR

Description

Tree bisection and reconnection

Usage

TBR(tree, edgeToBreak = NULL, mergeEdges = NULL)

TBRSwap(parent, child, nEdge = length(parent), edgeToBreak = NULL, mergeEdges = NULL)

TBRMoves(parent, child, nEdge = length(parent), avoid = NULL, retainRoot = FALSE)

AllTBR(parent, child, nEdge = length(parent), avoid = NULL, retainRoot = FALSE)

RootedTBR(tree, edgeToBreak = NULL, mergeEdges = NULL)

RootedTBRSwap(parent, child, nEdge = length(parent), edgeToBreak = NULL, mergeEdges = NULL)

Arguments

tree

A bifurcating tree of class phylo, with all nodes resolved;

edgeToBreak

(optional) integer specifying the index of an edge to bisect/prune, generated randomly if not specified. Alternatively, set to -1 to return a complete list of all trees one step from the input tree.

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 edgeToBreak); if only a single edge is specified, the second will be chosen at random

parent

the first column of the edge matrix of a tree of class phylo, i.e. tree$edge[, 1]

child

the second column of the edge matrix of a tree of class phylo, i.e. tree$edge[, 2]

nEdge

(optional) Number of edges.

avoid

Integer vector specifying which edges should not be broken

retainRoot

logical specifying whether taxa may be swapped across the root

Value

This function returns a tree in phyDat format that has undergone one TBR iteration.

a list containing two elements, corresponding in turn to the rearranged parent and child parameters

a matrix with two columns, each row listing an edge that can be broken and an edge into which it can be merged

a list of trees, in parent-child format

Functions

  • TBRSwap: faster version that takes and returns parent and child parameters

  • TBRMoves: Possible TBR moves

  • AllTBR: All unique trees one TBR move away

  • RootedTBR: Perform TBR rearrangement, retaining position of root

  • RootedTBRSwap: faster version that takes and returns parent and child parameters

Details

TBR performs a single random TBR iteration.

Branch lengths are not (yet) supported.

References

The TBR algorithm is summarized in Felsenstein2004TreeSearch

See Also

RootedTBR useful when the position of the root node should be retained.

Examples

Run this code
# NOT RUN {
{
library('ape')
tree <- rtree(20, br=NULL)
TBR(tree)
}
# }

Run the code above in your browser using DataLab