Greetings! Hope you all doing well :)
I have a question regarding extracting differentially expressed genes identified with the global method of the decideTests
function from limma. I have 7 contrasts that are related to each other. From the user guide, it is advised to adjust for BETWEEN cotnrasts as well in cases like mine using method="global"
. I found an answer in other posts that the results from decideTests
can be extracted using the write.fit
function from limma as follows :
write.fit(fit3, adjust="BH", method="global", file="globalDEresults.txt")
However, I have 2 questions about this method:
1) Using write.fit
function outputs a large file for ALL contrasts with their log fold change, p values, t statistcs and adjusted p-values in ONE file. This requires more work to make it tidy per contrast. Normally speaking(if method=separate
), topTable
function would allow me to extract results per contrast by changing the coef option as follows:
dpe_ckd_alone<-topTable(fit3, coef="CKD_alonevsNoCOM",number = nrow(fit3))
So, my question is: is there a similar method to toptable when you are correcting for between contrasts using method=global
from decidetests
? Otherwise, how would you extract results(including log fold changes, p values etc) per contrasts easily and assign them to an object?
2) If I don't want to extract the results directly to excel or txt file, but would rather want to manipulate it in R before exporting it, Is it possible to assign the data to an object? because if I write the follwoing code :
my_df<-write.fit(fit, results=resultsG, adjust="BH", method="global", file="globalDEresults.txt")
I get an empty object, which is to be expected as write.fit
is intended to export results and not to assign them to an object?
Thank you very much in advance! Best, Ridha
I have exactly the same problem! I just want to get the genes from the decideTest using method=global!!
I've got it! https://bioconductor.org/packages/devel/workflows/vignettes/RNAseq123/inst/doc/limmaWorkflow.html
here's the answer The top DE genes can be listed using topTreat for results using treat (or topTable for results using eBayes). By default topTreat arranges genes from smallest to largest adjusted p-value with associated gene information, log-FC, average log-CPM, moderated t-statistic, raw and adjusted p-value for each gene. The number of top genes displayed can be specified, where n=Inf includes all genes. Genes Cldn7 and Rasef are amongst the top DE genes for both basal versus LP and basal versus ML.