Skip to main content
Harpy logo

Single-cell spatial omics analysis that makes you happy.

PyPI Release Status Build Status Test Status pre-commit.ci status documentation badge codecov Downloads License GitHub repo size Zenodo Paper

Documentation · Quick Start · Tutorials · napari-harpy · harpy-vitessce

💫 If you find Harpy useful, please give us a ⭐! It helps others discover the project and supports continued development.

Why Harpy?

Harpy is a spatial omics analysis library for spatial transcriptomics and proteomics. Within the scverse stack, it bridges SpatialData and downstream analysis tools such as AnnData, Scanpy, and Squidpy. It provides scalable, image- and geometry-aware computation to transform raw spatial data into analysis-ready representations, with a strong emphasis on interoperability and large-scale workflows.

In practice, Harpy offers fast, out-of-core image preprocessing, tiled segmentation, along with efficient aggregation workflows to generate AnnData tables and compute per-cell features from images, segmentation masks, and transcript coordinates. It also supports deep feature extraction, pixel- and cell-level clustering, and the construction of single-cell representations from highly multiplexed images.

  • Multi-platform support for spatial transcriptomics and proteomics data.
  • Interoperable outputs built on SpatialData.
  • Scales to (very) large images: tiled workflows with Dask; optional GPU acceleration with CuPy and PyTorch.
  • Scalable computational building blocks for segmentation, feature extraction, clustering, and spatial analysis.

Installation

pip install harpy-analysis

With extras

pip install "harpy-analysis[extra]"

[extra] installs optional dependencies for:

  • Segmentation: cellpose, instanseg-torch
  • OpenCV support: opencv-python-headless
  • FlowSOM Clustering: flowsom
  • Vitessce: harpy-vitessce
  • Notebook workflows: ipywidgets, tqdm, bokeh, textalloc, joypy, supervenn, nbconvert, ipython

With extras and napari

pip install "harpy-analysis[extra,napari]"

[napari] adds:

  • napari[all]
  • napari-harpy
  • napari-spatialdata

Only for developers. Clone this repository locally, install the .[dev] instead of the [extra] dependencies and read the contribution guide.

# Clone repository from GitHub
uv venv --python=3.12  # create venv, set python version (>=3.11)
source .venv/bin/activate  # activate the virtual environment
uv pip install -e '.[dev]'  # editable install with dev tooling
python -c 'import harpy; print(harpy.__version__)'  # check if the package is installed
# make changes
python -m pytest  # run the tests

For more installation details, see the installation guide.

Quickstart

See the short, runnable guide.

API Changes in 0.4.0

Note for users upgrading to Harpy 0.4.0: parameters that refer to SpatialData elements now use the *_name convention instead of the older *_layer naming to stay aligned with scverse naming conventions. For example, img_layer becomes image_name, labels_layer becomes labels_name, and table_layer becomes table_name.

The examples in this README and in the documentation already follow the 0.4.0 naming convention.

🧭 Tutorials and Guides

Explore how to use Harpy for segmentation, shallow and deep feature extraction, clustering, and spatial analysis of gigapixel-scale multiplexed data with these step-by-step notebooks:

  • 🚀 Basic Usage of Harpy

    Learn how to read in data, perform tiled segmentation using Cellpose and Dask-CUDA, extract features, perform QC and analyze results downstream with Scanpy and Squidpy.

    👉 Tutorial image based transcriptomics, Human Ovarian Cancer, Xenium 10x Genomics

    👉 Tutorial proteomics, MACSima

  • 🔧 Technology-specific advice

    Learn which technologies Harpy supports. 👉 Tutorial

  • 🧩 Pixel and Cell Clustering

    Learn how to perform unsupervised pixel- and cell-level clustering using Harpy together with FlowSOM. 👉 Tutorial

  • ✂️ Cell Segmentation

    Explore segmentation workflows in Harpy using different tools:

    💡 Want us to add support for another segmentation method? 👉 Open an issue and let us know!

  • 🧪 Single-cell representations from highly multiplexed images and downstream use with PyTorch

    Learn how single-cell representations can be generated from highly multiplexed images. These representations can then be used downstream to train classifiers in PyTorch. 👉 Tutorial

  • 🧠 Deep Feature Extraction

    Discover how Harpy enables fast, scalable extraction of deep, cell-level features from multiplex imaging data with the KRONOS foundation model for proteomics. 👉 Tutorial

    💡 Want us to add support for another deep feature extraction method? 👉 Open an issue and let us know!

  • 🔬 Shallow Feature Extraction

    Learn to extract shallow features—such as mean, median, and standard deviation of intensities—from multiplex imaging data with Harpy. 👉 Tutorial

  • 🧬 Spatial Transcriptomics

    Learn how to analyze spatial transcriptomics data with Harpy.

    👉 Tutorial (Mouse Liver, Resolve Molecular Cartography)

    👉 Tutorial (Human Ovarian Cancer, Xenium 10x Genomics)


  • 🌐 Multiple samples and coordinate systems

    Learn how to work with multiple samples, intrinsic and micron coordinates. 👉 Tutorial


  • 📐 Rasterize and vectorize labels and shapes

    Learn how to convert a segmentation mask (array) into its vectorized form, and segmentation boundaries (polygons) into their rasterized equivalents. This conversion is useful, for example, when integrating annotations (e.g., from QuPath) into downstream spatial omics analysis.👉 Tutorial


📚 For a complete list of tutorials, visit the Harpy documentation.

Computational benchmark

Explore the benchmark performance of Harpy on a large MACSima tonsil proteomics dataset. 👉 Results

Contributing

See the contribution guide for info on how to contribute to Harpy.

Citation

If you use Harpy in your work, please cite:

Benjamin Rombaut, Arne Defauw, Frank Vernaillen, Julien Mortier, Evelien Van Hamme, Sofie Van Gassen, Ruth Seurinck, Yvan Saeys. Scalable analysis of whole slide spatial proteomics with Harpy. Bioinformatics (2026), btag122. https://doi.org/10.1093/bioinformatics/btag122

If you use Harpy for spatial transcriptomics analysis, please cite:

Lotte Pollaris, Bavo Vanneste, Benjamin Rombaut, Arne Defauw, Frank Vernaillen, Julien Mortier, Wout Vanhenden, Liesbet Martens, Tinne Thone, Jean-Francois Hastir, Anna Bujko, Wouter Saelens, Jean-Christophe Marine, Hilde Nelissen, Evelien Van Hamme, Ruth Seurinck, Charlotte L. Scott, Martin Guilliams, Yvan Saeys. SPArrOW: a flexible, interactive and scalable pipeline for spatial transcriptomics analysis. https://doi.org/10.1101/2024.07.04.601829

License

Harpy is licensed under the BSD 3-Clause License.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Metadata

Release files for harpy-analysis 0.5.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 harpy-analysis 0.5.0
File Size Uploaded
harpy_analysis-0.5.0.tar.gz 21.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for harpy-analysis 0.5.0
File Interpreter ABI Platform
harpy_analysis-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 MB

Release files / harpy_analysis-0.5.0.tar.gz

Download URL harpy_analysis-0.5.0.tar.gz
Size 21.7 MB
Tags Source
SHA-256 checksum
How to use checksums
6e662b2070d7fd666f0e25ae2831e004e269b2930d00f699dc15e4143c3cf0e9
BLAKE2b-256 checksum
How to use checksums
5070c80df90cc54005507a26908d9180245ee103aef68209958b62abdc296267
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / harpy_analysis-0.5.0-py3-none-any.whl

Download URL harpy_analysis-0.5.0-py3-none-any.whl
Size 885.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25d6d9cd175425b2726add9efc28edee15841b2a4a300f83275b3dd26bc51b1e
BLAKE2b-256 checksum
How to use checksums
c57d48ac0aaac45885b0e84fe64cf17cd9e96f5b6f07a995ed8ebe5e44b72200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.4

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

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