1

Hy to everyone. I am new with LIMMA package in R studio and I'm encountering trouble in the following procedure:

I want to discover DEGs between two classes (SD and CR). I have a gene expression matrix of >26k genes and a info table with 79 samples. Reading LIMMA user guide (chapter 8.2), it suggests to create a design matrix with 0~factor and follow procedure:

design_resp <- model.matrix(~ 0 + factor(c(1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,
                                       1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,
                                       1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,1,2,1,
                                       1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1))) 
colnames(design_resp) <- c("gruppo_SD", "gruppo_CR")
fit <- lmFit(Gene_expression_matrix, design_resp)
contrast.matrix <- makeContrasts(gruppo_SD-gruppo_CR, levels=design_resp)
fit2 <- contrasts.fit(fit, contrast.matrix)
fit2 <- eBayes(fit2)
tabella_resp <- topTable(fit2, coef=1, n=Inf, adjust="BH")

This procedure give me these results (head) enter image description here

I found on internet another procedure, with a different model matrix creation and no contrast.matrix or contrast.fit

design_altern <- model.matrix(~ tab_info$resp_vs_non)
fit_altern <- lmFit(Gene_expression_matrix, design_altern)
fit_altern <- eBayes(fit_altern)
tabella_resp_altern <- topTable(fit_altern, coef=1, n=Inf, adjust="BH")

that give me this output:

enter image description here

Results have huge differences

Could someone please explain me what procedure is correct between these two in this situation? I think the first one, but why the second should be incorrect?

user438383
  • 5,716
  • 8
  • 28
  • 43
fpisto
  • 35
  • 3
  • In the second case, you have an intercept and coef=1 relates to this intercept. You should have the same results if you set coef=2 which related to the contrast you made in the first case – Basti Apr 06 '22 at 08:32
  • Please see this great paper which simply explain everything about design matrices : https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7873980/ – Basti Apr 06 '22 at 08:34
  • I checked and is correct, with coef = 2 I obtained same 1 case results. In other words with coef = 1 in second case I'm referring to the intercept? – fpisto Apr 06 '22 at 08:37
  • Yes, if you check in the design matrix in the second case, there should be two columns : Intercept and tab_info$resp_vs_non. In this case coef=1 will refer to the first column of your design matrix i.e. "intercept" while coef=2 will refer to the second column, i.e. "tab_info$resp_vs_non" – Basti Apr 06 '22 at 08:44

0 Answers0