Metadata-Version: 2.5
Name: segger
Version: 1.0.0
Summary: Segmentation of spatial transcriptomics data
Project-URL: Homepage, https://github.com/dpeerlab/segger
Project-URL: Documentation, https://segger-segmentation.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/dpeerlab/segger
Project-URL: Changelog, https://github.com/dpeerlab/segger/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/dpeerlab/segger/issues
Author-email: Elyas Heidari <elyas.heidari@dkfz-heidelberg.de>, Andrew Moorman <moormana@mskcc.org>
License-Expression: MIT
License-File: LICENSE
Keywords: image-analysis,segmentation,spatial-transcriptomics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: <3.14,>=3.13
Requires-Dist: anndata
Requires-Dist: cudf-cu13>=26
Requires-Dist: cugraph-cu13>=26
Requires-Dist: cuml-cu13>=26
Requires-Dist: cupy-cuda13x
Requires-Dist: cuspa-cu13
Requires-Dist: cyclopts
Requires-Dist: fastquadtree
Requires-Dist: geopandas
Requires-Dist: imagecodecs
Requires-Dist: lightning
Requires-Dist: numba
Requires-Dist: numpy
Requires-Dist: opencv-python
Requires-Dist: pandas
Requires-Dist: polars
Requires-Dist: pyarrow
Requires-Dist: rmm-cu13>=26
Requires-Dist: scanpy>=1.13
Requires-Dist: scikit-image
Requires-Dist: scikit-learn
Requires-Dist: scipy
Requires-Dist: shapely
Requires-Dist: tifffile
Requires-Dist: torch-geometric
Requires-Dist: torch==2.14.*
Requires-Dist: torchvision
Requires-Dist: tqdm
Provides-Extra: spatialdata
Requires-Dist: spatialdata; extra == 'spatialdata'
Description-Content-Type: text/markdown

# segger

[![Release](https://img.shields.io/github/v/release/dpeerlab/segger)](https://github.com/dpeerlab/segger/releases)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
[![Docs](https://img.shields.io/badge/docs-Read%20the%20Docs-8CA1AF?logo=readthedocs&logoColor=white)](https://segger-segmentation.readthedocs.io/en/latest/)
[![Python 3.13](https://img.shields.io/badge/python-3.13-blue)](https://www.python.org/)
[![CUDA 13](https://img.shields.io/badge/CUDA-13-76B900)](https://developer.nvidia.com/cuda-toolkit)
[![Powered by cuspa](https://img.shields.io/badge/powered%20by-cuspa-76B900)](https://github.com/NVIDIA/cuspa)

Cell segmentation for imaging-based spatial transcriptomics as graph-based transcript–cell assignment.

![segger overview](https://raw.githubusercontent.com/dpeerlab/segger/main/segger_overview.png)

> Segger is a graph neural network (GNN)-based method that formulates cell segmentation in imaging-based spatial transcriptomics (iST) as a problem of transcript–cell assignment. Rather than relying solely on geometric proximity, Segger assumes that a transcript belongs to a cell if it is consistent both with its local spatial context and with the gene expression programs that define cell identity, as captured in a shared latent representation.
>
> — [Heidari, Moorman, et al., segger methods description](segger_methods.pdf)

> [!NOTE]
> This release uses [`cuspa`](https://github.com/NVIDIA/cuspa), which we developed together with NVIDIA, to support atera-scale,
> billion-transcript whole-transcriptome datasets. It requires CUDA 13 and Python 3.13.

Full documentation - installation, quickstart, outputs, API reference, etc.:
[segger-segmentation.readthedocs.io](https://segger-segmentation.readthedocs.io/en/latest/)

## Installation

**segger** requires CUDA 13 and Python 3.13.

```bash
uv pip install segger
```

For conda, pixi, installing from source and older CUDA versions, see the [installation docs](https://segger-segmentation.readthedocs.io/en/latest/installation.html).

### Container

On HPC clusters, run the Docker image with Apptainer/Singularity. Pull it once (about 10-20 minutes), then run on a GPU node with `--nv`:

```bash
export APPTAINER_CACHEDIR=/path/to/cachedir
apptainer pull segger.sif docker://sailmskcc/segger:latest
apptainer exec --nv segger.sif segger --help
```

For Docker, see [Use a container](https://segger-segmentation.readthedocs.io/en/latest/installation.html#use-a-container).

## Usage

```bash
segger segment \
  -i /path/to/your/ist/data/ \
  -o /path/to/save/outputs/ \
  --export anndata boundaries  # optional (e.g. anndata, boundaries, xeniumranger, ...)
```

See [notebooks/quickstart.ipynb](notebooks/quickstart.ipynb) for an end-to-end walkthrough.

If you run into a problem, first check the [GitHub issues](https://github.com/dpeerlab/segger/issues) and the [known issues](https://segger-segmentation.readthedocs.io/en/latest/common-issues.html) in the docs.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

## Methods description

[Heidari, E., Moorman, A., et al. Segger: Fast and accurate cell segmentation of imaging-based spatial transcriptomics data. Methods description (2026).](segger_methods.pdf)

## Citation

If you use segger in your research, please cite:

```bibtex
@misc{heidari2026segger,
  title={Segger: Fast and accurate cell segmentation of imaging-based spatial transcriptomics data},
  author={Heidari, Elyas and Moorman, Andrew and others},
  note={Methods description},
  year={2026},
  howpublished={\url{https://github.com/dpeerlab/segger/blob/main/segger_methods.pdf}}
}
```
