To use the agent, install Claude Code and log in with a Claude plan that
includes it (Pro or higher; the free plan does not). How to set it up, step by step →
STAnnotator takes spatial transcriptomics (Xenium, Atera, CosMx, MERSCOPE, Visium HD, Stereo-seq and more)
from import to results on the tissue image: registration, cell types, regions, niches, composition and DE genes,
cell–cell communication, trajectories and pseudotime, and comparisons across regions, slices and conditions.
Tell it what you know in plain sentences. Every change the agent proposes waits in
the app until you click Accept.
Human colonSCP2927, section 147328Xenium480 genes · 356,629 cellsAnnotatedfrom a marker list, the mucosa outlined
How it works
From the instrument's output to a notebook you can rerun
Every step happens in one window, on the image. Each change becomes a version you can go back to.
A Steps panel on the map shows where the sample stands and takes you to the next step.
1
Import
Xenium, 10x Atera, CosMx (AtoMx flat files), MERSCOPE, Visium HD and Stereo-seq output, h5ad, or Seurat and SpatialExperiment .rds files, read without R. Add the H&E and its registration, or let the agent align it without a registration file. Before you accept an alignment the whole tissue is checked, and areas where the tissue shifted are corrected in one click. Bring regions drawn in QuPath; filter cells and genes. An H&E alone works too, for a pathologist to outline regions before the expression data exist.
2
Annotate
From a marker gene list, a labeled single-cell reference, or an annotation you already have. No marker list? Start from a built-in list for 12 organs, pruned to your gene panel and checked against single-cell atlases. Then the agent reviews the result round by round (Refine cell types). The same data gives the same annotation on every computer.
3
Refine in words
Draw regions on the tissue with QuPath's tools (rectangle, ellipse, polygon, pen, brush) and say what you know: priors, corrections, a cluster to split. Each change opens in a review window with the cells it affects; you accept or dismiss it.
4
Analyze
PCA, UMAP and Leiden, niches, composition, DE genes (also DESeq2 on pseudobulk), cell–cell communication and trajectories, for one slice or several together.
5
Review
Review checks one part of the analysis against the organ's literature priors, tests its own advice against the data and the H&E, and shows only what holds up.
6
Export
The cell table, the registration, the regions as GeoJSON, figures as PDF, the agent's annotation report, a Jupyter notebook that reproduces the analysis without the app (one slice, or a whole project), or the whole annotation as one .stannot file to share.
Tutorial
From import to results, step by step
The real app in your browser, replaying a session with Claude on two Xenium sections, from importing
them to exporting the results. Press play; pause at any step and the app is yours to click around. Click a
chapter to jump to it.
The agent works through the app's tools: it reads the numbers and figures they compute, checks
them on the H&E, and proposes changes that wait in the app for you. In Auto mode they apply as they
come, and Undo takes one back. Choose its model next to the Agent button. Three examples of many.
Markers
Refine the marker list
You
“Review my annotation. Is my marker list missing a cell type?”
Agent
15,514 Unassigned cells express CD177, CSF3R and S100A12. These look like neutrophils, which your list
does not have. Your “dendritic cells” express macrophage genes (C1QC, LYVE1, MS4A7).
I suggest adding Neutrophils and revising the dendritic cell markers. Open in Markers… opens the list to edit.
What it checks
How often each marker is detected in its type compared with sibling types
SCP2927 section 146685, ulcerative colitis. Dataset labels used only to score the result.
Registration
Fix the H&E registration where it is off
You
“The cells at the lower left sit next to their nuclei, not on them. Can you check the registration there?”
Agent
I compared the nuclei on the H&E with the cell centers in windows across the section. The whole
section is slightly off in scale, and one area is shifted further.
I proposed an affine correction plus a local shift for that area. My figure marks the area with the
large shift.
You
“This piece of tissue tore off and turned. I outlined its cells as flap_1.”
Agent
I searched rotation, shift and mirroring for the piece. The best fit puts its cells on
nuclei, on tissue that no other cell covers. The move is waiting in the app's review window
(cyan: the cells now, yellow: moved).
What it checks
Nuclei (hematoxylin or DAPI) against cell centers in 200 µm windows, then 600 µm windows for shifts up to 100 µm
For a torn or folded piece: rotation, a shift of up to 300 µm, and mirroring
It proposes no move when the fit is no better than where the cells are now
After every alignment, and any time from Steps → Image → Check (the app itself, about a minute): the whole tissue, with a histogram and a map of the offsets, and Do local registration where areas sit off their nuclei
Measured
Section 147328, scale off by 0.28%30 → 0.5 µmLocal warp of 70 µm (test)→ 2 µmTorn pieces, up to 300 µm and 180° (tests)1–6 µm
Each correction can be undone. Regions keep their cells.
Hypotheses
Turn a pattern into something you can test
You
“What could keep the stem cells at the crypt base? Give me something I can test in this data.”
Agent
A hypothesis to test: R-spondin from fibroblasts around the crypt base acts on LGR5+ stem cells.
RSPO3 and LGR5 are both on your panel.
If it holds: RSPO3 → LGR5 is stronger from fibroblasts to stem cells than to other epithelial cells.
Caveats: one slice, no replicate; RSPO3 transcripts in cells next to fibroblasts can be spillover.
Put in Signal sets up this comparison. Run it to see the result.
What the app does
Put in Signal or Put in Compare fills in the analysis that would settle the question
Show on map colors the tissue by the gene or the signal
Review of Compare and Signaling explains the results you ran and names the caveats
More to ask
Anything the app can compute, the agent can run, explain and check. For example:
“Draft a marker list for this panel; it is lung.”
“Align this H&E. I have no registration file.”
“Outline the mucosa and the lymphoid follicles as regions.”
“Cluster 7 of the T cells is mixed. Split it.”
“These cells in crypt_1 are goblet cells.”
“Show me the biggest group of cells labeled against my priors.”
“Name the niches from the H&E.”
“Add this prior to all slices.”
“Is my UMAP driven by one slice?”
“What do these DE genes mean? What are the caveats?”
“Import these CosMx files as a new sample.”
“Go back to version 3.”
“Export a notebook that reproduces this analysis.”
Plain-language priors
Say what a pathologist would say
Knowledge about where cells belong becomes a rule the model can use. The agent reads your sentence
and proposes the change; the app shows it to you, and nothing happens until you accept it.
The app also knows what the literature says for 12 organs: where each cell type lies, with its
exceptions and references. Prior shows them for your tissue, chosen from your annotation; remove the ones
that do not hold for it, or add your own in plain words and the agent writes the rule. The agent's Review
checks your annotation and regions against them.
You
“Epithelial cells are only in the mucosa.”
Agent
regiononly Epithelial lineage, inside the region you drew and named mucosa.
The change is waiting in the app with the cells it would relabel.
App
Review Claude's changeNothing changes until you click Accept.DismissAccept
Kind
Condition
Example
region
The cell lies in one of the regions you drew
Epithelial cells only in the mucosa
depth
Within a distance of the epithelium
Goblet cells within 30 µm of the epithelium
neighborhood
A share of the 15 nearest cells are given types
Tfh cells next to B cells
The mucosa of the same section, closer: crypts in red, lymphoid follicles of B cells in olive. Each dot is one cell, colored by its type and placed on its nucleus.
Analyses
The analyses you would run next, in the same window
Embed
PCA, UMAP, Leiden
Select cells on the UMAP and see them light up on the tissue. Harmony integration for several slices.
Niche
Cellular neighborhoods
Niches shared across slices, which the agent names from the H&E and their composition.
Compare
Composition and DE genes
Compare regions, niches, slices or conditions, with dot plots of the top genes; DESeq2 on pseudobulk counts per slice or patient.
Signal
Cell–cell communication
Ligand–receptor interactions as bubble and circle plots. Senders and receivers shown together on the map.
Trajectory
Spatial axes and pseudotime
Order cells from the crypt base to the surface, or by diffusion pseudotime from a root, with tissue neighbors mixed in if you like. The genes that rise, fall or peak along it, and the cells colored by their place on the map.
Project
Several slices at once
Healthy and disease, time courses, replicates: one annotation model and one embedding for all slices. Niche names and priors go to every slice with one Accept. Put any samples into a project, or move slices between projects.
Overview of all samples
Every sample side by side
Each sample over its image, colored the same way. Tick legend entries to show only those cells on all samples, and save the panel as one PDF.
Report
An annotation report
Written by the agent from the tools' numbers: sample, method and inputs, composition, compartments, quality and open questions. Saved as Markdown.
Measured
Tested on published atlases
Numbers from the validation runs in the user guide. Dataset labels were used only to score the results afterwards, never as input.
~5minutes
to annotate a million cells
1,081,532 cells of two Xenium 5K sections (4,624 genes) imported side by side as one sample, on a 20-core CPU: 4.5 minutes with approximate neighbors and 7.2 GB of memory; 5.5 minutes with exact neighbors on an NVIDIA GPU, the app's choice there (8.4 GB).
10x Xenium Prime 5K human lymph node + Xenium 5K colitis colon (GSE282123)
0.5µm
median distance to the reference registration
Align with Agent searched the slide in 8 s and refined in 3 s, on a slide with two sections rotated 180°. The registration file shipped with the data was 13 µm off.
SCP2927, section 147328
97%
lineage agreement from a single-cell reference
A reference built from three other sections labeled section 147328: 97% on the five lineages
(98% with majority voting), 80% on 56 fine cell types.
SCP2927 IBD Xenium atlas, section 147328
88–92%
lineage agreement across a mouse colitis time course
Four MERFISH slices (healthy, DSS day 3, 9 and 21; 66,818 cells), each annotated with the built-in colon list in about 10 s. The day-21 slice, with few transcripts per cell, agreed less (51%).
Cadinu et al., Cell 2024, MERFISH, 990 genes
Under the hood
The app computes, the agent reads and proposes, you decide
Every number comes from the app's own code. The agent reads those results, looks at the figures and proposes changes; it never computes a number
or invents a cell type. What changes is up to you.
The app: computesThe agent: reads, judges, proposesYou: decide, draw regions, state rules
Solid boxes: what the app computes. Dashed: where the agent comes in, with proposals only. Bottom row: where you decide.
How the cell types are found
The marker list is a hierarchy: lineages, and the types under them. GENE+ should
be expressed, GENE- should not, and A|B|C+ means any one of these genes.
Marker step
Top down: at each level the cells are clustered again (PCA, a neighbor graph, Leiden),
and each cluster is scored on how often each type's markers are detected, compared with the other clusters.
A cluster goes to a type only when its score and its lead over the runner-up are both clear; otherwise it
stays at the level above.
Rare types
A type of your list that no cluster went to is looked for in finer clusters, then in single
cells. It is taken only where at least half of its markers are clearly raised. A type still without cells is
listed under Not found, with the reason.
Expression model
A logistic regression trained on the marker step's labels gives every cell a
probability for each type. Only types the marker step actually found can get cells.
Untyped cells
Cells the marker step could not type are typed by their marker genes: which ones are
detected and which are not, scaled to the cell's transcripts. When the evidence is too weak (a Bayes factor
below 3), the cell stays Unassigned instead of being forced into a type. Their neighbors are then
taken into account, round by round.
Spillover
Transcripts a cell's outline caught from its neighbors are left out: a gene counts only
above a tenth of the mean of the 6 nearest cells.
How a rule meets the expression
A rule has a condition (one of the kinds under Plain-language priors), a way it acts and a strength.
only · exclude · enrich
The types belong only where the condition holds, never where it
holds, or more often where it holds.
probability of each type in a cell ∝ expression model × the weights of the rules that apply there
A rule weighs in; it does not overwrite. Where the expression is unsure, the rule changes the
label. Where the expression is very sure, the cell keeps its type and is listed as a conflict for you to
look at, never changed quietly.
The expression is unsure: the rule decides
A cell in the submucosa. Rule: goblet cells only in the mucosa, strong (×0.01).
Before
Goblet0.55
Fibroblast0.35
Smooth m.0.10
After
Goblet0.01
Fibroblast0.77
Smooth m.0.22
Labeled Fibroblast (the prior overrode the expression).
The expression is sure: it keeps its type
Same place, same rule, but the cell's goblet markers are unmistakable.
Before
Goblet0.995
Fibroblast0.004
Smooth m.0.001
After
Goblet0.67
Fibroblast0.27
Smooth m.0.07
Still Goblet, listed as a conflict: is the rule wrong here (displaced epithelium in diseased
tissue), or is the cell?
Illustrative numbers, computed with the formula above. Conflicts are also sorted by where they lie:
at a region's border, in a cluster, or alone (often a tissue edge or a segmentation problem).
How a request reaches the agent
The app runs an MCP server that offers about 100 of its functions to Claude as tools.
What it sees
The facts the tools return: cells per type, how often each marker is detected
in each type, types not found and why, registration offsets, conflicts; and the figures they draw (the H&E,
cells on it, the UMAP).
What it does not
Compute numbers, invent types or values, or change your annotation
behind your back. In Auto mode its changes apply as they come, and Undo takes one back.
Refine cell types, round by round
This is where the agent does the most. After each marker annotation a round opens: the app
sums up what may be wrong, including types whose cells lie mostly among another lineage and cells that break
your rules. The agent reviews it with the organ's priors and proposes edits of the marker list, grouped by the
problem they fix, and lists what goes against the priors, each with a map of those cells on the tissue. You
tick the edits, mark each finding Real biology (diseased tissue may break a rule) or Mislabel,
and Accept: the app annotates again and sends the next round to the agent by itself.
An edit adds or removes a marker, replaces a type's markers, or adds, removes, renames or moves a
type; one the agent marks optional (such as splitting a type into subtypes) starts unticked. A small edit can
shift many types, so every round shows the cell counts that changed. The first round waits for
Agent review, so you can confirm the organ and write to the agent first.
Where it runs
Your data stays where it is
On your computer
Data
Your computer, in a folder you choose
Window
Your computer
Needs
A Mac with Apple silicon or a Windows 10 / 11 PC, 8 GB of memory or more; for the agent, Claude Code logged in once
On a server, over SSH
Data
The server; nothing is copied except what you export
Window
Your computer, through an SSH tunnel; no port is opened on the server
Needs
The app on your computer, STAnnotator on the server, SSH login without a password
Many samples, in a terminal
Data
A server or a cluster: stagent batch imports, registers and annotates every sample of a CSV list
Window
None: it decides by itself and writes CSV files; the samples it flags open in the app over SSH
Needs
STAnnotator on the server and a marker list (refine it on a few samples in the app first); no agent
The agent is your own Claude Code, running with your own Claude account:
a Pro, Max, Ultra, Team, Enterprise or Console account (the free Claude plan does not include Claude Code).
STAnnotator never asks you to sign in. Without Claude Code, or offline, everything but the agent works.
Besides what the agent reads into your conversation with Claude, nothing leaves your computer
unless you choose to send it: a bug report, and, while the app is being tested and only if you agree, a usage
report every 3 days (your conversations with the agent, its tool calls, the analyses you ran without their
results, and the app's log; never expression data, cell tables or images). The app also asks GitHub whether a newer version exists, and once a day it sends
us a count: a random installation id, the version and the system (macOS or Windows), nothing else, so we know
how many use it.
Download
Get STAnnotator
Version 0.2.59. Both apps contain everything they need; no Python to install.
All releases and their notes are on the releases page. Once installed (0.2.46 and
later), the app offers each new version itself and installs it with one click. Something not working? The bug
icon at the top right of the app sends the developers a report.
Start STAnnotator from the Start menu and click Import.
Uninstalling keeps your data.
Note for Windows
The Windows installer is not signed yet. If Windows SmartScreen stops it, click More info → Run anyway.
On Windows 11, Smart App Control blocks unsigned apps without that button: the installer does not run,
and an installed STAnnotator does not open ("blocked by an application control policy"). STAnnotator then runs
only with Smart App Control turned off (Settings → Privacy & security → Windows Security → App & browser
control → Smart App Control settings). Depending on the Windows version, turning it back on may need a reset of
Windows.
git clone https://github.com/caokai1073/STAnnotator.git && cd STAnnotator
uv venv .venv --python 3.12
uv pip install --python .venv/bin/python -e ".[app]"
.venv/bin/stagent app # the window; --browser for a browser tab
On a server
Install the same version as the app on your computer (the tag below is the newest release), then click Local → A server over SSH in the app. For many samples without the app: stagent batch (see the README).
git clone --branch v0.2.59 https://github.com/caokai1073/STAnnotator.git ~/STAnnotator && cd ~/STAnnotator
uv venv .venv --python 3.12
uv pip install --python .venv/bin/python -e .
# the command to enter in the app: ~/STAnnotator/.venv/bin/stagent
Every control and method is described in the user guide.
If you use STAnnotator in published work, please cite it (the paper reference will be added here):
STAnnotator, https://github.com/caokai1073/STAnnotator, and the version you used.