I would like to do a simple GO enrichment analysis with topGO. In theory I believe this should be possible with a simple "classic fisher" test.
However, I am not only interested in GO terms that are significantly enriched in significant genes, but also GO terms that are significantly depleted. While I could not find any details on this in the documentation, it seems that topGO only does a single-tailed test, so these don't seem to come up.
I did find a workaround by reversing the geneSelectionFun, essentially checking for an enrichment of certain categories in non-significant genes. However, I am not sure whether this doesn't violate some assumptions in the underlying statistics, so I would prefer to just do a proper two-tailed test.
Is this possible, and if so, how?
Why would it make more sense to test separately? Wouldn't two separate one-tailed tests actually overestimate significance, which we would have to correct for again? It definitely feels "statistically cleaner" to me to do a two-tailed test for significance first and then check the direction afterwards.
I'll have a look at GOstats, thanks. However, if there is a way to do this with topGO I'd be happy to hear about it, since I'd prefer to use this instead.
Fair enough, it would be logical to do a two-tailed test, provided that you check the direction for significant terms afterwards.
I was concerned that the two-tailed Fisher test gives no output other than a p-value and therefore doesn't distinguish between enrichment and depletion.