seedy-package: Simulation of Evolutionary and Epidemiological Dynamics

Description Details Author(s) Examples

Description

A package of functions to simulate, visualize and assess epidemiological and pathogen genomic sample data collected during an outbreak.

Details

Package: seedy
Type: Package
Version: 1.3
Date: 2015-11-06
License: GPL-3

Author(s)

Colin Worby ([email protected])

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Load within host data
data(withinhost)
	
# Calculate genetic distance matrix
Gmat <- gd(withinhost$obs.strain, withinhost$libr, withinhost$nuc, 
           withinhost$librstrains)

# Set colors
colvec <- rainbow(1200)[1:1000] # Color palette
coltext <- rep("black", length(colvec)) # Corresponding text colors
coltext[680:970] <- "white" # White text for darker background colours

# Plot distance matrix
plotdistmat(Gmat, colvec, coltext, pos="bottomleft", labels=NULL, numbers=TRUE)
	
# Load outbreak data
data(outbreak)
sampledata <- outbreak$sampledata
epidata <- outbreak$epidata

# Calculate distance matrix for observed samples
distmat <- gd(sampledata[,3], outbreak$libr, outbreak$nuc, outbreak$librstrains)

# Now pick colors for sampled isolates
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.