Differential Expression Analysis with limma in R
John Blischak
Instructor
$$ Y = \beta_0 + \beta_1 X_1 + \epsilon $$
$$ Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \epsilon $$
$$ Y = \beta_1 X_1 + \beta_2 X_2 + \epsilon $$
$$ Y = \beta_1 X_1 + \beta_2 X_2 + \beta_3 X_3 + \epsilon $$
design <- model.matrix(~0 + er, data = pData(eset))
head(design)
ernegative erpositive
VDX_3 1 0
VDX_5 0 1
VDX_6 1 0
VDX_7 1 0
VDX_8 1 0
VDX_9 0 1
colSums(design)
ernegative erpositive
135 209
library(limma)
cm <- makeContrasts(status = erpositive - ernegative,
levels = design)
cm
Contrasts
Levels status
ernegative -1
erpositive 1
fit <- lmFit(eset, design)
head(fit$coefficients, 3)
ernegative erpositive
1007_s_at 11.725148 11.823936
1053_at 8.126934 7.580204
117_at 7.972049 7.798623
fit2 <- contrasts.fit(fit, contrasts = cm)
head(fit2$coefficients, 3)
Contrasts
status
1007_s_at 0.09878782
1053_at -0.54673000
117_at -0.17342654
# Calculate the t-statistics
fit2 <- eBayes(fit2)
# Count the number of differentially expressed genes
results <- decideTests(fit2)
summary(results)
status
-1 6276
0 11003
1 5004
Differential Expression Analysis with limma in R