cytoGateR Python

cytoGateR Python#

Marker-aware cell annotation for spatial proteomics.

cytoGateR combines interpretable marker gating, supervised prediction, and uncertainty measurements for single-cell spatial data stored in AnnData. The Python API follows the R package’s function names, parameters, defaults, and result structure wherever Python syntax permits.

cytoGateR logo

Install the current release from PyPI:

pip install cytogater

Optional plotting, neural-network, and notebook dependencies are available as extras:

pip install "cytogater[plot]"
pip install "cytogater[torch]"
pip install "cytogater[notebook]"

What cytoGateR provides#

  • marker GMMs, soft gating, and marker-priority tree gating;

  • confidence-based reference selection;

  • weighted kNN, random-forest, and optional PyTorch prediction;

  • hierarchical reference construction and recursive hierarchical kNN;

  • classification metrics, probability uncertainty, and spatial uncertainty;

  • Matplotlib plots for labels, markers, probabilities, metrics, and trees.

Minimal workflow#

import cytogater

result = cytogater.run_tree_gating(
    adata,
    lineage_table,
    assay_name="exprs",
)

labels = result["hard_label"]
probabilities = result["prob_mat"]

See Getting started for the expected data layout, Basic annotation pipeline for a small executable example, and cytoGateR Python: complete workflow using the R demo data for the complete workflow using the R package’s demonstration data.