Skip to main content

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"
  • nPermSimple
  • nperm
  • minSize
  • maxSize
  • sampleSize
  • scoreType
  • gseaParam

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,
    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"])

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 nperm forces simple-mode execution instead of multilevel refinement
  • leave this as None unless you intentionally want simple mode

Practical rule:

  • light users: keep nperm=None
  • use nPermSimple to tune the default wrapper behavior
  • only set nperm when you deliberately want fixed-permutation simple execution

Returned Results

Each result row is a dictionary with:

  • pathway
  • size
  • es
  • nes
  • pval
  • padj
  • log2err
  • leading_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

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

rsfgseapy-0.2.4.tar.gz (558.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rsfgseapy-0.2.4-cp313-cp313-win_amd64.whl (315.9 kB view details)

Uploaded CPython 3.13Windows x86-64

rsfgseapy-0.2.4-cp313-cp313-macosx_11_0_arm64.whl (431.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rsfgseapy-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (492.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file rsfgseapy-0.2.4.tar.gz.

File metadata

  • Download URL: rsfgseapy-0.2.4.tar.gz
  • Upload date:
  • Size: 558.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rsfgseapy-0.2.4.tar.gz
Algorithm Hash digest
SHA256 c083897a0d499841b4adab6e723473243605ef19a8e4c15ef2f97ef0836e03c8
MD5 1b54ff9e5a802101bc129ffdc5f780dc
BLAKE2b-256 3934cdf2996700b2900eaaa268d63881b4b4f409895b9c48e09d11a106b00e29

See more details on using hashes here.

Provenance

The following attestation bundles were made for rsfgseapy-0.2.4.tar.gz:

Publisher: pypi-publish.yml on deminden/rsfgsea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rsfgseapy-0.2.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rsfgseapy-0.2.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 315.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rsfgseapy-0.2.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fca4165bf0f48a7ec321a650dff24ffd5fae49184ca58a0fb9daf0eb7b73774f
MD5 4a471bc134b36c79b22e845171d23984
BLAKE2b-256 188046010f5e280939d7b6a50892033d540808619ebafd12c89752982d5cb2ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for rsfgseapy-0.2.4-cp313-cp313-win_amd64.whl:

Publisher: pypi-publish.yml on deminden/rsfgsea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rsfgseapy-0.2.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rsfgseapy-0.2.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c63a5920a46619f0a5255c5f5215a8bd71b17b7489c06e83d8bb033e78ef722
MD5 110e73328281d376ee81475d1b74e5d0
BLAKE2b-256 c6df86f55a3950928c29bae6afd7d8ff8f5d6b0ba30c2412af520a508c2d23d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rsfgseapy-0.2.4-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: pypi-publish.yml on deminden/rsfgsea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rsfgseapy-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rsfgseapy-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92693f16296a246ec1ef0ca313c189f66e71ab2356864fc3398c32d3d84d6e4c
MD5 53b621f4a3e6e09a4b5f5d8eb460a809
BLAKE2b-256 1abd25bc505dbf978dfb7b1ae4ab3431024229e2e0ef658fc3bd436b999745c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rsfgseapy-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi-publish.yml on deminden/rsfgsea

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page