Fast Gene Set Enrichment Analysis in Rust (Python bindings)
Project description
rsfgseapy
Python bindings for rsfgsea, a Rust implementation of preranked fgsea-compatible gene set enrichment analysis.
What It Exposes
The package currently exposes one public entrypoint:
run_gsea_py(...)
The API intentionally keeps fgsea-style parameter names and execution modes:
mode="fgsea"mode="simple"mode="multilevel"nPermSimpleseednpermminSizemaxSizesampleSizescoreTypegseaParam
Installation
From PyPI:
pip install rsfgseapy
From a repository:
git clone https://github.com/deminden/rsfgsea
cd rsfgsea
cd crates/rsfgseapy
maturin develop --release
Input Shape
ranks
- Python mapping of
gene -> score - values must be finite numeric scores
gmt_path
- path to a GMT file
Minimal Example
For most users, wrapper mode with defaults is the right starting point.
import rsfgseapy
results = rsfgseapy.run_gsea_py(
ranks={"GENE_A": 2.0, "GENE_B": 1.0, "GENE_C": -1.0, "GENE_D": -2.0},
gmt_path="pathways.gmt",
)
for row in results:
print(row["pathway"], row["pval"])
Full Example
import rsfgseapy
ranks = {
"GENE_A": 3.2,
"GENE_B": 1.7,
"GENE_C": -2.4,
"GENE_D": -3.1,
}
results = rsfgseapy.run_gsea_py(
ranks=ranks,
gmt_path="pathways.gmt",
mode="fgsea",
gpu=False,
nPermSimple=1000,
seed=None,
nperm=None,
minSize=1,
maxSize=None,
eps=1e-50,
sampleSize=101,
scoreType="std",
gseaParam=1.0,
nproc=0,
)
for row in results:
print(row["pathway"], row["nes"], row["pval"])
Plotting
import rsfgseapy
rsfgseapy.write_enrichment_plot_png_py(
ranks={"GENE_A": 2.0, "GENE_B": 1.0, "GENE_C": -1.0, "GENE_D": -2.0},
pathway_genes=["GENE_A", "GENE_B"],
output_path="enrichment.png",
pathway_name="PW_A",
dpi=300,
title="PW_A",
)
For multi-pathway summaries:
import rsfgseapy
rsfgseapy.write_gsea_table_plot_png_py(
ranks={"GENE_A": 2.0, "GENE_B": 1.0, "GENE_C": -1.0, "GENE_D": -2.0},
pathways=[("PW_A", ["GENE_A", "GENE_B"]), ("PW_B", ["GENE_C", "GENE_D"])],
results=[
{"pathway": "PW_A", "nes": 1.5, "pval": 0.01, "padj": 0.02},
{"pathway": "PW_B", "nes": -1.4, "pval": 0.03, "padj": 0.05},
],
output_path="table.png",
dpi=300,
)
All plotting parameters are available in the Python API; the examples above keep only the most common publication-oriented overrides visible.
For the full cross-interface plotting guide, see:
nPermSimple vs nperm
These two names come from fgsea and they are not interchangeable.
nPermSimple
- the normal simple-stage permutation count
- used by default in wrapper mode
- tune this when you want a different wrapper screening budget
nperm
- explicit fixed-permutation override
- in wrapper mode, setting
npermforces simple-mode execution instead of multilevel refinement - leave this as
Noneunless you intentionally want simple mode
Practical rule:
- leave
seed=Nonefor a fresh random run, or setseed=<int>for reproducibility - light users: keep
nperm=None - use
nPermSimpleto tune the default wrapper behavior - only set
npermwhen you deliberately want fixed-permutation simple execution
Returned Results
Each result row is a dictionary with:
pathwaysizeesnespvalpadjlog2errleading_edge
leading_edge is returned as a Python list of genes.
GPU Support
gpu=True enables the hybrid GPU path when the extension is built with the gpu feature.
Current behavior:
- GPU accelerates simple-stage screening
- CPU performs parity-focused multilevel refinement
If the extension is built without GPU support, gpu=True raises a runtime error.
Supported Python Versions
The package metadata currently targets Python 3.8 and newer.
Project Links
- Repository: https://github.com/deminden/rsfgsea
- Main project docs: https://github.com/deminden/rsfgsea/tree/main/docs
- Rust crate: https://crates.io/crates/rsfgsea
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rsfgseapy-0.3.3.tar.gz.
File metadata
- Download URL: rsfgseapy-0.3.3.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc16134ed3dfcc232a27c7edca212fbf31bb0d03fe7382907358a0659590974
|
|
| MD5 |
818f089186f296698c88101b9412609a
|
|
| BLAKE2b-256 |
a83f3e8907ff855fa7ed174b2020b11fbd4a88ff59c9ca42c463bdfea90132c4
|
Provenance
The following attestation bundles were made for rsfgseapy-0.3.3.tar.gz:
Publisher:
pypi-publish.yml on deminden/rsfgsea
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rsfgseapy-0.3.3.tar.gz -
Subject digest:
9dc16134ed3dfcc232a27c7edca212fbf31bb0d03fe7382907358a0659590974 - Sigstore transparency entry: 1283186105
- Sigstore integration time:
-
Permalink:
deminden/rsfgsea@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/deminden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rsfgseapy-0.3.3-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: rsfgseapy-0.3.3-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf20730ce30714529ed3572dd930c51c99c4defc67935267c5780b0aaafd3b3a
|
|
| MD5 |
ba32f94770a95fa942ae37843bb3d5d0
|
|
| BLAKE2b-256 |
bc0ac7e5c43bce0ef93245caa1222634b50ba5f7c4af4d0a933e6b425030139b
|
Provenance
The following attestation bundles were made for rsfgseapy-0.3.3-cp313-cp313-win_amd64.whl:
Publisher:
pypi-publish.yml on deminden/rsfgsea
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rsfgseapy-0.3.3-cp313-cp313-win_amd64.whl -
Subject digest:
cf20730ce30714529ed3572dd930c51c99c4defc67935267c5780b0aaafd3b3a - Sigstore transparency entry: 1283186120
- Sigstore integration time:
-
Permalink:
deminden/rsfgsea@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/deminden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rsfgseapy-0.3.3-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: rsfgseapy-0.3.3-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dd8c9ce48bce8ee02e6a6a964cd734b53079c6c6c464648cb5a3f51c19be01b
|
|
| MD5 |
80b1380bd98973bd4465d010f006e3f5
|
|
| BLAKE2b-256 |
4ea78305bc3d7a763290b028c6c1c12c656e04f0307a7553b6322b87961fac8a
|
Provenance
The following attestation bundles were made for rsfgseapy-0.3.3-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
pypi-publish.yml on deminden/rsfgsea
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rsfgseapy-0.3.3-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
8dd8c9ce48bce8ee02e6a6a964cd734b53079c6c6c464648cb5a3f51c19be01b - Sigstore transparency entry: 1283186111
- Sigstore integration time:
-
Permalink:
deminden/rsfgsea@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/deminden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rsfgseapy-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rsfgseapy-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
972be8158c44083475979e03562c695a39304639e1b7d3919b613443d49d7dc1
|
|
| MD5 |
7595472a9b0b89d3836a165a6ce350e8
|
|
| BLAKE2b-256 |
a8b803861f3ad2a7daad064cd2e58c8d10b041e4c3b8c415cf83d7a5a9fc8f6b
|
Provenance
The following attestation bundles were made for rsfgseapy-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
pypi-publish.yml on deminden/rsfgsea
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rsfgseapy-0.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
972be8158c44083475979e03562c695a39304639e1b7d3919b613443d49d7dc1 - Sigstore transparency entry: 1283186107
- Sigstore integration time:
-
Permalink:
deminden/rsfgsea@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/deminden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@ee848e6ac9ff37a055eae1fe11d19f532922e819 -
Trigger Event:
push
-
Statement type: