Skip to main content

mantpy

Mantpy: extracellular-matrix analysis for spatial proteomics

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.

Mantpy overview: input, graph construction, applications and interoperability

Installation

Mantpy requires Python 3.11 or newer.

pip install mantpy

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

This runs as written — 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:

The full analyses behind the preprint run on real cohorts in the reproducibility repository; the intestine and lung workflows open directly in Colab.

Public datasets

One-line, checksummed loaders for every tutorial dataset, cached outside the package and reused offline:

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

Every loader returns the same Bunch shape as toy_ecm_roi, so moving an example from synthetic to real data is a one-line change. The bundles are frozen under CC BY 4.0 in an immutable Zenodo record.

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

Machine-readable citation metadata is in CITATION.cff (GitHub's "Cite this repository" button). The tutorial datasets have their own Zenodo DOI.

Contact

For questions and help requests, use the scverse discourse. To report a bug, use the issue tracker.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mantpy-1.0.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mantpy-1.0.1-py3-none-any.whl (254.0 kB view details)

Uploaded Python 3

File details

Details for the file mantpy-1.0.1.tar.gz.

File metadata

  • Download URL: mantpy-1.0.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mantpy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 08a7d6f6c4fa7d72090ffd84e9128ebd1d3d92f177afb0468ec95039db089959
MD5 7de5b46212d34a45b26e07cb265faaaa
BLAKE2b-256 05f4e011e713abb2abf4e991c597fe28eff791163878e582a681bc07e7274b3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mantpy-1.0.1.tar.gz:

Publisher: release.yaml on moeghaf/Mantpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mantpy-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mantpy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 254.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mantpy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76f552894a0402c3732c8758d21440d2910a065d83871a9f45868fcf22936f5a
MD5 d7c0c95a0282bab5937d8dc33cc329f9
BLAKE2b-256 e31c4002774a061fdc4395c7254e0d58524303554089f7c30a8c407b8ace3968

See more details on using hashes here.

Provenance

The following attestation bundles were made for mantpy-1.0.1-py3-none-any.whl:

Publisher: release.yaml on moeghaf/Mantpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page