Abstract
With the rise of spatially resolved transcriptomics biotechnologies, performing spatially-aware analysis of the resulting data is crucial to maximise advances in biological understanding. Dimensionality reduction is a first step in most analyses of spatial transcriptomics data, and common approaches that preserve total variation of gene expression features do not usually preserve biologically meaningful spatial variation. To this end, we develop weighted sliced inverse regression (wSIR), a sufficient dimension reduction technique that aims to retain the predictive power of the spatial coordinates. wSIR is applicable to multiple distinct spatial transcriptomic datasets and is highly scalable, with over 100, 000 cells processed in under two minutes on a standard laptop. The feature loadings are interpretable, and new non-spatial data can be projected into wSIR’s low-dimensional space for downstream analyses. We examine wSIR’s performance and demonstrate its biological relevance through two case studies in human breast cancer and mouse early embryonic development.
Subject terms: Genomics, Data integration, Breast cancer
Woollard and colleagues present wSIR, a dimension reduction method for spatial transcriptomics data. wSIR is scalable with its embedding constructed using spatial coordinates. Two case studies show how wSIR facilitates meaningful biological discovery.
Introduction
Spatial transcriptomics is becoming a widespread method for profiling hundreds to thousands of genes at single-cell resolution in their spatial context for a variety of tissues1. There is great potential to uncover the complexity of tissue organisation and discover new biological aspects in normal processes and the emergence of disease. Current analysis of spatial transcriptomics data has emerged primarily as an extension of the last 5–8 years of single-cell transcriptomics research (https://www.scrna-tools.org/), with several key analytical steps often borrowed from single-cell analysis, including normalisation, filtering and dimensionality reduction techniques. Dimensionality reduction, in particular, is a crucial step in analysing complex high-dimensional data, including single-cell and spatial transcriptomics, as several other downstream analysis steps rely on this2–4. For example, clustering of cells is typically performed using graph-based approaches on low-dimensional embeddings rather than the original gene expression matrix to avoid the curse of dimensionality. As such, effective and appropriate dimensionality reduction of spatial transcriptomics data is an important challenge in the analysis of these data.
Despite the rapidly accelerating generation of spatial transcriptomics data, it is not straightforward how to incorporate spatial coordinates and gene expression measurements to form a low-dimensional representation of the data. Popular dimensionality reduction approaches such as principal component analysis (PCA) do not utilise spatial coordinates; it focuses on finding orthogonal linear combinations of the gene expression data to preserve the largest amounts of their total variation. Other classical statistical approaches can be adapted to perform a ‘spatially-aware’ dimensionality reduction, such as partial least squares (PLS) and linear discriminant analysis (LDA). PLS treats spatial coordinates in each dimension as separate responses and may not be well suited to account for the complex spatial associations between the spatial coordinates and the gene expressions. LDA is sensitive to the arbitrary choice of allocation of the spatial coordinates into distinct classes. Given these challenges, new approaches have emerged that aim to integrate gene expression and spatial coordinates to arrive at meaningful dimensionality reduction. Some innovative approaches, such as GraphPCA5 and SpatialPCA6, improve PCA by incorporating an additional step, such as augmenting the PCA objective function with a spatial penalty term, including a cell-cell kernel function, utilising experimental trajectory information, or incorporating PCA into a hierarchical model, respectively. Dimension-Reduction Spatial-Clustering (DR-SC)7 and PRECAST8 assume factor-analysis models with low-dimensional embeddings are spatially clustered based on a smooth hidden Markov model. Other approaches have adapted different modelling strategies, such as nonnegative matrix factorisation, to utilise spatial information9–11. In another line of research, several methods have utilised a dimensionality reduction step to cluster cells or spots in a ‘spatially-aware’ manner, including STAMP12, stLearn13 and FAST14. Other approaches used bespoke techniques utilising deep learning to learn from spatial gene expression and images jointly15, or exploited higher order interactions to identify clusters of interest16. Additionally, some methods are developed to utilise the spatial transcriptomic data as a reference to predict the latent spatial coordinates of scRNA-seq-derived data, such as CellContrast17 and Tangram18.
In statistics research, advances in sufficient dimension reduction (SDR) have emerged in the last few decades. SDR is a technique that enables dimensionality reduction of features so that the ability to predict the response variables is best preserved. Among SDR methods, sliced inverse regression (SIR), which was originally proposed in the seminal paper of ref. 19 is still the most popular due to its simplicity, flexibility and computational efficiency20. Despite many developments of SIR to handle complex settings, to the best of our knowledge, SIR has not been adapted to be suitable for single-cell or spatial transcriptomics data. While several approaches have been developed for spatial dimensionality reduction, many are prohibitive in terms of computational scalability and runtime, and are limited in their ability to project new gene expression data into a low-dimensional space.
Given these challenges, we have developed weighted Sliced Inverse Regression (wSIR), an innovative statistical approach that performs SDR to preserve the association between the gene expressions and the spatial information. wSIR takes into account the slice-slice correlation induced from spatial transcriptomics data, and enables the projection of non-spatial gene expression data into the low-dimensional spaces. Due to its linearity, wSIR is highly scalable and can be applied to massive single-cell spatial transcriptomics datasets across multiple distinct samples. In this paper, we describe the wSIR approach, explore its properties and demonstrate its superior performance compared to other statistical methods. Furthermore, we will also employ wSIR to uncover additional insights from spatial transcriptomics data in two real biological contexts in human breast cancer and mouse development.
Results
Scalable spatially-aware dimensionality reduction with weighted sliced inverse regression (wSIR)
Given the challenges in effectively describing spatial transcriptomics data, we developed a linear sufficient dimension reduction approach named weighted sliced inverse regression (wSIR). Assuming a n × p gene expression matrix X with n samples and p features, and a corresponding n × q responses Y, sufficient dimension reduction is a class of statistical techniques that aims to estimate a d ≪ p vector-valued function of the data f(X) so that Y⊥X∣f(X), that is, that Y and X are conditionally independent given the reduced data f(X). Sliced inverse regression (SIR), which was invented in ref. 19 is an example of linear sufficient dimension reduction, where f(X) is assumed to be a linear combination of the X, i.e. f(X) = XB with B a p × d matrix. Under mild technical conditions, SIR has been shown to be a powerful technique in the area of linear SDR due to its ability to preserve complex and nonlinear patterns within the data [refs. 20–22, among many others]. One important challenge in implementing such an approach to spatial transcriptomics, however, is that SIR does not account for possible spatial relationships among the slices, prompting our development of a novel weight component to SIR to create wSIR (‘Methods’).
Briefly, wSIR takes in spatial transcriptomics data with appropriately normalised, centred and scaled gene expression values, alongside spatial coordinates that can belong to one or more distinct tissues or samples (Fig. 1a). The observations within each sample are then grouped according to their proximity in physical space into distinct ‘slices’, alongside the corresponding gene expression data (Fig. 1b). Then, a slice-slice correlation matrix is estimated by taking into account the physical proximity of the centroids of each slice per sample (Fig. 1c, ‘Methods’), where the closer the two slices are, the higher the corresponding value in the correlation matrix. On each slice, gene expression values are averaged over each gene. Following this step, the slice-mean gene expression and slice-slice correlation matrix are subjected to an eigendecomposition to obtain the eigenvectors, which are finally multiplied by the inverse of the sample covariance matrix of the gene expression to the wSIR direction (loadings). A sample-level scores (embeddings) matrix is then formed by multiplying the original data by the loadings matrix, representing the low-dimensional embedding of the data (Fig. 1d). This procedure enables the projection of new, unseen, potentially non-spatial data to the same low-dimensional embedding via matrix multiplication. Overall, wSIR enables interpretation of important genes via examination of the loadings matrix, as well as further downstream analysis (such as clustering) on the spatial transcriptomic data, alongside mapping of non-spatial (e.g. scRNA-seq resolved) transcriptomic data to a spatially-informed low-dimensional space. As a linear dimension reduction method, wSIR’s computational cost is comparable to PCA and more scalable than other existing spatially-aware dimension reduction methods (Supplementary Fig. 1) that either use a cell–cell adjacency matrix and/or require fitting sophisticated statistical or deep learning models.
Fig. 1. Schematic of the wSIR algorithm.

a wSIR requires an input of a set of 2D or 3D spatial coordinates for cell-resolved or spot-resolved spatial omics, alongside a normalised and centred gene expression matrix, potentially coming from multiple distinct samples. b wSIR performs slicing of the spatial coordinates per sample, and groups cells/spots into slices according to their proximity in space. c A slice-slice similarity matrix is created where entries correspond to the proximity of slice centroids in space. Slices belonging to different samples are assigned a value of zero, indicating no proximity. The corresponding sets of cells/spots are summarised by taking averages across all of the genes. d wSIR then performs eigendecomposition of the slice-summarised gene expression data and slice-slice similarity. This provides three main outputs: 1. loadings, 2. scores for the input data and 3. an ability to project new gene expression data into the same low-dimensional space. Overall, wSIR enables downstream analyses for biological discovery. Notation is defined in the ‘Materials and Methods’ section.
wSIR prioritises spatially relevant variation
To examine the properties of wSIR, we created a simple simulation containing features that were associated with spatial coordinates as well as features that were independent of spatial coordinates. We generated an input data matrix X containing p = 20 features and n = 500 samples, alongside q = 2-dimensional spatial coordinates in Cartesian space corresponding to a rough doughnut shape (Fig. 2a, left column, Methods). We split features so that some features were (1) uncorrelated with spatial coordinates, (2) some features were correlated with the radial position of the sample and (3) some features were correlated with the angular position of the sample, all with varying degrees of total noise. We then performed other common approaches for supervised or unsupervised dimensionality reduction, including GraphPCA5, PLS and PCA. We found that in this simulation, the corresponding scores generated by the first and second wSIR’s directions were highly correlated with the angle and radius, respectively, where, in contrast, GraphPCA and PLS were only able to partially recover the spatial pattern. As expected, PCA did not capture the spatial pattern and rather captured the non-spatial variables that were simulated to have the highest amount of variation (Fig. 2a). Since the spatial patterns correspond to angle and radius, we conclude that wSIR is capable of prioritising the underlying linear signals in the gene expression data, which encode the non-linear relationship with the spatial positions of each cell.
Fig. 2. Comparison to other methods.

a Result of illustrative simulation where points are placed according to their simulated spatial position, and points are coloured according to the true simulated value (first column), subsequent columns are arranged according to: wSIR, GraphPCA, linear discriminant analysis (LDA), partial least squares (PLS) and PCA. The first row indicates the first direction or component selected for each method, and the second row indicates the second direction or component. b Heatmap displaying the bias corrected distance correlation (BCDC) for the mouse embryo data with different choices of number of slices and slice-slice weighting alpha. c similar to panel b but for the Xenium breast cancer dataset. d Barplots displaying the BCDC of different dimension reduction (DR) methods for a leave-one-dataset-out evaluation of the three samples of the mouse embryo dataset. wSIR(0) indicates α = 0, equivalent to SIR. Error bars indicate standard deviation of BCDC values resulting from 10 bootstrap samples of the training set. e Similar to (d) for Xenium breast cancer dataset. f Line plots indicating the ability to preserve local neighbourhoods for each method, relative to PCA, using the same evaluation strategy as (d). Error bands are constructed in the same way as in (d). g Similar to panel f for the Xenium breast cancer dataset. Source data are provided as a Source Data file.
wSIR is robust to parameter choice and slicing mechanisms
Next, we sought to examine the impact of the two main parameters in the wSIR algorithm on the performance of the corresponding low-dimensional embeddings. The main tuning parameters of interest are (1) the number of tiles to partition the spatial coordinates, and (2) Alpha (α), representing the scaling factor applied to the slice-slice correlation matrix (‘Methods’). We note that for certain selections of these tuning parameters, the wSIR approach becomes equivalent to SIR (α = 0) and PCA (i.e. when the number of slices approaches the total number of observations in the dataset). For this exploration, we used two case study datasets from single-cell resolved transcriptomic technologies in mouse development and human breast cancer stemming from seqFISH and 10x Genomics’ Xenium platform, respectively23,24 (‘Methods’). For each combination of these tuning parameters, the quality of the low-dimensional embedding was measured by the bias-corrected distance correlation (BCDC, Methods) between it and the true spatial coordinates. The resulting heatmaps for each dataset (Fig. 2b, c) show that, overall, wSIR obtains a higher BCDC than SIR, and that a high value of BCDC is maintained for parameter choices deviating from the ‘optimal’ choices. This indicates that the performance of wSIR is relatively robust to the choice of parameters, and that a selection of a sub-optimal combination of parameters is likely to still yield useful results.
We also conducted a sensitivity analysis of wSIR to the slicing mechanisms. By default, slicing is implemented based on a rectangular grid of the spatial coordinates. We implemented two different transformations of this grid, one by rotating it to a certain degree, and the other by shifting it to the right and upward by an amount proportional to the height and width of the smallest rectangle in the original grid. Supplementary Fig. 2 demonstrates that the BCDC between wSIR loadings (with α = 4 and k = 8) and the true spatial coordinates are robust to both these transformations.
We explored the effect of using a different function to create each entry of the weight matrix. We performed wSIR using the default spatial dependence function of (‘Methods’), and compared this with performance of wSIR using Gaussian kernel and Matern covariance function with different parameters to construct the weight matrix W. Supplementary Fig. 3 illustrates that while optimal performance as measured by BCDC can be achieved with other spatial dependence structures, they are highly sensitive to parameter choices. Our default structure achieves the most stable performance across varying values of the parameter α, and hence is preferred.
wSIR embeddings better preserve local and global cell–cell distances
Following our exploration of tuning parameter selection for wSIR, we examined the relative performance of wSIR compared to other spatially-aware dimensionality-reduction approaches used in single-cell and spatial transcriptomics analysis, including SpatialPCA, PRECAST, DR-SC and STAMP, in the two case-study datasets. Comparisons were based on in-sample performance metrics, as cross-validation was not feasible in this setting: our objective was to project non-spatial gene expression data into a spatially informed low-dimensional embedding, with spatial coordinates of the query cells used only for post-hoc accuracy assessment. Existing spatially aware methods do not support such out-of-sample projection and therefore cannot be evaluated on a held-out test set. We found that wSIR consistently resulted in the highest BCDC values when performed on each embryo of the mouse development data and on each sample of the Xenium breast cancer dataset, indicating its ability to preserve spatially relevant patterns from gene expression data (Fig. 2d, e). When we examined an additional metric of neighbourhood preservation (‘Methods’), by taking the Jaccard index of local neighbourhoods of cells according to physical space and the low-dimensional embeddings, we found that, overall, wSIR was best able to faithfully recapitulate the local neighbourhoods of cells, especially as the sizes of neighbourhoods increased as a percentage of the test sets (Fig. 2f, g).
We next compared wSIR with popular non-spatial dimensionality reduction methods, including PCA, GraphPCA, LDA, PLS and SIR (i.e. wSIR with α = 0). We conducted cross-validation studies to perform the comparison, as all these methods are capable of producing low-dimensional embeddings of gene expressions on a test set without using the spatial coordinates there. For the mouse development dataset, we performed cross-validation by selecting two of the three biological samples as reference and query, and repeating for each of the six combinations (Supplementary Fig. 4). For the human breast cancer data, we repeatedly randomly selected subsets of the cells to treat as reference and took the remainder of the cells as query. Following this, we found that wSIR consistently resulted in higher BCDC and higher Jaccard values (Supplementary Fig. 4).
Finally, we also examined the performance of wSIR when performed in multiple samples. For the mouse development dataset, we found wSIR has a higher BCDC and higher Jaccard values on a test embryo when trained in two other embryos altogether than when trained in only one embryo (Supplementary Fig. 5).
Uncovering relevant spatial biology in embryonic development
To further investigate the ability of wSIR in uncovering relevant biological patterns, we performed an exploration of single-cell spatial transcriptomics data of early mouse development23. This dataset contains 351 genes profiled across three biological replicates of sagittal sections of mouse embryos at the stage of early organogenesis, and was annotated with 23 distinct cell types across the entire body plan of the developing embryo. We applied wSIR to this dataset alongside PCA as a comparison (‘Methods’), to generate low-dimensional embeddings for the spatially-resolved cells. We noticed that all cell types were distinguished with wSIR in a similar manner to PCA (Fig. 3a, b), but that there were additional subdivisions of cell types, such as ‘Forebrain/Midbrain/Hindbrain’ and ‘Gut tube’, compared to PCA, illustrating that wSIR is able to subdivide heterogeneous cell types.
Fig. 3. Exploration of the mouse development dataset and spatial mapping benchmark with Tangram.

a UMAP of seqFISH mouse development cells using wSIR, coloured by original cell type annotation. b Same as (a) but using PCA as the underlying dimension reduction approach. c Spatial expression plots of the top 5 genes according to wSIR (left column) and PCA (right column), noting that top genes associated with wSIR have localised expression in space. d Scatterplot displaying GO terms according to for enrichment of top-ranked genes in PCA (x-axis) and in wSIR (y-axis), where the most significant terms are labelled. For each GO term, each Benjamini–Hochberg (BH) adjusted p-value is computed from the one-sided Fisher exact test comparing the number of top-ranked genes (either from PCA or wSIR) annotated to the term with the number expected by chance given the set of genes in the full data (e), UMAP as in panel a, highlighting cells belonging to Endothelium. f UMAP of Endothelium cells using wSIR, coloured by clustering of these cells. g Spatial plots of Endothelium cells coloured by clusters. h Expression dotplot of Endothelium clusters, the first 15 genes correspond to markers of Endothelium, and other genes correspond to specific markers for the clusters. The size of each dot represents the proportion of detected expression, and the colour indicates the average expression level relative to each group. i Tangram benchmarking with the mouse development dataset. The table compares input dimensions, mean JSD for 20 neighbours, bias-corrected distance correlation (BCDC), mean-squared error (MSE) and running time for Tangram with three inputs, including raw gene counts, PCA loadings and wSIR loadings. The best values for each criterion, including the lowest number of dimensions, the highest BCDC, the lowest MSE and the lowest running time, are highlighted. j Spatial plots of true cell types (top left) and Tangram predicted cell types for gene counts (top right), PCA (bottom left) and wSIR (bottom right). Source data are provided as a Source Data file.
When examining the most relevant genes according to wSIR and PCA (‘Methods’), we identified different sets of highly ranked genes; notably, we observed genes such as Hoxb9, Nepn and Meox1 as highly ranked for wSIR. According to visual inspection, these genes are extremely localised to anatomical sites such as the tail, trunk and developing spine, respectively (Fig. 3c). For the highly ranked genes in PCA, we did not observe such a marked pattern of localised expression. To examine this pattern further, we extracted the top 50-ranked genes according to wSIR and PCA, and performed functional enrichment analysis using GO terms. We found that the degree of significance for these terms were uncorrelated, and we noted relevant significant terms for wSIR including ‘pattern specification process’, ‘regionalisation’ and ‘embryonic morphogenesis’, whereas the terms most significant for the PCA-ranked genes were related to epigenetic regulation and methylation enzymes and not cell type specific (Fig. 3d). This indicates that wSIR prioritises gene expression variability relevant to the formation of the body plan, most clearly belonging to the formation of the head-to-tail axis.
Following the wSIR analysis of all the cells belonging to the mouse development dataset, we focused on the cells belonging to the ‘Endothelium’ cell type, as we noticed these cells were especially diverse according to the wSIR low-dimensional embedding (Fig. 3e), with some cells appearing closer to ‘Cardiomyocytes’ and ‘Allantois’ in the UMAP representation. We subset the Endothelium cells and performed wSIR followed by graph-based clustering (Fig. 3f), resulting in four identified clusters. Visualising the original locations of these cells indicates that the clusters correspond to distinct anatomical regions, such as the posterior region, which includes the allantois (cluster 1) and the endocardium (cluster 4) (Fig. 3g). Further examination of the marker genes associated with these clusters highlights the common expression of endothelial genes such as Cdh5, Plvap and Eng, alongside unique expression of the clusters. The posterior endothelial cluster expressed high levels of Plac1 and Tbx4, a T-box transcription factor, which plays an important role in vasculogenesis within the developing allantois25,26. We also observed expression of Gata4, Gata5 and Gata6 in cluster 4, indicating the endocardium27,28 (Fig. 3h). Taken together, our exploration highlights the utility of wSIR in providing access to spatial information during dimensionality reduction. This enables researchers to: (1) identify gene sets with important spatial roles, such as those involved in axial patterning during mouse development, and (2) uncover spatially localised cellular subtypes, such as vascular endothelial subsets arising in distinct anatomical regions. These findings underscore the potential of wSIR as a powerful tool for integrating spatial context into high-dimensional analyses, offering new insights into the spatial organisation of cellular and molecular processes.
Spatial prediction, pseudospace and domain detection approaches are improved by using wSIR
Since we have shown wSIR’s ability to generate low-dimensional embeddings that are useful in uncovering spatial biology, we wondered if wSIR, as a linear dimensionality reduction approach, would be useful as an input into more complex modelling approaches. To examine this, we turned to a popular method, named Tangram18, that uses deep learning to map single-cell gene expression data to spatial transcriptomics references. Tangram typically takes in a filtered gene expression matrix as input and returns a prediction of the physical locations of single cells, given a spatial omics reference dataset. Using the mouse development data, we performed Tangram with three input types: (1) gene expression counts, (2) PCA scores and (3) wSIR scores. We used five different metrics to evaluate the performance of the predicted coordinates (‘Methods’). Overall, we found that using wSIR as the input to Tangram resulted in the best performance evidenced by the highest BCDC, Jensen–Shannon divergence, Spearman correlation, the smallest MSE and the shortest run time (Fig. 3i). Visually, we noticed that predicted coordinates using wSIR aligned well with previously known organisation of cell types in the developing embryo (Fig. 3j). Overall, this investigation indicates that wSIR is a useful initial analytical step prior to applying other bespoke analyses, and is versatile in the range of downstream applications that can be employed.
We next wondered if wSIR may be useful in uncovering axes of biologically relevant variation in space. To this end, we used a recently published human thymus spatial omics dataset29 where a continuous cortico-medullary axis (CMA) was defined. The CMA represents a continuous, rather than discrete, shift from tissue areas most associated with the cortex and medulla of the thymus. We used the nine spatial omics-resolved samples to perform wSIR dimension reduction alongside PCA, followed by trajectory ‘pseudospace’ inference using Slingshot30 (‘Methods’). We observed that both approaches were able to recapitulate the CMA well, with Spearman correlations of 0.39 and 0.22 for wSIR and PCA, respectively (Supplementary Fig. 6a, b), and fairly close concordance between wSIR and PCA overall (Spearman correlation 0.57). Overall, this analysis demonstrates wSIR’s ability to prioritise spatially relevant and continuous gene expression variation.
Since tissue domain detection is a key analysis task in exploring spatial omics data, we examined wSIR’s ability to produce meaningful and stable spatial domains compared to other state-of-the-art methods. While wSIR is fundamentally an approach to embed observations into a reduced dimension space, it can be coupled with unsupervised learning to generate spatially-informed clusters or domains. To facilitate this comparison, we used one real dataset (DLPFC, ‘Methods’) and one synthetic simulation dataset (as per8, ‘Methods’) that contained what can be considered ‘ground truth’ domain labels. When we compared wSIR’s derived domains against those of other methods, including DR.SC, PRECAST, SpatialPCA and STAMP for the real DLPFC dataset, we observed comparable performance in terms of pseudo-R2 and ARI (Supplementary Fig. 7a–d). Similarly, for the synthetic data, we observed both comparable performance in terms of BCDC, neighbourhood similarity and pseudo-R2 (Supplementary Fig. 8a–c), as well as observing a consistent visual recapitulation of the striped spatial patterns in this dataset (Supplementary Fig. 8d, e). Overall, these analyses demonstrate wSIR’s ability to facilitate downstream detection of discrete spatially relevant domains.
Exploration of breast cancer spatial transcriptomics at the spot- and single-cell level
Following our application of wSIR to single-cell spatial transcriptomics data, we wondered if wSIR would allow us to similarly interrogate spot-level spatial transcriptomics data to derive biologically relevant insights. The human breast cancer dataset stems from an experimental study where slices from the same tissue block were also subjected to spot-level spatial transcriptomics via the 10x Visium platform24. Using this spot-level data, we first subset genes to those also captured in the single-cell resolved Xenium data. We performed both wSIR and PCA, and found that we were able to recapitulate the diversity of tissue structure (Fig. 4a, b), in particular identifying regions belonging to the tumour invasive region (cluster 6) and DCIS (cluster 2) (Fig. 4c–e). Using the gene importance metric for wSIR and PCA (‘Methods’), we found there was a low association between genes identified as strongly relevant by wSIR and PCA, such as MMP12 and OPRPN ranked most relevant by wSIR and PTGDS and SFRP4 ranked most relevant by PCA (Fig. 4f). We noted that some of the top-ranked wSIR genes were not necessarily the most prevalently expressed (Fig. 4g), for example, MMP12, a matrix metallopeptidase gene, appears to be expressed in distinct small regions of the Visium-resolved tissue, while PTGDS and SFRP4 are more prevalently expressed across the tissue. This suggests that wSIR may be able to prioritise spatial gene expression that is highly localised and potentially biologically relevant.
Fig. 4. Exploration of the ductal breast cancer dataset.

a Spatial plot of breast cancer Visium data where spots are coloured according to clustering of the wSIR dimension reduction. b Corresponding UMAP plot of Visium spots with spots coloured as in (a). c Spatial plot coloured by annotation from original publication. d Corresponding UMAP plot with spots coloured as in (c). e Heatmap of tabulation of the number of spots belonging to wSIR clusters and original annotation. f Scatterplot of gene relevance of PCA (x-axis) and wSIR (y-axis), where higher values mean more relevant genes. g Spatial expression plots of selected top-ranked genes according to wSIR (MMP12, OPRPN), both wSIR and PCA (POSTN), and only PCA (PTGDS, SFRP4). h UMAP of breast cancer Xenium cells according to projection to the Visium-informed wSIR low-dimensional embeddings. Cells belonging to a distinct group, made of the majority Macrophages_1, are circled in black. i Volcano plot displaying differential expression testing results of the set of cells selected in (e). The p-value is calculated from a two-sided t-test between the selected group and the remaining cells without any multiple comparison adjustment. j Spatial plot of Xenium cells that belong to the selected group, coloured in black, corresponding to a macrophage subcluster that localises around ducts and expresses MMP12. Source data are provided as a Source Data file.
Our next question was whether we could successfully map single-cell resolved data to a low-dimensional embedding that is informed by spot-level spatial transcriptomics data. To do so, we took the Xenium-resolved human breast cancer cells and projected the gene expression to the low-dimensional space as estimated from the Visium data. We observed that the cell types, as originally annotated24 were preserved among this projection (Fig. 4h). Interestingly, we noticed that a set of cells primarily annotated as ‘Macrophages_1’ appeared as a distinct group, and this was not the case for PCA. When we selected these cells and performed differential expression analysis, we observed that the cells were marked by genes including MMP12, CD68, APOC1 and FCER1G, indicating that these cells indeed correspond to a type of macrophage that may be involved in remodelling of the extracellular matrix (Fig. 4i). Since this gene expression data came from the Xenium platform, we were able to visualise their original locations (Fig. 4g). In doing so, we noted distinct positioning of these cells around some of the DCIS (as annotated in the original publication), suggesting a possible role of these cells in the progression into invasive tumours. Taken together, our in-depth case study of single-cell-resolved and spot-resolved human breast cancer spatial transcriptomics data encapsulates the ability of wSIR to uncover relevant signals for spatial cancer biology.
Discussion
In this paper, we have introduced wSIR, an approach to perform spatially-aware dimensionality reduction of single-cell and spot-level spatial transcriptomics data. wSIR can handle multiple distinct biological samples, and enables mapping of non-spatial gene expression data to a low-dimensional embedding that is informed by spatial coordinates. We have implemented wSIR as an R package, with scalability due to efficient Rcpp implementation. We have shown relatively superior performance of wSIR compared to other dimensionality reduction approaches, and demonstrated wSIR’s applicability in two real-world biological contexts.
A current limitation of wSIR is that an initial step of feature selection is needed for very large datasets, e.g. whole transcriptome data. While there are works in statistics research on implementing sparsity to SIR via the Lasso21, future work would focus on incorporating such regularisation approaches to the wSIR context in terms of both the slicing mechanisms for spatial transcriptomics data, and taking the slice-slice correlations into account. Adding further complexity to the modelling step could be met with a decrease in computational scalability, so future work would focus on ensuring that any algorithmic advance is not met with a large drop in computational efficiency.
We have shown that wSIR is quite robust to changes in the slicing mechanism, such as location shifts, but we have not fully examined the impact of other types of slicing mechanisms that, for example, take into account the density of cells in a tissue. Given this, there is a future opportunity to investigate whether an ‘adaptive’ slicing mechanism may be beneficial in balancing between large enough sample sizes for analytical stability and small enough sample sizes to retain subtle spatial patterns.
A key advantage of wSIR is its ability to take into account multiple samples to generate a single low-dimensional loading and embedding. We currently do so by assuming that the slice-slice correlation of slices belonging to separate samples is zero. With the increase in throughput of spatial transcriptomics studies and the inevitable rise in variety and complexity of the studies31, it is important to consider different levels of replication. For example, datasets can contain distinct spatial samples that are 2D slices from the same 3D tissue block across multiple individuals, and care will need to be taken to build an appropriate slice-slice correlation matrix in these situations. Currently, wSIR would be limited in assuming that such 2D slices from the same 3D block are not spatially correlated at all, potentially reducing the ability of wSIR to leverage this information. There are algorithms that computationally ‘register’ 2D samples into a 3D structure, but there is a potential circularity issue in using gene expression data to register spatial coordinates, then using spatial coordinates to reduce the dimensionality of gene expression data. Future work could consider tackling these tasks jointly, potentially leading to more accurate results.
We envisage wSIR being used in a variety of contexts, especially as spatial transcriptomics data becomes more widespread. Effectively using spatial information is a challenge in contemporary spatial transcriptomics analyses, and simply using tools designed for scRNA-seq can hinder the ability to draw insight in terms of spatial biology. We believe that wSIR is helpful in uncovering spatially relevant variation, but may be limited in identifying non-spatial but still biologically relevant variation. As such, wSIR should be considered as one of many tools that analysts can use for understanding their complex and high-dimensional spatial omics data. Overall, we see the potential of wSIR to ensure that spatially relevant variation is not lost, and to enable a more comprehensive understanding of spatial biology in several contexts.
While wSIR is computationally efficient because it is a linear dimension reduction method, it may not be the case that linear combinations of gene expression are able to predict the spatial outcomes. To that end, future research could adapt the idea of wSIR to non-linear sufficient dimension reduction methods, such that those recently developed by ref. 32. From a theoretical standpoint, properties of wSIR, such as consistency and optimality, similar to those developed by refs. 33,34,35, can also be investigated.
Methods
A brief review of sliced inverse regression
Dimension reduction (DR) refers to statistical methods aiming to reduce the dimension, typically the number of columns, of a dataset to address the curse of dimensionality and remove noise from the data. Let X be an n × p matrix of gene expression features, where n is the number of observations (cells), and p is the number of genes, where p is typically large. Dimension reduction methods aim to find a low–dimensional score n × d matrix V, with d ≪ p, where different methods differ in what information of X (e.g. total variances, graph structures) need to be retained as much as possible in V.
In our spatial transcriptomic context, in addition to X, we have an n × q matrix of response Y containing spatial coordinates of cells with q = 2 or q = 3. Therefore, we aim to find such a matrix V so that V preserves the ability of X to predict Y20, i.e. Y⊥X∣V, with ⊥ denoting statistical independence and ∣ denoting conditioning. This is precisely the aim of ‘sufficient dimension reduction’, which is an active research area that gains increasing popularity among practitioners. Among sufficient dimension reduction methods, SIR is the most widely used due to its generality, simplicity, and computational efficiency. Since its first introduction, SIR has been adapted into many complex settings, including missing data36,37 and high-dimensional features with n ≪ p17,21. Nevertheless, most recent works on SIR assume a univariate response, i.e. q = 1. While a few works have extended SIR to the multivariate response settings38,39, our paper is the first to propose SIR for responses with spatial coordinates. Without the loss of generality, we assume each column of the feature matrix X is centred.
As a linear sufficient dimension reduction method, SIR assumes V = XB, where B is a p × d loading matrix B such that Y⊥X∣V. This conditional independence relationship is invariant for any rotation of V by an orthonormal d × d matrix C, i.e. Y⊥X∣V is equivalent to Y⊥X∣(VC), so the loading matrix B is only identifiable up to rotation. Compared to non-linear sufficient dimension reduction methods, linear dimension reduction methods are more interpretable and scalable, and they enable a straightforward projection of a new dataset into the lower-dimensional space.
The basic algorithm for SIR is as follows. Let be the sample covariance matrix of the gene expression data and be the standardised covariates matrix. In the first step, all of the observations are allocated into one of the H slices, where each slice has observations with similar value for the response variables Y, where H is a pre-specified user input. Let zh be a p × 1 column vector consisting of the average of all the standardised covariates within the hth slice for h = 1,…, H. In the second step, let be a sample covariance matrix of these sliced means, where nh is the number of observations within the hth slice. Then, an eigendecomposition is performed on M to obtain its eigenvectors u1,…,ud, and each column of the final SIR estimates of the loading matrix is obtained as for j = 1,…, d. We note that while any two eigenvectors uj and uk are orthogonal to each other for j ≠ k, the columns and are not. The column space of B is finally estimated by the column space of .
There are two main challenges of adapting the above basic SIR algorithm to our settings with spatial coordinate responses. First, it is not clear how to form slices. Second, each slice in our setting corresponds to one spatial location, so these slices are spatially correlated with each other. Nevertheless, in the basic SIR algorithm, this spatial information is ignored after the slices are formed. To overcome these challenges, we introduce a general weight matrix into the computation of the sample covariance matrix of the sliced mean, where the off-diagonal elements are explicitly used to account for the correlation among the slices.
Slicing mechanisms for spatial coordinate responses
To form slices of the data with a multivariate response, for each sample, we assign cells to H = k2 tiles, where k is the number of slices representing the number of non-overlapping bins of equal length along each axis direction in the 2D coordinate. In general, the number of cells/spots within each slice should be large enough to benefit from the SIR mechanism, noting that in the extreme case, if each cell/spot is within its own slice, then the approach is akin to PCA. While there are practical discussions around slicing in the SIR literature22 and general heuristics can be followed (e.g. at least 25 cells), the number of slices is treated as a tuning parameter and a selection is made according to the largest cross-validated BCDC.
wSIR: Spatial weighting matrix to handle correlations among the slices
In the second step of the basic SIR algorithm, we can write the matrix M in the form
| 1 |
where ZH is the H × p matrix whose hth row is the vector of average of the standardised covariates and ph = nh/n for h = 1,…, H, and H is the number of tiles. Since the matrix D is diagonal, no correlation among the slices is accounted for in this computation of M. To allow for the correlation among the slices and preserve the proportion of observations within these slices, we propose to compute M to be
| 2 |
where W is a H × H correlation matrix, whose diagonal elements are one and off-diagonal elements are between 0 (inclusive) and 1. Since these tiles correspond to spatial locations, the higher the proximity between two tiles, the more correlated they are. Hence, we construct the off-diagonal elements wij of W from the distance between the centroid of the ith and jth tile as follows.
Let Sh be the index set for the hth tile, i.e. Sh = {i: ith observation belong to the hth tile} for h = 1,…, H. Then the spatial coordinates for the centroid of the hth tile is
| 3 |
Therefore, the Euclidean distance between the centroid of the two tiles (i, j) is for i, j = 1,…, H. We then compute
| 4 |
where α > 0 is another tuning parameter. This choice of wij in the equation above ensures that all the resulting wij are between 0 and 1, and a higher distance dij leads to a lower value for wij as desired. Furthermore, we include the α to ensure our resulting method can include the basic SIR as a special case; indeed, the basic SIR that ignores all the correlations among the slices correspond to α = 0.
Selecting the number of wSIR directions
To select the number of directions d for the low-dimensional score, we employ a cumulative variance threshold when performing the eigendecomposition of the matrix M. Particularly, let be the eigenvalues of M, so each is the variance of the score ZHuk, for k = 1,…,p. We then choose an estimate to be the minimum number of directions that explains a certain percentage of total variance across all the scores, i.e
| 5 |
As a default, we look for the minimum number of directions that captures at least 99% of the variance, so C = 0.99. Otherwise, as often done in PCA, we can keep the number of wSIR directions to be 50, particularly when we use wSIR embeddings for other downstream analyses (such as clustering or prediction).
Selecting tuning parameters for wSIR
For these other parameters in the wSIR algorithm, including the number of tiles H and the coefficient α in the computation of the weight matrix, we use a 10-fold cross-validation. Specifically, we split our data into a training set (Xtrain, Ytrain) and a validation set (Xval, Yval). For each potential candidate of H and α, we computed the corresponding wSIR loading in the training data with the number of components being selected from the above cumulative variance threshold. Then, we computed the score on the test set , and we choose the combination of (H, α) that maximises the distance correlation between the two matrices Yval and Vval40. This distance correlation metric is widely used in the statistics literature to measure the dependence between two datasets, encompassing both linear and non-linear relationships among them41–43. We outlined the computation of this metric below.
Applying wSIR to multiple samples
When we use multiple samples in the training set for a dimension reduction procedure, we must account for possible differences between both the gene expression data and the spatial coordinate systems (e.g. coordinate (0, 0) in one sample may not correspond to coordinate (0, 0) in another sample). These concerns can both be addressed by the weight matrix. In the weight matrix, a value of 0 corresponds to no spatial correlation between the tiles. For a pair of tiles from different samples, we set the corresponding entry in the weight matrix to 0.
The weight matrix has a dimension , where S is the set of all samples, s is one of the samples, and Hs is the number of tiles in sample s. For any entry wij of the weight matrix W, it will take the value 0 if tiles i and j come from different samples. If they are from the same sample, its value will be calculated in the usual way as if there was only one sample in the wSIR computation. As a result, we are not assuming any spatial correlation between tiles from different samples.
Because of the structure of the weight matrix W, when wSIR is applied to multiple samples, there are few constraints on the samples included. Performing wSIR together would only add value if there is some spatially-relevant information that is common to all samples, so having a shared tissue origin is required. The procedure also requires that the gene sets in all the samples are the same. Further, because wSIR does not include any batch correction stage, it is assumed that the input to wSIR will have already undergone batch correction. Note that we also do not need shared or aligned coordinate systems between the samples, because wSIR will automatically set the element in the weight matrix corresponding to two tiles from different samples to zero.
Ranking variables by importance in wSIR
Following the fitting of wSIR, we examine the estimated loadings matrix to obtain a ranking of the variables that are most relevant in the dimensionality reduction. Recall that the matrix B is only identifiable up to an orthogonal rotation, but the ranking of variables within each column of B is generally not invariant to such a rotation. Hence, we remove the effect of rotations by computing the corresponding p × p projection matrix . Then, a measure of importance for the jth gene expression feature is the corresponding diagonal element of , i.e. for j = 1,…, p. The values of aj range from 0 to 1, with ; a higher value of aj indicates the jth feature is more important. Intuitively, a high value of aj indicates a relatively large loading of the jth gene expression feature in at least one of the d dimensions; a low value of aj indicates the corresponding gene expression has a small loading in all dimensions. This measure of variable importance is commonly used in sufficient dimension reduction, see for example refs. 44 and 45.
We then rank the variables in descending order according to these scores. The user may select a set number of top-ranked variables as relevant, e.g. the top 50 genes. We note that this approach to ranking variables is also applied to the loadings estimated using PCA.
Projecting non-spatial data using wSIR
Since a fitted wSIR model only involves the feature-level information of spatial omics data, non-spatial data can be projected into the spatially-aware low-dimensional space as estimated from spatial data. This is done by employing the same projection for centred and scaled non-spatial gene expression data.
Comparison with existing methods
We compare wSIR with PCA, LDA, PLS, GraphPCA (GPCA), DR-SC, PRECAST, SpatialPCA and STAMP. PCA forms the low-dimensional scores Z that preserve as much as total variability in X; as a common practice, we kept the number of PCs to be 50 for all downstream analyses46. For LDA, we create a categorical response variable with H categories, each corresponding to one slice. LDA finds H − 1 linear combinations of X that separate these categories. PLS finds the components that maximise the sample covariance between X and the spatial coordinates Y; we selected the number of low-dimensional components by cross-validation as implemented in the plsr function of the pls R package47. GPCA is a regularised version of PCA; it aims to construct low-dimensional scores Z of X that minimise the reconstruction error while preserving the graph structures among the cells. GPCA requires an n × n cell-cell adjacency matrix, which is obtained from computing k-nearest neighbour graph on the spatial coordinates Y. As implemented in the GraphPCA Python package, the default choice is k = 5 for the ST platform, and the regularisation parameter for the graph constraint is fixed at 0.5. SpatialPCA is a spatially-aware dimension reduction approach that augments the PCA objective function with a regularisation term to preserve the neighbouring structure of the original data in the low-dimensional embeddings. DR-SC performs dimension reduction assuming low-dimensional embeddings follow a finite Gaussian mixture model, where the probability that two observations belong to the same cluster depends on their spatial coordinates; PRECAST extends DR-SC to multiple samples and accounts for possible batch effects and misalignment among these samples. Finally, STAMP is a Bayesian topic model, which uses a graph convolutional network with inputs being gene expression and an adjacency matrix built from the spatial coordinates, to perform dimension reduction and infer the contribution of each gene to each topic.
Datasets and case studies used in this study
Synthetic data
We generated a simulated dataset where we know the true low-dimensional spaces (ground-truth) and used them to demonstrate wSIR and compare it with other popular dimension reduction methods. Specifically, we generated the spatial coordinates Yi = (Yi1, Yi2) from and , where the radius Ri and θi are independently random numbers drawn from the Uniform(0.1, 1) distribution and the Uniform(−π, π) distribution for i = 1,…, n. The n × p gene expression feature matrix X is decomposed into three blocks X = [X1, X2, X3], where X1 is an n × p1 matrix whose elements are independently generated from N(0, 5) distribution, X2 is an n × p2 matrix whose each element in the ith row are drawn from N(Ri, 0.5) distribution, and X3 is an n × p3 matrix whose each element in the ith row is independently drawn from N(θi, 0.5) distribution for i = 1,…, n. We set n = 1000, p1 = 10, p2 = p3 = 5, so p = p1 + p2 + p3 = 20. In this synthetic data, the ground-truth two-dimensional low-dimensional scores that fully capture the spatial information are V = (X2, X3) = XB, where B = [B1, B2] with and , where 0k and 1q denote a k × 1 and q × 1 vectors of zero and one, respectively. Figure 2 (panel a, first column) plots a generated sample of spatial coordinates (Y1i, Y2i), coloured by the magnitude of Ri (top) and θi (bottom) for i = 1,…, n.
Furthermore, we also used a simulated dataset following the PRECAST model in ref. 8 to validate the performance of wSIR in a more sophisticated simulation. We downloaded the dataset from the GitHub of the first author of PRECAST. This dataset contains three samples, each of which contains spatial coordinates with ground-truth spatial domains (Supplementary Fig. 7e) and expression for p = 2000 genes for 4226, 3661 and 3639 spots, respectively.
Human breast cancer dataset
We downloaded single-cell spatial transcriptomic data for human breast cancer from the 10x Genomics website (see ‘Data Availability’). We retained only the spatial coordinates and gene expression belonging to replicate 1. We performed filtering of low-quality cells and filtering of lowly expressed genes, prior to performing a log-count normalisation on the retained cells. We used the cell annotation provided in the publication, resulting in a dataset with n = 163,998 cells and p = 313 genes. To obtain PCA and wSIR results for this dataset, we performed PCA (50 PCs) using the runPCA function in the scater R package, and we performed wSIR with H = 302 tiles and α = 4. When comparing the performance of the wSIR with other methods in dimensionality reduction alone (such as the results in Fig. 2), we used the proportion of explained variance threshold C = 0.99 to determine the number of wSIR dimensions. When wSIR low-dimensional embeddings were used for further downstream analyses, we kept the number of dimensions to be 50. To facilitate visualisation, for both PCA and wSIR, we performed UMAP using the runUMAP function in the scater R package. We identified the top 50 most relevant genes according to the procedure outlined above, and performed functional enrichment analysis using Gene Ontology (GO) using the clusterProfiler R package, retaining GO terms containing between 20 and 200 genes, and set all the genes appearing in the dataset as the gene universe. We performed differential expression analysis using the findMarkers function in the scater R package.
We also downloaded the corresponding spot-level 10x Genomics’ Visium dataset from the same website. We performed wSIR using the same parameters except with H = 202 tiles and a maximum of 30 directions. We projected the single-cell Xenium data into the Visium-resolved low-dimensional embedding using the projectWSIR function in our wSIR R package. We performed differential expression analysis of the macrophage subset using the findMarkers function in the scater R package.
Mouse development dataset
We downloaded single-cell spatial transcriptomic data from a recent study of early organogenesis23 using the MouseGastrulationData Bioconductor package. This dataset comprises three biological replicates of sagittal sections of mouse embryos, totalling n = 57,536 cells (19,451, 14,891 and 23,194 cells for embryos 1, 2 and 3, respectively) measured across p = 351 genes. We removed the gene Xist from further analysis, since the embryos are a mix of male and female, and filtered cells annotated as ’Low quality’ as well as cells containing fewer than 10 counts and fewer than five unique genes. We performed normalisation using the logNormCounts function in the scater R package. We performed wSIR of the spatial gene expression using H = 302 slices, α = 4, where the number of dimensions was selected as outlined in the ‘Methods’ section. Further visualisation using UMAP and GO enrichment testing was the same as for the human breast cancer data. For the endothelium data, we used the same wSIR parameters and performed clustering of the cells using the bluster R package with infomap graph-based clustering.
Human thymus dataset
We downloaded the human thymus dataset from CellxGene (see Data Availability), comprising nine samples. We performed library size normalisation followed by HVG selection to obtain a processed gene expression dataset. We performed wSIR and PCA with default parameters. To remove technical artefacts (batch effects) between samples, we used the RunHarmony function from the Harmony package. We compared the resulting batch-corrected wSIR and PCA embeddings with the true Cortico-Medullary Axis (CMA) from the original publication.
Dorso-lateral prefrontal cortex (DLPFC) dataset
We downloaded the DLPFC dataset from CellxGene (see Data Availability), comprising 12 samples. In a similar manner to the human thymus dataset, we performed library size normalisation followed by HVG selection of 500 genes to obtain a processed gene expression dataset. We then used wSIR alongside other methods with default parameters to generate low-dimensional embeddings and domains. We used k-means clustering to obtain putative domains from wSIR embeddings, with k set to the true number of domains based on the published annotations.
Evaluation metrics
Distance correlation
First, we are interested in the overall association between the spatial coordinates and the low-dimensional scores, as measured by the bias-corrected distance correlation (BCDC), which is a popular dependence measure between two sets of random vectors with arbitrary numbers of components encompassing both their linear and non-linear relationships40. Given the spatial coordinates Y and a low-dimensional score matrix V, each with n rows, let Yi and Vi be the ith row of Y and V, respectively. Let Aij and Bij be the pairwise distance between the ith and jth row of Y and V, i.e Aij = ∥Yi − Yj∥ and Bij = ∥Vi − Vj∥ for i, j = 1,…, n. The centred distances on Y are given by
| 6 |
and similar definition holds for . Hence the bias-corrected distance correlation (BCDC) is defined to be
| 7 |
with the bias-corrected distance covariance
| 8 |
and the bias-corrected distance variances dVar(Y) = dCov(Y, Y) and dVar(V) = dCov(V, V). A higher BCDC implies a strong association between Y and V, encompassing both linear and non-linear relationships.
Average Jaccard coefficient
We also evaluate the performance of dimension reduction methods in terms of how well they preserve the neighbourhood structure among the cells. Particularly, let be the index set of the K nearest neighbours for the ith observation from the spatial coordinates matrix Y, i.e.
| 9 |
and similar definition holds for with Aij replaced by Bij. The Jaccard index for the ith observations measures the similarity between the two above sets, i.e
| 10 |
where ∩, ∪ denote the set intersection and union, respectively, and ∣⋅∣ measures the number of elements in the set. For each value of K, we compute the average Jaccard value ; in our results, we select different values of K corresponding to (0.5%, 1%, 5%, 10%, 20)% the number of observations in a test set.
Pseudo-R2 and Adjusted Rand Index
For the spatial datasets that contain ground-truth about spatial domains, we also compared dimension reduction methods based on the downstream tasks of spatial domain detection and clustering, which follows what was performed by ref. 8. Regarding spatial domain detection, we treated the true spatial domains as the outcome and fitted a multinomial regression model with predictors being the embeddings obtained from each dimension reduction method. After fitting the model, we computed the McFadden-adjusted pseudo-R2 to evaluate the predictive ability of the predictor variables in predicting the ground truth, with a higher pseudo-R2 indicating better performance. To cluster spatial domains, we apply the k-means clustering with k being the true number of spatial domains on each low-dimensional embedding and compute the Adjusted Rand index (ARI) to measure the similarity between the predicted and true clusters; a higher ARI indicates a better performance.
As input to Tangram spatial mapping
We used Tangram, a deep learning model for alignment, to explore the applicability of wSIR dimensions in downstream analysis. Tangram maps a query nsc × g single cell gene expression matrix to a reference nsp × g spatial location gene expression matrix, where nsc, nsp and g are the number of single cells, the number of spatial spots and genes used for training, respectively. This mapping is characterised by a nsp × nsc matrix Q where each entry qij is the probability that the ith single cell is in the jth spatial spot, so for i = 1,…nsc. The mapping is performed iteratively by minimising a loss function, according to which the cosine similarity between the gene expressions of the mapped single cells and reference spatial data cells should be as high as possible. We applied Tangram to two embryo replicates from the mouse embryo dataset, by treating replicate 2 as the query single cell dataset, i.e. nsc = n2 and ignoring the spatial locations, and treating replicate 1 as the reference spatial dataset, i.e. nsp = n1, where n1 and n2 are the number of cells on the replicates 1 and 2, respectively. To predict the location for the query single cell data, we adopted the approach used in ref. 17, which assigns the ith query single cell to the jth spatial location with the highest probability value. We applied this workflow to low-dimensional embeddings generated by wSIR , from which we calculated the n2 × 2 matrix of spatial coordinates for query single-cell samples (i.e. embryo 2), and compared with the n2 × 2 actual spatial coordinates matrix Y in that embryo. We compared the performance of this approach (wSIR + Tangram) versus (a) the same workflow with input being PCA scores of the same dimensions (PCA + Tangram), and (b) naïve-Tangram analysis with raw (Count) gene expression (g = p = 351) based on (1) dimensions of inputs, (2) average Jensen-Shannon divergence (JSD) between the cell-type distributions of predicted K-nearest neighbour cells and the true K nearest neighbours, where K = 20, (3) Spearman’s rank correlation between and Y, (4) bias-corrected distance correlation between and Y, (5) mean squared error (MSE) and (6) total computation time.
Reporting summary
Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.
Supplementary information
Source data
Acknowledgements
We thank our colleagues in the University of Sydney School of Mathematics and Statistics, Charles Perkins Centre and Sydney Precision Data Science Centre for their support and intellectual engagement.
Author contributions
L.H.N. and S.G. conceived the study. M.W. developed the method and software and performed data analysis with supervision from L.H.N. and S.G. P.P. performed the spatial mapping benchmarking. S.G. and L.T.G.H. interpreted the development results with input from B.G. J.M. and H.Z. interpreted the breast cancer results with input from A.S. and S.G. M.W., L.H.N. and S.G. wrote the manuscript. All authors read and approved the final version of the manuscript.
Peer review
Peer review information
Nature Communications thanks the anonymous reviewer(s) for their contribution to the peer review of this work. A peer review file is available.
Funding
The following sources of funding are gratefully acknowledged. S.G. was supported by an Australian Research Council DECRA Fellowship (DE220100964). P.P. was supported by the Chan Zuckerberg Initiative DAF, an advised fund of Silicon Valley Community Foundation (2022-249319 to S.G.). L.T.G.H. was supported by a Wellcome Early-Career Award (226309/Z/22/Z). B.G. was supported by Wellcome (206328/Z/17/Z, 203151/Z/16/Z and 226795/Z/22/Z) and UKRI Medical Research Council (MC_PC_17230). A.S. is supported by the generosity of Deborah and John McMurtrie and the Petre Foundation and grants from the Breast Cancer Research Foundation (BCRF-23-209), NHMRC (APP2018440) & NBCF (IIRS-23-074). The funding sources mentioned above had no role in the study design; in the collection, analysis and interpretation of data, in the writing of the manuscript and in the decision to submit the manuscript for publication.
Data availability
This study used publicly available data. The mouse embryo seqFISH data was accesssed via Bioconductor (version 3.19) ExperimentHub package MouseGastrulationData (version 1.18.0). The breast cancer 10x Genomics Xenium data was accessed via the 10x Genomics website (https://www.10xgenomics.com/products/xenium-in-situ/preview-dataset-human-breast) on 2 February 2024 and processed using MoleculeExperiment (version 1.5.1). The matching Visium data was accessed by the same website on 1 December 2024 and processed using DropletUtils (version 1.24.0). The human thymus and DLPFC data were downloaded from the CellXgene website (https://cellxgene.cziscience.com/datasets) on 1 October 2025. Source data for figures are provided with this paper. Source data are provided with this paper.
Code availability
All analyses were performed in R (version 4.4.2). The wSIR software is available as an R package48 and has been submitted to the Bioconductor Project. Scripts for analyses and generating figure panels in this paper are available at https://github.com/SydneyBioX/wSIR_2024.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Contributor Information
Shila Ghazanfar, Email: shila.ghazanfar@sydney.edu.au.
Linh H. Nghiem, Email: linh.nghiem@sydney.edu.au
Supplementary information
The online version contains supplementary material available at https://doi.org/10.1038/s41467-026-76871-z.
References
- 1.You, Y. et al. Systematic comparison of sequencing-based spatial transcriptomic methods. Nat. Methods21, 1743–1754 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Huang, H., Wang, Y., Rudin, C. & Browne, E. P. Towards a comprehensive evaluation of dimension reduction methods for transcriptomic data visualization. Commun. Biol.5, 10.1038/s42003-022-03628-x (2022). [DOI] [PMC free article] [PubMed]
- 3.Wang, K. et al. Comparative analysis of dimension reduction methods for cytometry by time-of-flight data. Nat. Commun.14, 10.1038/s41467-023-37478-w (2023). [DOI] [PMC free article] [PubMed]
- 4.Cantini, L. et al. Benchmarking joint multi-omics dimensionality reduction approaches for the study of cancer. Nat. Commun.12, 10.1038/s41467-020-20430-7 (2021). [DOI] [PMC free article] [PubMed]
- 5.Yang, J., Wang, L., Liu, L. & Zheng, X. Graphpca: a fast and interpretable dimension reduction algorithm for spatial transcriptomics data. Genome Biol.25, 10.1186/s13059-024-03429-x (2024). [DOI] [PMC free article] [PubMed]
- 6.Shang, L. & Zhou, X. Spatially aware dimension reduction for spatial transcriptomics. Nat. Commun.13, 10.1038/s41467-022-34879-1 (2022). [DOI] [PMC free article] [PubMed]
- 7.Liu, W. et al. Joint dimension reduction and clustering analysis of single-cell RNA-seq and spatial transcriptomics data. Nucleic Acids Res.50, e72–e72 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Liu, W. et al. Probabilistic embedding, clustering, and alignment for integrating spatial transcriptomics data with precast. Nat. Commun.14, 296 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Wang, Y. et al. mNSF: multi-sample non-negative spatial factorization. Genome Biol.26, 149 (2025). [DOI] [PMC free article] [PubMed]
- 10.Georgaka, S. et al. CellPie: a scalable spatial transcriptomics factor discovery method via joint non-negative matrix factorization. Nucleic Acids Res.53, 6 (2025). [DOI] [PMC free article] [PubMed]
- 11.Townes, F. W. & Engelhardt, B. E. Nonnegative spatial factorization applied to spatial genomics. Nat. Methods20, 229–238 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Zhong, C., Ang, K. S. & Chen, J. Interpretable spatially aware dimension reduction of spatial transcriptomics with stamp. Nat. Methods21, 2072–2083 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Pham, D. et al. Robust mapping of spatiotemporal trajectories and cell–cell interactions in healthy and diseased tissues. Nat. Commun14, 7739 10.1038/s41467-023-43120-6 (2023). [DOI] [PMC free article] [PubMed]
- 14.Liu, W. et al. FAST: Scalable Factor Analysis for Spatial Dimension Reduction of Multi-section Spatial Transcriptomics. Genom. Proteom. Bioinform. (2026). [DOI] [PubMed]
- 15.Tang, J. et al. The interpretable multimodal dimension reduction framework SpaHDmap enhances resolution in spatial transcriptomics. Nat. Cell Biol.28, 363–377 10.1038/s41556-025-01838-z (2026). [DOI] [PMC free article] [PubMed]
- 16.Haviv, D. et al. The covariance environment defines cellular niches for spatial inference. Nat. Biotechnol. 10.1038/s41587-024-02193-4 (2024). [DOI] [PMC free article] [PubMed]
- 17.Li, S. et al. Cellcontrast: Reconstructing spatial relationships in single-cell RNA sequencing data via deep contrastive learning. Patterns5, 8 (2024). [DOI] [PMC free article] [PubMed]
- 18.Biancalani, T. et al. Deep learning and alignment of spatially resolved single-cell transcriptomes with tangram. Nat. Methods18, 1352–1362 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Li, K.-C. Sliced inverse regression for dimension reduction. J. Am. Stat. Assoc.86, 316–327 (1991). [Google Scholar]
- 20.Li, B. Sufficient dimension reduction: Methods and applications with R (Chapman and Hall/CRC, 2018).
- 21.Lin, Q., Zhao, Z. & Liu, J. S. Sparse sliced inverse regression via Lasso. J. Am. Stat. Assoc.114, 1726–1739 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22.Girard, S., Lorenzo, H. & Saracco, J. Advanced topics in sliced inverse regression. J. Multivar. Anal.188, 104852 (2022). [Google Scholar]
- 23.Lohoff, T. et al. Integration of spatial and single-cell transcriptomic data elucidates mouse organogenesis. Nat. Biotechnol.40, 74–85 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Janesick, A. et al. High resolution mapping of the tumor microenvironment using integrated single-cell, spatial and in situ analysis. Nat. Commun.14, 10.1038/s41467-023-43458-x (2023). [DOI] [PMC free article] [PubMed]
- 25.Naiche, L. A. & Papaioannou, V. E. Loss of tbx4 blocks hindlimb development and affects vascularization and fusion of the allantois. Development130, 2681–2693 (2003). [DOI] [PubMed] [Google Scholar]
- 26.Naiche, L., Arora, R., Kania, A., Lewandoski, M. & Papaioannou, V. E. Identity and fate of tbx4-expressing cells reveal developmental cell fate decisions in the allantois, limb, and external genitalia. Dev. Dyn.240, 2290–2300 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27.Tremblay, M., Sanchez-Ferras, O. & Bouchard, M. Gata transcription factors in development and disease. Development145, 10.1242/dev.164384 (2018). [DOI] [PubMed]
- 28.Rivera-Feliciano, J. et al. Development of heart valves requiresgata4expression in endothelial-derived cells. Development133, 3607–3618 (2006). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29.Yayon, N. et al. A spatial human thymus cell atlas mapped to a continuous tissue axis. Nature635, 708–718 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Street, K. et al. Slingshot: cell lineage and pseudotime inference for single-cell transcriptomics. BMC Genom.19, 10.1186/s12864-018-4772-0 (2018). [DOI] [PMC free article] [PubMed]
- 31.Velten, B. & Stegle, O. Principles and challenges of modeling temporal and spatial omics data. Nat. Methods20, 1462–1474 (2023). [DOI] [PubMed] [Google Scholar]
- 32.Chen, Y., Jiao, Y., Qiu, R. & Yu, Z. Deep nonlinear sufficient dimension reduction. Ann. Stat.52, 1201–1226 (2024). [Google Scholar]
- 33.Hsing, T. & Carroll, R. J. An asymptotic theory for sliced inverse regression. Ann. Stat.20, 10.1214/aos/1176348669 (1992). [DOI]
- 34.Lin, Q., Zhao, Z. & Liu, J. S. On consistency and sparsity for sliced inverse regression in high dimensions. Ann. Stat.46, 580–610 (2018).
- 35.Lin, Q., Li, X., Huang, D. & Liu, J. S. On the optimality of sliced inverse regression in high dimensions. Ann. Stat.49, 1–20 (2021). [Google Scholar]
- 36.Li, L. & Lu, W. Sufficient dimension reduction with missing predictors. J. Am. Stat. Assoc.103, 822–831 (2008). [Google Scholar]
- 37.Xiao, Z. & Zhang, Q. Dimension reduction for block-missing data based on sparse sliced inverse regression. Comput. Stat. Data Anal.167, 107348 (2022). [Google Scholar]
- 38.Li, K. C., Aragon, Y., Shedden, K. & Thomas Agnan, C. Dimension reduction for multivariate response data. J. Am. Stat. Assoc.98, 99–109 (2003). [Google Scholar]
- 39.Coudret, R., Girard, S. & Saracco, J. A new sliced inverse regression method for multivariate response. Comput. Stat. Data Anal.77, 285–299 (2014). [Google Scholar]
- 40.Székely, G. J., Rizzo, M. L. & Bakirov, N. K. Measuring and testing dependence by correlation of distances. Ann. Stat.35, 2769–2794 (2007). [Google Scholar]
- 41.Sheng, W. & Yin, X. Sufficient dimension reduction via distance covariance. J. Comput. Graph. Stat.25, 91–104 (2016). [Google Scholar]
- 42.Nghiem, L. H., Hui, F. K., Müller, S. & Welsh, A. Sparse sliced inverse regression via cholesky matrix penalization. Stat. Sin.32, 2431–2453 (2022). [Google Scholar]
- 43.Zeng, J., Mai, Q. & Zhang, X. Subspace estimation with automatic dimension and variable selection in sufficient dimension reduction. J. Am. Stat. Assoc.119, 343–355 (2024). [Google Scholar]
- 44.Tan, K. M., Wang, Z., Zhang, T., Liu, H. & Cook, R. D. A convex formulation for high-dimensional sparse sliced inverse regression. Biometrika105, 769–782 (2018). [Google Scholar]
- 45.Nghiem, L. H. & Hui, F. K. C. Random effects model-based sufficient dimension reduction for independent clustered data. J. Am. Stat. Assoc.120, 2449–2460 10.1080/01621459.2025.2457919 (2025). [DOI]
- 46.Kobak, D. & Berens, P. The art of using t-SNE for single-cell transcriptomics. Nat. Commun.10, 5416 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47.Liland, K., Mevik, B. & Wehrens, R. pls: Partial Least Squares and Principal Component Regression. R package version 2.8-5 https://CRAN.R-project.org/package=pls (2024).
- 48.Woollard, M., Nghiem, L. & Ghazanfar, S. wSIR: Weighted Sliced Inverse Regression (wSIR) for supervised dimension reduction of spatial transcriptomics and single cell gene expression data. R package version 0.99.9. 10.18129/B9.bioc.wSIR (2026). [DOI]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
This study used publicly available data. The mouse embryo seqFISH data was accesssed via Bioconductor (version 3.19) ExperimentHub package MouseGastrulationData (version 1.18.0). The breast cancer 10x Genomics Xenium data was accessed via the 10x Genomics website (https://www.10xgenomics.com/products/xenium-in-situ/preview-dataset-human-breast) on 2 February 2024 and processed using MoleculeExperiment (version 1.5.1). The matching Visium data was accessed by the same website on 1 December 2024 and processed using DropletUtils (version 1.24.0). The human thymus and DLPFC data were downloaded from the CellXgene website (https://cellxgene.cziscience.com/datasets) on 1 October 2025. Source data for figures are provided with this paper. Source data are provided with this paper.
All analyses were performed in R (version 4.4.2). The wSIR software is available as an R package48 and has been submitted to the Bioconductor Project. Scripts for analyses and generating figure panels in this paper are available at https://github.com/SydneyBioX/wSIR_2024.
