ContextFlow: Context-Aware Flow Matching For Trajectory Inference From Spatial Omics Data
Santanu Subhash Rathod, Francesco Ceccarelli, Sean B. Holden, Pietro Liò, Xiao Zhang, Jovan Tanevski
TL;DR
ContextFlow tackles the challenge of inferring continuous spatiotemporal tissue trajectories from snapshot spatial omics data by marrying flow matching with context-aware optimal transport. It introduces a transitional plausibility framework that encodes local tissue structure and ligand–receptor signaling into OT couplings, via two integration schemes: PACM and PAER. The method demonstrates consistent improvements over state-of-the-art baselines across three datasets, yielding trajectories that are both statistically accurate (via $\mathcal{W}_2$, MMD, and Energy metrics) and biologically coherent (reduced implausible transitions and coherent cell-type progression). The entropic variant, ContextFlow-H, provides robust generalization and eliminates the need for extensive hyperparameter tuning, offering a scalable, interpretable approach for spatiotemporal dynamics in spatial omics. $ContextFlow$ thus provides a principled, generalizable framework for integrating biological priors into trajectory inference from spatial omics data, with potential extensions to spatial flow modeling and perturbation analysis.
Abstract
Inferring trajectories from longitudinal spatially-resolved omics data is fundamental to understanding the dynamics of structural and functional tissue changes in development, regeneration and repair, disease progression, and response to treatment. We propose ContextFlow, a novel context-aware flow matching framework that incorporates prior knowledge to guide the inference of structural tissue dynamics from spatially resolved omics data. Specifically, ContextFlow integrates local tissue organization and ligand-receptor communication patterns into a transition plausibility matrix that regularizes the optimal transport objective. By embedding these contextual constraints, ContextFlow generates trajectories that are not only statistically consistent but also biologically meaningful, making it a generalizable framework for modeling spatiotemporal dynamics from longitudinal, spatially resolved omics data. Evaluated on three datasets, ContextFlow consistently outperforms state-of-the-art flow matching methods across multiple quantitative and qualitative metrics of inference accuracy and biological coherence. Our code is available at: \href{https://github.com/santanurathod/ContextFlow}{ContextFlow}
