# NOT RUN {
## LOAD DATA ##
data(ToyOutbreakRaw)
attach(ToyOutbreakRaw)
## CONSTRUCTING AN OBKDATA OBJECT ##
x <- new ("obkData", individuals=individuals, records=records,
contacts=contacts, contacts.start=contacts.start,
contacts.end=contacts.end, dna=dna,
dna.individualID=dna.info$individualID,
dna.date=dna.info$date, sample=dna.info$sample, trees=trees)
detach(ToyOutbreakRaw)
## EXAMINING THE OBJECT ##
head(x@individuals)
names(x@records)
lapply(x@records, head)
x@contacts
x@dna
x@trees
## HEAD, TAIL, SUMMARY ##
head(x)
tail(x)
summary(x)
## ACCESSORS
get.nlocus(x)
get.locus(x)
get.nindividuals(x)
head(get.individuals(x))
get.individuals(x, data="contacts")
get.nsequences(x)
get.dna(x, locus="gene2")
get.dna(x, locus=1)
head(get.data(x, "Fever"))
head(get.data(x, "Age", showSource=TRUE))
head(get.data(x, c("Age","Sex", "infector"), showSource=TRUE))
## GRAPHICS ##
## default plot (timeline of information) ##
plot(x)
plot(x, colorBy='Sex')
plot(x, colorBy='Sex', orderBy='Sex')
plot(subset(x, 1:50), colorBy='Sex', size=4)
## plot contacts ##
plot(x, "contacts", main="Contacts")
# }
# NOT RUN {
## visualize data on a map ##
plot(x,'geo',location=c('lon','lat'),zoom=15,colorBy='Sex')
## plot the tree ##
plotggphy(x)
plotggphy(subset(x, 1:50), tip.color="Sex", color.pal="Set1")
# }
Run the code above in your browser using DataLab