plotTrans: Plotting a phybreak or phybreakdata transmission tree.

Description Usage Arguments Details Author(s) References Examples

View source: R/plotTrans.R

Description

Plots a phybreak-object or phybreakdata-object as transmission tree. The default is to plot the current state, but any posterior sample can be chosen, as well as various consensus trees; in that case, coloured arrows indicate posterior support.

Usage

1
2
3
4
5
6
plotTrans(x, plot.which = c("sample", "edmonds", "mpc", "mtcc"),
  samplenr = 0, mar = 0.1 + c(4, 0, 0, 0), label.cex = NULL,
  label.space = 0.15, label.adj = 0, arrow.lwd = 1, arrow.length = NULL,
  arrow.col = NULL, sample.pch = 4, sample.lwd = NULL,
  sample.cex = label.cex, polygon.col = "gray", polygon.border = NA,
  line.lty = 3, xlab = "Time", axis.cex = 1, title.cex = 1, ...)

Arguments

x

An object of class phybreak or phybreakdata. A phybreakdata-object should contain the slots sim.infectors and sim.infection.times.

plot.which

Either "sample" to plot the current state or a selected posterior sample, "mpc" or "mtcc" to plot a consensus transmission tree (see transtree) or "mcc" to plot the maximum clade credibility tree (see phylotree).

samplenr

If plot.which = "sample", this indicates which posterior tree should be plotted: samplenr = 0 to plot the current state.

mar

Plot margins.

label.cex

Size of host names, as in par("cex"). Defaults to a value between 0.5 and 1 depending on outbreak size.

label.space

Scales the space at the right-hand side to place the host names.

label.adj

Left-right adjustment of host names.

arrow.lwd

Arrow width.

arrow.length

Arrow point length, as default automatically scaled with outbreak size.

arrow.col

Arrow colour. Defaults to "black" if plot.which = sample, and otherwise to five colours c("blue", "green", "orange", "red", "purple") indicating posterior support of infectors in bins of 0.2 width, from low to high support. Any vector of colours will be divided into equal-sized bins.

sample.pch

Character par("pch") used for sampling events.

sample.lwd

Line width of sampling event character.

sample.cex

Size of sampling event character.

polygon.col

Color of polygons indicating generation interval distributions.

polygon.border

Border of polygon.

line.lty

Line type of horizontal host lines.

xlab

X-axis title.

axis.cex

Size of tick labels.

title.cex

Size of X-axis title.

...

Further graphical parameters (see details).

Details

Graphical parameters can be added by using names in the format prefix.parameter for the different parts of the plot. The parameter will then be passed on to the appropriate graphics function, e.g. arrow.lty to change the line type of the arrows. The following prefixes can be used: label for the host labels, arrow for the arrows, sample for the sampling time indicators, polygon for the generation interval distributions, line for the horizontal host lines, axis for the X-axis, and title for the X-axis title.

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
10
11
12
13
14
15
#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)

plotTrans(MCMCstate, plot.which = "mpc")

#Plotting from data only (empty sequences needed):
outbreak <- phybreakdata(sequences = matrix("a", nrow = 5, ncol = 1),
  sample.names = LETTERS[1:5],
  sample.times = c(0, 2, 2, 4, 4),
  sim.infectors = c("B", "index", "B", "A", "A"), 
  sim.infection.times = c(-2, -3, -1, 1, 2)))
plotTrans(outbreak)

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