plotPhyloTrans: Plotting a phybreak object transmission and phylogenetic...

Description Usage Arguments Details Author(s) References Examples

View source: R/plotPhyloTrans.R

Description

Plots a phybreak-object as a transmission tree with coloured phylogenetic trees for each host. The default is to plot the current state, but any posterior sample can be chosen, as well as various consensus trees.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
plotPhyloTrans(x, plot.which = c("sample", "mpc", "mtcc", "mcc"),
  samplenr = 0, select.how = "trees", select.who = "index",
  showmutations = FALSE, mar = 0.1 + c(4, 0, 0, 0), tree.lwd = 1,
  tree.col = NULL, hostlabel = TRUE, hostlabel.cex = NULL,
  hostlabel.pos = "adjacent", hostlabel.col = tree.col,
  samplelabel = FALSE, samplelabel.cex = NULL,
  samplelabel.pos = "right", samplelabel.col = tree.col,
  mutationlabel = FALSE, mutationlabel.cex = NULL,
  mutationlabel.pos = "right", label.space = 0.15,
  host.col = tree.col, host.alpha = 0.2, cline.lty = 3,
  cline.lwd = 1, cline.col = "black", cpoint.pch = 20,
  cpoint.cex = 1, cpoint.col = tree.col, xlab = "Time",
  axis.cex = 1, title.cex = 1, ...)

Arguments

x

An object of class phybreak.

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.

select.how

Method to select subset of hosts to plot, in combination with select.who. Options are "trees", in which case subtrees are plotted with index cases defined in select.who. Options are:

  1. "trees": subtrees starting with cases defined in select.who, with all progeny. This is the default, starting with "index", so that all cases are selected.

  2. "pruned": prunes the complete transmission tree to the minimum fully connected subtree containing all cases in select.who, plus all cases needed to link them. Include "index" for the index case.

  3. "leaves": plot only the hosts in select.who. Here, including "index" has no effect.

select.who

Vector of hosts used to select subset of hosts to plot, in combination with select.how (explained above). Can be given as named hosts, where "index" can be used to plot the index host with selection methods "trees" and "pruned", or as numbers, where 0 indicates the index host.

mar

Plot margins.

tree.lwd

Line width of phylogenetic trees.

tree.col

Colours of the host phylogenetic trees. Defaults to evenly spaced hues in hcl, with c = 100 and l = 65.

hostlabel

Whether to print the host names.

hostlabel.cex

Size of host names. Defaults to a value between 0.5 and 1 depending on outbreak size.

hostlabel.pos

Position of host names, either just right from the host's phylogenetic tree, or aligned at the right hand side of the plot ("right").

hostlabel.col

Colours of the host names. Defaults to same as tree colours.

samplelabel

Whether to print the sample names.

samplelabel.cex

Size of sample names. Defaults to a value between 0.4 and 0.8 depending on outbreak size.

samplelabel.pos

Position of sample names, either just right from the host's phylogenetic tree, or aligned at the right hand side of the plot ("right").

samplelabel.col

Colours of the sample names. Defaults to same as tree colours, matching the host.

mutationlabel

Whether to print the number of mutations on each edge in the phylogenetic trees, calculated with parsimony reconstruction using ancestral.pars. Only for edges with > 0 mutations.

mutationlabel.cex

Size of mutation labels. Defaults to same as sample label.

mutationlabel.pos

Position of mutation label on edge. Default is "right", which is on the node to the right, otherwise it is centered.

label.space

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

host.col

Colour of shading behind the host phylogenetic trees. Defaults to same as tree colours.

host.alpha

Transparancy of shading behind the host phylogenetic trees.

cline.lty

Line type of vertical lines showing the transmission contacts.

cline.lwd

Line width of vertical lines showing the transmission contacts.

cline.col

Colour of vertical lines showing the transmission contacts. If NULL, the tree colours are used.

cpoint.pch

Character par("pch") used for points indicating the transmission contacts, both at the tips and roots of the phylogenetic trees.

cpoint.cex

Size of transmission contact points.

cpoint.col

Colour of points indicating the transmission contacts, associated with the secondary case, both at the tips and roots of the phylogenetic trees. Defaults to same as tree colours.

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. tree.lty to change the line type of the phylogenetic tree. The following prefixes can be used: tree for the phylogenetic trees, hostlabel for the host names, samplelabel for the sample names, host for the host's shading areas, cline for the vertical contact lines, cpoint for the transmission contact points, axis for the X-axis, and title for the X-axis title.

Author(s)

Don Klinkenberg don@xs4all.nl

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

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

donkeyshot/phybreak documentation built on Sept. 17, 2021, 9:32 p.m.