plotoutbreak: Plot outbreak

Description Usage Arguments Details Examples

View source: R/plotoutbreak.R

Description

Provides a graphical representation of simulated outbreak and sampled genomes.

Usage

1
2
3
plotoutbreak(epidata, sampledata, col = "red", stack = TRUE, arr.len = 0.1, 
blockheight = 0.5, hspace = max(epidata[,3])/20, labels = NULL, label.pos = "left", 
	block.col = "grey", jitter = 0, pch = 1, ...)

Arguments

epidata

Simulated epidemiological data - matrix consisting of person IDs, infection and recovery times, and infection source.

sampledata

Simulated genomic sample data - matrix of person IDs, sample times and genome ID. Genomic sample data simulated with full=TRUE cannot be used.

col

A vector of colors to represent increasing genetic distance.

stack

Should infectious periods be organized to minimize plot height? Alternatively, each period occupies one row.

arr.len

Arrow length. See arrows.

blockheight

The height of each bar representing infectious periods. Takes a value between 0 and 1.

hspace

Minimum horizontal space between two infectious period bars (in units of time).

labels

Labels for each infectious episode. First columns of epidata by default.

label.pos

Position of labels. Accepted values are "centre", "left" and "right".

block.col

Background color for each infectious period bar.

jitter

Amount of jitter to be applied to genome sample points (as a proportion of plot dimensions).

pch

Point type for genome samples (see par).

...

Additional arguments to be passed to plot.

Details

Graphical representation of transmission dynamics and sampled genomes. For multiple genome samples per time point, set jitter>0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(outbreak)
sampledata <- outbreak$sampledata
epidata <- outbreak$epidata

distmat <- gd(sampledata[,3], outbreak$libr, outbreak$nuc, outbreak$librstrains)

# Now pick colors for sampled isolates
colvec <- rainbow(1200)[1:1000] # Color palette
refnode <- 1 # Compare distance to which isolate?
colv <- NULL # Vector of colors for samples
maxD <- max(distmat[,refnode])

for (i in 1:nrow(sampledata)) {
  	colv <- c(colv, 
              colvec[floor((length(colvec)-1)*(distmat[refnode,i])/maxD)+1])
}

plotoutbreak(epidata, sampledata, col=colv, stack=TRUE, arr.len=0.1, 
             blockheight=0.5, hspace=500, label.pos="left", block.col="grey",
             jitter=0.004, xlab="Time", pch=1) 

seedy documentation built on May 29, 2017, 10:58 a.m.