Skip to main content

CellTypeAI: Automated cell identification for scRNA-seq using local generative-AI

CellTypeAI, a streamlined, scalable program developed to perform context-dependent cell identification in scRNA-seq datasets, which leverages locally-run LLMs with enhanced RAG methods and optional ensemble methods.

CellTypeAI builds upon local LLM hosting technol-ogies and integrates directly into scanpy-based scRNA-seq analysis pipelines to enable accurate cell type identification of pre-clustered scRNA-seq data

Table of Contents

Installation

Dev version:

#Using pip:
pip install git+https://github.com/rhdaw/celltypeai

#Using uv: 
uv add git+https://github.com/rhdaw/celltypeai

# Navigate into the directory to install requirements from .toml
cd CellTypeAI
pip install .

# Or using uv:
uv pip install -r pyproject.toml

pip installation (to be confirmed)

pip install celltypeai
#or
uv add celltypeai

Usage

Ollama Requirements:

ollama pull phi4:14b
  • Initialise ollama server via ollama serve in terminal / powershell
ollama serve

Running CellTypeAI

Following standard scRNA-seq processing with leiden OR louvain clustering.

import celltypeai as cta

cta.cell_annotator(
                "Human",
                "Intestine",
                adata,
                model="qwen3:32b",
                num_genes=200,
                n_iterations=3,
            )

On completion, annotations are stored in adata.obs["cell_type_ai"]

cell_annotator(adata, species, tissue, ...)

Takes a processed .h5ad object, extracts Differentially Expressed Genes (DEGs) from each cluster, and utilizes a local LLM via Ollama to define and annotate cell types.

Parameter Type Default Description
adata AnnData Required Annotated data matrix containing cell clusters (Leiden or Louvain).
species str Required The biological species (e.g., "Human", "Mouse").
tissue str Required The tissue type being analyzed. Must be one of: Adrenal, Brain, Eye, Heart, Immune system, Intestine, Kidney, Liver, Lung, Muscle, Pancreas, Placenta, Spleen, Stomach, Thymus, Skin.
model str "phi4:14b" The Ollama model to use. Recommended: "phi4:14b", "qwen3:32b", "qwen3:235b".
num_genes int 200 Number of top marker genes to provide to the LLM for each cluster.
n_iterations int 3 Ensemble size. The model prompts n times and selects the mode (most frequent) annotation.
verbose bool False If True, outputs detailed logs and saves the engineered prompt to the working directory for inspection.

Returns:

  • adata (AnnData): The input object with a new .obs column containing the predicted cell types.

Contributing

Fork the repo, create a feature branch, and submit a pull request. Please add tests and update documentation for new features.

License

GNU GPL-2.0 license - see LICENSE file

Metadata

Release files for celltypeai 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for celltypeai 1.0.0
File Size Uploaded Provenance Actions
celltypeai-1.0.0.tar.gz 26.9 kB Without provenance Details for celltypeai-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for celltypeai 1.0.0
File Interpreter ABI Platform Actions
celltypeai-1.0.0-py3-none-any.whl Python 3 none any Details for celltypeai-1.0.0-py3-none-any.whl

Total release size: 53.8 kB

Release files / celltypeai-1.0.0.tar.gz

Download URL celltypeai-1.0.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c41dc87a4bb408c2eb96bd508edccdeab62765bb2222f1c3d3d5344f02b9a49a
BLAKE2b-256 checksum
How to use checksums
793ab9ee53c647571964895f28aeb77d27c00260cea38ed614192f5b1ea211d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / celltypeai-1.0.0-py3-none-any.whl

Download URL celltypeai-1.0.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0c0b59115e821c000de7a804c97fa331e3cad4621872724b0d9ae1ec1bed768
BLAKE2b-256 checksum
How to use checksums
3ccf8dfc2fc000c384190c341cc427b18dd5353608b21d8c41aed0913f215e98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for celltypeai 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page