| title: “lab8” |
| author: “Naree Ketusing” |
| date: “October 21, 2015” |
| output: html_document |
Load package
library ("OutbreakTools")
library ("ggplot2")
library ("ape")
library ("adegenet")
library ("adephylo")
Load Data
data ("HorseFlu")
Creat Figure
figure1 = plot(HorseFlu, orderBy="yardID", colorBy="yardID", what="shedding", size=2)
Customize legends
figure1 = figure1 + scale_color_discrete("Yard identifier") + guides(col=guide_legend(ncol = 4))
figure1 = figure1 + scale_shape("Shedding data", labels=paste("sample",1:6)) + labs(x="Collection date")
Display figure
figure1
This figure shows time and temporal distribution. Dots and other shapes represent the sample collecting from influenza infected equine. Each line color represents each yard of sample collection. This figure does not show the amount of virus shedding, it only shows where samples were collected and when were collected. It is a temporal distribution graph.
Load Data
data("FluH1N1pdm2009")
attach(FluH1N1pdm2009)
## The following object is masked from package:datasets:
##
## trees
Creat obkdata object
x <- new("obkData", individuals = individuals, dna = FluH1N1pdm2009$dna, dna.individualID = samples$individualID, dna.date = samples$date, trees = FluH1N1pdm2009$trees)
## Found more than one class "multiPhylo" in cache; using the first, from namespace 'OutbreakTools'
detach(FluH1N1pdm2009)
Creat Figure
figure2 = plotggphy (x, ladderize = TRUE, branch.unit = "year", major.breaks = "1 month", axis.date.format = "%b%y", tip.color = "location", tip.size =2 , tip.alpha = 0.75)
Display figure
figure2
The H1N1 phylogenetic tree shows sample collection period and location of sampling. This phylogenetic tree explains how virus in each location are related. Even though virus was sampling during June 2009, the virus might originate since Febuary 2009. When I compare my figure with original figure, I supposed some data might be missing. Since figure 2 of paper the root start before Jan 2009, but my figure the root begins from febuary 2009.
simulate outbreak
set.seed(1)
epi = simuEpi (N=100, beta = 0.005, D=50)
Creat Basic Figure = Panel A
figure3a = epi$plot + labs(y="Number of individuals")
Display fig panel A
figure3a
This graph shows stochastic SIR model. Susceptible, infected and recovery are change based on outbreak/epidemic period
net = epi$x@contacts
Define colors and annotations
dates <- get.data(epi$x,"DateInfected")
days <- as.integer(dates-min(dates))
col.info = any2col(days, col.pal=seasun)
col.graph = col.info$col[as.numeric(get.individuals(net))]
annot = min(dates) + col.info$leg.txt
annot = format(annot, "%b%d")
Display figure
par(mar=c(.2,1,1,0.2),xpd=TRUE)
plot(net, vertex.cex=1.5, vertex.col=col.graph)
legend("topleft", fill=col.info$leg.col, leg=annot, bg=transp("white"),cex=0.75,
title="Date of infection", ncol=2, inset=c(-.02))
This outbreak shoe network model. The root or index case starts from number 1 or blue color, then disease spread to person who contact to the first case. We simulated 100 hosts, blue color represents the begining of outbreak then spread to yellow and red.
tre <- nj(dist.dna(get.dna(epi$x)$locus.1))
tre <- ladderize(tre) # ladderize the tree
tre <- root(tre,1) # root tree to first case
Display figure
par(mar=rep(2,4))
bullseye(tre, tip.color=col.info$col, circ.bg=transp("grey",0.1), font=2)
legend("bottomright", fill=col.info$leg.col, leg=annot,
bg=transp("white"),cex=1, title="Date of infection", ncol=2,inset=c(-.02) )
box("figure")
The neighbour joining phylogeny is constructed based on DNA sequencing. Getting DNA sequence from the first host until final host. First case is a root then 2nd, 3rd and 4th are surrounding which close to the root. The higher case number, the longer ladder from the begining.