This is a test version of Biostars. For the public version, visit https://www.biostars.org.
clusterProfiler GSEA function set seed

Hi, everyone, I am using R clusterProfiler package to do GSEA analysis. Following is my code,

        GSEA_GO_BP <- GSEA(cor_sort, 
                exponent = 1, 
                nPerm = 1000, 
                minGSSize = 10, 
                maxGSSize = 500, 
                pvalueCutoff = 1, 
                pAdjustMethod = "BH",
                seed=FALSE,
                TERM2GENE=GO_BP)

I got one question. No matter whether I set seed TRUE or FALSE, GSEA results always changed. I just can't get a reproducible result. Did i set seed in a wrong way? I also see someone else posted the same question, but still no answer.

Thanks in advance.

r clusterprofiler

Have you been able solve it? I am having the same issue, and I think it's really important. Every time I run it GSEA using GO and cluster profiler, it give me a different set of enrichment. Please let me know if you figured it out. That will be a great help! Thank you!

Sorry, I still don't know how to figure it out.

1 answer

hey! I had the same issue and I fixed it by adding set.seed(1234) before the function, and then seed = T within the function. You should get the same results now.

set.seed(1234)
GSEA_GO_BP <- GSEA(cor_sort, 
                exponent = 1, 
                nPerm = 1000, 
                minGSSize = 10, 
                maxGSSize = 500, 
                pvalueCutoff = 1, 
                pAdjustMethod = "BH",
                seed=TRUE,
                TERM2GENE=GO_BP)

If this doesn't solve the issue, I strongly recommend to alert the author of the package directly. Actually, I suspect it's a problem with the fgsea algorithm, according to this issue, the solution proposed by brivero should hold up.

Log in to answer this question.