Getting started with Compocyte¶
This short tutorial shows how to load an AnnData object and run a pretrained hierarchical classifier to annotate cells.
Install dependencies (see project README for full instructions).
Install quick docs dependencies (optional, for running docs examples):
pip install scanpy anndata
Load your adata file with scanpy:
import scanpy as sc adata = sc.read('path/to/adata.h5ad')
Load a pretrained Compocyte classifier and attach data:
from Compocyte.core.hierarchical_classifier import HierarchicalClassifier clf = HierarchicalClassifier('path/to/model/folder') clf.load() clf.load_adata(adata)
Predict on the full hierarchy:
clf.predict_all_child_nodes('RootCellType')
Save annotated adata:
clf.adata.write('annotated_adata.h5ad')
Screenshot¶
If you want to include quick visuals in the docs, the project logo is available and used in the documentation theme. You can also include result screenshots here by placing images in source/_static and referencing them, e.g.: