Hi!

I need to run a GSEA analysis on distinct lists of pre-ranked DEG, as well as diverse lists of gene sets obtained from MSigDB.
To run the analysis using one pre-ranked list and one gene set, the code is:

fgsea_results <- fgsea(kegg.db, #Gene set
                                   b, #List of pre-ranked DEG
                                   minSize = 15, 
                                   maxSize = 500, 
                                   nPerm = 10000
                                   )

To follow good practices in code writing and, also, for avoid DRY I figured out that I need to build a for loop to run the analysis in all my pre-ranked lists or the gene sets.
A first attempt to build a for loop was the next

for (samples in c(a, b, c, d)) {
   fgsea(kegg.db, #Gene set
             samples, #List of pre-ranked DEG
             minSize = 15, 
             maxSize = 500, 
             nPerm = 10000
              )}

However, there's something I missed cause result was not successful.
I need your help to solve this issue.

Best regards!
Rodolfo



Source link