getTreeIntervals: Intervals of a phylogenetic tree

Description Usage Arguments Details Value See Also

View source: R/tree_utils.R

Description

Function to get the coalescent and sampling intervals of a binary tree (the function also works for serially-sampled trees). The function returns a table with each row representing one of the intervals in the tree. This can be used to get the vector of speciation/transmission and sampling times for a phylogenetic tree.

Usage

1
getTreeIntervals(tree, decreasing = FALSE, raw = FALSE)

Arguments

tree

An object of class "phylo" from ape

decreasing

If FALSE intervals are ordered from the present into the past. If TRUE intervals are ordered from the tMRCA to the present.

raw

If TRUE return the raw table before reordering and calculating interval lengths or numbers of lineages. Mostly for debugging purposes.

Details

Each row of the output table represents an interval of the tree. Intervals are between successive nodes in the tree, with time measured from the present (t = 0) into the past. For an interval between time x and y, with x < y, the function returns

Rows are ordered based on the end time of the intervals. If two nodes have the same height, nodes are ordered by type ("coalescent" < "sample") and then by node number.

To get the tree interval the function performs a depth first traversal of the tree.

The results of this function are equivalent to getx in the TreeSim package, but more verbose.

Value

A table with each row representing one of the tree intervals.

See Also

getBranchingTimes, getSamplingTimes, getx, branching.times, coalescent.intervals


laduplessis/beastio documentation built on Dec. 14, 2021, 7:04 p.m.