Skip to main content

mantpy

Mantpy: extracellular-matrix analysis for spatial proteomics

PyPI Tests Documentation Preprint

Mantpy is a scverse-based framework for graph analysis of the extracellular matrix (ECM) in spatial proteomics. It represents cells and ECM patches as distinct, linked node types, so matrix structure can be analysed on its own or together with cellular context. Mantpy works with AnnData and interoperates with Scanpy, Squidpy, and other single-cell and spatial tools.

  • 2026: Accepted poster presentation, ML4SpatialBio workshop at NeurIPS.
  • 2026: Flash talk, scverse conference.
  • 2025: Top Poster Award, British Society for Matrix Biology conference.

Mantpy overview (manuscript Fig. 1): input, graph construction, applications and interoperability

Installation

Mantpy requires Python 3.11 or newer. CPU workflows run on Windows, Linux and macOS. GPU training additionally requires a compatible PyTorch installation; the package does not require a GPU for graph construction or descriptive analysis.

pip install mantpy

The current release is 1.1.0 (PyPI, GitHub release v1.1.0); the changelog lists what changed between releases.

Optional extras add heavier dependencies only when needed:

pip install "mantpy[gnn]"      # graph learning and explainability
pip install "mantpy[patch]"    # learned image-patch features
pip install "mantpy[spatial]"  # SpatialData integration
pip install "mantpy[segment]"  # Cellpose segmentation

Quick start

toy_ecm_roi synthesises a small region of interest in memory, so there is nothing to download:

import mantpy as mt

# A small synthetic ROI: image stack, channel panel, cell table.
roi = mt.datasets.toy_ecm_roi()

# Read multiplexed imaging and a cell table into AnnData.
adata = mt.io.read_imc(
    roi.image, panel=roi.panel, cells=roi.cells,
    sample_id="toy", condition="ctrl",
)

# Normalise channels and segment the ECM into patch nodes.
mt.pp.normalize(adata)
mt.pp.extract_ecm_patches(
    adata,
    roi.image,
    ecm_channel="ColIV",
    ecm_K="auto",
    features=["mean"],
)

# Build cell, ECM, and joint cell-ECM graph layers.
mt.gr.build_graph(adata, mode="cell")
mt.gr.build_graph(adata, mode="ecm")
mt.gr.build_graph(adata, mode="cell_ecm")

# Quantify spatial organisation.
mt.tl.cell_ecm_enrichment(adata, cell_type="B")
mt.tl.neighbourhood_clustering(adata, n_clusters=4)

# Visualise results.
mt.pl.cell_ecm_graph(adata)
mt.pl.neighbourhood_clusters(adata)

Point mt.io.read_imc at your own files to run the same pipeline on real data:

adata = mt.io.read_imc("image.tiff", panel="panel.csv", cells="cells.csv")

The toy ROI is synthetic — its clusters and statistics describe the generator, not biology. Use it to learn the API, then move to real data.

Tutorials

Step-by-step guides, each executed when the documentation is built:

Paper reproducibility

The paper reproducibility repository contains tutorials, full experiment notebooks and figure plotting code.

Public datasets

intestine = mt.datasets.coliv_intestine()   #  93 MB
lung = mt.datasets.balbc_pbs_lung()         #  71 MB
liver = mt.datasets.schistosoma_ecm()       #  38 MB

Documentation

Documentation · API reference · Changelog

Citation

If you use Mantpy, please cite the preprint:

Ghafoor M, Parkinson JE, Pham T, Georgaka S, Haley MJ, Jokl E, Piper Hanley K, Allen JE, Sutherland TE, Rattray M. Mantpy: a framework for extracellular matrix analysis in spatial proteomics. bioRxiv (2026). doi: 10.1101/2025.06.04.657781

Contact

For questions, contact moeghaf@gmail.com or mohamed.ghafoor@postgrad.manchester.ac.uk. To report a bug, use the issue tracker.

Metadata

Release files for mantpy 1.1.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 mantpy 1.1.0
File Size Uploaded Provenance Actions
mantpy-1.1.0.tar.gz 1.1 MB With provenance Details for mantpy-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.4 MB

Release files / mantpy-1.1.0.tar.gz

Download URL mantpy-1.1.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
5269ef3faa1752a60f392ab188a772e0e82d5d9fcb9498f40babbabb213615b6
BLAKE2b-256 checksum
How to use checksums
addaca70011b6fa9320229815ef695ea4e829c712e29469683d9601aecbc6707
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 31, 2026.

Transparency log

Release files / mantpy-1.1.0-py3-none-any.whl

Download URL mantpy-1.1.0-py3-none-any.whl
Size 292.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2fd8908ade80b2b65e211762f30468940946671b3b8fc8a0a8afbb1690ca456
BLAKE2b-256 checksum
How to use checksums
02fb3a419a67040acd0d7281c335d5056d44bd8428f56c06ba951f241689aca9
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 31, 2026.

Transparency log

Security for mantpy 1.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mantpy-1.1.0.tar.gz

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 31, 2026.

Transparency log

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.

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