This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tool: rsfgsea: Rust implementation of preranked GSEA built for large transcriptome workflows where GSEA became the bottleneck

Hi,

I am sharing rsfgsea, a Rust implementation of preranked GSEA built for a large transcriptome analysis workflow where GSEA had become a bottleneck.

The goal was not to replace fgsea as a method, but to provide a faster implementation while staying as close as possible to fgsea results. rsfgsea has Rust crate, CLI, Python and R bindings. Max absolute difference from R fgsea is around 5e-9 for ES, NES, p-value, and padj. Benchmark speedups from about 3x to 21.5x, depending on workload. Also it has experimental hybrid CPU/GPU path.

Install Python binding

pip install rsfgseapy

Minimal Python usage:

import rsfgseapy

res = rsfgseapy.run_gsea_py(
    ranks=ranks,
    gmt_path="pathways.gmt",
)

I would be interested in feedback on:

  • whether this looks useful beyond a single pipeline

  • whether the parity and benchmark results are convincing

  • what would be important to see before a small software paper

  • whether the hybrid CPU/GPU direction is interesting in practice

Comments from users of GSEA in real workflows would be especially helpful.

rust python gsea tool fgsea

1 answer

I think it would be good to have some awareness that pre-ranked GSEA is very different in statistical behaviour from the original published GSEA method, which was based on sample permutation. There have never been any publications supporting the pre-ranked GSEA statistical method, and it is known in some circles to give spectacularly inflated statistical significance. You say on your github page that rsfgsea and fgsea use a "robust statistical model", but I do not think there is any published literature supporting that remark. Robust to what and according to whom? We have shown in unpublished work that pre-ranked GSEA is spectacularly non-robust to inter-gene correlations https://genome-2026.p.asnevents.com.au/days/2026-02-16/abstract/133160.

See https://support.bioconductor.org/p/9158100/ for more discussion.

Try out this experiment: take any large human expression dataset. Randomly split it into two sets of samples. Use fgsea or rsfgsea to do a pathway analysis between the two random sets.

You discuss accuracy in terms of absolute differences, but relative differences might be more relevant for very small p-values. fgsea often gives very small p-values like 1e-30, especially for larger gene sets. How close an approximation is rsfgsea in cases like that?

Thanks, these are fair and important points.

My goal with rsfgsea is much narrower than validating preranked GSEA as a statistical framework. It is primarily a high-performance implementation of fgsea-style preranked GSEA, with a focus on numerical agreement, reproducibility, and runtime in larger workflows.

I agree that fgsea is often used in correlation-prone settings such as differential expression workflows, and I have therefore replaced “robust statistical method” with “widely used” in the GitHub description.

On the implementation side, I am already checking relative differences in the low-p tail.

Thanks again for the comment and for pointing to these alternatives.

I rechecked this on synthetic low-p benchmark cases spanning approximately 1e-20 down to 1e-125, with matched seed handling on both sides, and in that setting the p-values were effectively identical to machine precision.

Log in to answer this question.