TreeTools (version 0.1.3)

SplitFrequency: Frequency of splits

Description

SplitFrequency provides a simple way to count the number of times that bipartition splits, as defined by a reference tree, occur in a forest of trees.

Usage

SplitFrequency(reference, forest)

SplitNumber(tips, tree, tipIndex, powersOf2)

ForestSplits(forest, powersOf2)

TreeSplits(tree)

Arguments

reference

A tree of class phylo, a Splits object.

forest

a list of trees of class phylo, or a multiPhylo object; or a Splits object.

tips

Integer vector specifying the tips of the tree within the chosen split

tree

A tree of class phylo.

tipIndex

Character vector of tip names, in a fixed order

powersOf2

Integer vector of same length as tipIndex, specifying a power of 2 to be associated with each tip in turn

Value

Number of trees in forest that contain each split in reference. if reference is a tree of class phylo, then the sequence will correspond to the order of nodes (use `ape::nodelabels to view). Note that the three nodes at the root of the tree correspond to a single split; see the example for how these might be plotted on a tree.

Functions

  • SplitNumber: Assign a unique integer to each split

  • ForestSplits: Frequency of splits in a given forest of trees

  • TreeSplits: Deprecated. Listed the splits in a given tree. Use as.Splits instead.

Details

If multiple calculations are required, some time can be saved by using the constituent functions (see examples)

Examples

Run this code
# NOT RUN {
forest <- as.phylo(c(1, 10, 10, 100, 1000), nTip = 7)

# Simple, but means counting each split in the forest twice:
tree1Freqs <- SplitFrequency(forest[[1]], forest)
SplitFrequency(forest[[2]], forest)

plot(forest[[1]])
ape::nodelabels(tree1Freqs, node=as.integer(names(tree1Freqs)))

# }

Run the code above in your browser using DataLab