cytoGateR Python 
This is the Python implementation of cytoGateR. It uses an AnnData object
and keeps the R function names, parameter names, and defaults where Python
syntax permits.
cytoGateR ecosystem
cytoGateR— the original R package;cytoGateR-py— this Python implementation, also available from PyPI;cytoNavigator— a local-first, LLM-supported agent for building, reviewing, and runningcytogaterannotation workflows.
Implemented modules include:
- marker GMMs, soft gating, and tree gating;
- hierarchical reference construction and recursive hierarchical kNN;
- weighted kNN consensus cleaning and prediction;
- random-forest consensus cleaning and prediction;
- optional PyTorch training and prediction;
- confidence labels, cutoffs, F1, confusion, and agreement metrics;
- probability and spatial uncertainty;
- Matplotlib spatial, marker, label, metric, and tree plots.
Installation
Install the latest release from PyPI:
pip install cytogater
Plotting, neural-network, and notebook support are available as optional extras:
pip install 'cytogater[plot]'
pip install 'cytogater[torch]'
pip install 'cytogater[notebook]'
To install from source for development, clone the repository and create the provided Conda environment:
git clone https://github.com/SydneyBioX/cytoGateR-py.git
cd cytoGateR-py
conda env create -f environment.yml
conda activate cytogater-python
pytest
Data layout
Python AnnData stores cells in rows and markers in columns. Put the expression
matrix used by the R assay_name = "exprs" default in:
adata.layers["exprs"]
The lineage table is a pandas data frame with cell_type, pos_markers, and
neg_markers columns. The marker columns contain Python lists.
Example
import pandas as pd
import cytogater
lineage_table = pd.DataFrame({
"cell_type": ["Tcell", "Bcell"],
"pos_markers": [["CD3e"], ["CD20"]],
"neg_markers": [["CD20"], ["CD3e"]],
})
result = cytogater.run_tree_gating(
adata,
lineage_table,
assay_name="exprs",
max_depth=1,
min_cells=100,
min_score=0.1,
workers=1,
)
result["hard_label"]
result["prob_mat"]
Results are returned with the same main keys as R. Labels and P_* columns are
also stored in adata.obs; probability matrices are stored in adata.obsm.
The package is intentionally flat at its public surface:
cytogater.run_soft_gating(...)
cytogater.run_tree_gating(...)
cytogater.train_custom_knn(...)
cytogater.train_custom_randomforest(...)
cytogater.calculate_uncertainty(...)
The implementations are also grouped under cytogater.gating,
cytogater.models, cytogater.metrics, cytogater.uncertainty, and
cytogater.plotting.
R compatibility note
The Python implementation uses a deterministic two-component Gaussian-mixture
fit. R uses mclust, so fitted cutoffs can differ slightly even though the
pipeline, parameters, defaults, scoring, and output structure are aligned.
The Python lambda_ argument corresponds to the R lambda argument because
lambda is reserved syntax in Python. num_trees corresponds to R's
num.trees; train_custom_randomforest() also accepts **{"num.trees": 200}.
Run tests with:
cd cytoGateR-py
pytest
Metadata
Release files for cytogater 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cytogater-0.1.4.tar.gz | 33.9 kB | Without provenance | Details for cytogater-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cytogater-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for cytogater-0.1.4-py3-none-any.whl |
Total release size: 63.5 kB
Release files / cytogater-0.1.4.tar.gz
| Download URL | cytogater-0.1.4.tar.gz |
|---|---|
| Size | 33.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfbaad4c81e8b8087c4a84b5bf53a93da8a0f2ee7217ae96fc39f8496cf95ab9
|
|
BLAKE2b-256 checksum How to use checksums |
508548949af339b71ecbfa205e001c0a9c2c25843042bd743644844d0f7ac0da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / cytogater-0.1.4-py3-none-any.whl
| Download URL | cytogater-0.1.4-py3-none-any.whl |
|---|---|
| Size | 29.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a57de448df986b89847b25ddde783b8226eb001e73c603c8e73bf28b5dc894e4
|
|
BLAKE2b-256 checksum How to use checksums |
5724ff23f760e9919973bf3c2fe46b01f0c4ec54837985838e0c0affce76099e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for cytogater 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.