Abstract
Comprehensive characterization of the tumor microenvironment (TME) is essential for understanding cancer progression and developing effective, patient-specific therapies. Spatial context of the TME is particularly important, and exists across multiple scales-from the molecular to cellular to tissue levels. However, current methods are modality-specific and lack flexibility in effectively modeling the TME. We introduce SPIFEE, a flexible graph deep learning framework designed to model the TME and uncover spatial insights across multiple levels of biological organization. SPIFEE increases the expressivity of graph-based representations by directly encoding spatially varying functional vectors into graph edges. Additionally, it represents graph nodes as unique TME entities (e.g., cell types, phenotypic clusters, molecular pathways). This general formulation is modality-agnostic and also offers cross-modality integration. We demonstrate the versatility of SPIFEE across multiplex immunofluorescence, H&E histopathology, and spatial transcriptomics datasets, enabling rich characterization of cellular, phenotypic, and pathway-level interactions. SPIFEE shows improved performance when leveraging function-based edge representations and outperforms existing spatial modeling approaches. Moreover, by integrating graph attention mechanisms, SPIFEE reveals multi-scale spatial interactions most associated with disease state and patient survival. Overall, SPIFEE enhances the flexibility and representational power of spatial graph modeling, and enables deeper interrogation of the TME, advancing the potential for personalized cancer analysis.