Tidying method for a MA list
Tidy an EList expression object
"tidy"(x, intercept = FALSE, ...)
"augment"(x, data, ...)
"glance"(x, ...)
"tidy"(x, ...)
"tidy"(x, addTargets = FALSE, ...)
MArrayLM
, MAList
, Elist
object(Intercept)
term should be included
(default FALSE)augment
returns only
the computed per-gene statisticstidy
returns one row per gene per coefficient. It always
contains the columns
eBayes
, it may also
contain
augment
returns one row per gene, containing the original
gene expression matrix if provided. It then adds columns containing
the per-gene statistics included in the MArrayLM object, each prepended
with a .:
lmFit
and eBayes
:
glance
returns one row, containing
tidy
returns a data frame with one row per gene-sample
combination, with columns
tidy
returns a data frame with one row per gene-sample
combination, with columns
weights
is setaddTargets
is setaugment
output has more rows
than the tidy
output. This is a side effect of the fact that the
input to limma is not tidy but rather a one-row-per-gene matrix).
if (require("limma")) {
# create random data and design
set.seed(2014)
dat <- matrix(rnorm(1000), ncol=4)
dat[, 1:2] <- dat[, 1:2] + .5 # add an effect
rownames(dat) <- paste0("g", 1:nrow(dat))
des <- data.frame(treatment = c("a", "a", "b", "b"),
confounding = rnorm(4))
lfit <- lmFit(dat, model.matrix(~ treatment + confounding, des))
eb <- eBayes(lfit)
head(tidy(lfit))
head(tidy(eb))
if (require("ggplot2")) {
# the tidied form puts it in an ideal form for plotting
ggplot(tidy(lfit), aes(estimate)) + geom_histogram(binwidth=1) +
facet_wrap(~ term)
ggplot(tidy(eb), aes(p.value)) + geom_histogram(binwidth=.2) +
facet_wrap(~ term)
}
}
Run the code above in your browser using DataLab