sample.tt: Sample one or more transmission trees uniformly

Description Usage Arguments Value Examples

View source: R/sampling.R

Description

Sample one or more transmission trees uniformly

Usage

1
2
3
4
5
6
7
8
sample.tt(
  generator,
  count = 1,
  unsampled = 0,
  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.

draw

Use ggtree to draw a coloured phylogeny showing each transmission tree overlaid 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
 8
 9
10
11
12
# draw one sample from the uniform distribution
generator <- tt.generator(stratus.example.tree)
samples <- sample.tt(generator, 1, draw = TRUE)
samples[[1]]
# with unsampled.hosts
generator.us <- tt.generator(stratus.example.tree, max.unsampled = 2)
# note that you can ask for less unsampled hosts than the generator has (but not more)
samples.1us <- sample.tt(generator.us, 1, unsampled = 1,  draw = TRUE)
samples.1us[[1]]
# with multiply sampled hosts
generator.ms <- tt.generator(stratus.example.tree, tip.map = grouping.map)
samples.ms <- sample.tt(generator.ms, 1, draw = TRUE)

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

Related to sample.tt in STraTUS...