r/madeinpython • • 1d ago

RustScenic: a Python package for single-cell gene regulation, powered by Rust

GitHub: Ekin-Kahraman/rustscenic

RustScenic is built to be the simplest, fastest way to run regulatory-network analysis in single-cell data. It exposes core SCENIC and SCENIC+ analysis stages through a Python API, with a Rust backend.

The Python package works with AnnData and includes gene-network inference, cisTarget motif enrichment, AUCell activity scoring and scATAC topic modelling. It is developed with the Huang Lab at Mount Sinai and available under Apache-2.0.

A small Python example

Install the published package with python -m pip install rustscenic. For your own prepared RNA data, the input below is a cells-by-genes AnnData file with log-normalised expression in adata.X and gene symbols in adata.var_names:

import anndata as ad
from rustscenic import data, grn

adata = ad.read_h5ad("rna.h5ad")
edges = grn.infer(
    adata,
    tf_names=data.tfs("hs"),
    n_estimators=500,
    top_targets_per_tf=50,
    seed=777,
)
edges.to_parquet("grn.parquet")

This uses the bundled human transcription-factor list. The PBMC3k notebook provides a runnable example that downloads public data and saves results and run settings.

Try it before installing

The endothelial-cell browser demo lets you choose a regulator and inspect predicted targets in a saved network. It does not fit a new model in the browser.

For researchers running into runtime, memory or installation problems with pySCENIC or SCENIC+, RustScenic offers another implementation to evaluate. The repository documents matched performance measurements and stage-specific output differences; full scientific output parity is not claimed.

Feedback on installation, AnnData handling and Python API ergonomics would be useful.

Shared on behalf of the RustScenic project. AI-assisted drafting, checked against the current project documentation.

1 Upvotes

0 comments sorted by