| sample.partial.tt {STraTUS} | R Documentation |
Resample the subtree rooted at any tree node, keeping the annotations for the rest of the tree fixed
Description
Resample the subtree rooted at any tree node, keeping the annotations for the rest of the tree fixed
Usage
sample.partial.tt(
generator,
count = 1,
unsampled = 0,
starting.node = phangorn::getRoot(generator$tree),
existing = NULL,
check.integrity = TRUE,
draw = count == 1,
igraph = FALSE,
verbose = FALSE
)
Arguments
generator |
A list of class |
count |
How many transmission trees to sample. |
unsampled |
The number of unsampled hosts in the transmission chain. (The whole transmission chain, even if only part of the transmission tree is being resampled). A value >0 requires a |
starting.node |
The root of the subtree to resample. If this is the root of the whole tree, then |
existing |
An existing list of class |
check.integrity |
Whether to check if |
draw |
Use |
igraph |
Produce the transmission trees in |
verbose |
Verbose output |
Value
A list, each of whose elements is a list of class tt with one or more of the following elements:
annotationsAlways present. A vector indicating which host (given by numbers corresponding to the ordering ingenerator$hosts) is assigned to each phylogeny node.edgelistAlways present. Adata.framegiving the edge list; the first column are parents and the second children.hiddenPresent ifunsampledis greater than 0. The number of "hidden" unsampled hosts (with no associated nodes) along each branch.picturePresent ifdrawwas TRUE; aggtreeobject.igraphPresent ifigraphwas TRUE; anigraphobject.
Examples
# draw one sample from the uniform distribution
generator <- tt.generator(stratus.example.tree)
samples <- sample.tt(generator, 1, draw = TRUE)
original.tt <- samples[[1]]
# sample anew, from node 31 downwards
revised.tt <- sample.partial.tt(generator, 1, starting.node = 31,
existing = original.tt, draw = TRUE)