View source: R/treeSimulatorCpp2.R
DatedTree | R Documentation |
Create a DatedTree class object; it includes heights for each node and other helper variables
DatedTree(
phylo,
sampleTimes,
sampleStates = NULL,
sampleStatesAnnotations = NULL,
tol = 1e-06,
minEdgeLength = 0
)
phylo |
A phylogenetic tree of class ape::phylo. Note that this tree should be a timetree. |
sampleTimes |
A numeric vector providing the times of samples. If named, taxon labels will be based on names of the corresponding sample times |
sampleStates |
For models with more than one deme, a matrix must be supplied describing the probability of sampling from each deme. Each row corresponds to a sample in the same order as sampleTimes. Each column corresponds to probability of sampling each deme. Column names should be defined which correspond to deme names in the model. Rows should sum to one. |
sampleStatesAnnotations |
Vector of possible discrete character states for taxa. If inferring taxon state from label, this provides the possible matches for taxon annotations. |
tol |
Numeric to set the amount of error allowed in the edge length of the phylogenetic tree. |
minEdgeLength |
Numeric and it is the minimum length in the returned phylogenetic tree. |
tol and minEdgeLength are necessary because it will adjust the edge length of the tree to ensure they are greater than 0 and taking into consideration the sample times.
A dated phylogenetic tree with additional metadata to use with phydynR functions.
Erik Volz
# read the tree
#usually this is a tree that the branch lengths are in unit of calendar time
tree <- read.tree(system.file('extdata/hivSimulation.nwk', package='phydynR'))
# the sample times are the same, because it is a homochronous sample at 50 years
sampleTimes <- rep(50, length(tree$tip.label))
names(sampleTimes) <- tree$tip.label
# create a tree with dated tips and internal nodes,
# will infer the sample states from tip labels
bdt <- DatedTree(phylo = tree,
sampleTimes = sampleTimes,
minEdgeLength = 0.01)
bdt
class(bdt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.