Question: Small differences in limma with and without contrast matrix
0
4 weeks ago by
Jake60
United States
Jake60 wrote:

Hi,

I am doing pairwise RNA-Seq comparisons between 3 groups in limma. Looking at the manual it seems like this is best done with the contrasts. However, I wanted to compare the results using contrasts with the results doing just group 1 vs group 2 in limma. I've noticed some differences in the differential expression results. I understand the P values might be different due to slightly different variance estimates due to the counts from group 3. However, I noticed that some of the fold changes are slightly different and I don't understand why that would be.

Thanks

   > design
Group1 Group2 Group3
1    0    1   0
2    0    0   1
3    0    0   1
4    0    1   0
5    1    0   0
6    1    0   0
7    0    1   0
8    0    1   0
9    0    0   1
10   0    0   1

v <- voom(count_mat_filtered, design, plot = T)

contrast.matrix <- makeContrasts(
Group1 - Group2,
Group1 - Group3,
Group2 - Group3,
levels = design)
fit <- lmFit(v, design)
fit2 <- contrasts.fit(fit, contrast.matrix)
fit2 <- eBayes(fit2)
Group1_Group2 <- topTable(fit2, coef = 1, number = nrow(count_mat_filtered))

> design2
Group2 Group1
1     1    0
2     1    0
3     0    1
4     0    1
5     1    0
6     1    0

v2 <- voom(count_mat_filtered2, design2, plot = T)

fit3 <- lmFit(v2, design2)
fit3 <- eBayes(fit3)
topTable(fit3, coef = ncol(design2))
Group1_Group2 <- topTable(fit3, number = nrow(count_mat_filtered2))

limma • 58 views
modified 4 weeks ago by Aaron Lun24k • written 4 weeks ago by Jake60
Answer: Small differences in limma with and without contrast matrix
2
4 weeks ago by
Aaron Lun24k
Cambridge, United Kingdom
Aaron Lun24k wrote:

The linear model fit (and thus the log-fold change) depends on the weights. The weights will change when you apply voom on a subset of the data. This is because the weights are dependent on the variance estimates, which are affected by the samples in group 3.