How to apply enrichGO over a list
1
0
Entering edit mode
2.7 years ago
barix ▴ 20

Hi all!

I have a list of 16 elements each containing DEx genes between our control and experimental groups

list of DEGs

I would like to do enrichment analysis using enrichGO function from clusterProfiler for each (total 16). How can I apply enrichGO function on each of these from the list (using lapply or for loop in R) so I don't have to do it individually 16 times.

The goal is to get a new list with 16 elements each containing enrichGO results for each of the elements from DEG list.

Can someone help with the code?

Thank you!!

enrichGO clusterprofiler loop R • 1.4k views
ADD COMMENT
3
Entering edit mode
2.7 years ago

Using for loop:

GOres = list() # define an empty list to store the for loop output from each interation
for(i in 1:length(DEG)) {
  GOres[[i]] = enrichGO(gene          = DEG[[i]],
                        universe      = allExpressedGene, #provide all genes with expression in your experiment/or skip this
                        OrgDb         = org.Hs.eg.db, # assumed the data is coming from human
                        ont           = "CC", # check other options like MF and BP 
                        pAdjustMethod = "BH",
                        pvalueCutoff  = 0.01,
                        qvalueCutoff  = 0.05,
                        readable      = TRUE)
}
ADD COMMENT
0
Entering edit mode

Thank you very much!

ADD REPLY

Login before adding your answer.

Traffic: 2001 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