sample.partial.tt: Resample the subtree rooted at any tree node, keeping the...

Description Usage Arguments Value Examples

View source: R/sampling.R

Description

Resample the subtree rooted at any tree node, keeping the annotations for the rest of the tree fixed

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 tt.generator produced by tt.generator.

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 generator list whose type is unsampled.

starting.node

The root of the subtree to resample. If this is the root of the whole tree, then existing is irrelevent (but generally sample.tt should be used for this purpose).

existing

An existing list of class tt, representing a transmission tree to be modified. Usually these are produced by a sample.tt or sample.partial.tt call.

check.integrity

Whether to check if existing is indeed a valid transmission tree.

draw

Use ggtree to draw a coloured phylogeny showing each transmission tree overload onto the phylogeny

igraph

Produce the transmission trees in igraph format.

verbose

Verbose output

Value

A list, each of whose elements is a list of class tt with one or more of the following elements:

Examples

1
2
3
4
5
6
7
# 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)

STraTUS documentation built on April 4, 2020, 5:07 p.m.