GNN-based cell segmentation of spatial transcriptomics data.
The accurate assignment of transcripts to their cells of origin remains the Achilles heel of imaging-based spatial transcriptomics, despite being critical for nearly all downstream analyses. We introduce segger, a versatile graph neural network based on a heterogeneous graph representation of individual transcripts and cells, that frames cell segmentation as a transcript-to-cell link prediction task and can leverage single-cell RNA-seq information to improve transcript assignments. On multiple Xenium dataset benchmarks, segger exhibits superior sensitivity and specificity, while requiring orders of magnitude less compute time than existing methods.
Full documentation - installation, quickstart, outputs, API reference, etc.: segger-segmentation.readthedocs.io
pixi with Python 3.11 (conda and Python 3.13 support coming soon):
curl -fsSL https://pixi.sh/install.sh | sh
git clone https://github.com/dpeerlab/segger.git
cd segger
pixi install -e cuda121# run segger segmentation
segger segment \
-i /path/to/your/ist/data/ \
-o /path/to/save/outputs/
# export different data formats (e.g. boundaries, spatialdata, anndata, xeniumranger, ...)
segger export boundaries \
-s /path/to/save/outputs/segger_segmentation.parquet \
-o /path/to/export/See notebooks/quickstart.ipynb for an end-to-end walkthrough.
See CONTRIBUTING.md.
If you use segger in your research, please cite:
@article{heidari2025segger,
title={Segger: Fast and accurate cell segmentation of imaging-based spatial transcriptomics data},
author={Heidari, Elyas and Moorman, Andrew and others},
journal={bioRxiv},
year={2025},
doi={10.1101/2025.03.14.643160}
}