A tool to annotate cell types
Project description
CellAnnotator
CellAnnotator is an scverse ecosystem package, designed to annotate cell types in scRNA-seq data based on marker genes using OpenAI models.
Key features
- Automatically annotate cells including type, state and confidence fields.
- Generate consistent annotations across samples of your study.
- Optionally infuse prior knowledge by providing information about your biological system.
- Retrieve reliable results thanks to OpenAI structured outputs
- Use this tool to quickly generate pre-integration cell type labels to either score your integration quality (e.g. scIB metrics) or to guide your integration effort (e.g. scPoli, scANVI).
Note that this package is based on output generated by large language models and might sometimes make mistakes. We use some safeguards, like anchoring the tool in a multi-step process, and using structured output predictions, but mistakes are still possible. We recommend using this tool as a first step in an annotation workflow to generate an initial, coarse set of annotations that must be further refined.
Installation
You need to have Python 3.10 or newer installed on your system. If you don't have Python installed, we recommend installing Mambaforge.
PyPI
Install by running:
pip install cell-annotator
Development version
To install the latest development version from GitHub, run
pip install git+https://github.com/quadbio/cell-annotator.git@main
Getting started
After installation, head over to OpenAI to generate your API key
Keep this key private and don't share it with anyone. CellAnnotator will try to read the key as an environmental variable - either expose it to the environment yourself, or store it as an .env file anywhere within the repository where you conduct your analysis and plan to run CellAnnotator. The package will then use dotenv to export the key from the env file as an environmental variable.
Here's the simplest way to annotate your data:
from cell_annotator import CellAnnotator
cell_ann = CellAnnotator(
adata, species="human", tissue="heart", cluster_key="leiden", sample_key="samples",
).annotate_clusters()
By default, this will store annotations in adata.obs['cell_type_predicted']. Head over to our tutorials to see more advanced use cases, and learn how to adapt this to your own data. You can run CellAnnotator for just a single sample of data, or across multiple samples. In the latter case, it will attempt to harmonize annotations across samples.
Costs and models
The default model is currently gpt-4o-mini, which is included in OpenAI's Free Usage Tier. Thus, you can get started for free and experiment with our tutorials and with your own data. If you want to get accurate cell type labels for complex tissues, we strongly recommend using more powerful models, like gpt-4o, gpt-4.1, etc, or reasoning models like o3-mini, for which you will have to pay a small fee to OpenAI. As an orientation, running both tutorials with o3-mini will cost around 1 USD. Take a look at the OpenAI API docs to learn more about the different available models.
Data privacy
This package sends cluster marker genes to OpenAI, but no actual gene expression values. In addition, it sends the species and tissue you define. Make sure your usage of this package aligns with your institutions guidelines on data privacy and AI models.
Credits
This tool was inspired by Hou et al., Nature Methods 2024 and https://github.com/VPetukhov/GPTCellAnnotator.
Contact
If you found a bug, please use the issue tracker.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cell_annotator-0.1.5.tar.gz.
File metadata
- Download URL: cell_annotator-0.1.5.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa8356f6ed2469f91530915ed354855843ea2e3c31290f67450d815b9ed3982a
|
|
| MD5 |
8a47f6c3c25cddf8cd17bf936bca147b
|
|
| BLAKE2b-256 |
d895b215798795d57e33e12eff83ffd82e11c11582ad09ac34800be249aed898
|
Provenance
The following attestation bundles were made for cell_annotator-0.1.5.tar.gz:
Publisher:
release.yaml on quadbio/cell-annotator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cell_annotator-0.1.5.tar.gz -
Subject digest:
aa8356f6ed2469f91530915ed354855843ea2e3c31290f67450d815b9ed3982a - Sigstore transparency entry: 308884869
- Sigstore integration time:
-
Permalink:
quadbio/cell-annotator@583984d328851fc02c5ccaddfa84561520034f9f -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/quadbio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@583984d328851fc02c5ccaddfa84561520034f9f -
Trigger Event:
release
-
Statement type:
File details
Details for the file cell_annotator-0.1.5-py3-none-any.whl.
File metadata
- Download URL: cell_annotator-0.1.5-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87769a799ca4036e492859348b69008edab63e676ba9e66953a8bbb56fa48616
|
|
| MD5 |
89595273a8a85102059c1d469f18715b
|
|
| BLAKE2b-256 |
bfa165deb60c54f2149517041876f714f2a5755625bdf99d2163822f15f4d63d
|
Provenance
The following attestation bundles were made for cell_annotator-0.1.5-py3-none-any.whl:
Publisher:
release.yaml on quadbio/cell-annotator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cell_annotator-0.1.5-py3-none-any.whl -
Subject digest:
87769a799ca4036e492859348b69008edab63e676ba9e66953a8bbb56fa48616 - Sigstore transparency entry: 308884887
- Sigstore integration time:
-
Permalink:
quadbio/cell-annotator@583984d328851fc02c5ccaddfa84561520034f9f -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/quadbio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@583984d328851fc02c5ccaddfa84561520034f9f -
Trigger Event:
release
-
Statement type: