Abstract
Spatially resolved transcriptomics (SRT) technologies measure messenger RNA (mRNA) expression at thousands of locations in a tissue slice. However, nearly all SRT technologies measure expression in two-dimensional (2D) slices extracted from a 3D tissue, thus losing information that is shared across multiple slices from the same tissue. Integrating SRT data across multiple slices can help recover this information and improve downstream expression analyses, but multislice alignment and integration remains a challenging task. Existing methods for integrating SRT data either do not use spatial information or assume that the morphology of the tissue is largely preserved across slices, an assumption that is often violated because of biological or technical reasons. We introduce PASTE2, a method for partial alignment and 3D reconstruction of multislice SRT data sets, allowing only partial overlap between aligned slices and/or slice-specific cell types. PASTE2 formulates a novel partial fused Gromov-Wasserstein optimal transport problem, which we solve using a conditional gradient algorithm. PASTE2 includes a model selection procedure to estimate the fraction of overlap between slices, and optionally uses information from histological images that accompany some SRT experiments. We show on both simulated and real data that PASTE2 obtains more accurate alignments than existing methods. We further use PASTE2 to reconstruct a 3D map of gene expression in a Drosophila embryo from a 16 slice Stereo-seq data set. PASTE2 produces accurate alignments of multislice data sets from multiple SRT technologies, enabling detailed studies of spatial gene expression across a wide range of biological applications.
Spatially resolved transcriptomics (SRT) technologies measure messenger RNA (mRNA) expression simultaneously at thousands of locations within a tissue. These technologies include both sequencing-based approaches, such as 10x Genomics Visium (https://www.10xgenomics.com/products/spatial-gene-expression) and Slide-seq (Rodriques et al. 2019; Stickels et al. 2021), as well as hybridization and fluorescent approaches such as MERFISH (Chen et al. 2015) and seqFISH (Lubeck et al. 2014). Nearly all of these technologies measure expression at two-dimensional (2D) locations within a thin tissue slice ( ≈ 10 μm), and we will use the term spatial transcriptomics (ST) as a generic term to refer to any of these technologies. ST provides spatial context that is missing from single-cell RNA sequencing (scRNA-seq) measurement of mRNAs from disassociated cells, and has been widely used to study both normal (Baccin et al. 2020; van den Brink et al. 2020) and diseased tissues, such as cancer (Ståhl et al. 2016; Thrane et al. 2018; Ji et al. 2020) and Alzheimer's disease (Chen et al. 2020). However, similar to scRNA-seq, ST data suffers from high rates of sparsity. Moreover, recording only the x, y coordinates on a 2D tissue slice loses information along the z (orthogonal) direction of the 3D tissue, hindering a comprehensive analysis of the whole tissue (Fig. 1).
Spatial transcriptomics is often applied to multiple sequential 2D slices from the same tissue (Fig. 1), thus opening the possibility of performing integrative analysis of all slices. Such joint analysis of multiple slices not only helps with the data sparsity problem in individual slices, but also enables innovative downstream tasks such as 3D spatial expression analysis, 3D cell-cell communication, and 3D clustering (Lin and Yang 2022; Zeira et al. 2022). However, aligning multiple slices from the same tissue along the orthogonal direction to recover spot-spot correspondence across slices is a challenging task because of morphological differences across slices as well as technical variability in mRNA capture between experiments.
Several approaches have been used for alignment of multiple ST slices. One approach is to apply methods developed for scRNA-seq and multi-omics data integration, such as Seurat (Stuart et al. 2019), SCOT (Demetci et al. 2022; Demetçi et al. 2022), or Pamona (Cao et al. 2022). Another approach is to use methods that align an scRNA-seq data set onto an ST data set, such as Tangram (Biancalani et al. 2021) or RCTD (Cable et al. 2022). However, these methods are designed for different alignment tasks and ignore the spatial information within or across slices. Another method, STUtility (Bergenstråhle et al. 2020) is designed to align a pair of ST slices, but aligns only the histology images, ignoring both gene expression and spatial information. Moreover, this method can only be applied to 10x Genomics Visium data. Another recent method, GPSA (Jones et al. 2022) integrates multiple ST slices into a common coordinate system, but does not output a mapping between spots that can be used for downstream analysis, and the common coordinate system it produces is different from the 3D coordinates of the tissue.
Another possible solution is to use histological and medical image registration (Maes et al. 2003) toolkits such as ITK (McCormick et al. 2014) and SimpleITK (Beare et al. 2018). However, many image registration methods are supervised and often require manually selected landmarks, creating an extra burden on the user. The spatial alignment problem has also been studied in the context of functional magnetic resonance imaging (fMRI) data registration (Lancaster et al. 2000; Brett et al. 2001; Klein et al. 2009), but these methods are not easily extensible to the spatial genomics setting (Jones et al. 2022). Finally, many ST technologies do not have matching histological images.
Recently, PASTE, a method that performs probabilistic alignment of ST slices using both spatial and transcriptional similarities, was introduced (Zeira et al. 2022). However, PASTE assumes that the slices overlap over the full 2D assayed region, with a similar field of view and similar number and proportion of cell types. Essentially, PASTE assumes the two slices are biological/technical replicates of a 2D tissue, an assumption that is often violated in real ST experiments because of technical difficulties in tissue dissection and array placement, or differences in tissue morphology between nearby slices. For example, two slices may only partially overlap along the z axis because of different placements of the array on the tissue, and hence only a part of both slices should be aligned (Fig. 1). Furthermore, two slices may have different compositions of cell types, leading to slice-specific cell types and spots that should not be aligned.
Here, we introduce PASTE2, a method to align multiple adjacent ST slices from the same tissue with several substantial improvements over existing methods. First, PASTE2 performs partial pairwise alignment, selecting and aligning only a subset of spots. PASTE2 thus addresses the important case in which adjacent slices do not fully overlap in space or have different cell type compositions. To solve the partial alignment problem, we introduce the partial fused Gromov-Wasserstein (partial-FGW) optimal transport framework. We derive a conditional gradient (Frank-Wolfe) algorithm (Frank and Wolfe 1956) to optimize the partial-FGW objective. Partial-FGW is the partial extension (Chapel et al. 2020) of the fused Gromov-Wasserstein optimal transport (Titouan et al. 2019) and allows only a fraction of the total mass to be transported between the two distributions. To the best of our knowledge, PASTE2 is the first to formulate the partial-FGW problem and provide an optimization procedure for it. Second, PASTE2 includes a model selection procedure to estimate the fraction of overlap between two slices to align, which is in general a very difficult problem. Third, PASTE2 optionally uses the histological images. Some ST technologies, such as the 10x Genomics Visium platform, produce a Hematoxylin and Eosin (H&E) stained image of the same tissue slice in which gene expression is measured. The information in this image can aid in alignment of slices by identifying spots with similar histology. Finally, we provide a generalized Procrustes analysis (Wahba 1965) method for 3D spatial reconstruction of the tissue from partially aligned 2D slices. We show PASTE2's advantages on both simulated and real ST data sets.
Methods
An ST experiment on a 2D tissue slice yields a pair (X, Z), where X ∈ n×p is the gene expression matrix of the tissue slice, and Z ∈ 2×n is the spatial location matrix of each spot on the slice, where the jth column z·j is the x-y coordinate of spot j on the 2D array3 used by the ST experiment. Here, n is the number of spots on the slice and p is the number of genes measured. xij ∈ is the transcript count of gene j in spot i. Each row vector xi· of X is the expression profile of spot i. Following Zeira et al. (2022), we encode the spatial location of each spot in a pairwise distance matrix , where dij is the Euclidean distance between spot i and spot j on the slice, calculated from the 2D coordinates z·i and z·j. Thus, we represent an ST slice of n spots and p genes by a tuple (X, D).
Partial pairwise slice alignment problem
Given a pair (X, D) and (X′, D′) of ST slices, our goal is to compute a partial pairwise slice alignment, that is, to find a probabilistic spot-spot correspondence between spots in the two slices while accounting for the fact that some spots should not be mapped (Fig. 1). The probabilistic mapping is a matrix between the n spots in one slice and n′ spots in the other slice, where πij describes the probability (or relative fraction) that a spot i in the first slice is aligned to a spot j in the second slice.
We begin by describing the solution given in Zeira et al. (2022) to the pairwise slice alignment problem, implemented in the PASTE algorithm. PASTE uses a formulation based on optimal transport to compute the mapping π. Specifically, given probability distributions g and g′ over the spots in slice X and X′, respectively, PASTE finds the map π (also known as the transport matrix) that minimizes the following transport cost:
(1) |
subject to the regularity constraint that π has to be a probabilistic coupling between g and g′:
(2) |
Here, c:p × p → + is an expression cost function that gives a nonnegative dissimilarity score between the expression profiles of two spots over the same genes. 1n is an all-one vector of length n. Typically, g and g′ are chosen to be uniform distributions over spots in each slice, although other distributions can be used (Zeira et al. 2022).
The PASTE objective function F is composed of an expression similarity term (first summand) and a spatial similarity term (second summand) weighted by a parameter α. The first term, also called the Wasserstein distance in the OT literature (Peyré and Cuturi 2019), represents the cost of moving one unit of probability mass from each spot i to each spot j, with the cost being the gene expression dissimilarity between spots. The second term, also called the Gromov-Wasserstein distance (Mémoli 2011; Peyré et al. 2016), approximately preserves the intraslice spatial distances between spots. Together, the convex combination of the two terms in F is known as the FGW optimal transport objective (Titouan et al. 2019).
The regularity condition (2) forces a rigid structure on π such that all spots from both slices must be aligned. However, such constraints may not be appropriate for ST slices with considerable differences in field of view or cell type composition because of both biological variation across tissue sections as well as differences caused by the manual nature of tissue dissection. Therefore, spots containing cell types or tissue regions that are unique to only one slice will be forced to be mapped to somehow arbitrary spots on the other slice.
Thus, in PASTE2, we propose to solve the partial pairwise slice alignment problem by minimizing the same objective function as PASTE (Equation 1), but with a different set of constraints that allow for unmapped spots. Specifically, given a parameter s ∈ [0, 1] describing the fraction of mass to transport between g and g′, we define a set of s-partial couplings between distributions g and g′ as
(3) |
The parameter s ∈ [0, 1] is interpreted as the overlap percentage between the two slices to align. The constraint ensures that only the fraction of s probability mass is transported. Equivalently, if is a point mass for each spot, then roughly the s fraction of the spots in each slice are aligned. The feasibility constraints π ≥ 0, for all spots i in the first slice, and for all spots j in the second slice make sure that each spot only transports probability mass that it already has according to g and g′, hence ensures π to be a valid transport plan. In PASTE2 we require that the map π belongs to , thus replacing the set (defined in Equation 2) by the set (defined in Equation 3). In analogy to sequence alignment, PASTE calculates a global alignment, whereas PASTE2 calculates a local alignment.
The general concept of partial optimal transport (Caffarelli and McCann 2010) extends optimal transport theory to allow the transportation of only a specified fraction of mass between distributions. Here, we adapt the idea of partial optimal transport to the fused Gromov-Wasserstein objective, hence the PASTE2 optimization problem is a novel partial fused Gromov-Wasserstein (partial-FGW) optimal transport problem. Although there are existing solutions to the partial Wasserstein and partial Gromov-Wasserstein problem, to the best of our knowledge, PASTE2 is the first to state and formulate the partial-fused Gromov-Wasserstein problem and provide an optimization procedure to solve this problem.
PASTE2 has two parameters: α, the balance between the gene expression dissimilarity and the spatial dissimilarity, and the overlap percentage parameter s indicating the fraction of mass to transport. Unless otherwise specified, we set α = 0.1 following Zeira et al. (2022). We choose the value of s using a model selection procedure described in Supplemental Material S1. The choice of c, the expression dissimilarity function, is described in Supplemental Material S2.
An iterative conditional gradient algorithm for optimization
We derive an optimization algorithm to minimize the objective (1) subject to the constraint (3). This problem is a large-scale (each slice contains thousands of spots) nonconvex quadratic program with a convex and compact feasible region. Our algorithm is based on the Frank-Wolfe optimization algorithm (Frank and Wolfe 1956), also known as the conditional gradient (Levitin and Polyak 1966) algorithm. This algorithm has been widely adopted in the optimal transport community (Ferradans et al. 2014; Flamary et al. 2014; Titouan et al. 2019; Chapel et al. 2020) to compute transport plans because of its ability to handle large-scale quadratic programs (Jaggi 2013). The optimization problem in PASTE2 is thus particularly suitable for the conditional gradient algorithm.
The conditional gradient algorithm is an iterative first-order algorithm for constrained optimization. To fit in the conditional gradient scheme, we first write Equation 1 in matrix form, following Peyré et al. (2016):
(4) |
where encodes the gene expression dissimilarity between each spot i in the first slice and each spot j in the second slice, and is a 4D tensor defined by . ⊗ is the tensor-matrix multiplication operator; that is, L ⊗ π is an n × n′ matrix whose (i, j)th element is . <,> denotes the Frobenius dot product of matrices.
In each iteration, the algorithm moves in the direction that minimizes a linear approximation of the objective function while remaining in the feasible region. The mathematical details of the derivation of each step, as well as the pseudocode, are provided in Supplemental Material S3.
Using histological image data in alignment
We further extend the PASTE2 partial-FGW framework to incorporate image information. Specifically, we replace the gene expression dissimilarity matrix in Equation 4 by a sum of two n × n′ dissimilarity matrices , where Cgene is the gene expression dissimilarity matrix as defined above and Cimage encodes the dissimilarity between the image information at each spot. Thus, we seek a map π that minimizes the following objective function:
(5) |
Note that to avoid an extra parameter we give equal weight to both gene expression and image information, although substituting other weights is straightforward. Also, because Cgene and Cimage may not be on the same scale, we scale Cimage such that the maximum entry of Cimage equals the maximum entry of Cgene. In our implementation, we define [Cimage]ij to be the Euclidean distance between the mean RGB values of the spots. See Supplemental Material S4 for further details.
3D Reconstruction based on the partial alignment matrix
Given a series of consecutive, (partially) overlapping slices from the same tissue, we aim to reconstruct the spatial expression of the tissue in 3D by transforming PASTE2 partial pairwise alignments into a common coordinate system. Specifically, given a series of consecutive slices we first find partial alignments between adjacent slices by solving the partial pairwise slice alignment problem as above. To project all slices onto a common coordinate system, we extend the generalized weighted Procrustes analysis (Wahba 1965; Kabsch 1976) approach in Zeira et al. (2022) to sequentially project each pair of adjacent slices. Whereas Zeira et al. (2022) projects a pair of slices onto the same coordinate system by centering both slices followed by calculating a rotation matrix, we derive the centering step for each slice separately to address the case in which the alignment matrix π is partial and the aligned regions of the two slices have unique barycenters. The details of the projection are in Supplemental Material S5.
Results
Evaluation on simulated ST data
We first compared PASTE2 and PASTE on a simulated ST data set based on a human dorsolateral prefrontal cortex (DLPFC) tissue slice from Maynard et al. (2021). Specifically, we extracted two partially overlapping subslices from a single DLPFC slice (sample 151674) with varying overlap percentages 90%, 70%, 50%, 30% (Fig. 2A). To perturb the gene expression, we resample the gene expression profile of each spot in one of the subslices by sampling from a multinomial distribution with added pseudocount δ, which controls the noise level (Supplemental Material S6). We vary the pseudocount δ in the range4 from 0.1 to 2 with an increment of 0.1. In total, we generated 4 × 30 = 120 pairs of subslices with different overlap percentages and noise levels δ. For each pair of subslices, we ran PASTE2 with α = 0, 0.1, 1 and using the ground-truth value for the overlap fraction s (we evaluated model selection separately in Supplemental Material S9), as well as full PASTE with default parameters (α = 0.1). We evaluated the alignment using Label Transfer Adjusted Rand Index (LTARI). Given a labeling of cell type/spatial region of spots, LTARI measures how well the alignment preserves the label between the aligned spots. LTARI first defines a new spot labeling for the second slice by assigning to each aligned spot the label of the most likely corresponding spot in the first slice, then calculates the ARI between the induced spot labeling of the second slice and the ground-truth labeling (Supplemental Material S7). We used the manual cortical layer annotation from Maynard et al. (2021) as ground-truth spot labeling (Fig. 2A).
We found that PASTE2 with the default parameter setting of α = 0.1, which uses both gene expression information and spatial information, outperforms PASTE across most values of the added noise δ for every overlap percentage (Fig. 2B,C; Supplemental Fig. S1). Specifically, for all four overlap percentages, PASTE2 (α = 0.1) achieves the highest LTARI when δ < 2.0, and achieves almost perfect LTARI when δ is small. Note that PASTE obtains constant accuracy because it aligns overlapping regions well but nonoverlapping regions arbitrarily. The gap in accuracy between PASTE2 and PASTE is larger when the overlap is smaller. This indicates that PASTE, which finds an alignment between all pairs of spots, is not suitable for the partial alignment task. In contrast, PASTE2 has high accuracy in partial alignment across a wide range of overlap percentages and gene expression noise. In particular, PASTE2 achieves near perfect LTARI when the pseudocount δ is in the range ≈0.1−0.2 that matches the variability in read counts observed in real data (Zeira et al. 2022), although the performance of PASTE2 does degrade for substantially larger pseudocount values δ > 1.
To investigate the effect of the misspecification of the value of the overlap percentage parameter s on the result of PASTE2, we ran PASTE2 with s ranging from 0.1 to 1, with a step size of 0.1, on a simulated pair in which the ground-truth overlap percentage is 50% and the added pseudocount is 0.1. We found that PASTE2 aligns correctly when s is lower than the ground truth, whereas the performance degrades for larger values of s (Supplemental Fig. S2). This is expected because with an overestimation of the overlap percentage, the PASTE2 alignment becomes more similar to the PASTE alignment which includes all the spots. Thus, in selecting a value for s, it is preferable to use a model selection procedure that slightly underestimates s rather than overestimates s. We propose a heuristic for selecting s in Supplemental Material S1.
Because the ground-truth 1-1 spot alignment for these simulated pairs is known, we also evaluated PASTE2 alignments using another metric, precision, which is defined as the amount of mass transported between each pair of corresponding spots in the ground-truth alignment over the total mass transported. For a given alignment, the precision measures the percentage of aligned spot pairs that are ground-truth correspondence, and the result shows similar trends as LTARI, where PASTE2 achieves the highest performance in the reasonable range of δ (Supplemental Fig. S3).
Finally, we emphasize the importance of using both gene expression and spatial information in computing accurate partial alignments. PASTE2 (α = 1.0) has consistently low LTARI, indicating that using spatial coordinates alone cannot recover alignment across slices. The performance of PASTE2 (α = 0), which only uses gene expression information of each spot for alignment, drops more quickly than PASTE2 (α = 0.1) with increasing pseudocount δ indicating more noise in gene expression. Using both gene expression and spatial information, PASTE2 is able to accurately align two partially overlapping ST slices. We investigated the effect of different intermediate values of α on the alignment performance (Supplemental Fig. S4) and found that α between 0.1 and 0.5 results in good performance.
Human dorsolateral prefrontal cortex (DLPFC) slices
We next compared PASTE2 to PASTE (Zeira et al. 2022) and two other transcriptomics alignment methods—Pamona (Cao et al. 2022) and Tangram (Biancalani et al. 2021)—on the full human DLPFC data set containing 10x Genomics Visium ST data from three individuals (labeled sample 1, 2, 3) with four slices (labeled slice A, B, C, D) per individual (Maynard et al. 2021). For each individual, slice A and B are 10 µm apart, the same as slice C and D. Slice B and C are further apart at a distance of 300 µm, hence slice pairs AB and CD are more similar to each other than slice pair BC. Note that Pamona (Cao et al. 2022), a manifold alignment algorithm for multi-omics data sets, is also based on partial optimal transport; Tangram (Biancalani et al. 2021) is a deep learning–based method that aligns scRNA-seq data onto ST data. We create partial ST alignment problems by generating two partially overlapping DLPFC data sets as follows. For each individual, we extracted the left portions of slice A and C, and the right portions of slice B and D such that the extracted pairs AB, BC, and CD have ≈70% overlap in area (Fig. 3A). We also created another set of partially overlapping data using horizontal slices (Supplemental Fig. S5A). We ran each of the methods as described in Supplemental Material S8. We evaluate the accuracy of each method by computing the label transfer ARI (LTARI) as previously described.
We find that PASTE2 achieves the highest LTARI on all adjacent subslices of all individuals, for both vertical partial slices and horizontal partial slices, with the exception of one pair (Fig. 3B; Supplemental Fig. S5B). About 70%–75% of the spots from each subslice is aligned in each pair indicating the parameter s corresponds well with slice overlap. For most pairs, PASTE2 has more than twice the LTARI than all other methods, demonstrating PASTE2's ability to identify the overlap region of the two ST slices and align the overlap region reliably. On one pair, Pamona has slightly higher LTARI than PASTE2 (Supplemental Fig. S5B), but all methods have very low LTARI (<0.1), suggesting that this pair has low spatial coherence. PASTE is the second-highest performing method on most pairs, indicating that even though PASTE does not model partially overlapping slices, it is still more suitable for aligning spatial transcriptomics data than methods designed for different purposes. Although Pamona is designed to align data sets with both shared and data-set-specific cells (Cao et al. 2022)—the analog of the partial pairwise slice alignment problem for single cell data sets—Pamona does not model spatial constraints, perhaps explaining its lower performance. Tangram assumes the single-cell gene expression data set and the spatial data set come from the same anatomical region (Biancalani et al. 2021); hence, the partial slice alignment task violates the Tangram assumption, leading to a low alignment accuracy.
For a more intuitive demonstration of PASTE2's advantage and accuracy, we projected the vertical subslices of sample 3 pair AB onto the same coordinate system, computed as described in Methods based on the alignment matrix computed by PASTE2 (Fig. 3C), as well as the optimal projection of the same pair based on the alignment computed by PASTE (Supplemental Fig. S6A). Qualitatively, the projection of PASTE2 correctly stacks the overlap area of the two slices, with spots from the same cortical layer stacking on top of each other, although PASTE fails to find the corresponding layers in the two slices. Additionally, PASTE2 correctly identifies and aligns the overlap area of all four partial slices of an individual while leaving the rest unaligned, leading to a visually correct 3D reconstruction of the tissue from partial slices (Supplemental Fig. S6B).
We also ran STUtility (Bergenstråhle et al. 2020), a method to align H&E stained images that are generated as part of the 10x Genomics Visium ST workflow. STUtility outputs new coordinates of the aligned slices and does not produce a mapping between pairs of spots; thus, we visualized the alignment results by plotting each pair of partial subslices according to the new coordinates output by STUtility (Supplemental Fig. S7). The image masking function used by STUtility failed for the partial slices of sample 3, so we only visualized the results for samples 1 and 2. STUtility correctly identifies that each pair of input slices are partially overlapping, but it does not align the correct overlapping region, and the output alignment seems quite arbitrary. These results might be because STUtility aligns images by identifying and finding correspondences between edges of the two input tissues, but when two tissues are partially overlapping, the edges do not provide information about spot correspondences. On the other hand, PASTE2 correctly aligns the overlapping region (Fig. 3C). This shows that using transcriptomic similarity, spatial similarity, and image information yields better partial alignments than H&E images alone.
Finally, we compared PASTE2's running time with other methods on the vertical subslices of sample 3. PASTE2 finished in under 10 min for all subslice pairs on a Macbook Pro with 2.4GHz Intel Core i5 CPU, with most of the running time spent on the GLM-PCA subroutine (Supplemental Fig. S8). The conditional gradient optimizer in PASTE2 runs in less than half of the time of Pamona and Tangram, and only runs slightly slower than PASTE. We also used the DLPFC data sets to evaluate the accuracy of PASTE2's model selection procedure for estimating the overlap percentage s (Supplemental Material S9), and found that PASTE2 correctly estimates the overlap percentage in many scenarios (Supplemental Figs. S9, S10).
Incorporating histology information improves alignment
We compared PASTE2's alignment performance when using both gene expression and histological image (Equation 5) versus using only gene expression data (Equation 4). Note that spatial information is included in both analyses. We ran the two modes of PASTE2 on pairs of horizontal and vertical subslices from DLPFC sample 3. We found that using the histological image substantially improved the alignment performance for pair CD (Fig. 4A,B), increasing the LTARI from 0.34 to 0.46. Examining the alignment obtained on this pair using only gene expression information (Fig. 4C) to the alignment obtained with both gene expression and the histology image (Fig. 4D), we observe that the alignment obtained using the images is more spatially contiguous. In particular, there is a curve of unaligned spots (blue spots in Fig. 4C) in subslice D inside the yellow region. This curve corresponds to spots that are manually annotated as Layer 6 of the DLPFC (Maynard et al. 2021). Notably, the spots in this layer have lower total UMI counts than other layers: the mean total UMI counts for spots from Layer 6 is 2915 compared to total UMI counts ≈4500 in the other layers. This suggests that the gene expression signal is weaker in these spots. In contrast, the PASTE2 alignment obtained using both gene expression and image information (Fig. 4D) does not have the same curve of unaligned spots, demonstrating the advantages of using the histological image for spots with a weak gene expression signal.
In the horizontal slices, we see cases in which using the image information reduces the alignment performance. For example, the LTARI drops from 0.56 (expression) to 0.50 (expression and image) for horizontal subslices of pair AB (Supplemental Fig. S11A,B). The aligned part of subslice B in Supplemental Figure S11D shows that many spots are left unaligned in the actual overlap region, and there is a clear stripe of unaligned blue spots towards the left part of the subslice. Looking at the H&E image of subslice B in Supplemental Figure S11B, we see a clear dark stain on the left of the subslice that is missing from the image of subslice A, at exactly the same location of the unaligned stripe. This indicates that the stain on the H&E image is the cause for the worse alignment performance.
For the other pairs, the LTARI for PASTE2 alignments with and without images is approximately the same. This is not too surprising because the H&E images of DLPFC slices do not display strong heterogeneity across different layers (Fig. 4B; Supplemental Fig. S11B). Thus, gene expression appears to be the dominant signal in computing the alignment in this data set. To evaluate further, we ran PASTE2 with only image information on the six pairs of sample 3, and found that the LTARI is lower than using only expression or using both expression and image on all pairs (Supplemental Fig. S12), which shows that, on this data set, histological images alone cannot provide enough signal for finding an accurate alignment. However, the fact that utilizing image information corrects the alignment of low UMI spots shows the potential for histological images to guide PASTE2 alignment. The image information can help overcome the sparsity of gene expression, and when the histological images have greater variation across spots, using the images should further improve the alignment quality by complementing the gene expression signal.
Spatial transcriptomics of Drosophila embryo
We applied PASTE2 to analyze a Stereo-seq data set from a Drosophila embryo (Chen et al. 2022). Stereo-seq is a new SRT technology with 500-nm resolution, two orders of magnitude smaller than the 10x Visium platform, but with lower UMIs per spot. Wang et al. (2022) applied Stereo-seq to two late-stage Drosophila embryos 14–16 h and 16–18 h after egg laying (labeled E14–16 and E16–18) and three stages of larvae (labeled L1–L3). Each slice has ≈1000 spots with median UMI per spot of ≈2000, compared to ≈4000 spots and ≈5000 median UMI per spot in the 10x Visium DLPFC data set. They derived the cell type of each spot by unsupervised clustering of gene expression followed by annotation based on marker genes. The publication used PASTE to align all slices from the same stage and obtain a 3D map of spatial expression of each stage. However, slices from the same stage vary in size and cell type compositions and do not fully overlap in space. For example, inspection of annotated cell types shows that adjacent slices from the E14–16 sample do not fully overlap (Supplemental Fig. S13). Therefore, it is appropriate to use PASTE2 to realign the adjacent slices respecting the different composition of cell types across slices, and to obtain a more accurate 3D reconstruction of the Drosophila embryo.
We applied PASTE2 to compute a partial alignment for each pair of 16 adjacent slices from the E14–16 sample, estimating the overlap percentage using the PASTE2 model-selection heuristic (Supplemental Material S1). Slices 7 and 8 have clear differences in the composition of cell types annotated by Wang et al. (2022), with the carcass cells showing the largest difference in proportion (Fig. 5A). PASTE2 addresses this imbalance by aligning a similar proportion of carcass cells across slices, leaving the excess cells in slice 8 unaligned. The spots from the two slices included in the PASTE2 partial alignment show similar spatial organization (Fig. 5B) and cell type composition (Supplemental Fig. S14B). For example, the proportions of carcass cells in slices 7 and 8 differ by 10% before alignment (Supplemental Fig. S14A), but after alignment the difference is <3% (Supplemental Fig. S14B). The differences in proportions shrink for salivary gland cells as well, indicating PASTE2 correctly identifies and aligns the overlapping parts. PASTE2 optimal projection of the two slices to the same coordinate system puts slice 8 slightly higher in y coordinates than slice 7, consistent with the observation that slice 8 has unaligned carcass cells at the top (Fig. 5C). The LTARI obtained by PASTE2 for this pair is 0.49, compared to an LTARI of 0.39 for PASTE, again showing the advantages of partial alignment. Examination of pair of adjacent slices 14 and 15 shows a similar advantage of partial alignment. Slice 15 has a stripe of carcass cells that is absent in slice 14 (Supplemental Fig. S15A). PASTE2 leaves the stripe unaligned across slices (Supplemental Fig. S15B,C), increasing the LTARI from 0.29 for PASTE to 0.52 for PASTE2. Because PASTE computes an alignment for all spots, the extra carcass cells in slice 15 are mapped somewhere on slice 14, creating false correspondences between spots (Supplemental Fig. S16).
We compared the LTARI of the PASTE2 alignment with the LTARI scores of PASTE, Pamona, and Tangram on every pair of adjacent slices. PASTE2 achieves the highest LTARI for most pairs, with the largest gain in pairs in which the two slices have different compositions of cell types, such as slice 14 and 15 (Supplemental Fig. S17). Pairs in which PASTE2 does not obtain the highest LTARI, such as slice 2 and 3, have relative similar sizes and cell types, and PASTE2 still achieves comparable LTARI with the highest performing method. This indicates that PASTE2 not only aligns partially overlapping slices correctly, but also performs well on pairs of similar slices.
We used PASTE2 to generate a 3D reconstruction of all 16 slices of the E14–16 Drosophila embryo, in which adjacent slices have on average 70% of overlapping spots (Fig. 5D). The PASTE2 3D reconstruction will be useful for refining the analyses presented in Wang et al. (2022) who showed that the PASTE-generated 3D expression helped detect functional subregions and uncover the dynamics of cell state changes and tissue-specific gene regulation.
Discussion
We present PASTE2, a method to perform pairwise alignment and 3D reconstruction of multislice spatial transcriptomics data. PASTE2 addresses the important situation in which slices partially overlap in space or have different cell type compositions, which is the case for most real data sets. We formulate the ST partial pairwise alignment problem using a partial fused Gromov-Wasserstein optimal transport framework and derive an optimization algorithm to solve this problem. We further design a model selection procedure to determine the overlap between slices, and extend the framework to incorporate both gene expression and imaging information.
We show on simulated data that PASTE2 achieves accurate alignment and outperforms PASTE when slices do not fully overlap. We found that PASTE2 outperforms multiple other methods for alignment of spatial transcriptomics or single cell data including PASTE, Pamona, Tangram, and STUtility on ST data set from the human DLPFC (Maynard et al. 2021). We show that PASTE2's use of histology images can further improve alignments, although the results are variable depending on the quality of the images. We expect that PASTE2 will achieve much higher accuracy incorporating image information in data sets in which histological images display stronger signal across spots—in preliminary results on unpublished cancer data sets with high-quality H&E images we observed even larger gains. Finally, we show PASTE2's capabilities on larger data sets from another SRT technology by generating a 3D reconstruction of a Drosophila embryo from 16 slices of Stereo-seq data.
There are multiple directions for future work. First, is to extend the partial alignment framework to integrate multiple slices into a single consensus slice to address the data sparsity issue by pooling counts from corresponding spots (Zeira et al. 2022). Second, one could stitch together multiple partially overlapping slices into a larger 2D slice. This stitching would be helpful in cases in which adjacent tissue slices are close in the z-coordinate which is often the case with thin tissue slices ( ≈ 10 μm). In addition, one could incorporate additional spatial regularization terms to enforce more contiguous overlapping regions. Third, it would be interesting to apply PASTE2 to integrated spatial transcriptomics and imaging data from other platforms such as Slide-seq (Rodriques et al. 2019; Stickels et al. 2021), or combined Stereo-seq and imaging data which Wang et al. (2022) noted as a future technology development. Finally, it would be interesting to examine the effectiveness of other optimal transport frameworks such as unbalanced OT (Séjourné et al. 2021) that impose soft constraints rather than hard constraints on partial alignments.
We anticipate that PASTE2 will be a useful tool for integrating transcriptomic information across multislice ST data sets and for building 3D tissue atlas across both normal and diseased tissues, such as in the Human Tumor Atlas Network and related projects.
Software availability
PASTE2 has been implemented in an open-source, publicly available Python package that is available at GitHub (https://github.com/raphael-group/paste2). All the code to reproduce the analysis can be found in Supplemental Code.
Supplementary Material
Acknowledgments
This work is supported by Grants No. U24CA264027 and No. U24CA248453 from the U.S. National Cancer Institute (NCI) to B.J.R.
Author contributions: X.L., R.Z., and B.J.R. developed the method; X.L. implemented the software and performed the analysis; and all authors analyzed the results and wrote the manuscript.
Footnotes
[Supplemental material is available for this article.]
Article published online before print. Article, supplemental material, and publication date are at https://www.genome.org/cgi/doi/10.1101/gr.277670.123.
We refer here to array-based technologies, but the formulation is the same for other technologies.
With the typical sequence coverage and data sparsity in ST data, δ > 2.0 (adding >2 counts to each transcript) is a strong perturbation of the data that essentially destroys the signal present in the original data.
Competing interest statement
The authors declare no competing interests.
References
- Baccin C, Al-Sabah J, Velten L, Helbling PM, Grünschläger F, Hernández-Malmierca P, Nombela-Arrieta C, Steinmetz LM, Trumpp A, Haas S. 2020. Combined single-cell and spatial transcriptomics reveal the molecular, cellular and spatial bone marrow niche organization. Nat Cell Biol 22: 38–48. 10.1038/s41556-019-0439-6 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Beare R, Lowekamp B, Yaniv Z. 2018. Image segmentation, registration and characterization in R with SimpleITK. J Stat Softw 86: 8. 10.18637/jss.v086.i08 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Bergenstråhle J, Larsson L, Lundeberg J. 2020. Seamless integration of image and molecular analysis for spatial transcriptomics workflows. BMC Genomics 21: 482. 10.1186/s12864-020-06832-3 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Biancalani T, Scalia G, Buffoni L, Avasthi R, Lu Z, Sanger A, Tokcan N, Vanderburg CR, Segerstolpe Å, Zhang M, et al. 2021. Deep learning and alignment of spatially resolved single-cell transcriptomes with Tangram. Nat Methods 18: 1352–1362. 10.1038/s41592-021-01264-7 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Brett M, Christoff K, Cusack R, Lancaster J. 2001. Using the Talairach atlas with the MNI template. Neuroimage 13: S85. 10.1016/S1053-8119(01)91428-4 [DOI] [Google Scholar]
- Cable DM, Murray E, Zou LS, Goeva A, Macosko EZ, Chen F, Irizarry RA. 2022. Robust decomposition of cell type mixtures in spatial transcriptomics. Nat Biotechnol 40: 517–526. 10.1038/s41587-021-00830-w [DOI] [PMC free article] [PubMed] [Google Scholar]
- Caffarelli LA, McCann RJ. 2010. Free boundaries in optimal transport and Monge-Ampère obstacle problems. Ann Math 171: 673–730. 10.4007/annals.2010.171.673 [DOI] [Google Scholar]
- Cao K, Hong Y, Wan L. 2022. Manifold alignment for heterogeneous single-cell multi-omics data integration using Pamona. Bioinformatics 38: 211–219. 10.1093/bioinformatics/btab594 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Chapel L, Alaya MZ, Gasso G. 2020. Partial optimal tranport with applications on positive-unlabeled learning. Adv Neural Inf Process Syst 33: 2903–2913. [Google Scholar]
- Chen KH, Boettiger AN, Moffitt JR, Wang S, Zhuang X. 2015. Spatially resolved, highly multiplexed RNA profiling in single cells. Science 348: aaa6090. 10.1126/science.aaa6090 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Chen WT, Lu A, Craessaerts K, Pavie B, Frigerio CS, Corthout N, Qian X, Laláková J, Kühnemund M, Voytyuk I, et al. 2020. Spatial transcriptomics and in situ sequencing to study Alzheimer's disease. Cell 182: 976–991.e19. 10.1016/j.cell.2020.06.038 [DOI] [PubMed] [Google Scholar]
- Chen A, Liao S, Cheng M, Ma K, Wu L, Lai Y, Qiu X, Yang J, Xu J, Hao S, et al. 2022. Spatiotemporal transcriptomic atlas of mouse organogenesis using DNA nanoball-patterned arrays. Cell 185: 1777–1792.e21. 10.1016/j.cell.2022.04.003 [DOI] [PubMed] [Google Scholar]
- Demetci P, Santorella R, Sandstede B, Noble WS, Singh R. 2022. Single-cell multiomics integration by SCOT. J Comput Biol 29: 19–22. 10.1089/cmb.2021.0477 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Demetçi P, Santorella R, Sandstede B, Singh R. 2022. Unsupervised integration of single-cell multi-omics datasets with disproportionate cell-type representation. In International Conference on research in computational molecular biology, pp. 3–19. Springer. [Google Scholar]
- Ferradans S, Papadakis N, Peyré G, Aujol JF. 2014. Regularized discrete optimal transport. SIAM J Imaging Sci 7: 1853–1882. 10.1137/130929886 [DOI] [Google Scholar]
- Flamary R, Courty N, Rakotomamonjy A, Tuia D. 2014. Optimal transport with Laplacian regularization. In NIPS 2014, Workshop on Optimal Transport and Machine Learning. [Google Scholar]
- Frank M, Wolfe P. 1956. An algorithm for quadratic programming. Naval Res Logist Q 3: 95–110. 10.1002/nav.3800030109 [DOI] [Google Scholar]
- Jaggi M 2013. Revisiting Frank-Wolfe: projection-free sparse convex optimization. In International Conference on Machine Learning. PMLR, pp. 427–435. [Google Scholar]
- Ji AL, Rubin AJ, Thrane K, Jiang S, Reynolds DL, Meyers RM, Guo MG, George BM, Mollbrink A, Bergenstråhle J, et al. 2020. Multimodal analysis of composition and spatial architecture in human squamous cell carcinoma. Cell 182: 497–514.e22. 10.1016/j.cell.2020.05.039 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Jones A, Townes FW, Li D, Engelhardt BE. 2022. Alignment of spatial genomics and histology data using deep Gaussian processes. bioRxiv 10.1101/2022.01.10.475692 [DOI] [PMC free article] [PubMed]
- Kabsch W. 1976. A solution for the best rotation to relate two sets of vectors. Acta Crystallogr Sect A 32: 922–923. 10.1107/S0567739476001873 [DOI] [Google Scholar]
- Klein A, Andersson J, Ardekani BA, Ashburner J, Avants B, Chiang MC, Christensen GE, Collins DL, Gee J, Hellier P, et al. 2009. Evaluation of 14 nonlinear deformation algorithms applied to human brain MRI registration. Neuroimage 46: 786–802. 10.1016/j.neuroimage.2008.12.037 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Lancaster JL, Woldorff MG, Parsons LM, Liotti M, Freitas CS, Rainey L, Kochunov PV, Nickerson D, Mikiten SA, Fox PT. 2000. Automated Talairach atlas labels for functional brain mapping. Hum Brain Mapp 10: 120–131. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Levitin ES, Polyak BT. 1966. Constrained minimization methods. USSR Comput Math Math Phys 6: 1–50. 10.1016/0041-5553(66)90114-5 [DOI] [Google Scholar]
- Lin Y, Yang JY. 2022. 3D reconstruction of spatial expression. Nat Methods 19: 526–527. 10.1038/s41592-022-01476-5 [DOI] [PubMed] [Google Scholar]
- Lubeck E, Coskun AF, Zhiyentayev T, Ahmad M, Cai L. 2014. Single-cell in situ RNA profiling by sequential hybridization. Nat Methods 11: 360–361. 10.1038/nmeth.2892 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Maes F, Vandermeulen D, Suetens P. 2003. Medical image registration using mutual information. Proc IEEE 91: 1699–1722. 10.1109/JPROC.2003.817864 [DOI] [PubMed] [Google Scholar]
- Maynard KR, Collado-Torres L, Weber LM, Uytingco C, Barry BK, Williams SR, Catallini JL, Tran MN, Besich Z, Tippani M, et al. 2021. Transcriptome-scale spatial gene expression in the human dorsolateral prefrontal cortex. Nat Neurosci 24: 425–436. 10.1038/s41593-020-00787-0 [DOI] [PMC free article] [PubMed] [Google Scholar]
- McCormick M, Liu X, Jomier J, Marion C, Ibanez L. 2014. ITK: enabling reproducible research and open science. Front Neuroinform 8: 13. 10.3389/fninf.2014.00013 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Mémoli F. 2011. Gromov–Wasserstein distances and the metric approach to object matching. Found Comput Math 11: 417–487. 10.1007/s10208-011-9093-5 [DOI] [Google Scholar]
- Peyré G, Cuturi M. 2019. Computational optimal transport: with applications to data science. Found Trends Mach Learn 11: 355–607. 10.1561/2200000073 [DOI] [Google Scholar]
- Peyré G, Cuturi M, Solomon J. 2016. Gromov-Wasserstein averaging of kernel and distance matrices. In International conference on machine learning. PMLR, pp. 2664–2672. [Google Scholar]
- Rodriques SG, Stickels RR, Goeva A, Martin CA, Murray E, Vanderburg CR, Welch J, Chen LM, Chen F, Macosko EZ. 2019. Slide-seq: a scalable technology for measuring genome-wide expression at high spatial resolution. Science 363: 1463–1467. 10.1126/science.aaw1219 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Séjourné T, Vialard FX, Peyré G. 2021. The unbalanced Gromov Wasserstein distance: conic formulation and relaxation. Adv Neural Inf Process Syst 34: 8766–8779. [Google Scholar]
- Ståhl PL, Salmén F, Vickovic S, Lundmark A, Navarro JF, Magnusson J, Giacomello S, Asp M, Westholm JO, Huss M, et al. 2016. Visualization and analysis of gene expression in tissue sections by spatial transcriptomics. Science 353: 78–82. 10.1126/science.aaf2403 [DOI] [PubMed] [Google Scholar]
- Stickels RR, Murray E, Kumar P, Li J, Marshall JL, Di Bella DJ, Arlotta P, Macosko EZ, Chen F. 2021. Highly sensitive spatial transcriptomics at near-cellular resolution with Slide-seqV2. Nat Biotechnol 39: 313–319. 10.1038/s41587-020-0739-1 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Stuart T, Butler A, Hoffman P, Hafemeister C, Papalexi E, Mauck WM III, Hao Y, Stoeckius M, Smibert P, Satija R. 2019. Comprehensive integration of single-cell data. Cell 177: 1888–1902.e21. 10.1016/j.cell.2019.05.031 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Thrane K, Eriksson H, Maaskola J, Hansson J, Lundeberg J. 2018. Spatially resolved transcriptomics enables dissection of genetic heterogeneity in stage III cutaneous malignant melanoma. Cancer Res 78: 5970–5979. 10.1158/0008-5472.CAN-18-0747 [DOI] [PubMed] [Google Scholar]
- Titouan V, Courty N, Tavenard R, and Flamary R. 2019. Optimal transport for structured data with application on graphs. In International conference on machine learning. PMLR, pp. 6275–6284. [Google Scholar]
- van den Brink SC, Alemany A, van Batenburg V, Moris N, Blotenburg M, Vivié J, Baillie-Johnson P, Nichols J, Sonnen KF, Martinez Arias A, et al. 2020. Single-cell and spatial transcriptomics reveal somitogenesis in gastruloids. Nature 582: 405–409. 10.1038/s41586-020-2024-3 [DOI] [PubMed] [Google Scholar]
- Wahba G. 1965. A least squares estimate of satellite attitude. SIAM Rev 7: 409. 10.1137/1007077 [DOI] [Google Scholar]
- Wang M, Hu Q, Lv T, Wang Y, Lan Q, Xiang R, Tu Z, Wei Y, Han K, Shi C, et al. 2022. High-resolution 3D spatiotemporal transcriptomic maps of developing Drosophila embryos and larvae. Dev Cell 57: 1271–1283.e4. 10.1016/j.devcel.2022.04.006 [DOI] [PubMed] [Google Scholar]
- Zeira R, Land M, Strzalkowski A, Raphael BJ. 2022. Alignment and integration of spatial transcriptomics data. Nat Methods 19: 567–575. 10.1038/s41592-022-01459-6 [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.