Getting started with Compocyte

This short tutorial shows how to load an AnnData object and run a pretrained hierarchical classifier to annotate cells.

  1. Install dependencies (see project README for full instructions).

  2. Install quick docs dependencies (optional, for running docs examples):

pip install scanpy anndata
  1. Load your adata file with scanpy:

    import scanpy as sc
    adata = sc.read('path/to/adata.h5ad')
    
  1. 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)
    
  2. Predict on the full hierarchy:

    clf.predict_all_child_nodes('RootCellType')
    
  3. 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.:

Compocyte logo