Learn R Programming

phybreak (version 0.2.0)

transtree: Create a consensus transmission tree.

Description

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

Usage

transtree(phybreak.object, 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

phybreak.object

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.

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).

Details

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

  • "count" gives the most frequent infector from the posterior samples. Note that this may result in an improper tree (multiple roots and/or cycles). Support is measured by the frequency of the infector in the posterior distribution.

  • "edmonds" starts from the most frequent infector (method "count"), multiple roots and cycles are removed by selecting one by one the next most frequent option that minimizes the loss in support (Edmonds' algorithm). Support is measured by the frequency of the infector in the posterior distribution.

  • "mpc" gives the maximum parent credibility tree as described in Hall et al (2015). This is the tree in the set of posterior samples that has maximum support = product of frequencies among all posterior samples. Support is measured by the frequency of the infector in the posterior distribution.

  • "mtcc" gives the maximum transmission cluster credibility tree. This is equivalent to the maximum clade credibility (mcc) phylogenetic tree, with clusters defined as host + all progeny. Support is measured by the frequency of the cluster in the posterior distribution.

References

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

Examples

Run this code
# NOT RUN {
#First build a phybreak-object containing samples.
simulation <- sim.phybreak(obsize = 5)
MCMCstate <- phybreak(data = 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")
# }

Run the code above in your browser using DataLab