how can FDR be greater than 1, webgestaltpy 0.3.1

21 views
Skip to first unread message

Klara Kuret

unread,
Apr 8, 2025, 11:20:10 AMApr 8
to webgestalt
Hi!

Today I have tried to use the webgestaltpy 0.3.1 for GSEA, and I was surprised to see that the reported FDR values exceed 1. What is going on there, is his expected? Should I do the adjustment myself?

I checked the github, and even in the script comments(https://github.com/bzhanglab/webgestaltpy/blob/master/src/lib.rs) example the FDR exceeds 1. I paste the script comment example below:

/// # Example
///
/// ```python
/// import webgestaltpy
///
/// res = webgestaltpy.gsea("kegg.gmt", "example_ranked_list.rnk")
///
/// print(res[0:2]) # print first two results
/// ```
///
/// **Output**
///
/// ```
/// [
///   {
///     'set': 'has00010',
///     'p': 0.353,
///     'fdr': 1.276048474073356,
///     'es': 0.40653028852961814,
///     'nes': 1.07659486501464,
///     'leading_edge': 24
///   },
///   {
///     'set': 'has00020',
///     'p': 0,
///     'fdr': 0.028834551777982824,
///     'es': 0.6216527702210619,
///     'nes': 1.5721004858071521,
///     'leading_edge': 20
///   }
/// ]
/// ```

John Elizarraras

unread,
Apr 8, 2025, 11:33:21 AMApr 8
to webgestalt
I would not do the adjustment using the p values, because the FDR is calculated by using the NES values of the real list vs. the random permutations. It is technically possible to have an FDR > 1 due to the way it is calculated (it would have to be a really poorly enriched set, especially since the random permutations would have higher enrichment). In the older R package, any FDR >1 would be reduced back down to 1.0. I previously left the FDR untouched in the Python package, but I do think it might be confusing. I created a GitHub issue to track this: https://github.com/bzhanglab/webgestalt_rust/issues/27. I think I will have these FDRs be reduced to 1.0.

Best,
John

John Elizarraras

unread,
Apr 8, 2025, 1:53:17 PMApr 8
to webgestalt
This has been fixed in webgestaltpy 0.3.2. You can install using pip install webgestaltpy.

Klara Kuret

unread,
Apr 9, 2025, 3:26:20 AMApr 9
to webgestalt
Thank you very much for the explanation and the fix.

Kind regards,
Klara

torek, 8. april 2025 ob 19:53:17 UTC+2 je oseba John Elizarraras napisala:
Reply all
Reply to author
Forward
0 new messages