Mantpy: extracellular-matrix analysis for spatial omics
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.
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:
- Loading data
- Building ECM graphs
- Cell–ECM graphs
- Exporting to AnnData
- Exporting to PyTorch Geometric
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb5ba650e769c9c873a480d70e55f713d1424208941427f09c860a4b2a81201e
|
|
| MD5 |
e3c0a9338f34d3ce07d5750916495e60
|
|
| BLAKE2b-256 |
fe6e6aec617475ade7862c36e75e65c9b3a9642253c979cfe692123ff0d6e2cc
|
Provenance
The following attestation bundles were made for mantpy-0.2.0.tar.gz:
Publisher:
release.yaml on moeghaf/Mantpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mantpy-0.2.0.tar.gz -
Subject digest:
cb5ba650e769c9c873a480d70e55f713d1424208941427f09c860a4b2a81201e - Sigstore transparency entry: 2270358162
- Sigstore integration time:
-
Permalink:
moeghaf/Mantpy@73ccc8606d543e58dcf8012dcef0b54e4f1613bc -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/moeghaf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@73ccc8606d543e58dcf8012dcef0b54e4f1613bc -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06ea8fe5232c52a59b0617a684dc037ba221aaeb01c91118f87055697d323b87
|
|
| MD5 |
c5e105fe864e8308b65a6f7bf3386d7b
|
|
| BLAKE2b-256 |
82db29c96f251f542ae60bd52fb5fca88d394bb7dc4ebc90fef9fc9b2405954a
|
Provenance
The following attestation bundles were made for mantpy-0.2.0-py3-none-any.whl:
Publisher:
release.yaml on moeghaf/Mantpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mantpy-0.2.0-py3-none-any.whl -
Subject digest:
06ea8fe5232c52a59b0617a684dc037ba221aaeb01c91118f87055697d323b87 - Sigstore transparency entry: 2270358493
- Sigstore integration time:
-
Permalink:
moeghaf/Mantpy@73ccc8606d543e58dcf8012dcef0b54e4f1613bc -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/moeghaf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@73ccc8606d543e58dcf8012dcef0b54e4f1613bc -
Trigger Event:
release
-
Statement type: