Dear community,

I'm searching for a R package for performing enrichment and depletion analysis of user-defined pathways (e.g. in gmt format) using an empirical p-value calculated from a permutation test (i.e. random sampling the same number of genes as the user submitted gene set from the background set e.g. 1000 times and testing the intersection with the pathway set for each pathway). Can you please help? If I don't find it, I'll generate a custom function, but I find weird that a package like that does not exist. Thanks in advance

Thanks for your answer but as far as I know this cannot perform depletion analysis, correct?

You can also use the base R function

`stats::phyper`

which lets you calculate a p-value for underrepresentation`lower.tail=TRUE`

or overrpresentation`lower.tail=FALSE`

.