Abstract
Understanding how tissues remodel in response to perturbations requires computational tools that can untangle condition-specific changes from the conserved tissue architecture. We present Haruka, a spatially aware contrastive learning framework that identifies salient (condition-specific) and background (shared) spatial domains across tissue slices and experimental conditions. Haruka integrates contrastive variational inference with an auxiliary microenvironment reconstruction task, enabling the model to learn spatial-context-informed embeddings that capture both perturbation effects and local neighborhood context. Through benchmarking on simulated and real datasets, Haruka outperforms state-of-the-art methods in detecting spatially heterogeneous responses. Applied to diverse spatial omics platforms, Haruka distinguished immunotherapy responders in melanoma, traced fibrosis progression in human lung tissue, and mapped treatment-resistant microenvironments in KRAS (G12D) -mutated lung cancer. Thus, Haruka provides a generalizable framework for spatial contrastive analysis, enabling systematic dissection of tissue organization, cellular plasticity, and microenvironmental remodeling across disease, development, and therapeutic response.