limma: correct design matrix and topTable for 2 way comparison
0
0
Entering edit mode
2.5 years ago
erica.fary ▴ 20

Dear All,

A naive question, but I am facing an issue regarding the design matrix and the intercept when conducting differential expression analysis within the limma/edge framework. And then how to set the "coef" in TopTable accordingly.

I would like to do a simple DE analysis between 2 groups (cond1, cond2) from gene expression matrices (cond1_dt and cond2_dt, respectively; cond12_dt being cbind of the two - both have same genes in rows)

Could someone explain me the differences among the 6 "res_de_1/2a/b/c" result tables here below ? And most importantly what would be the best way to proceed ?

cond12_dt <- cond12_dt[,c(colnames(cond1_dt), colnames(cond2_dt))]

sub_labs <- factor(c(rep(cond1, ncol(cond1_dt)),rep(cond2, ncol(cond2_dt))), levels=c(cond1, cond2))
design <- model.matrix(~ sub_labs)
v <- voom(cond12_dt, design, plot=FALSE)
fit <- lmFit(v, design)
eb_fit <- eBayes(fit)
res_de_1a <- topTable(eb_fit,  adjust.method="BH", coef=ncol(v$design), number=Inf, sort.by="p")
res_de_1b <- topTable(eb_fit,  adjust.method="BH", number=Inf, sort.by="p")
res_de_1c <- topTable(eb_fit,  adjust.method="BH", coef=1, number=Inf, sort.by="p")

sub_labs <- factor(c(rep(cond1, ncol(cond1_dt)),rep(cond2, ncol(cond2_dt))), levels=c(cond1, cond2))
design <- model.matrix(~ 0+sub_labs)
v <- voom(cond12_dt, design, plot=FALSE)
fit <- lmFit(v, design)
eb_fit <- eBayes(fit)
res_de_2a <- topTable(eb_fit,  adjust.method="BH", coef=ncol(v$design), number=Inf, sort.by="p")
res_de_2b <- topTable(eb_fit,  adjust.method="BH", number=Inf)
res_de_2c <- topTable(eb_fit,  adjust.method="BH", coef=1, number=Inf)


# res_de_1b = res_de_1a
# res_de_1c similar but not equal res_de_2a
# res_de_1c similar = res_de_2b (with 2 cols)
# res_de_1c = res_de_2c

I would be grateful if anyone could help

thanks in advance

erica

edge R differential RNA-seq limma expression • 645 views
ADD COMMENT

Login before adding your answer.

Traffic: 2656 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6