name of the sample (in the OTU table) from the control
unit before the treatment is applied to the treatment unit
control.after
sample from the control unit after treatment is applied
treatment.before
sample from the treatment unit before the treatment is applied
treatment.after
sample from the treatment unit after the treatment is applied
quad
a quad generated by quad.table
Details
texmexseq was designed to compare four samples at a time: two are “control” samples
(before and after the treatment was applied to the “treatment” samples), the other two are
the treatment samples.
quad.table will grab the columns with the four given names and make them into a new
data frame (with OTU IDs kept as a separate column). This object can be plugged into quad.plot
for viewing. quad.plot expects that the OTU table will be z- or F-transformed.
# 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)))