Mantpy: graph representation learning on the extracellular matrix and its interface with cells
Abstract
Spatial proteomics now routinely images the extracellular matrix (ECM) alongside cells, yet analysis frameworks remain cell-centric and the matrix is rarely analysed in its own right. We present Mantpy, an open-source framework that gives the matrix a graph of its own. Continuous, unsegmentable ECM signal is tiled into patches that become graph nodes, from a single marker to multiplexed panels, and the ECM graph links to a cell graph to form a joint cell–ECM graph. Graphs live in scverse data structures and export to PyTorch Geometric, so masked graph autoencoding, GNN classification and integrated-gradients attribution apply directly to the matrix. Across three datasets, Mantpy recovers annotated tissue architecture from one basement-membrane marker by unsupervised graph learning, resolves important ECM clusters via explainable graph learning, and characterises cell–matrix association via graph statistics. Released as open-source software with ECM inclusive datasets, Mantpy turns the matrix from background signal into a spatial graph for machine learning.