A Python package that maps free-text cell type labels to standardized Cell Ontology terms, with a human-in-the-loop review workflow.
- Two-stage mapping pipeline: Fast direct matching via
pronto(exact name + synonyms), with optional semantic matching viaomicverse - Human-in-the-loop review: Interactive CLI for reviewing and approving automated mappings
- Growing mapping database: CSV-based store that accumulates verified mappings across projects
- Transparent audit trail: Every mapping records its origin, confidence, review status, and timestamp
Note: calmate is not yet published on PyPI. For now, install directly from GitHub.
pip install git+https://github.com/mengerj/calmate.gitWith the omicverse auto-mapping backend:
pip install "calmate[omicverse] @ git+https://github.com/mengerj/calmate.git"Or, if you use uv:
uv add "calmate @ git+https://github.com/mengerj/calmate.git"
uv add "calmate[omicverse] @ git+https://github.com/mengerj/calmate.git" # with omicverse backend# Map cell type labels from a file (one label per line)
calmate map labels.txt
# Check mapping status
calmate status
# Interactively review unreviewed mappings
calmate review
# Apply verified mappings to a CSV file
calmate apply data.csv --column cell_typefrom calmate import MappingStore, map_labels, apply_labels
# 1. Map a list of labels (populates the mapping store)
store = MappingStore(".calmate/mappings.csv")
map_labels(["beta cell", "T cell", "astrocyte"], store=store, origin="my_dataset")
# 2. Apply reviewed mappings to replace labels
predicted = ["beta cell", "T cell", "astrocyte", "Treg cells"]
result = apply_labels(predicted, store)
result.mapped_labels # ["type B pancreatic cell", "T cell", "astrocyte", "Treg cells"]
result.label_map # {"beta cell": "type B pancreatic cell"}
result.unreviewed # ["Treg cells"] -- still needs human review
result.unmapped # []
# 3. Print a ready-made diagnostic message
print(result.message)
# calmate: 1/4 unique label(s) mapped to ontology terms.
#
# WARNING: 1 label(s) have unreviewed mappings and were NOT replaced:
# - Treg cells
# Run `calmate review` to approve or edit them.
# 4. Optionally gate on warnings
if result.has_warnings:
raise RuntimeError(result.message)- Direct match: Each label is checked against Cell Ontology term names and synonyms (case-insensitive). Exact matches are auto-approved.
- Semantic match (optional): Unmatched labels are passed to
omicverse.single.CellOntologyMapperfor embedding-based similarity matching. These suggestions require human review. - Review: Users approve, edit, or reject mappings via
calmate reviewor by editing the CSV directly.
- Store location: Defaults to
.calmate/mappings.csvin the current directory. Override with--storeflag orCALMATE_STOREenvironment variable. - Cache directory: Ontology files are cached in
.calmate/cache/. Override with--cache-dir.
MIT