transtree: Create a consensus transmission tree.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/transtree.R

Description

Various methods to create summary transmission trees from a phybreak-object containing posterior samples.

Usage

1
2
3
4
transtree(x, method = c("count", "edmonds", "mpc", "mtcc"),
  samplesize = Inf, infector.name = TRUE, support = c("proportion",
  "count"), infection.times = c("all", "infector", "infector.sd"),
  time.quantiles = c(0.025, 0.5, 0.975), phylo.class = FALSE)

Arguments

x

An object of class phybreak.

method

The method used to create the tree (see details).

samplesize

The number of posterior samples that is used, taken from the tail.

infector.name

Whether to return the infector names, or the position in the vector of hosts.

support

Whether to return the support (= posterior probability) for each infector as a "proportion" or as a "count" of posterior trees in which that transmission link or transmission cluster is present.

infection.times

Whether to base the summary infection times on "all" samples, or only on samples in which the "infector" was the same as in the consensus tree. A third option is "infector.sd", in which case only posterior trees with the same infector or transmission cluster as in the consensus tree were used to calculate a mean and standard deviation. In that case and if method = "mpc" or method = "mtcc", also the infection times in the first sampled tree with consensus tree topology are given.

time.quantiles

Used only if infection.times = "all" or "infector".

phylo.class

Whether to return an object of class "phylo", in which case a single tree ("mpc" or "mtcc") from the posterior is returned (not with summary infection times). This option is used by plotPhylo.

Details

Four methods are supported for transmission tree reconstruction (who infected whom).

Value

If phylo.class = FALSE, a data.frame with per item (=host) its infector and support per infector (or cluster), and summary infection times. If phylo.class = TRUE, a class "phylo" object, a single tree ("mpc" or "mtcc") from the posterior is returned (not with summary infection times).

Author(s)

Don Klinkenberg [email protected]

References

Klinkenberg et al. (2017) Simultaneous inference of phylogenetic and transmission trees in infectious disease outbreaks. PLoS Comput Biol, 13(5): e1005495.

Examples

1
2
3
4
5
6
7
8
9
#First build a phybreak-object containing samples.
simulation <- sim_phybreak(obsize = 5)
MCMCstate <- phybreak(dataset = simulation)
MCMCstate <- burnin_phybreak(MCMCstate, ncycles = 20)
MCMCstate <- sample_phybreak(MCMCstate, nsample = 50, thin = 2)

transtree(MCMCstate, method = "edmonds")
transtree(MCMCstate, method = "mpc", infection.times = "infector.sd")
plot(MCMCstate, plot.which = "mpc")

donkeyshot/phybreak documentation built on Aug. 16, 2018, noon