Quickstart¶
Infer a gene network and score candidate gene-set activity with v0.7.0. Start with Installation, or run PBMC3k for a complete example that downloads its own data.
Run the PBMC3k notebook in Colab to install the published package, fit a small GRN, score candidate gene sets and export your results. It uses public count data and does not perform motif filtering or biological validation.
Prepare your input¶
Use an RNA AnnData file (rna.h5ad) with:
- Cells as rows and genes as columns.
- Log-normalised expression in
adata.X. If it is in a layer, setadata.X = adata.layers["logcounts"]using your layer's name. - Gene symbols matching your TF list. Use
data.tfs("hs")for human ordata.tfs("mm")for mouse.
For Ensembl-indexed AnnData, RustScenic can resolve gene symbols from
adata.var["feature_name"]. For R inputs, see the
Seurat / R guide for explicit RNA layer selection and a
sparse matrix round-trip.
Python¶
import anndata as ad
from rustscenic import aucell, 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,
)
regulons = {
tf: group["target"].tolist()
for tf, group in edges.groupby("TF")
if len(group) >= 10
}
auc = aucell.score(adata, regulons, top_frac=0.05)
edges.to_parquet("grn.parquet")
auc.to_parquet("aucell.parquet")
print(edges.head())
print(auc.iloc[:3, :3])
grn.parquet contains TF, target and importance columns.
aucell.parquet contains cells × candidate gene-set activity scores,
with cell names in the index.
These candidate sets are not motif-filtered or split by correlation sign. For signed sets and motif support, see the API map.
Command line¶
Run the RNA pipeline on the same prepared file. The hs shortcut uses the
bundled human TF list; use mm for mouse.
rustscenic pipeline --rna rna.h5ad --tfs hs --output out/
Results are written to out/. The pipeline separates candidate target sets
by correlation sign; motif filtering requires motif rankings and annotations.
For individual GRN and AUCell commands with prepared inputs, see the
PBMC3k walkthrough.
Next steps¶
Motif and multiome stages · HPC operation · Tester guide · Explore a saved network