Abstract
Elucidating the spatial organization of cells is fundamental to understanding tissue architecture and function, yet tissue dissociation during single-cell RNA sequencing (scRNA-seq) strips cells of their native architectural context. It is essential to integrate scRNA-seq data with spatial transcriptomics (ST) references to infer the spatial information of individual cells. Despite the development of various tools, achieving precise and biologically relevant spatial reconstructions remains challenging. Here, we present Cell2space, a deep learning framework that integrates scRNA-seq data with ST references to reconstruct multi-scale cellular spatial organization in a stepwise manner. Instead of treating spatial reconstruction as coordinate regression, Cell2space learns a universal spatial affinity function and employs a hierarchical inference strategy that integrates domain-level priors to refine cellular neighborhoods. This approach enables accurate assignment of single cells to spatial domains and inference of cell–cell neighborhood relationships. Comprehensive evaluations demonstrate that Cell2space robustly achieves superior performance in both domain assignment and neighborhood inference. Applied to the mouse visual cortex and human skin, Cell2space identifies layer-specific markers, reveals continuous gene expression gradients, and faithfully reconstructs stratified tissue architecture without requiring prior annotations. Together, Cell2space provides a powerful framework for integrating single-cell and spatial modalities, enabling deeper insights into tissue organization and cellular microenvironments.
Keywords: spatial organization reconstruction, spatial domain assignment, data integration
Introduction
Single-cell RNA sequencing (scRNA-seq, SC) has transformed our understanding of cellular heterogeneity and transcriptional landscapes at high resolution [1, 2]. Despite its power in identifying rare cell types and reconstructing developmental trajectories, standard scRNA-seq pipelines require tissue dissociation, which disrupts native tissue architecture. As a result, critical spatial context is lost, limiting the characterization of cell–cell communication, microenvironmental interactions, and higher-order tissue organization.
To address this limitation, spatial transcriptomics (ST) technologies have emerged, enabling the simultaneous measurement of gene expression profiles and spatial localization at the cellular level [3]. Current ST platforms generally fall into two categories: sequencing-based methods (e.g. 10X Visium [4], Slide-seq [5]), which provide genome-wide coverage but typically lack single-cell resolution, and imaging-based approaches (e.g. MERFISH [6], STARmap [7]), which achieve subcellular precision but are constrained to targeted gene panels. These inherent trade-offs between transcriptomic coverage and spatial resolution have motivated the development of computational methods to integrate scRNA-seq and ST data, aiming to reconstruct spatial organization at single-cell resolution.
A major class of computational integration strategies uses scRNA-seq as a reference to enhance ST data, including cell-type deconvolution (i.e. inferring the cell-type composition of mixed low-resolution spatial spots) [8, 9] and imputation to recover or predict unmeasured gene expression values and thereby extend the gene coverage of imaging-based platforms [10, 11]. In contrast, complementary approaches seek to map dissociated single cells back into physical space. By leveraging the genome-wide coverage and single-cell resolution of scRNA-seq, these methods enable spatial organization reconstruction with rich molecular information, facilitating downstream analyses and biological discovery. Representative methods such as Tangram [12] and CytoSpace [13] align scRNA-seq profiles to ST references through probabilistic mapping or optimal transport to infer spatial positions. However, these approaches focus primarily on cross-modal alignment, i.e. matching cells and spatial references in a shared correspondence framework, rather than explicitly modeling the structural dependencies that govern local cellular neighborhoods. Others, including scSpace [14] and CeLEry [15], attempt to directly learn regression models to predict continuous spatial coordinates from gene expression. However, treating spatial reconstruction strictly as a coordinate prediction task overlooks an important conceptual issue. Spatial coordinates are not the primary biological quantity of interest, but rather a geometric representation of underlying neighborhood relationships. Tissue architecture is defined by structured cellular interactions and domain-level organization, rather than by absolute positions alone. Importantly, many ST analysis frameworks, such as STAGATE [16] and GraphST [17], use spatial coordinates mainly to construct K-nearest neighbor (KNN) graphs, which then support downstream structural modeling. This indicates that cellular neighborhood relationships are a more direct and biologically meaningful representation of spatial organization. Therefore, spatial reconstruction from single-cell transcriptomic data can be reframed as directly inferring domain-level structure and cell–cell neighborhood relationships, without explicitly recovering absolute coordinates. Such a formulation is both sufficient for downstream spatial analysis and more consistent with the hierarchical organization of tissues.
To address this conceptual and methodological gap, we present Cell2space, a Python-based computational framework that integrates scRNA-seq data with ST references to reconstruct cellular spatial organization. The core of Cell2space is the optimization of a spatial affinity function, implemented as a multilayer perceptron (MLP), that captures the intrinsic relationship between gene expression and physical proximity. The framework employs a hierarchical inference strategy to reconstruct tissue architecture across multiple scales: it first assigns single cells to coarse-grained tissue domains and then utilizes these assignments as topological constraints to infer fine-grained, cell–cell neighborhood relationships. Using scRNA-seq expression profiles together with an ST reference, including its expression matrix, spatial coordinates, and domain annotations or computational partitions, Cell2space transfers tissue architecture to whole-transcriptome single-cell profiles by modeling these spatial dependencies within a shared latent biological space. The main outputs of the framework are (i) the predicted spatial domain assignments of single cells and (ii) the inferred cell–cell neighborhood structure. We demonstrate that this approach achieves high accuracy in spatial reconstruction and enables downstream analyses such as identifying novel layer-specific markers and uncovering continuous gene expression gradients. Furthermore, Cell2space is compatible with computationally identified spatial domains, providing a robust and flexible tool for characterizing tissue organization and cellular microenvironments.
Results
Overview of Cell2space
The core principle of Cell2space is to learn a universal spatial affinity function from ST data and transfer it to scRNA-seq data to infer spatial relationships at single-cell resolution. The model takes scRNA-seq and ST datasets as input, leveraging domain annotations in the ST reference to guide the learning process (Fig. 1a). To harmonize these disparate modalities, Cell2space first projects both datasets into a joint latent biological space, effectively mitigating technical variations and batch effects (Fig. 1b). The central component of Cell2space is the optimization of a nonlinear spatial affinity function that parameterizes the intrinsic relationship between transcriptomic similarity and physical adjacency. This function is implemented as a dense MLP trained exclusively on the ST reference, which learns to discriminate between spatially adjacent (positive) and distant (negative) spot pairs based on their latent representations (Fig. 1c). Crucially, Cell2space employs a hierarchical inference strategy to reconstruct tissue architecture across multiple scales. In the first stage, the model performs spatial domain assignment by aggregating affinities between individual cells and reference spots, mapping each cell to its most probable coarse-grained tissue domain (Fig. 1d). Building upon these domain-level assignments, the second stage executes cell–cell neighborhood relationships inference, where pairwise affinities among all single cells are computed and refined through domain-specific topological constraints (Fig. 1e). This hierarchical approach ensures that fine-grained cellular neighborhoods are reconstructed within a biologically plausible spatial context. Together, these multi-scale outputs empower diverse biological applications, enabling precise spatial domain assignment, high-resolution cell–cell neighborhood inference, robust cell-type annotation, and the identification of novel spatially variable markers across complex tissues (Fig. 1f).
Figure 1.

Overview of Cell2space. (a) The inputs of Cell2space include scRNA-seq (SC) data and ST with domain annotations. (b) The gene expression profiles from scRNA-seq and ST are integrated into a unified feature space to mitigate technical discrepancies and align the distributional differences between the two modalities. (c) Cell2space establishes a universal spatial affinity function, parameterized by a dense MLP, by contrasting spatially adjacent positive pairs and distant negative pairs in the shared latent feature space. (d) Once trained, the MLP-based affinity function predicts the affinity between each single cell and reference ST spots, enabling spatial domain assignment by aggregating spot-level affinities within each domain. (e) Based on the shared latent representations of query cells, the trained MLP-based spatial affinity function computes pairwise cell–cell affinities, which are further refined using domain-level topological constraints to infer spatial cell–cell neighborhood relationships. (f) By restoring the spatial context of single-cell profiles, Cell2space enables deep biological insights, including high-resolution tissue mapping, neighborhood relationship analysis, and the expansion of the spatial transcriptomic landscape.
Cell2space enables accurate spatial domain assignment in paired-tissue benchmarks
To rigorously assess the performance of Cell2space, we established a ground-truth validation framework using paired tissue sections, rather than relying solely on synthetic simulations. This approach ensures that the evaluation captures complex, biologically authentic spatial structures across multiple scales. We evaluated the model from two complementary perspectives: the macroscopic prediction accuracy of single-cell spatial domains and the microscopic fidelity of inferred local cell–cell neighborhoods. To this end, we employed the human dorsolateral prefrontal cortex (DLPFC) dataset, which comprises 12 tissue sections arranged in adjacent pairs [18]. Within each pair, one section was treated as the reference ST data, while the other served as the pseudo single-cell input withholding its spatial coordinates. This setup yielded 12 independent validation scenarios, allowing us to benchmark reconstruction performance against the known ground truth of the held-out section (Fig. 2a and Methods).
Figure 2.

Cell2space enables accurate spatial domain assignment in paired-tissue benchmarks. (a) Schematic of the DLPFC dataset simulation process using adjacent slices for single-cell and ST inputs. (b) Boxplots quantify the performance of Cell2space compared to six baseline methods. Performance is evaluated using standard domain assignment accuracy. Statistical significance was assessed by two-sided paired Wilcoxon signed-rank tests comparing Cell2space with each baseline method; significance levels are indicated in the plot. Significance annotations are defined as follows: ns, 0.05<P≤ 1;
, 0.01<P≤ 0.05;
, 0.001<P≤ 0.01;
, 0.0001<P≤ 0.001;
, P≤ 0.0001. (c) Visualization of the ground-truth spatial domain annotations for DLPFC replicates 151674 and 151673. (d) Visualization of Cell2space-predicted spatial distributions for cells belonging to specific domains (Layer 1–6 and WM) in the DLPFC dataset. (e) Line plots comparing the expression profiles of representative layer-specific marker genes across spatial domains. Ground-truth and Cell2space-predicted expression profiles are indicated in the plot legend. (f) Visualization of the ground-truth spatial domain annotations for STARmap mouse visual cortex simulated dataset (raw versus bin). (g) Visualization of Cell2space-predicted spatial distributions for cells belonging to specific domains (hippocampus (HPC), corpus callosum (CC), and L1–L6) in the mouse visual cortex dataset. (h) Line plots comparing the expression profiles of representative region-specific marker genes across spatial domains in the STARmap dataset. Ground-truth and Cell2space-predicted expression profiles are indicated in the plot legend.
We quantified spatial domain assignment accuracy across all benchmark scenarios as the proportion of query cells assigned to the correct spatial domain. We used two evaluation criteria. Under the stringent criterion, a prediction was counted as correct only when the predicted domain exactly matched the ground-truth spatial domain. Under the relaxed neighbor-inclusive criterion, a prediction was counted as correct when the predicted domain matched either the ground-truth domain or one of its immediately adjacent domains (Methods). Benchmarking against state-of-the-art methods including CeLEry [15], Tangram [12], STEM [19], iSORT [20], CellContrast [21], and the nonspatial baseline Seurat [22], Cell2space consistently achieved the highest accuracy, with an average accuracy of 74% under the stringent criterion and up to 90% under the relaxed criterion (Fig. 2b, Supplementary Fig. 1, Supplementary Note 4). Here, the relaxed criterion reflects assignments to the correct domain or its immediately adjacent domain and is intended to measure local laminar consistency rather than exact recovery. Notably, Seurat exhibited the lowest reconstruction performance, which can be attributed to its inherent lack of spatial information. Although CeLEry is specifically designed to recover spatial domain annotations, its performance remained suboptimal, likely because it primarily models the association between gene expression profiles and domain annotations without fully leveraging spatial relationships. Visualization of the predicted spatial domains further confirmed that the majority of cells were correctly assigned to their original domains, including sparsely represented cortical layers such as Layer 2 and Layer 4 (Fig. 2c and d). Consistently, analysis of differentially expressed genes across layers showed that gene expression patterns in the inferred pseudo-space faithfully recapitulated their original spatial distributions, underscoring the ability of Cell2space to preserve spatial gene signatures (Fig. 2e).
To further assess the performance of Cell2space at true single-cell resolution, we constructed an additional pseudo-spot validation dataset based on STARmap data from the mouse visual cortex [7]. In this setting, the original STARmap measurements were treated as SC input, while groups of spatially neighboring cells were aggregated into pseudo-spots to generate the corresponding reference ST data. We applied the same evaluation framework to systematically quantify the fidelity of the reconstructed cellular topography (Fig. 2f and g, Supplementary Fig. 2). Notably, the predicted spatial patterns of key layer-specific markers showed high concordance with ground-truth measurements such as the enrichment of Mbp in the white matter (Corpus Callosum, CC) (Fig. 2h). These results collectively demonstrate that Cell2space effectively integrates transcriptional information with spatial topology to achieve accurate domain assignment and preserve nuanced gene expression gradients across complex tissues.
Cell2space robustly infers fine-grained local cell–cell neighborhood relationships
Beyond accurately assigning cells to broad spatial domains, we further evaluated the ability of Cell2space to infer fine-grained cell–cell neighborhood relationships, which are critical for understanding tissue microenvironments. To quantify this, we calculated the cosine similarity between the reconstructed and ground-truth neighborhood-averaged expression profiles for each cell (Methods). Benchmarking against leading spatial localization methods, including scSpace [14], CeLEry, STEM, STALocator [23], iSORT, and CellContrast, Cell2space consistently achieved the highest similarity scores across a wide range of neighborhood sizes (Fig. 3a, Supplementary Figs 3a and 4). Its performance advantage became more pronounced as the neighborhood size increased, indicating that Cell2space robustly captures local spatial context. We further conducted a top-5 neighborhood composition analysis to assess local microenvironment reconstruction. Cell2space more faithfully recovered neighborhood domain composition than STEM, indicating that it better preserves local tissue context beyond what is captured by cosine similarity alone (Supplementary Fig. 5).
Figure 3.

Cell2space robustly infers fine-grained local cell–cell neighborhood relationships. (a) Performance benchmarking of spatial neighborhood recovery across different methods. Boxplots show the cosine similarity between the average gene expression of the inferred spatial neighbors and that of the ground-truth neighbors, evaluated at varying neighbor sizes. (b) Heatmap visualization of the cell–cell neighborhood relationship graph reconstructed by Cell2space showing the connectivity strength within and between spatial domains (L1–L6 and WM). (c) Heatmap shows the connectivity strength inferred solely based on transcriptomic similarity (raw gene expression correlation) without spatial information. (d) Boxplots quantifying the shortest graph distance from cells in each spatial domain to Layer 1 within the Cell2space-inferred neighborhood graph. (e) Distribution of the affinity difference between spatially near and far same-domain spot pairs in the within-domain affinity analysis. The dashed line indicates zero difference. (f) Comparison of domain assignment accuracy between the full Cell2space model and latent-space baselines based on Harmony cosine similarity or Harmony KNN. (g) Comparison of neighborhood reconstruction performance under the full model, No Filter, and Soft Filter settings. Boxplots show cosine similarity between reconstructed and ground-truth neighborhood-averaged expression profiles.
To determine whether Cell2space captures spatial organization beyond transcriptional similarity, we compared its inferred cell–cell affinity matrix with a matrix derived solely from gene expression similarity. The Cell2space-derived matrix exhibited a clear hierarchical block structure, accurately reflecting strong spatial proximity within individual cortical layers and gradually decreasing similarity between more distant layers (Fig. 3b, Supplementary Fig. 3b). In contrast, the expression-based matrix lacked this laminar organization, indicating that transcriptional similarity alone is insufficient to resolve complex spatial architecture (Fig. 3c). Consistently, the inferred spatial distances faithfully recapitulated the anatomical layering of the cortex, further supporting that Cell2space preserves biologically meaningful tissue topology (Fig. 3d, Methods).
We further examined whether the learned affinity captured more than coarse domain separation. Within the same domain, spatially proximal spot pairs consistently received higher predicted affinities than more distant pairs, and the affinity decreased with increasing within-domain spatial distance (Fig. 3e, Supplementary Fig. 6b). These results indicate that Cell2space captures fine-scale spatial variation within domains, rather than functioning merely as a macroscopic domain classifier. Ablation analyses further demonstrated that the superior performance of Cell2space arises from two key design components. First, replacing the learned affinity module with a Harmony-only latent-space baseline led to a clear decline in domain assignment performance, indicating that the MLP-based affinity learning provides substantial additional gains beyond the shared embedding alone (Fig. 3f, Supplementary Note 2). Second, removing the domain-guided refinement step (No Filter) or downweighting affinities between nonadjacent domains (Soft Filter) resulted in deteriorated neighborhood reconstruction, confirming that hierarchical inference with topology-aware filtering is critical for accurately recovering local cellular structure (Fig. 3g, Supplementary Fig. 6a, Supplementary Note 2).
Consistent with this, we used the Soft Filter setting in the Xenium breast cancer dataset, which lacks a clear layer-like architecture and well-defined domain adjacency, and still achieved a domain assignment accuracy of 0.73 and a neighborhood reconstruction cosine similarity of 0.75 at k = 10 (Supplementary Fig. 7, Methods). We further evaluated the effect of imperfect computational priors by replacing manual domain annotations in the DLPFC dataset with GraphST-derived partitions. Although the resulting priors were less accurate, particularly around domain boundaries, the neighborhood reconstruction cosine similarity decreased only moderately, suggesting that Cell2space remains reasonably robust as long as the inferred partitions preserve the overall local topology (Supplementary Fig. 8). Collectively, these results show that Cell2space effectively integrates transcriptional and spatial information to recover fine-grained neighborhood structure across both layered and more complex tissue settings.
Robustness of Cell2space across diverse reference strategies and noise conditions
To further validate the robustness of Cell2space in practical applications, we performed a systematic sensitivity analysis across various reference selection strategies and corruption conditions. In real-world scenarios, ST references often originate from diverse biological sources or exhibit varying cell-type distributions. Using the human DLPFC dataset, we designated Sample 151674, with its coordinates withheld, as the pseudo-scRNA-seq input and evaluated the model’s performance across six distinct scenarios focused on both domain assignment and cell–cell neighborhood inference.
We first assessed the impact of biological similarity in single-slice reference scenarios (Fig. 4a). Using a homologous reference, specifically Sample 151673, yielded an assignment accuracy of 0.70. When utilizing a heterologous reference such as Sample 151507, the accuracy decreased to 0.57. However, it is important to note that despite this numerical decline, the spatial visualizations and Sankey plots still reveal a clear laminar organization consistent with the ground-truth cortical hierarchy. This observation indicates that Cell2space successfully captures fundamental structural trends even when mapping across distinct tissue samples. Furthermore, the model’s performance was significantly bolstered in the multiple-slice scenarios (Fig. 4b). Integrating structural information from three homologous slices (151673, 151675, and 151676) improved the accuracy to 0.74, while utilizing four heterologous slices (151507, 151508, 151509, and 151510) raised the performance to 0.62. These improvements demonstrate that the expansion of the training set through multi-slice integration effectively enhances the capacity of the model to capture generalizable spatial principles.
Figure 4.

Robustness of Cell2space across diverse reference strategies and noise conditions. (a) Performance of Cell2space using a single ST slice as a reference. Spatial maps show the predicted domain assignments for scRNA-seq cells (Sample 151674) using either a homologous (Sample 151673) or heterologous (Sample 151507) reference. Numbers below the maps indicate the domain assignment accuracy. Corresponding Sankey diagrams illustrate the flow between ground-truth domains (left) and predicted assignments (right), with bar segments representing cortical layers (L1–L6) and white matter (WM). (b) Performance of Cell2space utilizing multiple ST slices as references. “Homologous” refers to the integration of three slices from the same region (151673, 151675, and 151676), while “Heterologous” refers to four slices from different samples (151507, 151508, 151509, and 151510). (c) Robustness of Cell2space under transcriptional corruption. For the multiple-slice scenarios described in (b), technical noise was introduced by randomly masking a subset of gene expression values to zero. Despite the increased noise and cross-sample heterogeneity, the framework maintains stable spatial distributions and high accuracy. (d) Aggregated boxplots of reconstruction performance across the six robustness settings. Top, domain assignment accuracy. Bottom, cosine similarity between reconstructed and ground-truth neighborhood-averaged expression profiles at k = 10. Settings are labeled as S_Homo, S_Hete, M_Homo, M_Hete, M_Homo_corruption, and M_Hete_corruption.
To evaluate the stability of Cell2space against measurement variability, we introduced transcriptional perturbations in the multiple-slice settings (Fig. 4c). Specifically, 20% of genes in the query dataset were randomly selected and set to zero across all query cells, while the reference ST data were kept unchanged. Despite these perturbations, Cell2space maintained robust performance, with accuracies of 0.67 in the homologous setting and 0.60 in the heterologous setting. Beyond transcriptional noise, a major advantage of the Cell2space framework is its inherent robustness to geometric artifacts such as slice rotation. Because our spatial affinity function is trained to distinguish spot pairs based on their relative proximity rather than absolute positions, it is naturally invariant to global coordinate transformations. In contrast, methods based on absolute coordinate regression are often forced to learn slice-specific coordinate systems, which makes them highly susceptible to performance degradation when references are rotated or spatially misaligned.
In addition, we repeated the same robustness analysis across the other eligible DLPFC query sections (Supplementary Note 3). The overall conclusions were consistent with those observed in the representative 151674 example. Quantitative analysis of the performance metrics further supports the robustness of Cell2space, with high concordance between domain assignment accuracy and neighborhood cosine similarity observed across all six cases (Fig. 4d, Supplementary Figs 9-11). These results demonstrate that our hierarchical inference strategy, which anchors cells to macro-scale domains to establish a structural scaffold, effectively reduces the search space for fine-grained inference. Collectively, these findings underscore the superior cross-modality transferability and robustness of Cell2space, confirming its utility for dissecting tissue architecture in complex and noisy spatial omics environments.
Cell2space reveals multi-scale spatial organization and transcriptional landscapes of the mouse visual cortex
We next sought to demonstrate the applicability of Cell2space in a complex biological system. To achieve this, we applied Cell2space to a mouse visual cortex dataset by integrating high-resolution STARmap ST data with scRNA-seq data from the mouse primary visual area [24] (Fig. 5a, Supplementary Figs 12 and 13). Cell2space accurately annotated the cell type identities across spatial locations and reconstructed the structural organization of the hippocampus as well as cortical layers L1–L6 (Fig. 5b). This spatial characterization was consistent with established neuroanatomical knowledge, as the inferred cell type composition within each domain correctly captured the known layer-specific enrichment patterns of excitatory neuronal subtypes [25] (Fig. 5c, Supplementary Fig. 14).
Figure 5.

Cell2space reveals multi-scale spatial organization and transcriptional landscapes of the mouse visual cortex. (a) Spatial visualization of the raw STARmap dataset according to ground-truth spatial domain annotations (L1–L6, CC, HPC). (b) Spatial distribution of cell types inferred by Cell2space, providing high-resolution cell type annotations for the ST data. (c) Barplots show the composition of predicted cell types across each spatial domain, revealing the distinct cellular heterogeneity within domains. (d) Venn diagram comparing the overlap of domain-specific differentially expressed genes identified using Cell2space-imputed single-cell data versus those identified using only the raw, limited gene panel from ST data. (e) Violin plots visualize the expression levels of representative top differential expressed genes (DEGs) across different spatial domains, confirming their domain-specific specificity. (f) Boxplots of the shortest graph distance from cells in each domain to Layer 1 within the reconstructed spatial neighborhood graph. (g) Scatter plots of representative “gradient genes” identified by Cell2space that exhibit a statistically significant ascending expression trend along the cortical depth. The dashed line indicates the fitted linear regression. (h) Scatter plots of representative “gradient genes” identified by Cell2space that exhibit a statistically significant descending expression trend along the cortical depth. The dashed line indicates the fitted linear regression.
By transferring spatial domain annotations to scRNA-seq profiles, Cell2space overcomes the limited gene coverage of targeted ST, effectively expanding the gene throughput from 1020 to 38 048 genes. This whole-transcriptome upscaling enabled the identification of 9764 previously undetectable layer-specific marker genes (Fig. 5d), highlighting Cell2space’s ability to unlock molecular insights beyond the constraints of the original gene panel. Based on these newly identified spatially variable genes, we further performed layer-specific Gene Ontology (GO) enrichment analyses for each cortical layer, which revealed distinct functional programs associated with different laminar domains (Supplementary Fig. 15). The spatial specificity of these newly discovered markers was further validated by their expression patterns, such as Pvrl3 in Layer 2/3 and Krt12 in Layer 4 (Fig. 5e).
Beyond mapping individual cells, we constructed a cell–cell spatial graph based on predicted cellular proximities. The shortest-path distances between cortical layers in this graph effectively recapitulated their known physical adjacency (Fig. 5f), demonstrating that Cell2space preserves the essential spatial topology of the tissue. Furthermore, the spatially enhanced data enabled us to move beyond discrete domain annotations and uncover continuous gene expression gradients across cortical depth (Methods). For instance, genes with increasing expression toward the superficial layers, such as the pH regulator Car4 and the growth factor Kitl, are implicated in modulating high synaptic activity and guiding the precise wiring of local processing circuits, respectively (Fig. 5g) [24, 26]. Conversely, genes enriched in deeper layers, including the Cdk5 pathway regulator Cdk5rap3 and the sterol biosynthesis enzyme Ebpl, exhibited gradients that decreased toward the pial surface (Fig. 5h) [27, 28]. These expression patterns likely reflect the structural and metabolic demands of deep-layer neurons, supporting cytoskeletal dynamics required for axonal maintenance and the elevated membrane lipid turnover characteristic of large projection neurons. Together, the resolution of these smooth transcriptional gradients demonstrates that Cell2space captures continuous biological processes underlying tissue organization [18, 29], revealing principles that are not accessible to methods focused solely on discrete clustering.
Reconstruction of human skin tissue architecture without prior spatial domain annotations
A major challenge in ST is the absence of ground-truth spatial domain annotations. To demonstrate the utility of Cell2space under such unsupervised settings, we developed a pipeline in which unsupervised spatial clustering is performed prior to data integration. We applied this framework to a human skin dataset, integrating 10X Visium ST data with matched scRNA-seq profiles to reconstruct the layered cytoarchitecture [30] (Fig. 6a). Since the ST data lacked predefined spatial annotations, we first employed GraphST [17] to partition the tissue into four distinct spatial domains (Fig. 6b). These computationally inferred domains were subsequently used by Cell2space to infer the underlying cellular composition. The resulting analysis was in strong agreement with the known histological organization of human skin. Domain 4, corresponding to the outermost layer, was enriched for suprabasal cells. Directly beneath this layer, Domain 2 was primarily composed of basal and dermal cells, while the deeper Domain 3 consisted almost exclusively of smooth muscle cells associated with hair follicles or vasculature (Fig. 6c). To quantitatively validate this stratified organization, we computed the shortest graph distances from various cell types to smooth muscle cells, using the latter as a proxy for tissue depth. Consistent with anatomical expectations, suprabasal cells exhibited the greatest distance, followed by progressively shorter distances for basal and dermal cells [31, 32] (Fig. 6d). These observations confirm that Cell2space preserves the essential spatial topology of the tissue.
Figure 6.

Reconstruction of human skin tissue architecture without prior spatial domain annotations. (a) Uniform Manifold Approximation and Projection (UMAP) visualization of the single-cell RNA-seq dataset from human skin. (b) Spatial visualization of the tissue sections, showing the four distinct spatial domains identified via unsupervised clustering using GraphST. (c) Stacked bar plots illustrating the composition of Cell2space-predicted cell types within each spatial domain. (d) Boxplots quantify the shortest graph distance from various cell types to smooth muscle cells surrounding individual cells within the reconstructed spatial neighborhood graph. (e) Characterization of the local cellular microenvironment shows the average cell type composition of the 10 nearest spatial neighbors for each distinct cell type. (f) GO enrichment analysis of differentially expressed genes specific to Domain 2 and Domain 4.
We also performed a held-out validation analysis on the skin ST data and compared Cell2space with STEM and iSORT under the same evaluation protocol. Cell2space achieved a mean domain assignment accuracy of 0.60 and a mean neighborhood cosine similarity of 0.84, compared with ~0.51 and 0.61 domain assignment accuracy for STEM and iSORT, and ~0.75 and 0.79 neighborhood cosine similarity, respectively. These results provide additional quantitative support for the skin application (Supplementary Note 5). We further investigated local cellular microenvironments using a reconstructed spatial neighborhood graph (Fig. 6e). Epidermal lineages, including basal and suprabasal cells, displayed strong homotypic interactions [33], consistent with their roles in forming cohesive epithelial barriers. In contrast, other cell types exhibited more heterogeneous neighborhood compositions, indicative of complex heterotypic interactions. For instance, glandular epithelium was frequently adjacent to a mixture of dermal, endothelial, and immune cells, reflecting its functional integration within the vascularized dermis [34]. Similarly, immune and Schwann cells showed diverse neighborhood profiles, consistent with their dispersive roles in surveillance and tissue innervation [35]. GO enrichment analysis revealed spatially distinct immune functions across tissue layers (Fig. 6f). Domain 2 (basal/dermal) showed significant enrichment for cytokine- and chemokine-mediated signaling pathways, suggesting a primary role in immune cell recruitment and intercellular communication. Conversely, Domain 4 (suprabasal) was enriched for processes related to T cell activation and cellular defense responses. This layered functional organization indicates a coordinated immune landscape in which the basal and dermal interface mediates signaling, while the outer suprabasal layer is more actively engaged in defense and effector functions [36, 37].
In addition to GraphST, we evaluated alternative spatial domain clustering methods, such as SpaceFlow, and observed that Cell2space produced largely consistent cellular compositions and downstream analyses across different domain partitions, demonstrating robustness to the choice of clustering algorithm (Supplementary Figs 16 and 17).
Discussion
Integrating scRNA-seq with ST represents a critical frontier in tissue biology, as neither modality alone fully captures the complexity of cellular organization [38]. While scRNA-seq offers whole-transcriptome depth but lacks spatial context, ST preserves physical coordinates but is often limited in gene coverage or resolution. To synergize the strengths of both modalities, we introduce Cell2space, a deep learning framework that learns a transferable spatial affinity function. Recognizing the inherent ambiguity in mapping cells to precise coordinates, Cell2space emphasizes the recovery of relational tissue topology and local neighborhood structure, rather than exact position recovery, through a stepwise, multi-scale strategy. Specifically, the framework first reconstructs macro-scale spatial domains to establish a structural scaffold of the tissue; these domain-level assignments then serve as essential topological priors to guide and refine the inference of fine-grained cell–cell neighborhood relationships. By distinguishing adjacent from distant cell pairs in a shared latent space, Cell2space recovers both macro-scale structure and local neighborhood relationships. This approach not only restores spatial context for individual cells but also enables high-resolution, whole-transcriptome reconstruction, overcoming the inherent limitations of targeted ST.
Benchmarks on DLPFC and STARmap demonstrate that Cell2space consistently outperforms existing methods in spatial domain assignment and in recovering neighborhood-averaged expression profiles, validating the effectiveness of learning spatial adjacency as a discriminative task. Moreover, the framework exhibits strong robustness across diverse reference selection strategies and varying levels of transcriptional noise, consistently preserving tissue architecture in various challenging scenarios. Beyond benchmarking, Cell2space enables deep biological insights by integrating targeted ST with whole-transcriptome scRNA-seq. In the mouse visual cortex, the framework effectively addressed the limited coverage of imaging-based ST, expanding the effective gene throughput from 1020 to over 38 000 genes and uncovering nearly 10 000 previously inaccessible layer-specific markers. This transcriptome upscaling illustrates how modeling spatial affinity can unlock molecular insights beyond the constraints of predefined gene panels. Importantly, Cell2space captures continuous expression gradients along the cortical depth, revealing that tissue organization is governed by smooth transcriptional programs rather than purely discrete clusters. We further demonstrated that Cell2space can be extended beyond canonical layered tissues using a Xenium breast cancer dataset, while its application to human skin showed that the framework remains effective in label-free settings when combined with computationally inferred spatial partitions.
Despite these strengths, several limitations warrant consideration. First, Cell2space relies on macro-scale spatial domain annotations or partition priors to guide neighborhood refinement. Although this design is effective in layered tissues and can be relaxed using the Soft Filter strategy in more complex settings, meaningful neighborhood constraints still depend on reasonably informative domain labels or partitions. When such labels are unavailable or when adjacency relationships are difficult to define, specifying the structural prior becomes more challenging, and the refinement step may be less reliable. Second, Cell2space’s performance depends on the quality and suitability of the ST reference dataset. The method performs well when the reference is biologically and technically similar to the query data, with comparable tissue composition, section geometry, domain definitions, and gene-expression distributions. In heterologous-reference settings, these assumptions are weakened, and domain-level accuracy may decrease because spatial information must be transferred across mismatched biological or technical contexts. Therefore, results obtained with heterologous references should be interpreted as partial recovery of major tissue organization rather than exact domain-level reconstruction. Third, the current training signal is based on a binary pair-construction strategy defined by spatial proximity and domain structure. While effective in many settings, alternative sampling strategies may be more suitable for tissues with gradual spatial transitions, multi-axis organization, or substantial boundary ambiguity, suggesting that future work could explore more flexible distance-aware or uncertainty-aware supervision. Fourth, Cell2space is not primarily optimized for absolute coordinate regression, although 2D coordinates can be derived from the learned ST-cell affinity matrix by computing affinity-weighted centroids of the top-k reference spots. In the DLPFC benchmark, Cell2space showed competitive but not top-ranked coordinate-recovery performance, consistent with its design objective (Supplementary Note 6 and Supplementary Figs 19 and 20). Thus, coordinate-reconstruction methods are preferable when exact spatial positions or histology-based integration are the main endpoints, whereas Cell2space is better suited for preserving biologically meaningful local topology and neighborhood relationships. In addition, in its current form, Cell2space must be rerun for each new scRNA-seq query dataset, as preprocessing requires joint handling of the ST reference and SC query data to mitigate cross-modality distributional differences prior to affinity learning (Supplementary Fig. 21). While this is practical for matched analyses, it also increases computational cost when multiple query datasets need to be mapped to the same reference. Future extensions may therefore benefit from a more explicit reference–query formulation, in which the spatial reference is encoded once and reused across multiple query datasets. Finally, the original dense implementation of Cell2space can be computationally demanding for large-scale datasets, as cell–cell neighborhood inference requires evaluating a large number of pairwise relationships, leading to substantial memory and runtime costs. To address this issue, we developed a lightweight implementation that replaces dense all-by-all evaluation with a sparse candidate-based strategy, improving scalability for large single-cell and high-resolution ST datasets (Supplementary Figs 22 and 23).
Looking forward, Cell2space provides a flexible foundation for a range of future extensions. The inferred neighborhood graphs can be coupled with ligand–receptor modeling to decipher spatially constrained cell–cell communication or to identify microenvironmental niches [39]. The framework is also naturally suited for multi-sample studies, enabling cross-individual comparisons of spatial architecture and the systematic characterization of niche rewiring under perturbation [40]. In summary, by enabling robust domain mapping, accurate neighborhood reconstruction, and whole-transcriptome upscaling, Cell2space extends spatial inference beyond coordinate prediction and offers a practical and generalizable framework for dissecting tissue architecture across diverse biological contexts.
Methods
Cell2space framework
We developed Cell2space, a Python-based computational framework that reframes spatial reconstruction as a hierarchical structural inference problem. The primary inputs of Cell2space are the scRNA-seq (SC) expression matrix, the ST expression matrix, the 2D spatial coordinates of the ST reference, and the corresponding spatial domain annotations or computational partitions. The core of Cell2space is the optimization of a universal spatial affinity function that distills the intrinsic principles of cellular co-localization into a transferable metric for spatial association. To resolve tissue organization across multiple scales, the framework employs a stepwise inference strategy that first assigns cells to macro-scale domains and subsequently refines these associations into fine-grained cell–cell neighborhoods. The pipeline comprises five sequential modules: (i) data preprocessing, (ii) extraction of latent biological representation, (iii) spatial affinity modeling, (iv) spatial domain assignment, and (v) inference of cell–cell neighborhood relationships.
Data preprocessing
We first preprocess the scRNA-seq and ST datasets to ensure cross-modality comparability. The scRNA-seq data are log-normalized and filtered to retain the top 1000 highly variable genes (HVGs), with the same procedure applied to the ST data. HVGs are identified using the standard variance-based procedure implemented in SCANPY [41]. Genes shared between the two modalities are retained, and both datasets are scaled to zero mean and unit variance on a per-sample basis.
Let
denote the gene expression matrix of
single cells, and
represent the expression matrix of
spatial spots, where G is the number of genes shared between the two modalities. The spatial coordinates of the ST data are given by
, where each entry specifies the observed 2D spatial location of a spot.
Extraction of latent biological representation
To mitigate technical discrepancies between scRNA-seq and ST data, we perform joint embedding to align their latent representations into a shared biological space. Although both modalities are derived from the same tissue, their gene expression distributions can differ substantially due to variations in sequencing platforms, capture efficiency, and other technical factors. Without proper correction, these discrepancies can hinder effective cross-modality learning.
Our objective is to obtain a latent feature space in which the two modalities are approximately aligned while preserving their shared biological structure. We denote this cross-modality integration step as a transformation
, which maps the input data into a joint H -dimensional latent representation. Here,
denotes the cross-modality integration procedure used to construct a shared latent space, rather than a separately optimized neural network within Cell2space. Formally,
![]() |
where
and
are the latent representations for each modality. The goal of this transformation is to achieve distributional alignment between the two modalities such that
. Crucially, we assume that this transformation preserves biological consistency, ensuring that the latent features
capture the underlying biological states (e.g. cell types, spatial domains and contexts) across both modalities. To implement this alignment, we adopt Harmony [42], a widely used batch correction and data integration method that projects high-dimensional data into a shared latent space. The resulting latent representations
are subsequently used as input for downstream tasks, including spatial domain assignment and cell–cell neighborhood relationships inference. To assess whether Cell2space depends strongly on a specific integration backbone, we also evaluated alternative cross-modality integration methods, including Seurat v3 CCA [22] and scVI [43] (Supplementary Fig. 18). These results showed that Cell2space remains broadly robust to the choice of integrator, and therefore Harmony is used as the default option in the main workflow for simplicity and consistency.
Spatial affinity modeling
To model transcriptome-derived spatial proximity, Cell2space learns a spatial affinity function
that maps pairs of latent representations to co-localization probabilities. This function is optimized on the ST data, using binary adjacency spot pair labels derived from the spatial coordinates
as ground truth. Specifically, we first construct a spatial KNN graph over all ST spots based on their spatial coordinates
. This graph represents the local spatial neighborhood structure of the reference tissue and is used to identify spatially adjacent spot pairs for subsequent affinity learning. The corresponding adjacency matrix
is defined as follows:
![]() |
We curate the training dataset using a domain-stratified sampling strategy based on an anchor-partner framework. For each sampled spot designated as an anchor spot i, a partner spot j is selected to form either a positive (adjacent) or negative (distant) training pair. Positive samples consist of spot pairs where the partner j is a spatially adjacent neighbor of anchor i (
) that shares the same domain annotation. This constraint ensures that positive pairs capture intra-domain local structural proximity. To ensure a balanced representation of the tissue topography, the number of positive pairs sampled from each domain is proportional to the total number of spots within that domain. In contrast, negative samples are generated by pairing an anchor spot i with a partner spot j randomly selected from a different spatial domain. A 1:3 positive-to-negative sampling ratio is adopted to enhance the discriminative power of the model. In the main Cell2space workflow, negative pairs are defined using cross-domain sampling as the default strategy. To examine the robustness of this design, we also evaluated alternative negative sampling schemes, including far same-domain negatives and mixed sampling (Supplementary Fig. 6c). The affinity function
is implemented as an MLP. For a given ordered spot pair
, where i denotes the designated anchor spot and j denotes its partner, let
denote their latent embeddings. The input to the MLP is the concatenated embeddings
, where the anchor embedding
is placed in the first half of the input vector and the partner embedding
in the second half. The network outputs a co-localization probability
through the following layer-wise computation:
![]() |
where
, and
are learnable weight matrices, and
are bias terms. Here,
denotes the ReLU activation function,
and
are batch normalization layers, and
represents the sigmoid function that output the co-localization probabilities
.
The parameters of the spatial affinity function are optimized to maximize the discriminative power between proximal and dissociated biological profiles. This is achieved by minimizing the binary cross-entropy loss over the curated set of labeled spot pairs:
![]() |
where
denotes the ground-truth label for each spot pair, N is the total number of training samples, and
indexes each curated pair in the training set.
Spatial domain assignment
After training the spatial affinity function
on ST data, we apply it to assign spatial domain annotations for scRNA-seq cells by quantifying cross-modality associations between single-cell profiles and spatial spots in the learned latent space. We construct a joint embedding
, where
and
are the latent column vectors of the spot i and cell j, respectively. The affinity function computes a co-localization probability as follows:
![]() |
these pairwise scores are organized into a ST-SC affinity matrix
. To transition from spot-level affinities to domain-level assignments, we aggregate the scores based on the spatial domain annotations of the ST data. We define a domain indicator matrix
, where
indicates that spot i belongs to domain k. The raw cell-domain association matrix
is computed via matrix multiplication:
Each element
represents the cumulative affinity of cell j toward domain k. To account for the varying number of spots across different domains and prevent assignment bias toward larger tissue regions, we compute a normalized confidence score
. This score is defined by the squared aggregate affinity normalized by the domain cardinality :
![]() |
where
denotes the number of ST spots in domain k, and ɛ is a small numerical constant added to avoid division by zero.
Finally, each cell is assigned to the spatial domain with the highest normalized score:
![]() |
Inference of cell–cell neighborhood relationships
To reconstruct the spatial neighborhood relationships among single cells, we utilize the learned spatial affinity function
to infer pairwise neighborhood relationships among the scRNA-seq profiles. Given the feature matrix
for any two cells i and j, we construct a joint latent vector
. The pairwise affinity score is computed as follows:
![]() |
Collectively, these scores form a symmetric cell–cell affinity matrix
. Here,
quantifies the inferred spatial affinity between cell i and cell j, thereby characterizing the cell–cell neighborhood relationships within the reconstructed tissue architecture. Furthermore, we perform a symmetrization step to ensure that the inferred neighborhood relationships are bidirectional and consistent. The symmetrized affinity matrix
is defined as follows:
![]() |
where
represents the integrated likelihood of co-localization between cells i and j.
To further ensure that the inferred cell–cell neighborhood relationships are consistent with the known tissue architecture, we incorporate a domain-level spatial prior. We define a spatial adjacency set
, which contains all domains physically adjacent to domain d (including d itself). Based on the predicted domain annotations
and
obtained in the previous step, we refine the affinity matrix by applying a topological constraint. The final filtered affinity matrix
is defined as follows:
![]() |
This filtering step ensures that only biologically plausible interactions (i.e. within or between adjacent domains) are retained.
Simulation experiment design
To systematically evaluate the performance of Cell2space, we designed two simulation strategies that mimic realistic cross-modality integration scenarios.
In the first simulation, we used the publicly available human DLPFC dataset generated by the 10x Genomics Visium platform. Each tissue sample contains multiple adjacent histological sections. For each pair of adjacent slices, we designated one section as the ST reference and the other as pseudo scRNA-seq data, discarding its spatial coordinates. This yields six independent ST–scRNA-seq pairs. To test the robustness of Cell2space, we performed both forward and reverse predictions by swapping the roles of each pair.
In the second simulation, we used high-resolution STARmap data from the mouse visual cortex. We partitioned the field of view into equal-sized square regions and aggregated transcript counts within each region to simulate a coarse-resolution ST dataset. The original single-cell-level STARmap data were treated as the scRNA-seq modality. Cell2space was tasked with reconstructing the spatial coordinates of individual cells using only the binned ST data as reference. The known spatial locations of the high-resolution data served as ground truth.
Together, these two simulation settings allow controlled benchmarking across human and mouse tissue, with complementary strategies based on histological sectioning and spatial resolution degradation.
To further assess the applicability of Cell2space in a complex tissue setting without clear laminar organization, we analyzed a Xenium breast cancer dataset containing two adjacent tissue sections measured at single-cell spatial resolution. In this analysis, one section was used as the spatial reference, whereas the other was treated as pseudo single-cell input after withholding its spatial coordinates. Because this dataset lacks well-defined layer-like domains and explicit coarse domain adjacency, cell-type annotations were used as coarse domain priors during inference. Neighborhood reconstruction was then performed under the Soft Filter setting to allow greater flexibility in this irregular tissue context.
Benchmark metrics
To comprehensively assess the performance of Cell2space against benchmark methods, we employed two primary metrics focusing on domain assignment accuracy and the preservation of local gene expression neighborhoods.
Assignment accuracy
We evaluated the fidelity of spatial domain assignments using classification accuracy under two distinct criteria. The stringent accuracy metric quantifies the percentage of cells where the predicted spatial domain exactly matches the ground truth annotation. Acknowledging the continuous nature of biological tissues and potential ambiguity at layer boundaries, we further defined a relaxed accuracy (neighbor-inclusive) criterion. Under this metric, an assignment is considered correct if the inferred domain corresponds to either the ground truth domain or its immediately adjacent spatial domains (e.g. a cell originating from Layer 2 is deemed correctly classified if predicted as Layer 1, Layer 2, or Layer 3). This relaxed approach serves to mitigate penalties for minor spatial deviations while ensuring the predicted topology remains biologically consistent.
Cosine similarity
To measure the quality of local cell–cell neighborhood relationships inference, we utilized cosine similarity to compare the gene expression environment in the pseudo-space against the original space. For each cell i, we identified the k nearest spatial neighbors and aggregated their gene expression profiles to generate an accumulated transcriptome vector. The similarity score was calculated as follows:
![]() |
where A represents the accumulated transcriptome vector of the k nearest neighbors derived from the inferred spatial neighborhoods, and B represents the corresponding vector derived from the ground-truth spatial coordinates. A higher cosine similarity indicates that the reconstructed spatial neighborhood faithfully preserves the local transcriptomic signature of the original tissue.
Graph distance to reference layer
To assess whether spatial structure is preserved in the inferred cell–cell neighborhood graph, we computed the shortest-path distance from each cell to a reference layer using a mutual KNN graph constructed from the inferred cell–cell affinity matrix.
A cell–cell graph
was built where an edge existed between cell i and j if both were within each other’s k nearest neighbors. This mutual KNN criterion ensures local connectivity reflects reciprocal neighborhood structure. For each cell v, the distance to reference layer was computed as the average shortest path length to the top
closest reference layer cells:
,
|
where
is the set of
closest layer cells with valid paths to v.
Spatial domain identification
To identify distinct tissue regions without prior manual annotation, we employed two unsupervised spatial clustering frameworks: GraphST [17] and SpaceFlow [44]. For the GraphST analysis, the model was trained using default hyperparameters to learn the low-dimensional latent representations of the ST data. The final spatial domains were determined by applying the mclust [45] clustering algorithm to these learned representations, with the number of clusters explicitly set to 4. Similarly, SpaceFlow was executed using its standard configuration to generate spatial embeddings, and the target number of spatial domains was constrained to 4 to ensure consistent resolution across methods.
Neighborhood composition analysis
To quantify local microenvironment reconstruction, we defined a neighborhood composition metric based on the reconstructed nearest-neighbor graph. For each query cell, we identified its top-k predicted neighbors and summarized the proportion of neighbors belonging to each domain, thereby obtaining a neighborhood composition vector for that cell. The same procedure was applied to the ground-truth spatial coordinates to derive the corresponding true neighborhood composition vector. Neighborhood composition was then aggregated at the domain level by averaging the cell-wise composition vectors over all cells assigned to the same domain. The resulting domain-by-domain composition matrix was used to assess how well the reconstructed neighborhood graph preserved local tissue organization. In this study, k = 5 was used for the neighborhood composition analysis.
Cell type annotation by Cell2space
To transfer cell type identities from scRNA-seq data to the ST spots, we utilize the learned ST-SC affinity matrix
, where each entry
represents the predicted affinity between spot i and cell j. Let
denote the set of K distinct cell types annotated in the scRNA-seq dataset, and let
be the set of indices for all single cells belonging to cell type
.
For each spatial spot i, we compute a cell-type-specific score by averaging the affinity probabilities of all single cells associated with a given type
:
![]() |
where
is the number of cells of type
. This aggregation step normalizes for the varying abundance of cell types in the single-cell reference. Finally, the cell type identity for spot i, denoted as
, is assigned by selecting the type with the maximal average affinity score:
![]() |
Marker gene identification and functional analysis
Spatially variable genes were identified by performing differential expression analysis on log-normalized data for both ST and scRNA-seq datasets using the Wilcoxon rank-sum test. We defined significant domain-specific markers based on a stringent threshold of adjusted P-value <0 .01 and |
| > 1.0. Subsequently, the biological functions of these domains were characterized via GO enrichment analysis using GSEAPY. The top 200 markers per domain were queried against the “GO_Biological_Process_2023” database, and pathways with an FDR < 0.05 were reported as significant.
Gradient gene identification
To characterize continuous transcriptional variations across cortical depth, we first ordered the identified spatial domains according to their anatomical hierarchy (from deep regions HPC/CC to superficial Layer 1). We calculated the mean expression level for each gene within each domain to generate layer-specific expression profiles. A linear regression model was then fitted to these domain-averaged expression values against the ordinal domain indices. Genes were prioritized based on the magnitude of their regression slopes, allowing for the identification of markers with significant increasing (positive slope) or decreasing (negative slope) expression gradients toward the pial surface.
Lightweight implementation of Cell2space
To improve scalability for large-scale applications, we developed a lightweight implementation of Cell2space that replaces dense all-by-all neighborhood inference with sparse candidate-based inference. Because the final output of Cell2space is a local neighborhood graph, the lightweight version preserves the same neighborhood reconstruction objective and overall inference logic while restricting computation to a reduced set of likely cell–cell relationships and retaining only sparse top-k neighbors for downstream analysis. This reduces the practical complexity of neighborhood reconstruction from approximately
to O(Nk), where k denotes the number of retained candidate neighbors per cell (default 256), thereby lowering memory usage and computational cost and making Cell2space more suitable for datasets on the order of
cells with high-resolution spatial references.
We present the full and lightweight versions as complementary running modes: the full version is recommended when reconstruction accuracy is the main priority, whereas the lightweight version is intended for larger datasets where scalability, memory usage, and runtime are more limiting (Supplementary Fig. 23).
Key Points
Cell2space achieves accurate and robust spatial reconstruction, consistently outperforming state-of-the-art methods.
Cell2space reveals multi-scale spatial transcriptional landscapes.
Cell2space can reconstruct tissue architecture without prior domain annotations.
Supplementary Material
Contributor Information
Jieyi Pan, School of Mathematics, Shandong University, No. 27 Shanda South Rd., Jinan, Shandong 250100, China.
Qiyuan Guan, School of Mathematics, Shandong University, No. 27 Shanda South Rd., Jinan, Shandong 250100, China.
Duanchen Sun, School of Mathematics, Shandong University, No. 27 Shanda South Rd., Jinan, Shandong 250100, China; Shandong Key Laboratory of Cancer Digital Medicine, No. 247 Beiyuan St., Jinan, Shandong 250033, China.
Author contributions
J.P. and Q.G. contributed equally to this work and are co-first authors. D.S. conceived the idea and supervised the study. J.P. and Q.G. implemented the algorithm and performed the analyses. J.P., Q.G., and D.S. interpreted the results and wrote the manuscript. All authors read and approved the final manuscript.
Funding
This work has been supported by the Science Foundation Program of the Shandong Province (2023HWYQ-012); National Natural Science Foundation of China [No. 62202269]; the Program of Qilu Young Scholars of Shandong University.
Data availability
All datasets analyzed in this study are publicly available. The 10X Visium data of the human DLPFC were obtained from http://spatial.libd.org/spatialLIBD/. The mouse VISp scRNA-seq dataset was obtained from the Gene Expression Omnibus (GEO) under accession number GSE115746. The mouse visual cortex STARmap dataset was obtained from the STARmap data resource and is available through the Wang Lab data portal and Zenodo (https://www.wangxiaolab.org/data-portal-1; https://doi.org/10.5281/zenodo.10698912). The 10x Xenium breast cancer dataset was downloaded from the 10x Genomics official website (https://www.10xgenomics.com/products/xenium-in-situ/preview-dataset-human-breast). The human foreskin scRNA-seq and 10X Visium datasets are available from the GEO under accession number GSE220573.
The open-source Python implementation of Cell2space is available on GitHub at https://github.com/SDU-Math-SunLab/Cell2space. The repository also includes a step-by-step tutorial notebook, tutorial.ipynb, to demonstrate the main workflow and usage of Cell2space.
References
- 1. Saunders A, Macosko EZ, Wysoker A et al. Molecular diversity and specializations among the cells of the adult mouse brain. Cell 2018;174:1015–1030.e16. 10.1016/j.cell.2018.07.028 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2. Papalexi E, Satija R. Single-cell RNA sequencing to explore immune cell heterogeneity. Nat Rev Immunol 2018;18:35–45. 10.1038/nri.2017.76 [DOI] [PubMed] [Google Scholar]
- 3. Rao A, Barkley D, França GS et al. Exploring tissue architecture using spatial transcriptomics. Nature 2021;596:211–20. 10.1038/s41586-021-03634-9 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4. Ståhl PL, Salmén F, Vickovic S et al. Visualization and analysis of gene expression in tissue sections by spatial transcriptomics. Science 2016;353:78–82. 10.1126/science.aaf2403 [DOI] [PubMed] [Google Scholar]
- 5. Rodriques SG, Stickels RR, Goeva A et al. Slide-seq: A scalable technology for measuring genome-wide expression at high spatial resolution. Science 2019;363:1463–7. 10.1126/science.aaw1219 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6. Chen KH, Boettiger AN, Moffitt JR et al. Spatially resolved, highly multiplexed RNA profiling in single cells. Science 2015;348:aaa6090. 10.1126/science.aaa6090 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7. Wang X, Allen WE, Wright MA et al. Three-dimensional intact-tissue sequencing of single-cell transcriptional states. Science 2018;361:eaat5691. 10.1126/science.aat5691 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8. Kleshchevnikov V, Shmatko A, Dann E et al. Cell2location maps fine-grained cell types in spatial transcriptomics. Nat Biotechnol 2022;40:661–71. 10.1038/s41587-021-01139-4 [DOI] [PubMed] [Google Scholar]
- 9. Ma Y, Zhou X. Spatially informed cell-type deconvolution for spatial transcriptomics. Nat Biotechnol 2022;40:1349–59. 10.1038/s41587-022-01273-7 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10. Zhao J, Yu J, Cao Y et al. Enhancing spatial transcriptomics via spatially constrained matrix decomposition with EDGES. Adv Sci 2025;12:e08346. 10.1002/advs.202508346 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11. Shengquan C, Boheng Z, Xiaoyang C et al. stPlus: a reference-based method for the accurate enhancement of spatial transcriptomics. Bioinformatics 2021;37:i299–307. 10.1093/bioinformatics/btab298 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12. Biancalani T, Scalia G, Buffoni L et al. Deep learning and alignment of spatially resolved single-cell transcriptomes with Tangram. Nat Methods 2021;18:1352–62. 10.1038/s41592-021-01264-7 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13. Vahid MR, Brown EL, Steen CB et al. High-resolution alignment of single-cell and spatial transcriptomes with CytoSPACE. Nat Biotechnol 2023;41:1543–8. 10.1038/s41587-023-01697-9 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14. Qian J, Liao J, Liu Z et al. Reconstruction of the cell pseudo-space from single-cell RNA sequencing data with scSpace. Nat Commun 2023;14:2484. 10.1038/s41467-023-38121-4 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 15. Zhang Q, Jiang S, Schroeder A et al. Leveraging spatial transcriptomics data to recover cell locations in single-cell RNA-seq with CeLEry. Nat Commun 2023;14:4050. 10.1038/s41467-023-39895-3 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16. Dong K, Zhang S. Deciphering spatial domains from spatially resolved transcriptomics with an adaptive graph attention auto-encoder. Nat Commun 2022;13:1739. 10.1038/s41467-022-29439-6 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17. Long Y, Ang KS, Li M et al. Spatially informed clustering, integration, and deconvolution of spatial transcriptomics with GraphST. Nat Commun 2023;14:1155. 10.1038/s41467-023-36796-3 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18. Maynard KR, Collado-Torres L, Weber LM et al. Transcriptome-scale spatial gene expression in the human dorsolateral prefrontal cortex. Nat Neurosci 2021;24:425–36. 10.1038/s41593-020-00787-0 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19. Hao M, Luo E, Chen Y et al. STEM enables mapping of single-cell and spatial transcriptomics data with transfer learning. Commun Biol 2024;7:56. 10.1038/s42003-023-05640-1 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20. Tan Y, Wang A, Wang Z et al. Transfer learning of multicellular organization via single-cell and spatial transcriptomics. PLoS Comput Biol 2025;21:e1012991. 10.1371/journal.pcbi.1012991 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21. Li S, Ma J, Zhao T et al. CellContrast: reconstructing spatial relationships in single-cell RNA sequencing data via deep contrastive learning. Patterns 2024;5:101022. 10.1016/j.patter.2024.101022 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22. Stuart T, Butler A, Hoffman P et al. Comprehensive integration of single-cell data. Cell 2019;177:1888–1902.e21. 10.1016/j.cell.2019.05.031 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23. Li S, Shen Q, Zhang S. Spatial transcriptomics-aided localization for single-cell transcriptomics with STALocator. Cell Syst 2025;16:101195. 10.1016/j.cels.2025.101195 [DOI] [PubMed] [Google Scholar]
- 24. Tasic B, Yao Z, Graybuck LT et al. Shared and distinct transcriptomic cell types across neocortical areas. Nature 2018;563:72–8. 10.1038/s41586-018-0654-5 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 25. Yao Z, van Velthoven CTJ, Nguyen TN et al. A taxonomy of transcriptomic cell types across the isocortex and hippocampal formation. Cell 2021;184:3222–3241.e26. 10.1016/j.cell.2021.04.021 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26. Chesler M. Regulation and modulation of pH in the brain. Physiol Rev 2003;83:1183–221. 10.1152/physrev.00010.2003 [DOI] [PubMed] [Google Scholar]
- 27. Su SC, Tsai L-H. Cyclin-dependent kinases in brain development and disease. Annu Rev Cell Dev Biol 2011;27:465–91. 10.1146/annurev-cellbio-092910-154023 [DOI] [PubMed] [Google Scholar]
- 28. Moebius FF, Fitzky BU, Lee JN et al. Molecular cloning and expression of the human delta7-sterol reductase. Proc Natl Acad Sci USA 1998;95:1899–902. 10.1073/pnas.95.4.1899 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29. Cembrowski MS, Spruston N. Heterogeneity within classical cell types is the rule: lessons from hippocampal pyramidal neurons. Nat Rev Neurosci 2019;20:193–204. 10.1038/s41583-019-0125-5 [DOI] [PubMed] [Google Scholar]
- 30. Fu YC, Das A, Wang D et al. scHolography: a computational method for single-cell spatial neighborhood reconstruction and analysis. Genome Biol 2024;25:164. 10.1186/s13059-024-03299-3 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31. Solé-Boldo L, Raddatz G, Schütz S et al. Single-cell transcriptomes of the human skin reveal age-related loss of fibroblast priming. Commun Biol 2020;3:188. 10.1038/s42003-020-0922-4 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 32. Reynolds G, Vegh P, Fletcher J et al. Developmental cell programs are co-opted in inflammatory skin disease. Science 2021;371:eaba6500. 10.1126/science.aba6500 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33. Fuchs E. Skin stem cells: rising to the surface. J Cell Biol 2008;180:273–84. 10.1083/jcb.200708185 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 34. Joost S, Annusver K, Jacob T et al. The molecular anatomy of mouse skin during hair growth and rest. Cell Stem Cell 2020;26:441–457.e7. 10.1016/j.stem.2020.01.012 [DOI] [PubMed] [Google Scholar]
- 35. Roosterman D, Goerge T, Schneider SW et al. Neuronal control of skin function: the skin as a neuroimmunoendocrine organ. Physiol Rev 2006;86:1309–79. 10.1152/physrev.00026.2005 [DOI] [PubMed] [Google Scholar]
- 36. Nestle FO, Di Meglio P, Qin J-Z et al. Skin immune sentinels in health and disease. Nat Rev Immunol 2009;9:679–91. 10.1038/nri2622 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 37. Pasparakis M, Haase I, Nestle FO. Mechanisms regulating skin immunity and inflammation. Nat Rev Immunol 2014;14:289–301. 10.1038/nri3646 [DOI] [PubMed] [Google Scholar]
- 38. Li B, Zhang W, Guo C et al. Benchmarking spatial and single-cell transcriptomics integration methods for transcript distribution prediction and cell type deconvolution. Nat Methods 2022;19:662–70. 10.1038/s41592-022-01480-9 [DOI] [PubMed] [Google Scholar]
- 39. Jin S, Guerrero-Juarez CF, Zhang L et al. Inference and analysis of cell-cell communication using CellChat. Nat Commun 2021;12:1088. 10.1038/s41467-021-21246-9 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40. Wang G, Zhao J, Yan Y et al. Construction of a 3D whole organism spatial atlas by joint modelling of multiple slices with deep neural networks. Nat Mach Intell 2023;5:1200–13. 10.1038/s42256-023-00734-1 [DOI] [Google Scholar]
- 41. Wolf FA, Angerer P, Theis FJ. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 2018;19:15. 10.1186/s13059-017-1382-0 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 42. Korsunsky I, Millard N, Fan J et al. Fast, sensitive and accurate integration of single-cell data with Harmony. Nat Methods 2019;16:1289–96. 10.1038/s41592-019-0619-0 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 43. Lopez R, Regier J, Cole MB et al. Deep generative modeling for single-cell transcriptomics. Nat Methods 2018;15:1053–8. 10.1038/s41592-018-0229-2 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 44. Ren H, Walker BL, Cang Z et al. Identifying multicellular spatiotemporal organization of cells with SpaceFlow. Nat Commun 2022;13:4076. 10.1038/s41467-022-31739-w [DOI] [PMC free article] [PubMed] [Google Scholar]
- 45. Scrucca L, Fop M, Murphy TB et al. mclust 5: clustering, classification and density estimation using Gaussian finite mixture models. R J 2016;8:289–317. 10.32614/RJ-2016-021 [DOI] [PMC free article] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
All datasets analyzed in this study are publicly available. The 10X Visium data of the human DLPFC were obtained from http://spatial.libd.org/spatialLIBD/. The mouse VISp scRNA-seq dataset was obtained from the Gene Expression Omnibus (GEO) under accession number GSE115746. The mouse visual cortex STARmap dataset was obtained from the STARmap data resource and is available through the Wang Lab data portal and Zenodo (https://www.wangxiaolab.org/data-portal-1; https://doi.org/10.5281/zenodo.10698912). The 10x Xenium breast cancer dataset was downloaded from the 10x Genomics official website (https://www.10xgenomics.com/products/xenium-in-situ/preview-dataset-human-breast). The human foreskin scRNA-seq and 10X Visium datasets are available from the GEO under accession number GSE220573.
The open-source Python implementation of Cell2space is available on GitHub at https://github.com/SDU-Math-SunLab/Cell2space. The repository also includes a step-by-step tutorial notebook, tutorial.ipynb, to demonstrate the main workflow and usage of Cell2space.














