# make up some data
sim.data <- function() rpoilog(1000, 1.0, 1.0, condS=TRUE)
otu <- data.frame(sample0=sim.data())
for (i in 1:10) otu[[paste('sample', i, sep='')]] <- sim.data()
otu.ids <- paste('otu', seq(1:1000), sep='')
rownames(otu) <- otu.ids
z.table <- z.transform.table(otu)
# pull out a quad, imagining that samples 1 and 2 were the control samples
# and 3 and 4 were the treatment
q <- quad.table(z.table, 'sample1', 'sample2', 'sample3', 'sample4')
# plot it
p <- quad.plot(q)
p
# ok, it's just a blob because we generated the data, but imagine we
# were particularly interested in OTUs that bloomed in the treatment
# but not in the control
interesting.otus <- filter(q, d.treatment > 2, d.control < 0)
# we can plot those in a different color
p + geom_point(data=interesting.otus, color='red')
# or see what their names are
head(arrange(interesting.otus, desc(d.treatment)))
Run the code above in your browser using DataLab