ResSAT: enhancing spatial transcriptomics prediction from H&E-stained histology images with an interactive spot transformer Authors: Anqi Liu, Yue Zhao, Woong-Ki Kim, Hui Shen, Zhengming Ding, Hong-Wen Deng Published: 2026 ABSTRACT Spatial transcriptomics has revolutionized RNA quantification with spatial resolution. Hematoxylin and eosin (H&E) images, the gold standard in medical diagnosis, offer insights into tissue structure, correlating with gene expression patterns. We introduce ResSAT (Residual networks with Spatial encoding—self-Attention Transformer), a framework for predicting spatially resolved transcriptomic profiles from H&E images by integrating image features, spatial locations, and self-attention transformer-based spot interactions. Benchmarking on 10 × Visium datasets, ResSAT outperforms existing methods and preserved biologically meaningful spatial patterns, promising reduced spatial transcriptomics profiling costs and rapid acquisition of numerous profiles.Supplementary InformationThe online version contains supplementary material available at https://doi.org/10.1186/s13059-026-04168-x. Background The rapid advancement of spatial transcriptomics (ST) technology has revolutionized the field of RNA abundance quantification by offering remarkable spatial resolution for concurrent gene expression profiling and precise spatial spot localization [1]. This breakthrough allows researchers to generate detailed maps of gene expression within tissues, providing unprecedented insights into cellular function and tissue organization [2]. However, currently, the resource-intensive and time-consuming nature of ST profiling has limited its widespread application, creating a demand for more accessible methods. In contrast, Hematoxylin and eosin (H&E) staining is a widely used histological technique that provides detailed insights into tissue structure and composition at a microscopic level [3, 4]. H&E images are instrumental in medical diagnostics, offering clear visualizations of cellular morphology and tissue architecture [5]. As the gold standard in many diagnostic procedures, H&E imaging is cost-effective, readily available, and extensively utilized in clinical settings. Moreover, there is a close relationship between H&E staining and ST, as H&E images capture detailed cellular and tissue morphology that correlates with gene expression patterns [6]. The staining highlights different cellular components: hematoxylin stains the cell nuclei blue, indicating areas of high DNA concentration, while eosin stains the cytoplasm and extracellular matrix pink, showing the structural context [7]. These visual cues from H&E images reflect the underlying biological processes and molecular activities within the tissue [3, 4], providing a spatial map that can be linked to gene expression data. Previous studies have also demonstrated that changes in gene expression or genetic mutations often influence cell morphology, structure, and distribution, resulting in alterations in histological features [8, 9]​. This correlation enables the use of H&E images to predict spatial gene expression profiles, leveraging the morphological context provided by the staining to infer molecular states. Recognizing the potential to integrate these two powerful tools, recent studies [10–14] have focused on developing computational approaches to predict ST data from H&E images. This innovative synergy aims to leverage the comprehensive tissue insights provided by H&E images to infer spatial gene expression profiles. By doing so, these approaches can potentially circumvent the limitations of ST technology, making high-resolution gene expression mapping more accessible and practical. Several existing approaches, such as BLEEP [10], Hist2ST [11], HisToGene [12], mclSTExp [13], ST-Net [14], have shown promising results in predicting expression from histology images. For example, ST-Net uses H&E image patches centered at spots and a ResNet50 image encoder to predict the matched gene expression profile at each spot. Similarly, HisToGene takes histology image patches associated with spatial spots as input and uses a vision transformer backbone to learn image-based representations for spot-level gene expression prediction. Hist2ST further incorporates spatial coordinates as positional embeddings, which are additively combined with image features to improve spatial gene expression prediction. Other methods, such as BLEEP and mclSTExp, adopt contrastive learning frameworks to align image features with gene expression representations in a shared embedding space. However, these approaches either treat each spot independently or incorporate spatial information in a limited manner, which restricts their ability to model interactions across spatial locations. Such interactions provide essential context about tissue architecture, including the organization and interaction of cells, and spatial heterogeneity, and are closely associated with variations in cellular composition and functions across different tissue regions. Furthermore, these methods do not explicitly capture how spatial location influences image features, which may significantly impact biological interpretation and predictive accuracy [15]. To address these challenges, we proposed a novel approach called ResSAT (Residual networks with Spatial encoding—self-Attention Transformer) for predicting spatial transcriptomics profiles using H&E-stained histology images. ResSAT extracts visual features from H&E image patches using an image encoder and encodes spatial coordinates using a Fourier feature-based spatial encoder [16, 17]. The image and spatial representations are then integrated through a learned modulation mechanism, allowing spatial context to adaptively influence image features. Finally, a self-attention module operates across spots to model spatially informed spot–spot interactions for spatial gene expression prediction. We validated the effectiveness of ResSAT by benchmarking its performance on two different mouse brain datasets obtained from the 10 × Visium platform, along with additional evaluations on datasets from other human tissue types. Our results demonstrated significant improvements over existing methods such as BLEEP [10], Hist2ST [11], HisToGene [12], mclSTExp [13], and ST-Net [14] in terms of mean correlations across top 2,000 highly variable genes (HVGs) and mean correlations among the top 50 highly expressed genes (HEGs). In addition, downstream analyses demonstrate that the predicted gene expression preserves biologically meaningful spatial patterns. This innovative approach significantly enhances the performance of spatial gene expression prediction from histology images. The proposed framework has the potential to substantially reduce the time and cost associated with spatial transcriptomics profiling, opening up new possibilities for acquiring numerous spatial transcriptomics profiles rapidly and reconstructing comprehensive 3D spatial transcriptomics from adjacent 2D spatial transcriptomics profiles. Results ResSAT enables gene expression prediction and consistently performs well in mouse brain datasets To assess the predictive efficacy of ResSAT in quantifying gene expression, we applied our method to both the mouse brain sagittal anterior (SA) and sagittal posterior (SP) datasets [18–21]. We compared ResSAT to other methods for spatial gene expression prediction, including BLEEP [10], Hist2ST [11], HisToGene [12], mclSTExp [13], and ST-Net [14]. Predictive performance was evaluated using Pearson correlation coefficients (PCCs) computed between predicted and observed expression across spatial spots for each gene, as described in the Methods. The expression profiles reconstructed from ResSAT showed the highest mean correlation across both top 2,000 HVGs (Table 1) and top 50 HEGs (Table 2) in the two different datasets. To ensure robustness and reliability, the evaluations were repeated five times, and the resulting means along with 95% confidence intervals (CIs) were computed. Table 1Mean correlations of top 2,000 HVGs on held-out datasets (Section 1)MethodsSASPResSAT0.6577 (0.6485—0.6670)0.6980 (0.6976—0.6984)BLEEP0.4137 (0.3966—0.4309)0.5007 (0.4856—0.5159)His2ST0.4893 (0.4684—0.5102)0.5527 (0.5256—0.5798)HistoGene0.2070 (0.1943—0.2196)0.3668 (0.3565—0.3771)mclSTExp0.3849 (0.3726—0.3972)0.4972 (0.4912—0.5031)ST-Net0.5208 (0.5176—0.5241)0.5933 (0.5916—0.5951)Values are reported as mean (95% CI)Table 2Mean correlations of top 50 HEGs on held-out datasets (Section 1)MethodsSASPResSAT0.8781 (0.8722—0.8841)0.8999 (0.8979—0.9019)BLEEP0.5933 (0.5814—0.6052)0.7460 (0.7297—0.7624)His2ST0.7450 (0.7257—0.7643)0.7956 (0.7744—0.8167)HistoGene0.2971 (0.2805—0.3137)0.5653 (0.5468—0.5838)mclSTExp0.5514 (0.5281—0.5746)0.7272 (0.7239—0.7304)ST-Net0.6893 (0.6867—0.6920)0.8169 (0.8154—0.8184)Values are reported as mean (95% CI) Table 1Mean correlations of top 2,000 HVGs on held-out datasets (Section 1)MethodsSASPResSAT0.6577 (0.6485—0.6670)0.6980 (0.6976—0.6984)BLEEP0.4137 (0.3966—0.4309)0.5007 (0.4856—0.5159)His2ST0.4893 (0.4684—0.5102)0.5527 (0.5256—0.5798)HistoGene0.2070 (0.1943—0.2196)0.3668 (0.3565—0.3771)mclSTExp0.3849 (0.3726—0.3972)0.4972 (0.4912—0.5031)ST-Net0.5208 (0.5176—0.5241)0.5933 (0.5916—0.5951)Values are reported as mean (95% CI) Mean correlations of top 2,000 HVGs on held-out datasets (Section 1) Values are reported as mean (95% CI) Table 2Mean correlations of top 50 HEGs on held-out datasets (Section 1)MethodsSASPResSAT0.8781 (0.8722—0.8841)0.8999 (0.8979—0.9019)BLEEP0.5933 (0.5814—0.6052)0.7460 (0.7297—0.7624)His2ST0.7450 (0.7257—0.7643)0.7956 (0.7744—0.8167)HistoGene0.2971 (0.2805—0.3137)0.5653 (0.5468—0.5838)mclSTExp0.5514 (0.5281—0.5746)0.7272 (0.7239—0.7304)ST-Net0.6893 (0.6867—0.6920)0.8169 (0.8154—0.8184)Values are reported as mean (95% CI) Mean correlations of top 50 HEGs on held-out datasets (Section 1) Values are reported as mean (95% CI) As shown in Tables 1 and 2, ResSAT consistently outperformed all compared methods by a substantial margin on both datasets. On the SA dataset, ResSAT achieved a mean PCC of 0.6577 across all top 2,000 HVGs, surpassing the second-best method, ST-Net (0.5208), by approximately 26.3%. On the SP dataset, ResSAT achieved a mean PCC of 0.6980, exceeding ST-Net (0.5933) by 17.6%. For the top 50 HEGs, ResSAT also achieved the highest PCCs, with values of 0.8781 on the SA dataset and 0.8999 on the SP dataset, indicating strong predictive performance for HEGs. Overall, these results demonstrate that ResSAT more accurately reconstructs spatial gene expression profiles than existing methods across HVGs and HEGs. Respectively, for the SA and SP datasets, we trained ResSAT using one section and evaluated the correlation between predicted and observed expression profiles on the other section. Specifically, after training on Section 2 and testing on Section 1 as shown in Tables 1 and 2, we also trained on Section 1 and tested on Section 2 to validate the results. As illustrated in Fig. 1, ResSAT consistently yielded the highest PCCs between predicted and observed expression across all sections in both datasets.Fig. 1Comparative evaluation of spatial transcriptome prediction methods in mouse brain tissues. Box plots show the PCCs across all of the top 2,000 HVGs for each method. SA_Section 1: trained on Section 2, tested on Section 1 of the SA dataset. SA_Section 2: trained on Section 1, tested on Section 2 of the SA dataset. SP_Section 1: trained on Section 2, tested on Section 1 of the SP dataset. SP_Section 2: trained on Section 1, tested on Section 2 of the SP dataset. Each box represents the interquartile range (IQR) of PCCs, with the mean indicated by the center line. Results shown are from a representative run Comparative evaluation of spatial transcriptome prediction methods in mouse brain tissues. Box plots show the PCCs across all of the top 2,000 HVGs for each method. SA_Section 1: trained on Section 2, tested on Section 1 of the SA dataset. SA_Section 2: trained on Section 1, tested on Section 2 of the SA dataset. SP_Section 1: trained on Section 2, tested on Section 1 of the SP dataset. SP_Section 2: trained on Section 1, tested on Section 2 of the SP dataset. Each box represents the interquartile range (IQR) of PCCs, with the mean indicated by the center line. Results shown are from a representative run To assess the statistical significance of these improvements, we performed Wilcoxon signed-rank tests comparing PCCs between ResSAT and each baseline method across the top 2,000 HVGs. ResSAT significantly outperformed all other methods on both datasets (all P < 0.001, Additional file 1: Table S1), demonstrating that the observed improvements are robust and statistically significant. Ablation studies To evaluate the contribution of each component in ResSAT, we conducted comprehensive ablation experiments by systematically adding the spatial encoder and self-attention modules to the baseline image encoder. The results on the SA and SP datasets are summarized in Tables 3 and 4, respectively. Table 3Ablation study on the SA dataset (Section 1)ExperimentMean PCCs (95% CI)Top 50 HEG PCCs (95% CI)Image encoder only0.5480 (0.5441–0.5518)0.7281 (0.7212–0.7350) + Spatial encoder0.6014 (0.5973–0.6055)0.8312 (0.8257–0.8366) + Self-attention transformer (SAT)0.5516 (0.5446–0.5586)0.7335 (0.7250–0.7419)ResSAT(+ Spatial encoder + SAT)0.6577 (0.6512–0.6643)0.8781 (0.8739–0.8824)All experiments use the image encoder as the baseline. Spatial encoder and self-attention are incrementally evaluatedTable 4Ablation study on the SP dataset (Section 1)ExperimentMean PCCs (95% CI)Top 50 HEG PCCs (95% CI)Image encoder only0.6149 (0.6130–0.6168)0.8424 (0.8411–0.8438) + Spatial encoder0.6728 (0.6701–0.6755)0.8843 (0.8817–0.8869) + Self-attention transformer (SAT)0.6151 (0.6129–0.6173)0.8431 (0.8415–0.8446)ResSAT(+ Spatial encoder + SAT)0.6980 (0.6977–0.6983)0.8999 (0.8985–0.9013)All experiments use the image encoder as the baseline. Spatial encoder and self-attention are incrementally evaluated Table 3Ablation study on the SA dataset (Section 1)ExperimentMean PCCs (95% CI)Top 50 HEG PCCs (95% CI)Image encoder only0.5480 (0.5441–0.5518)0.7281 (0.7212–0.7350) + Spatial encoder0.6014 (0.5973–0.6055)0.8312 (0.8257–0.8366) + Self-attention transformer (SAT)0.5516 (0.5446–0.5586)0.7335 (0.7250–0.7419)ResSAT(+ Spatial encoder + SAT)0.6577 (0.6512–0.6643)0.8781 (0.8739–0.8824)All experiments use the image encoder as the baseline. Spatial encoder and self-attention are incrementally evaluated Ablation study on the SA dataset (Section 1) ResSAT (+ Spatial encoder + SAT) All experiments use the image encoder as the baseline. Spatial encoder and self-attention are incrementally evaluated Table 4Ablation study on the SP dataset (Section 1)ExperimentMean PCCs (95% CI)Top 50 HEG PCCs (95% CI)Image encoder only0.6149 (0.6130–0.6168)0.8424 (0.8411–0.8438) + Spatial encoder0.6728 (0.6701–0.6755)0.8843 (0.8817–0.8869) + Self-attention transformer (SAT)0.6151 (0.6129–0.6173)0.8431 (0.8415–0.8446)ResSAT(+ Spatial encoder + SAT)0.6980 (0.6977–0.6983)0.8999 (0.8985–0.9013)All experiments use the image encoder as the baseline. Spatial encoder and self-attention are incrementally evaluated Ablation study on the SP dataset (Section 1) ResSAT (+ Spatial encoder + SAT) All experiments use the image encoder as the baseline. Spatial encoder and self-attention are incrementally evaluated We first examined the effect of the spatial encoder. Adding spatial encoding to the image-only baseline substantially improved prediction performance, increasing the mean PCC from 0.5480 to 0.6014 on the SA dataset and from 0.6149 to 0.6728 on the SP dataset (Tables 3 and 4). Similar improvements were observed for the top 50 HEGs. These results indicate that spatial coordinates provide important information beyond visual features alone. We next evaluated the contribution of self-attention module. Applying self-attention alone to the image encoder resulted in only marginal improvements over the baseline (mean PCC = 0.5516 vs. 0.5480 on SA; 0.6151 vs. 0.6149 on SP), suggesting that modeling interactions without spatial context provides limited benefit. In contrast, combining spatial encoder with self-attention (i.e., the full ResSAT model) led to the largest performance gains, achieving mean PCCs of 0.6577 on SA and 0.6980 on SP, as well as the highest top 50 HEG PCCs (0.8781 on SA and 0.8999 on SP). Overall, these results demonstrate that spatial encoding and self-attention are complementary, and that their integration is critical for accurately reconstructing spatial gene expression patterns. Visualization of predicted gene expression We examined whether the expression profiles reconstructed from ResSAT recapitulated the spatial patterns of brain-related genes. Within the SA dataset, we assessed the correlation between observed and predicted expression profiles, computing the PCC for each gene. We then ranked these genes in descending order of their PCCs and selected the predicted genes with the top 5 highest correlations obtained from our method for visualization (Pcbp3, 1110008P14Rik, Stx1a, Lingo1, and Gng4), as shown in Fig. 2. These genes showed highly consistent spatial patterns between observed and predicted expression. Pcbp3 showed enriched expression in the olfactory bulb region of the SA mouse brain section in our results. This pattern is consistent with Human Protein Atlas mouse brain RNA-seq data and Allen Mouse Brain in situ hybridization (ISH) data [22], both showing enriched Pcbp3 expression in the olfactory region. 1110008P14Rik, currently annotated as Bbln, is a mouse protein-coding gene with limited functional characterization in the brain [23]. Allen Mouse Brain Atlas includes adult mouse brain ISH experiments for 1110008P14Rikin sagittal and coronal Sections [24]., supporting its annotation as a spatially profiled mouse brain transcript. In Fig. 2, 1110008P14Rik showed a dorsal forebrain and cortical-like expression pattern, indicating that ResSAT can accurately capture the spatial organization of a less-characterized mouse brain gene. Stx1a is a neuronal gene involved in synaptic vesicle exocytosis, vesicle docking, and neurotransmission [25, 26]. Lingo1 encodes a leucine-rich repeat and immunoglobulin domain-containing transmembrane protein with established roles in oligodendrocyte differentiation and central nervous system (CNS) myelination [27–29]. Stx1a and Lingo1 displayed broad expression across forebrain and cortical regions. Gng4 (G Protein Subunit Gamma 4) is a gene encoding a subunit of heterotrimeric G proteins, which are involved in signal transduction pathways in neurons [30]. In the mouse olfactory bulb, G proteins play a crucial role in mediating signaling pathways involved in odorant detection and processing. Heterotrimeric G proteins, consisting of alpha, beta, and gamma subunits, are involved in transducing signals from odorant receptors to downstream effector molecules, leading to neuronal activation and olfactory perception [30].Fig. 2Visualization of the mouse brain (SA) dataset by the top five predicted genes with the highest correlations: Pcbp3, 1110008P14Rik, Stx1a, Lingo1, and Gng4 Visualization of the mouse brain (SA) dataset by the top five predicted genes with the highest correlations: Pcbp3, 1110008P14Rik, Stx1a, Lingo1, and Gng4 To further validate the robustness of ResSAT in predicting brain-related genes, we extended our analysis to the SP dataset, achieving similarly accurate predictions, as shown in Fig. 3. ResSAT enabled accurate prediction of key genes associated with mouse brain. Figure 3 shows the top 5 genes (Cnpy1, Gabra6, Cbln3, Il16, and Shf) in the SP dataset predicted by ResSAT. Cnpy1 showed enriched expression in the cerebellar region of the mouse brain SP section. This pattern is consistent with previous findings reporting high Cnpy1 expression in the cerebellum [31]. Gabra6 (Gamma-aminobutyric acid type A (GABAA) receptor subunit alpha6) showed strong cerebellar expression, consistent with previous mouse studies showing that the GABAA receptor alpha 6 subunit is selectively expressed in cerebellar granule cells and marks cerebellar granule cell maturation [32]. Cbln3 also showed prominent cerebellar expression, consistent with reports that Cbln3 is expressed in cerebellar granule neurons and localizes with Cbln1 at parallel fiber–Purkinje cell synapses in the mouse cerebellum [33]. IL-16 is best known as an immune chemoattractant cytokine, but neuronal IL-16 has also been detected in mouse cerebellum, supporting its relevance as a brain-expressed transcript [34]. Shf was also accurately predicted in the cerebellar region. Public mouse expression resources report Shf expression in the cerebellar cortex [35].Fig. 3Visualization of the mouse brain (SP) dataset by the top five predicted genes with the highest correlations: Cnpy1, Gabra6, Cbln3, Il16, and Shf Visualization of the mouse brain (SP) dataset by the top five predicted genes with the highest correlations: Cnpy1, Gabra6, Cbln3, Il16, and Shf Together, these results demonstrate that ResSAT accurately recapitulates spatial gene expression patterns across different brain regions and datasets. The concordance between observed and predicted expression for genes enriched in olfactory bulb, forebrain/cortical, and cerebellar regions supports the robustness of ResSAT in preserving anatomically organized transcriptional patterns. Spatial domain detection To assess whether ResSAT preserves biologically meaningful spatial patterns, we identified spatial domains from predicted gene expression profiles in the mouse brain SA and SP datasets. Spatial domains are tissue regions with the same or similar expression profiles, and identifying spatial domains in ST is the basic step for elucidating transcriptomic heterogeneity and underlying cellular mechanisms [36]. We applied K-means clustering to both predicted and observed expression profiles. As shown in Fig. 4, ResSAT-reconstructed gene expression accurately recapitulates the spatial domain organization of the Section 1 in the mouse brain SA dataset. The predicted spatial domains from ResSAT closely match the reference domains derived from observed expression profiles, achieving the highest adjusted rand index (ARI) of 0.839 and normalized mutual information (NMI) of 0.754 compared to other baseline methods. The ARI measures how similar two clustering results are, while correcting for agreement that may occur by chance [37]. The NMI measures how much information is shared between two clustering assignments, indicating how well one clustering predicts the other [38]. Similarly, for the SP dataset (Fig. 5), ResSAT also achieved the highest ARI of 0.733 and NMI of 0.772 among all compared methods, indicating superior accuracy between spatial domains derived from predicted and observed expression profiles. These domains correspond to anatomically distinct regions, indicating that the predicted gene expression preserves biologically meaningful spatial organization.Fig. 4Spatial clustering analysis of the mouse brain SA dataset overlaid on the H&E image (Section 1)Fig. 5Spatial clustering analysis of the mouse brain SP dataset overlaid on the H&E image (Section 1) Spatial clustering analysis of the mouse brain SA dataset overlaid on the H&E image (Section 1) Spatial clustering analysis of the mouse brain SP dataset overlaid on the H&E image (Section 1) ResSAT performs well across multiple tissue types To further evaluate the robustness and generalizability of ResSAT beyond the mouse brain datasets, we next applied our model to two additional datasets from other tissue types.Human Squamous Cell Carcinoma (SCC) [39, 40] comprises 12 tissue sections obtained from four patients with cutaneous squamous cell carcinoma. For our experiments, we selected 3 tissue sections from the same patient to minimize inter-patient variability.HER2-positive Breast Tumor (HER2ST) [41, 42] includes 36 tissue sections from eight breast cancer patients, with four patients contributing 6 sections each and the remaining four patients contributing 3 sections each. For our experiments, we selected 6 tissue sections from the same patient. Human Squamous Cell Carcinoma (SCC) [39, 40] comprises 12 tissue sections obtained from four patients with cutaneous squamous cell carcinoma. For our experiments, we selected 3 tissue sections from the same patient to minimize inter-patient variability. Human Squamous Cell Carcinoma (SCC) [39, 40] comprises 12 tissue sections obtained from four patients with cutaneous squamous cell carcinoma. For our experiments, we selected 3 tissue sections from the same patient to minimize inter-patient variability. HER2-positive Breast Tumor (HER2ST) [41, 42] includes 36 tissue sections from eight breast cancer patients, with four patients contributing 6 sections each and the remaining four patients contributing 3 sections each. For our experiments, we selected 6 tissue sections from the same patient. HER2-positive Breast Tumor (HER2ST) [41, 42] includes 36 tissue sections from eight breast cancer patients, with four patients contributing 6 sections each and the remaining four patients contributing 3 sections each. For our experiments, we selected 6 tissue sections from the same patient. We selected consecutive sections from the same individual to ensure biological continuity between training and testing sets and to minimize confounding effects from inter-individual variability, thereby enabling the model to more effectively capture spatial gene expression patterns without confounding effects from inter-individual differences. For each dataset, we applied the same data preprocessing pipeline as used for the mouse brain datasets, with dataset-specific quality control parameters tailored to the characteristics of each dataset. For the SCC dataset, we excluded spots with fewer than 500 or more than 40,000 total UMI counts to remove low-quality spots. Spots with fewer than 3 detected genes or a mitochondrial gene fraction exceeding 20% were also filtered out. For the HER2ST dataset, we excluded spots with fewer than 100 or more than 40,000 total UMI counts to remove low-quality spots. Spots with fewer than 3 detected genes or a mitochondrial gene fraction exceeding 20% were also filtered out. Spots near the H&E image boundary were excluded if a complete image patch could not be extracted. Following quality control, we applied the same preprocessing pipeline as used for the mouse brain datasets, including normalization, feature selection, dimensionality reduction, and batch correction. Spatial coordinates were normalized to the range [0, 1] within each tissue section using min–max scaling to ensure comparability across sections. Detailed preprocessing procedures are described in the Methods section. We compared ResSAT against the same five baseline methods evaluated in the mouse brain experiments: BLEEP [10], Hist2ST [11], HisToGene [12], mclSTExp [13], and ST-Net [14]. As shown in Fig. 6, ResSAT demonstrates higher PCCs than all baseline methods across three sections from the same patient in the SCC dataset. The box plots display the distribution of PCCs between predicted and observed gene expression across the top 2,000 HVGs for each method in each tissue section. In Section 1, ResSAT achieved a mean PCC of approximately 0.52, outperforming other baseline methods. Similar trends were observed in Sections 2 and 3, where ResSAT maintained mean PCCs of approximately 0.53 and 0.46, respectively, consistently ranking among the top-performing methods. As shown in Fig. 7, ResSAT also demonstrated strong performance across all six sections in the HER2ST dataset. ResSAT achieved mean PCCs of approximately 0.32 across sections, consistently outperforming all baseline methods. Consistent with our findings on the mouse brain datasets, these improvements were statistically significant (all p < 0.001, Wilcoxon signed-rank test; Additional file 1: Tables S2 and S3). These results suggest that ResSAT maintains strong predictive performance across tissues with distinct cellular composition and spatial organization, supporting its potential applicability to diverse spatial transcriptomics datasets.Fig. 6Comparative evaluation of spatial transcriptome prediction methods in the SCC dataset. Box plots show the PCCs across all of the top 2,000 HVGs for each method. A nested cross-validation framework with a leave-one-section-out outer loop was used, where each section was held out as the testing set while the remaining sections were used for training. Each box represents the interquartile range (IQR), with the mean indicated by the center lineFig. 7Comparative evaluation of spatial transcriptome prediction methods in the HER2ST dataset. Box plots show the PCCs across all of the top 2,000 HVGs for each method. A nested cross-validation framework with a leave-one-section-out outer loop was used, where each section was held out as the testing set while the remaining sections were used for training. Each box represents the interquartile range (IQR), with the mean indicated by the center line Comparative evaluation of spatial transcriptome prediction methods in the SCC dataset. Box plots show the PCCs across all of the top 2,000 HVGs for each method. A nested cross-validation framework with a leave-one-section-out outer loop was used, where each section was held out as the testing set while the remaining sections were used for training. Each box represents the interquartile range (IQR), with the mean indicated by the center line Comparative evaluation of spatial transcriptome prediction methods in the HER2ST dataset. Box plots show the PCCs across all of the top 2,000 HVGs for each method. A nested cross-validation framework with a leave-one-section-out outer loop was used, where each section was held out as the testing set while the remaining sections were used for training. Each box represents the interquartile range (IQR), with the mean indicated by the center line ResSAT enables to localize cancer regions and recapitulate cancer-relevant biological pathways Beyond anatomically defined normal tissue regions, we further assessed whether ResSAT-predicted expression enables accurate localization of distinct tissue regions in a pathological context, particularly cancer regions, by examining a breast cancer section from the HER2ST dataset with available pathologist-annotated spot-level tissue classifications [12]. As shown in Fig. 8, ResSAT still achieved the highest ARI and NMI among all compared methods, demonstrating superior accuracy in identifying cancer regions and distinguishing them from surrounding tissue compartments. These results indicate that ResSAT-predicted expression preserves the transcriptional signatures underlying pathological tissue heterogeneity.Fig. 8Spatial clustering analysis of the HER2ST dataset overlaid on the H&E image. Spots were grouped into cancerous (red) and other tissue regions based on pathologist annotations Spatial clustering analysis of the HER2ST dataset overlaid on the H&E image. Spots were grouped into cancerous (red) and other tissue regions based on pathologist annotations To further assess the biological relevance of ResSAT-predicted gene expression, we performed differential expression analysis to identify genes significantly different between spots labeled as “invasive cancer” and other tissues in the HER2ST breast cancer section, followed by Kyoto Encyclopedia of Genes and Genomes (KEGG) and Gene Ontology Biological Process (GO:BP) pathway enrichment analyses [43]. KEGG analysis revealed significant enrichment in DNA repair pathways, including Homologous recombination and Nucleotide excision repair, consistent with the established role of BRCA1-mediated homologous recombination deficiency in breast cancer pathogenesis [44]. Enrichment of the Adherens junction pathway reflects dysregulation of cell–cell adhesion complexes associated with epithelial-mesenchymal transition, a key mechanism underlying breast cancer invasion and metastasis [45]. GO analysis revealed prominent enrichment of RNA splicing pathways, including mRNA splicing via spliceosome and transesterification reactions, consistent with widespread spliceosomal dysregulation documented in breast cancer [46]. Enrichment of signal transduction in response to DNA damage further reflects the genomic instability characteristic of invasive breast cancer [47]. The top 10 enriched KEGG and GO:BP pathways derived from ResSAT-predicted expression are presented in Additional file 2: Figure S1 and Additional file 1: Tables S4–S5, alongside the corresponding enrichment results derived from observed expression. Notably, all top 10 enriched pathways identified from ResSAT-predicted expression were also significantly enriched in the observed expression, demonstrating that ResSAT predictions faithfully preserve the biological signals of the breast tumor microenvironment. Discussion We developed ResSAT to jointly model morphological features, spatial context, and interactions between spatial locations for spatial gene expression prediction. ResSAT extracts visual features from H&E images and encodes spatial coordinates using a Fourier feature-based spatial encoder. These representations are integrated through a learned modulation mechanism, enabling spatial information to adaptively influence image features. In addition, a self-attention module operates across spatial locations to capture interactions between spots, allowing the model to leverage both spatial context and inter-spot dependencies for improving gene expression prediction. Ablation studies further highlight the importance of each component. Incorporating spatial encoding substantially improves performance over image-only models, while self-attention transformer alone provides limited benefit without spatial context. The combination of spatial encoding and self-attention transformer yields the strongest performance, indicating that modeling interactions between spatially informed representations is critical for accurate prediction. In our experimental evaluations on benchmark ST datasets, our proposed method demonstrated its effectiveness in accurately predicting spatial gene expression patterns across multiple datasets. We achieved significantly higher mean correlations across top 2,000 HVGs and top 50 HEGs, representing substantial improvements compared to existing methods. In mouse brain datasets, where more detailed downstream biological analyses were performed, the predicted gene expression patterns closely match the observed spatial distributions for representative genes. In addition, spatial domain analysis demonstrates that the predicted expression preserves biologically meaningful spatial organization, with domains corresponding to anatomically distinct regions. These results highlight the effectiveness of ResSAT for spatial gene expression prediction from H&E images. Beyond normal tissue architecture, ResSAT-predicted expression also accurately recapitulates cancer microenvironment organization, as evidenced by superior cancer region localization performance on the HER2ST dataset. Furthermore, pathway enrichment analysis of differentially expressed genes between cancer and non-cancer regions identified cancer-relevant biological processes including homologous recombination, nucleotide excision repair, epithelial-mesenchymal transition, and RNA splicing dysregulation, all of which are well-established hallmarks of breast cancer. These findings suggest that ResSAT predictions not only achieve high quantitative accuracy but also preserve the transcriptional signatures underlying pathological tissue heterogeneity, highlighting their potential utility for biological discovery in cancer research. Our analyses span multiple spatial transcriptomics datasets, including mouse brain and additional tissue types, providing a comprehensive evaluation of spatial gene expression prediction. Despite the improved performance of ResSAT, predicting gene expression from histology images remains a challenging task, and prediction accuracy varies across genes. This variability likely reflects weak associations between morphology and gene expression for certain genes, technical limitations of the Visium platform, and potential experimental noise. In addition, our evaluation primarily focuses on 10 × Visium spatial transcriptomics platforms. The applicability of the model to other platforms, especially single-cell or subcellular spatial transcriptomics platforms, remains to be further investigated. Finally, model performance may depend on the similarity between training and testing data. Differences in tissue types, staining protocols, experimental conditions, inter-individual variability, and variation across tissue sections and spatial regions may affect generalization. Future work will focus on improving the proposed framework to enhance robustness and generalizability across different spatial transcriptomics platforms and datasets. Conclusions We introduced ResSAT, a novel framework for predicting spatial gene expression profiles from H&E-stained histology images. ResSAT effectively captures tissue structures, incorporates spatial context to modulate image representations, and models interactions between spatial locations to enhance prediction performance. Our evaluations on multiple datasets demonstrated significant improvements over existing methods, with higher mean correlations and accurate spatial predictions. Methods Datasets: two mouse brain datasets (SA and SP) ST profiling of the anterior part and posterior part of the mouse brain tissue sagittal sections was generated with the Visium technology from 10 × Genomics [18–21]. Both datasets consist of serial H&E histology images and paired gene expressions at the spatial spots and their coordinates. The analyzed gene expression count matrices are outputs of the SpaceRanger pipeline [48]. The anterior sagittal dataset comprises two sets of H&E-stained histology images, alongside corresponding spatial gene expression data [18, 19]. In Section 1, the ST data encapsulates the expression profiles of 31,053 genes across 2,825 spots, given by read counts. Section 2 features ST data for 31,053 genes across 2,696 spots, also detailed through read counts. The posterior sagittal dataset includes two collections of H&E-stained histology images and their associated spatial gene expression data [20, 21]. For the first section, ST analysis reveals the expression levels of 32,285 genes across 3,355 spots, given by read count data. The second section presents ST information for the same number of genes, but across 3,289 spots, with expression quantified similarly through read counts. Data preprocessing For the H&E histology images, we extracted image patches centered on each spot using spatial coordinates from the SpaceRanger metadata, with the patch radius determined by the reported spot diameter. Each image patch was paired with the gene expression profile of the same spot. Spatial coordinates were normalized to the range [0, 1] within each tissue section using min–max scaling to ensure comparability across sections. For quality control, spots with fewer than 1,000 or more than 70,000 total UMI counts were excluded to remove low-quality spots. Spots with fewer than 3 detected genes or a mitochondrial gene fraction exceeding 20% were also filtered out. Spots near the H&E image boundary were excluded if a complete image patch could not be extracted. After filtering, gene expression counts were normalized to a target sum of 10,000 per spot and log-transformed. When merging tissue sections within each dataset, only genes present in all sections were retained to ensure a consistent feature space. Top 2,000 HVGs were then selected in a batch-aware manner (with section identity as the batch key) to prevent any single section from dominating the gene selection. The expression matrix was scaled to zero mean and unit variance per gene, with values capped at 10 to limit the influence of outliers. Principal component analysis (PCA) was performed to reduce the scaled matrix to 50 components. Harmony [49] was subsequently applied to the resulting PCs using section identity as the batch variable, with all hyperparameters set to their defaults. The corrected Harmony representations of gene expression served as prediction targets during model training. Overview of ResSAT ResSAT extracts visual features from the H&E patch through an image encoder and encodes spatial coordinates through a spatial encoder based on Fourier feature mapping [16, 17]. The resulting image and spatial representations are integrated through a learned modulation mechanism, which allows spatial features to adaptively adjust image representations. A self-attention transformer mechanism then operates across spots to learn spatially informed interactions for gene expression prediction. An overview of the framework is illustrated in Fig. 9. Each component is described in detail below.Fig. 9Overview of workflow Overview of workflow Image embedding Residual networks (ResNets) [50] are widely recognized architectures in image classification and continue to be a benchmark in various image analyses [51–53] and serve as baselines in image studies introducing novel architectures [54, 55]. Our focus in this paper was to extract highly representative features from H&E images using ResNet50. During the training phase, each image patch was represented as a 3D tensor \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${x}_{n}\in {\mathbb{R}}^{3\times W\times H}$$\end{document}xn∈R3×W×H, where WW and HH denoted the width and height of the patch, respectively. A pretrained ResNet50 backbone, fine-tuned during training, was used to extract a feature vector from each H&E image patch, followed by projecting it into a lower-dimensional feature space using a projection layer, serving as the image encoder of each spot \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f}_{n} \in {\mathbb{R}}^{{d}_{f}}$$\end{document}fn∈Rdf. Spatial embedding The image encoder captures visual features from each H&E patch independently, without knowledge of where the image patch is located within the tissue. However, H&E patches with similar appearances may exhibit different gene expression profiles depending on their locations in the tissue, reflecting location-specific variation not fully captured by histological images alone. To provide the model with explicit positional contexts, we introduced a spatial encoder based on Fourier features mapping [16, 17]. Spatial coordinates are two-dimensional (x, y)(x,y), which may limit their ability to capture complex spatial patterns when used directly [17]. To address this, we applied Fourier feature mapping [17] to project the spatial coordinates into a higher-dimensional representation. Given a set of spatial coordinates \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\left\{{\mathbf{c}}_{n}=({c}_{n}^{x},{c}_{n}^{y}){\}}_{n=1}^{N}\right. \mathrm{f}\mathrm{o}\mathrm{r} N \mathrm{s}\mathrm{p}\mathrm{o}\mathrm{t}\mathrm{s},$$\end{document}cn=(cnx,cny)}n=1NforNspots, where each \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathbf{c}}_{n}\in {\mathbb{R}}^{1\times 2}$$\end{document}cn∈R1×2, each coordinate is projected into a high-dimensional Fourier feature mapping space using a fixed matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbf{B}\in {\mathbb{R}}^{2\times m}$$\end{document}B∈R2×m, whose entries are independently and randomly sampled from \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal{N}(0,{\sigma }^{2})$$\end{document}N(0,σ2). The projected representations are then transformed using sine and cosine functions:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\phi \left({\mathbf{c}}_{n}\right)=\left[\mathrm{sin}\left(2\pi {\mathbf{c}}_{n}\mathbf{B}\right),\mathrm{cos}\left(2\pi {\mathbf{c}}_{n}\mathbf{B}\right)\right]\in {\mathbb{R}}^{2m},$$\end{document}ϕcn=sin2πcnB,cos2πcnB∈R2m,where mm denotes the number of Fourier features and σσ controls the scale of the encoding. This transformation yields a 2m2m-dimensional feature representation for each spatial coordinate. The resulting Fourier features are passed through a multilayer perceptron (MLP) to produce the spatial embedding \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathbf{s}}_{n}\in {\mathbb{R}}^{{d}_{s}}$$\end{document}sn∈Rds for each spot, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${d}_{s}$$\end{document}ds is the dimension of the spatial embedding. Feature representation aggregation To effectively integrate spatial and image representations, we adopt a feature-wise linear modulation mechanism (FiLM) [56] that enables spatial context to adaptively influence image features. Specifically, the spatial embedding modulates the image embedding through learned scaling and shifting parameters:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f}_{n}^{\prime}={f}_{n}\odot \gamma ({\mathrm{s}}_{n})+\beta ({\mathrm{s}}_{n}),$$\end{document}fn′=fn⊙γ(sn)+β(sn),where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f}_{n}$$\end{document}fn is the image embedding of spot nn, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathbf{s}}_{n}$$\end{document}sn is the spatial embedding of spot nn, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\gamma (\cdot )$$\end{document}γ(·) and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\beta (\cdot )$$\end{document}β(·) are learnable linear transformations that map the spatial embedding \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${s}_{n}$$\end{document}sn to scaling and shifting parameters, respectively, and ⊙⊙ denotes element-wise multiplication. The modulated image features and the spatial embedding are concatenated to form the joint representation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h}_{n}$$\end{document}hn of each spot:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h}_{n}=[{f}_{n}^{\prime}, {\mathrm{s}}_{n}],$$\end{document}hn=[fn′,sn], Spot-interaction module The emergence of transformers has led to their widespread application in image and omics data analysis, as demonstrated by numerous studies [57–60]. Particularly, recent transformer-based architectures have drawn attention to attention mechanisms, offering means to capture interdependence between different input modalities [61, 62]. In biological tissues, gene expression at a given spot is influenced not only by its local cellular composition but also by the surrounding microenvironment through processes such as paracrine signaling and ligand–receptor interactions [63–65]. These influences are spatially structured and give rise to correlated gene expression patterns among functionally related regions, even across non-adjacent spots [66, 67]. To explicitly model such spot–spot interactions, we employ a self-attention mechanism over the combined representations of all spots within each batch. Given the joint representation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h}_{n}\in {\mathbb{R}}^{{d}_{h}}$$\end{document}hn∈Rdh for each spot, we stack all spot representations into a matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$H\in {\mathbb{R}}^{B\times {d}_{h}}$$\end{document}H∈RB×dh, where BB denotes the number of spots in a batch. A self-attention module is then applied to model interactions among spots:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal{A}ttention\left(Q, K, V\right)=\mathrm{s}\mathrm{o}\mathrm{f}\mathrm{t}\mathrm{m}\mathrm{a}\mathrm{x}\left(\frac{Q{K}^{\mathrm{T}}}{\sqrt{{d}_{h}}}\right)V,$$\end{document}AttentionQ,K,V=softmaxQKTdhV,where QQ, KK, and VV are linear projections of HH, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${d}_{h}$$\end{document}dh denotes the dimensionality of the joint representation. This mechanism allows each spot to aggregate information from other spots within the batch through learned attention weights. The resulting representations are then passed through a prediction head to produce the final predictions. The model is trained end-to-end using mean squared error (MSE) loss between the predicted and observed low-dimensional gene expression representations (Harmony-corrected PCA embeddings):\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal{L}=\frac{1}{N}\sum_{n=1}^{N}\parallel {\widehat{\mathrm{y}}}_{n}-{\mathrm{y}}_{n}{\parallel }^{2}$$\end{document}L=1N∑n=1N‖y^n-yn‖2where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\widehat{\mathrm{y}}}_{n}$$\end{document}y^n and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathrm{y}}_{n}$$\end{document}yn denote the predicted and observed representations for spot nn, respectively. This formulation reduces the prediction space while preserving the dominant variation in gene expression, while batch effects are mitigated through Harmony-based preprocessing. Evaluation metrics Predictive performance was evaluated in the batch-corrected top 2,000-HVG reconstruction space. ResSAT was trained to predict Harmony-corrected low-dimensional gene expression representations. For gene-level evaluation, both predicted and observed Harmony-corrected representations were projected onto the PCA loadings saved during preprocessing and rescaled using the corresponding gene-wise mean and standard deviation, reconstructing batch-corrected log-normalized expression profiles for the top 2,000 HVGs and ensuring comparison within the same batch-corrected reconstruction space. PCCs were then computed between reconstructed predicted and reconstructed observed expression profiles across spatial locations for each gene. The PCC ranges between − 1 and 1. It was determined by dividing the covariance of two variables by the product of their individual standard deviations:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm{P}\mathrm{C}\mathrm{C}= \frac{\mathrm{C}\mathrm{o}\mathrm{v}({\mathrm{y}}_{\mathrm{o}\mathrm{b}\mathrm{s}}, {\mathrm{y}}_{\mathrm{p}\mathrm{r}\mathrm{e}\mathrm{d}})}{\upsigma \left({\mathrm{y}}_{\mathrm{o}\mathrm{b}\mathrm{s}}\right)\cdot\upsigma ({\mathrm{y}}_{\mathrm{p}\mathrm{r}\mathrm{e}\mathrm{d}})},$$\end{document}PCC=Cov(yobs,ypred)σyobs·σ(ypred),where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm{C}\mathrm{o}\mathrm{v}(\cdot , \cdot )$$\end{document}Cov(·,·) denotes covariance; \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathrm{y}}_{\mathrm{o}\mathrm{b}\mathrm{s}}$$\end{document}yobs and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathrm{y}}_{\mathrm{p}\mathrm{r}\mathrm{e}\mathrm{d}}$$\end{document}ypred represent the reconstructed batch-corrected observed expression and reconstructed batch-corrected predicted expression, respectively. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\upsigma \left(\cdot \right)$$\end{document}σ· means standard deviation. We first computed the mean PCCs of top kk HVGs as follows:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overline{R }=\frac{1}{k}{\sum}_{i=1}^{k}\mathbf{C}\mathbf{o}\mathbf{r}\mathbf{r}\left({\mathbf{y}}_{obs}^{i},{\mathbf{y}}_{pred}^{i}\right),$$\end{document}R¯=1k∑i=1kCorryobsi,ypredi,where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbf{C}\mathbf{o}\mathbf{r}\mathbf{r}\left({\mathbf{y}}_{obs}^{i},{\mathbf{y}}_{pred}^{i}\right)$$\end{document}Corryobsi,ypredi represented the PCC between the reconstructed batch-corrected observed expression and reconstructed batch-corrected predicted expression of the ii-th gene, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathbf{y}}_{obs}^{i}$$\end{document}yobsi and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathbf{y}}_{pred}^{i}$$\end{document}ypredi, respectively. kk corresponds to the number of HVGs selected in a batch-aware manner during data preprocessing. We set k=2,000k=2,000 in our experiments by default. In addition to the mean correlation of top 2,000 HVGs, we computed the mean correlation of the top 50 HEGs in the batch-corrected reconstruction space. This metric provided insight into the performance of the prediction method specifically for genes that are highly expressed in the spatial context. Technically, the mean correlation of the top \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k{\prime}$$\end{document}k′ HEGs was calculated as follows:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\overline{R} }_{50}=\frac{1}{k{\prime} }{\sum}_{i=1}^{k{\prime} }\mathbf{C}\mathbf{o}\mathbf{r}\mathbf{r}\left({\mathbf{y}}_{obs}^{i},{\mathbf{y}}_{pred}^{i}\right),$$\end{document}R¯50=1k′∑i=1k′Corryobsi,ypredi, We set \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k{\prime}=50$$\end{document}k′=50 in our experiments by default. Experiment settings To evaluate the accuracy of gene expression prediction, we employed a nested cross-validation framework for datasets containing at least three tissue Sections [68]. Specifically, an outer loop was used for performance evaluation, where one section was held out as the test set, and the remaining sections formed the training set. Within each outer iteration, an inner cross-validation loop was performed on the training sections, where one section served as the validation set and the others as the training set. Hyperparameters were selected based on validation loss across inner iterations. Using the optimal hyperparameters selected in the inner loop, ResSAT was retrained on all training sections in the outer iteration and evaluated on the held-out test section. This process was repeated until each section had served as the test set once, ensuring an unbiased estimate of generalization performance. For datasets containing only two tissue sections (e.g., mouse brain datasets), nested cross-validation is not feasible, as a separate validation set cannot be constructed while preserving section-level independence. In this case, one section was used for training and the other for testing. This process was then repeated with the two sections swapped. Hyperparameters were set to default values and kept fixed across runs. For experiments without hyperparameter tuning, each training–testing procedure was repeated five times with different random seeds to ensure robustness. For datasets with at least three tissue sections, hyperparameters were selected to optimize predictive performance. Specifically, we evaluated the following parameters: the number of Fourier features (128, 256, 512), which controls the dimensionality of the spatial encoding; the Fourier feature scale (1, 3, 5), which controls the scale of the spatial encoding; the learning rate (1 × 10⁻4, 5 × 10⁻4, 1 × 10⁻3), which controls the optimization step size; the dropout rate (0.1, 0.2, 0.3), which regulates model regularization; the weight decay (1 × 10⁻⁶, 5 × 10⁻⁶, 1 × 10⁻5), which controls L2 regularization strength; the batch size (32, 64, 128), which determines the number of spots per optimization step; and the image patch size (112, 224), which determines the resized input of H&E image patches. Supplementary Information Additional file 1: Tables S1–S5. This file contains Tables S1–S3 comparing PCCs between ResSAT and baseline methods across the mouse brain, SCC, and HER2ST datasets, and Tables S4–S5 reporting significantly enriched KEGG and GO pathways based on ResSAT-predicted and observed expression.Additional file 2: Figure S1. KEGG and GO pathway enrichment analysis of differentially expressed genes in cancer regions compared with other tissues, based on gene expression predicted by ResSAT on the HER2ST dataset. Additional file 1: Tables S1–S5. This file contains Tables S1–S3 comparing PCCs between ResSAT and baseline methods across the mouse brain, SCC, and HER2ST datasets, and Tables S4–S5 reporting significantly enriched KEGG and GO pathways based on ResSAT-predicted and observed expression. Additional file 2: Figure S1. KEGG and GO pathway enrichment analysis of differentially expressed genes in cancer regions compared with other tissues, based on gene expression predicted by ResSAT on the HER2ST dataset.