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)
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:
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?