Skip to main content

mantpy

Mantpy: extracellular-matrix analysis for spatial omics

Tests Documentation

Mantpy is a scverse-based framework for graph analysis of the extracellular matrix (ECM) in spatial omics. 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 and applications

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 manuscript analyses run on real cohorts in the reproducibility repository, each opening 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
prostate = mt.datasets.prostate_he_visium() # 194 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

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-0.2.0.tar.gz (984.7 kB view details)

Uploaded Source

Built Distribution

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

mantpy-0.2.0-py3-none-any.whl (265.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mantpy-0.2.0.tar.gz
  • Upload date:
  • Size: 984.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mantpy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cb5ba650e769c9c873a480d70e55f713d1424208941427f09c860a4b2a81201e
MD5 e3c0a9338f34d3ce07d5750916495e60
BLAKE2b-256 fe6e6aec617475ade7862c36e75e65c9b3a9642253c979cfe692123ff0d6e2cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for mantpy-0.2.0.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-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mantpy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 265.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mantpy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06ea8fe5232c52a59b0617a684dc037ba221aaeb01c91118f87055697d323b87
MD5 c5e105fe864e8308b65a6f7bf3386d7b
BLAKE2b-256 82db29c96f251f542ae60bd52fb5fca88d394bb7dc4ebc90fef9fc9b2405954a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mantpy-0.2.0-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

1.0.1

2 files

This release

0.2.0 This release

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