A spatial transcriptome slice adaptive alignment method based on a generative model

CN123017195APending Publication Date: 2026-10-30XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611146310.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0007]本发明提供一种于生成式模型的空间转录组切片自适应对齐方法,用以解决现有技术中对于切片发生非刚性形变不能进行较好的拟合,传统方法不能自适应对齐不同的切片形变场景以及需用户自主选择对齐的模式的问题

Benefits of technology

第一,本发明在寻找cell/spots对时采用互KNN的方法,克服了现有技术用断点检测、匈牙利算法得到cell/spots对,对选取cell/spots对十分敏感的缺陷,使得本发明对cell/spots对的误匹配较为鲁棒。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123017195A_ABST
    Figure CN123017195A_ABST
Patent Text Reader

Abstract

The application provides a spatial transcriptome slice adaptive alignment method based on a generative model, comprising the following steps: obtaining spatial transcriptome original data of a slice A to be aligned and a target slice B; after the spatial transcriptome original data is preprocessed, candidate cell matching pairs between the slice A and the slice B are obtained through mutual KNN screening; coarse alignment of the slice A and the target slice B is completed based on the candidate cell matching; an initial generative probability model under different scenarios of adaptive alignment is constructed based on the generative model; the data of the coarsely aligned slice A and the target slice B are input into the initial generative probability model, the initial generative probability model is iteratively optimized by maximizing the posterior probability, and an optimized generative probability model is obtained; and final alignment of the slice A and the target slice B is completed based on the optimized generative probability model. The application can adaptively align rigid deformation, partial loss and non-rigid deformation scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of biological technology, and in particular to a method for adaptive alignment of spatial transcriptome slices based on a generative model. Background Technology

[0002] Spatial transcriptomics (ST), as an extension of single-cell RNA sequencing (scRNA-seq), not only provides spatial localization information of gene expression but also constructs cellular spatial maps of tissues. This facilitates in-depth research into intercellular interactions and heterogeneity, and reveals complex biological processes that are difficult to capture using traditional sequencing methods. ST technology combines imaging, biomarkers, sequencing, and bioinformatics to spatially locate gene expression in tissue sections, revealing the spatial distribution of cell types, interactions between cell populations, and mapping gene expression in different tissue regions. This is of significant value for a deeper understanding of disease progression and pathological processes such as tumors.

[0003] Currently, spatial transcriptomics primarily relies on two strategies to elucidate gene expression patterns in tissues: next-generation sequencing (NGS)-based methods and imaging-based methods. NGS strategies record the spatial location information of mRNA through spatial barcodes, enabling sequencing data to be precisely mapped to specific regions of the tissue. Representative technologies include Slide-seq and Visium. In contrast, imaging-based methods rely on in situ sequencing (ISS) or in situ hybridization (ISH) technologies, directly detecting gene expression in tissue sections using fluorescent probes or signal amplification, resolving spatial information at single-cell or even subcellular resolution. Typical technologies include MERFISH and seqFISH+. With continuous technological advancements, ST technology has been widely applied in various research fields such as tumor biology and neurobiology.

[0004] Cross-slice alignment is a key challenge in spatial transcriptomics data analysis. Although ST data provides spatial continuity between adjacent slices, relying solely on gene expression information for integration often fails to ensure accurate alignment. Therefore, comprehensive analysis combining gene expression and spatial information is crucial for improving the resolution of multi-slice data and revealing tissue heterogeneity and function. Accurate data alignment can effectively correct anatomical biases and ensure the consistency of the same biological structure across different slices. Especially in 3D reconstruction with a large amount of slice data, different types of alignment may be required between slices, and models designed only for specific alignment cases will yield poor results.

[0005] During the slide alignment process, three types of problems typically exist between slides: rigid changes, partial loss, and non-rigid changes. Rigid changes originate from inconsistent positions and angles of the slides placed on the slides during preparation, causing the entire slide to shift or rotate. Partial loss may be caused by physical tearing or wrinkling during tissue slide transfer, or by differences in cell type composition between slides (such as tumor microenvironment heterogeneity), resulting in the loss, tearing, folding, or failure to be effectively captured by the probe in local areas of the slide. Non-rigid changes mainly occur in the sample preparation stage. During fixation and dehydration, slides may shrink or deform unevenly. At the same time, during the slide preparation process, the blade may introduce pulling and squeezing when cutting soft tissue, causing elastic deformation such as local stretching, compression, and twisting within the slide.

[0006] However, existing slice alignment methods are difficult to achieve accurate fitting when dealing with non-rigid deformations and cannot adaptively handle alignment tasks under different deformation scenarios. Users usually need to manually select the alignment mode based on experience, which seriously restricts data processing efficiency and versatility. Summary of the Invention

[0007] This invention provides a spatial transcriptome slice adaptive alignment method for generative models, which solves the problems in the prior art that it cannot fit slices with non-rigid deformation, traditional methods cannot adaptively align different slice deformation scenarios, and require users to manually select the alignment mode.

[0008] A generative model-based method for adaptive alignment of spatial transcriptome slices includes the following steps: S1: Obtain the raw spatial transcriptome data of slice A to be aligned and target slice B; the raw data includes the spatial coordinates and gene expression vectors of each cell / space capture unit; S2: After preprocessing the raw spatial transcriptome data, candidate cell matching pairs between slice A and slice B are obtained by mutual KNN screening; S3: Based on the candidate cell matching, complete the coarse alignment of slice A and target slice B; S4: Construct an initial generative probability model based on a generative model and adaptively align it to different scenarios; S5: Input the coarsely aligned slice A and target slice B data into the initial generative probability model, and iteratively optimize the initial generative probability model by maximizing the posterior probability to obtain the optimized generative probability model; S6: Based on the optimized generative probability model, the final alignment of complete slice A and target slice B.

[0009] Based on the generative model-based spatial transcriptome slice adaptive alignment method described above, the initial generative probability model in step S4 is as follows:

[0010]

[0011]

[0012]

[0013] in, This represents the generation probability of the nth cell / spatial capture unit pair in target slice B. This represents the probability of overlapping points. This represents the distribution of non-overlapping points. This represents the probability that the nth cell / spatial capture unit in target slice B aligns with the mth cell / spatial capture unit in slice A at the gene expression information level. This represents the probability that the nth cell / spatial capture unit in target slice B is aligned with the mth cell / spatial capture unit in slice A at the spatial location information level. This represents the probability that the nth cell / spatial capture unit in target slice B aligns with the mth cell / spatial capture unit in slice A during the current iteration; This represents the spatial information of the nth cell / spatial capture unit in target slice B. This represents the gene information of the nth cell / spatial capture unit in target slice B. Indicates whether the nth cell / spatial capture unit in target slice B is an overlap point. This indicates whether the nth cell / spatial capture unit in target slice B participates in alignment. This indicates the spatial location information of all cells / spatial capture units in slice A. This indicates gene expression information for all cells / spatial capture units in slice A; yes The variance of the spatial location error is calculated using the normal distribution. This represents the probability of being an overlapping point; This represents the positional information of the m-th cell / spatial capture unit in slice A after undergoing both rigid and non-rigid transformations. This represents a rigid transformation of the m-th cell / spatial capture unit in slice A, where R represents the rotation matrix and t represents the displacement matrix. This indicates that a non-rigid change is performed on the m-th cell / space capture unit in slice A after a rigid change. The mean is covariance is Gaussian process.

[0014] According to the generative model-based spatial transcriptome slice adaptive alignment method described above, step S5 includes: S51: Construct the posterior probability that the target slice B is aligned with slice A:

[0015] in, This represents the set of latent variables, specifically including: rotation matrix. R Displacement matrix t Gaussian process parameters, overlapping indicator variables Auxiliary variables Overlap probability ,variance ; Indicates slice A, This represents slice B; This represents the prior knowledge of the set of latent variables given that slice A is known. This represents the likelihood of slice B given slice A and the latent variables. S52: Take the logarithm of both sides of the above posterior probability and simultaneously introduce a variational distribution. To approximate the true posterior distribution, we obtain the following equation:

[0016] S53: On the right side of the above equation Integrating, we get the following formula:

[0017] in, LEBO is the lower bound of evidence. The formula for calculating the kl divergence is used to measure the variational distribution. Similarity to the true posterior distribution; S54: Using the above formula, the original posterior maximization problem is equivalently transformed into a maximization ELBO objective optimization problem:

[0018] S55: Iteratively update the variational distribution based on mean-field theory and the coordinate block descent method. The optimal latent variable is obtained when ELBO reaches its maximum. According to the optimal hidden variables The optimized generative probability model is obtained.

[0019] According to the generative model-based spatial transcriptome slice adaptive alignment method described above, S2 includes: Pearson correlation coefficients were calculated for each cell / spatial capture unit in target slice B and sequentially compared with cell / spatial capture units in slice A. The Pearson correlation coefficients were then sorted by power of 1, and the top K correlation coefficients with cell / spatial capture units in slice A were used to obtain N. A Individual cell / space capture unit pairs; Pearson correlation coefficients were calculated for each cell / space capture unit in slice A and each cell / space capture unit in target slice B. The Pearson correlation coefficients were then sorted by power of 1, and the top K correlation coefficients with the cell / space capture units in target slice B were used to obtain N. B Individual cell / space capture unit pairs; The N A Cell / space capture unit pairs and N B Each cell / space capture unit pair is merged to obtain a candidate cell matching pair.

[0020] According to the generative model-based spatial transcriptome slice adaptive alignment method described above, S3 includes: Based on the candidate cell matching pairs, a least squares model is constructed to solve for the globally optimal rotation and displacement matrices. Based on the rotation and displacement matrices, coarse alignment of slice A and target slice B is completed. The least squares model is as follows:

[0021] Where R represents the rotation matrix, t represents the translation matrix, and n represents the number of candidate cell matching pairs. This indicates the cells in the candidate cell matching pair that belong to slice A. This indicates the cells in the candidate cell matching pair that belong to target slice B. This represents the weight of the candidate cell matching pair.

[0022] According to the generative model-based spatial transcriptome slice adaptive alignment method described above, S3 further includes: Based on the candidate cell matching pairs, a least squares model is constructed to obtain the globally optimal rotation and displacement matrices; Based on the rotation matrix and the displacement matrix, slice A and target slice B are initially coarsely aligned; Calculate the alignment error between the two slices after the initial coarse alignment. If the alignment error is within the preset error range, the final coarse alignment of slice A and target slice B is completed. If the alignment error is outside the preset error range, slice A is flipped first to complete the final coarse alignment of slice A and target slice B.

[0023] Compared with the prior art, the present invention has the following advantages: First, the present invention uses the mutual KNN method when searching for cell / spot pairs, which overcomes the shortcomings of the existing technology that uses breakpoint detection and Hungarian algorithm to obtain cell / spot pairs, and is very sensitive to the selection of cell / spot pairs. This makes the present invention more robust to mismatches of cell / spot pairs.

[0024] Second, the present invention uses a Gaussian process prior when fitting non-rigid changes, which overcomes the shortcomings of the existing technology that uses simple weighting, resulting in abrupt changes in aligned cells / spots and discontinuous deformation. This allows the present invention to fit non-rigid deformations more smoothly.

[0025] Third, this invention transforms the alignment process into a generation process and performs explicit modeling of the generation process, unifying the correspondence between cells / spots and the physical alignment of slices into a single framework. This overcomes the shortcomings of existing technologies in fully utilizing spatial information, enabling this invention to ultimately adaptively align rigid deformation, partial missing parts, and non-rigid deformation scenarios. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0027] Figure 1 Flowchart of the adaptive alignment method for spatial transcriptome slices based on a generative model provided by this invention; Figure 2 This is a visualization of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) in a rigid deformation scenario; Figure 3 This is a visualization of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) using Pearson correlation coefficient (PCC) as an evaluation index in partially missing scenarios. Figure 4 This is a visualization of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) using cell type consistency CI as an evaluation index in partially missing scenarios. Figure 5 This is a visualization of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) in a non-rigid change scenario. Figure 6This is a visualization of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) in a multi-slice alignment scenario using Pearson correlation coefficient (PCC) as an evaluation index. Figure 7 This is a visualization of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) in a multi-slice alignment scenario using cell type consistency (CI) as an evaluation index. Figure 8 This diagram illustrates the alignment results of 20 slices of Drosophila embryo data in a non-rigid change scenario using the present invention and existing methods (PASTE, SLAT, SANTO, Moscot, GPSA). Figure 9 This is a comparison chart of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot, GPSA) in non-rigid alignment scenarios, using Pearson correlation coefficient (PCC) and cell type consistency (CI) as evaluation indicators. Figure 10 This is a visualization of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) in a multi-slice alignment scenario; Figure 11 This is a comparison chart of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) in a multi-slice alignment scenario, where the slices have not undergone random rotation, using the Pearson correlation coefficient (PCC) as the evaluation index. Figure 12 This is a comparison chart of the alignment results of the present invention and existing methods (PASTE, SLAT, SANTO, Moscot) in a multi-slice alignment scenario, where the slices are randomly rotated from 0° to 45°, using cell type consistency (CI) as an evaluation index. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0029] This invention employs a coarse-to-fine alignment framework. In the coarse alignment process, it uses a mutual KNN method to find cell / spot pairs, overcoming the shortcomings of existing technologies that use breakpoint detection and Hungarian algorithms to obtain cell / spot pairs, which are highly sensitive to the selection of cell / spot pairs. This makes the invention more robust to mismatches of cell / spot pairs. When fitting non-rigid changes, this invention uses a Gaussian process prior, overcoming the shortcomings of existing technologies that use simple weighting, resulting in abrupt changes in aligned cells / spots and discontinuous deformation. This allows the invention to fit non-rigid deformations more smoothly. This invention transforms the alignment process into a generation process and explicitly models the generation process, unifying the correspondence between cells / spots and the physical alignment of slices into a single framework. This overcomes the shortcomings of existing technologies that do not fully utilize spatial information, enabling the invention to adaptively align rigid deformations, partially missing parts, and non-rigid deformation scenarios.

[0030] The method provided by this invention will be described in detail below: Figure 1 The flowchart of the spatial transcriptome slice adaptive alignment method based on a generative model provided by this invention is as follows: Figure 1 As shown, the method includes the following steps: S1: Obtain the raw spatial transcriptome data of slice A to be aligned and target slice B; the raw data includes the spatial coordinates and gene expression vectors of each cell / space capture unit.

[0031] Specifically, two spatial transcriptome slices that need to be aligned are acquired, denoted as slice A (slice to be aligned) and slice B (target slice). The raw data includes the spatial coordinates and gene expression vectors of each cell / spot. The spatial coordinates are used to characterize the physical location of the cell / spot in the tissue slice, and the gene expression vectors are used to characterize the expression level of each gene in the cell / spot.

[0032] S2: After preprocessing the original spatial transcriptome data, candidate cell matching pairs between slice A and slice B are obtained through mutual KNN screening.

[0033] Specifically, this application uses preprocessed spatial transcriptome data to obtain cell / spot pairs through mutual KNN. The steps for obtaining cell / spot pairs through mutual KNN are as follows: Based on the gene expression information between the slices, calculate the Pearson correlation coefficient between cells / spots in slice A and cells / spots in slice B; The Pearson correlation coefficient values ​​of each cell / spot are sorted in ascending order. Each cell / spot is paired with the top K cells / spots in its sorted sequence to form K cell / spot pairs, resulting in a total of K(NA+NB) cell / spot pairs as candidate cell matching pairs, where N A N represents the number of cells / spots in slice A. B Let be the number of cell / spot pairs in slice B. For example, to find cell / spot pairs for a given cell / spot in slice A, calculate the Pearson correlation coefficient between each cell / spot in slice B and that cell / spot in slice A, sort them, and take the first K pairs with that cell / spot in slice A to obtain K cell / spot pairs.

[0034] The specific alignment method is as follows: Pearson correlation coefficients were calculated for each cell / spatial capture unit in target slice B and sequentially compared with cell / spatial capture units in slice A. The Pearson correlation coefficients were then sorted by power of 1, and the top K correlation coefficients with cell / spatial capture units in slice A were used to obtain N. A Individual cell / space capture unit pairs; Pearson correlation coefficients were calculated for each cell / space capture unit in slice A and each cell / space capture unit in target slice B. The Pearson correlation coefficients were then sorted by power of 1, and the top K correlation coefficients with the cell / space capture units in target slice B were used to obtain N. B Individual cell / space capture unit pairs; The N A Cell / space capture unit pairs and N B Each cell / space capture unit pair is merged to obtain a candidate cell matching pair.

[0035] This application overcomes the shortcomings of existing technologies that use breakpoint detection and Hungarian algorithms to obtain cell / spot pairs by employing mutual KNN when searching for cell / spot pairs. These technologies are highly sensitive to the selection of cell / spot pairs. This makes the present invention more robust to mismatches of cell / spot pairs.

[0036] S3: Based on the candidate cell matching, complete the coarse alignment of slice A and target slice B.

[0037] Specifically, after obtaining relatively reliable candidate cell matching pairs, this application uses these matching pairs to estimate the global rigid transformation parameters between slice A and slice B, achieving coarse alignment of the slices. The rigid transformation includes rotation and translation, used to correct overall deviations caused by inconsistent placement positions and angles during slice preparation. Specifically, this application constructs a least-squares model based on candidate matching pairs, with the optimization objective being to minimize the spatial distance error of all matching pairs after transformation. By decentering the point set of matching pairs, singular value decomposition is used to solve the model, obtaining the globally optimal rotation and translation matrices. Coarse alignment avoids getting trapped in local optima during subsequent fine alignment and reduces the computational burden of fitting non-rigid deformations.

[0038] The present invention achieves coarse alignment between slice A and target slice B using the following method: First, a least squares model is constructed based on the candidate cell matching pairs to solve for the globally optimal rotation and displacement matrices. Then, based on the rotation and displacement matrices, the initial coarse alignment of slice A and target slice B is completed. The least squares model is as follows: (1) Where R represents the rotation matrix, t represents the translation matrix, and n represents the number of candidate cell matching pairs. This indicates the cells in the candidate cell matching pair that belong to slice A. This indicates the cells in the candidate cell matching pair that belong to target slice B. This represents the weight of the candidate cell matching pair.

[0039] This application constructs a least-squares objective model based on matching cell / spatial capture unit pairs. After decentralizing the point set, the model is solved by SVD singular value decomposition to obtain the globally optimal rotation and displacement matrices, thereby completing the initial coarse alignment of the slices.

[0040] Secondly, calculate the alignment error between the two slices after the initial coarse alignment. If the alignment error is within the preset error range, the final coarse alignment of slice A and target slice B is completed. If the alignment error is outside the preset error range, slice A is flipped first to complete the final coarse alignment of slice A and target slice B.

[0041] The alignment error is calculated based on the spatial distance error of the aligned cell / spot pairs. The purpose of flipping is to prevent the original slices from being flipped. If flipping occurs, rigid and non-rigid changes alone cannot achieve proper alignment. Therefore, this application calculates the alignment error to prevent the original slices from being flipped. If a flip is detected, it is simply multiplied by a flip matrix, thereby eliminating the mirror alignment error.

[0042] S4: Construct an initial generative probability model based on a generative model and adaptively align it to different scenarios.

[0043] Specifically, existing slice alignment methods suffer from limitations such as inability to adaptively handle different deformation scenarios and the need for users to manually select alignment modes. This application differs from existing technologies that design different algorithms for different deformation types and require users to pre-determine and select alignment modes. It reconstructs the slice alignment problem into a unified generative probabilistic model. Through explicit modeling of the alignment process, it unifies the modeling of rigid deformation, non-rigid deformation, and partial loss mechanisms within a single framework. Specifically, the core idea of ​​the generative probabilistic model constructed in this application is to consider slice B as the result of a transformation of slice A, and this generation process can be explicitly modeled. The mathematical expression of this model consists of three key modules: a rigid transformation model, a non-rigid transformation module, and a module for distinguishing overlapping and non-overlapping points.

[0044] The rigid transformation module describes the translation and rotation of the entire slice, and is implemented using the following formula: (2) Indicates to To undergo rigid changes, Let R represent the m-th cell / spot in slice A, R represent the rotation matrix, and t represent the translation matrix.

[0045] The non-rigid transformation module is used to describe the local elastic deformation within the slice. The local deformation modeled by the non-rigid transformation is implemented using the following formula: (3) Indicates to Perform non-rigid changes, The mean is covariance is Gaussian process.

[0046] The overlapping and non-overlapping point discrimination module handles scenarios with partial missing sections between slices. During slice alignment, not all cell / spatial capture units can find a biological counterpart in another slice; some regions may fail to match due to physical tearing, probe capture failure, or differences in cell type composition. Therefore, the model introduces discrete latent variables. and auxiliary variables This is used to indicate whether the nth cell / space capture unit in slice B belongs to an overlapping region or a non-overlapping region. Specifically, in this embodiment, the generation probability of the nth cell / space capture unit in slice B is: (4) (5) in, This represents the generation probability of the nth cell / spatial capture unit pair in target slice B. This represents the probability of overlapping points. This represents the distribution of non-overlapping points. This represents the probability that the nth cell / spatial capture unit in target slice B aligns with the mth cell / spatial capture unit in slice A at the gene expression information level. This represents the probability that the nth cell / spatial capture unit in target slice B is aligned with the mth cell / spatial capture unit in slice A at the spatial location information level. This represents the probability that the nth cell / spatial capture unit in target slice B aligns with the mth cell / spatial capture unit in slice A during the current iteration; This represents the spatial information of the nth cell / spatial capture unit in target slice B. This represents the gene information of the nth cell / spatial capture unit in target slice B. Indicates whether the nth cell / spatial capture unit in target slice B is an overlap point. This indicates whether the nth cell / spatial capture unit in target slice B participates in alignment. This indicates the spatial location information of all cells / spatial capture units in slice A. This indicates gene expression information for all cells / spatial capture units in slice A; yes The variance of the spatial location error is calculated using the normal distribution. This represents the probability of being an overlapping point; This represents the positional information of the m-th cell / spatial capture unit in slice A after undergoing both rigid and non-rigid transformations. This represents a rigid transformation of the m-th cell / spatial capture unit in slice A, where R represents the rotation matrix and t represents the displacement matrix. This indicates that a non-rigid change is performed on the m-th cell / space capture unit in slice A after a rigid change. The mean is covariance is Gaussian process.

[0047] In the initial generative probabilistic model provided in this application, the data itself will automatically determine the contribution weight of each module during the optimization process: if there are only rigid changes and non-rigid deformations between slices... The variance will automatically shrink to near zero during optimization, and the model degenerates into a purely rigid alignment; if there is significant non-rigid deformation between slices, the Gaussian process will automatically adjust the covariance parameter to fit the local distortion; if there are a large number of non-overlapping regions between slices, the overlap probability will increase. and discrete variables The model automatically adjusts to ignore noisy areas. Thus, it achieves adaptive alignment for different deformation scenarios without requiring users to pre-determine the deformation type or manually select the alignment mode.

[0048] S5: Input the coarsely aligned slice A and target slice B data into the initial generative probability model, and iteratively optimize the initial generative probability model by maximizing the posterior probability to obtain the optimized generative probability model.

[0049] Specifically, because the model contains a large number of latent variables (such as rotation matrices) R Displacement matrix t Gaussian process parameters, overlapping indicator variables Auxiliary variables Overlap probability ,variance Since directly calculating the posterior distribution is computationally infeasible, this invention employs a variational inference method for approximate solution.

[0050] This step specifically includes the following steps: S51: Construct the posterior probability that the target slice B is aligned with slice A: (6) in, This represents the set of all latent variables, specifically including: rotation matrix. R Displacement matrix t Gaussian process parameters, overlapping indicator variables Auxiliary variables Overlap probability ,variance ; Indicates slice A, This represents slice B; This represents the prior knowledge of the set of latent variables given that slice A is known. This represents the likelihood of slice B given slice A and the latent variables.

[0051] S52: Take the logarithm of both sides of equation (6) and simultaneously introduce the variational distribution. To approximate the true posterior distribution, we obtain formula (7): (7) Specifically, due to The calculation requires the handling of latent variables. Integrating, but with hidden variables Complex integrals cannot be computed, so variational methods are introduced. To approximate the required posterior distribution.

[0052] S53: For the right side of formula (7) Integrating, we obtain formula (8): (8) It can be seen that the first term on the right side of formula (8) The second item is the lower bound of evidence, LEBO. It is a formula for calculating the k-L divergence, used to measure variational distributions. Similarity to the true posterior distribution. Since the expression on the left side of formula (8) is fixed, the smaller the second term, the better. and The closer the two distributions are, the larger the first term becomes. Therefore, the problem is transformed into an ELBO objective optimization problem.

[0053] S54: Using formula (8), the original posterior maximization problem is equivalently transformed into the ELBO objective optimization problem: (9) S55: Iteratively update the variational distribution based on mean-field theory and the coordinate block descent method. The optimal latent variable is obtained when ELBO reaches its maximum. According to the optimal hidden variables The optimized generative probability model is obtained.

[0054] Specifically, during the ELBO maximization process, the model simultaneously optimizes the rigid transformation parameters (for more accurate global alignment), the Gaussian process parameters (to smooth non-rigid deformation and fit local distortions), and the overlap probability parameters (to correctly identify non-overlapping regions as noise and ignore them). This invention, through this generative probabilistic model, enables all parameters to be jointly optimized under the same objective function, with the data itself driving the automatic balancing between the mechanisms. When only rigid transformation is needed, the contribution of the Gaussian process automatically decreases; when non-rigid deformation is required, the Gaussian process parameters are automatically adjusted to fit the data; when missing regions exist, the overlap probability is automatically reduced to avoid forced matching. This achieves the adaptive alignment of different slice deformation scenarios and eliminates the need for user-selected alignment modes.

[0055] Finally, based on mean-field theory, the joint variational distribution is decomposed into the product of the independent variational distributions corresponding to each latent variable. The coordinate block descent method is used to iteratively update each variational distribution until ELBO converges to the maximum value. At this point, the optimal variational distribution of each latent variable is obtained.

[0056] S6: Based on the optimized generative probability model, the final alignment of complete slice A and target slice B.

[0057] Specifically, after obtaining the optimal latent variable distribution, especially the optimal transformation parameter rotation matrix... R Displacement matrix t This allows the optimal transformation to be applied to all cells / space capture units in slice A, resulting in their final alignment position in the space of slice B. This ensures that each cell / space capture unit in slice A is mapped to the spatial coordinate system of slice B, ultimately achieving precise alignment of cells / space capture units between the two slices.

[0058] Simulation experiment: The software platform for the simulation experiment of this invention is: WINDOWS 10 operating system, Python 3.9 and PyCharm integrated development software.

[0059] The simulation experiment 1 of this invention uses data from two pairs of original aligned slices of the brains of mice aged 8 and 13 months, respectively, and the data is derived from STARMAP PLUS technology.

[0060] The simulation experiment 2 data of this invention comes from 12 slices of the human dorsolateral prefrontal cortex (DLPFC), which are derived from the 10x Visium technique.

[0061] The simulation experiment 3 data of this invention comes from 20 slices of fruit fly embryos that have been developing for 8-10 hours, and the data is derived from stereo-seq technology.

[0062] The simulation experiment 4 of this invention uses 24 slices of the preoptic area of ​​the hypothalamus in two mouse brains, and the data is derived from the MERFISH technique.

[0063] The present invention includes four simulation experiments, which use the present invention and existing technologies (PASTE, PASTE2, SLAT, SANTO, GPSA, Moscot) to conduct simulation experiments on four different datasets.

[0064] Simulation Experiment 1 uses two pairs of original aligned slices of mouse brains at ages 8 and 13 months, generated by STARMAP PLUS technology, to simulate alignment under a rigid change scenario.

[0065] Simulation Experiment 1 of this invention uses the present invention and existing technologies (PASTE, SLAT, SANTO, Moscot) to simulate two pairs of slices of the mouse brain, obtaining alignment results for the five methods under a rigid change scenario. The alignment visualization results are as follows... Figure 2 As shown. Figure 2 The image includes visualizations of how aligned slices are aligned after rotating them by 90° and 135°. Each point in the image represents a cell. Figure 2 In blue, the reference slice is shown; in green, the slice to be aligned is shown; and in red, the slice after alignment is shown. Figure 2 Each point in the diagram represents the cell's position in the organization space. Figure 2 It can be seen that the present invention achieves good alignment after rotating the slices by 90° and 135°, while the existing methods PASTE and SLAT are not effective and make it difficult to further analyze these cells.

[0066] To further verify the simulation results of this invention, two evaluation metrics (Pearson correlation coefficient PCC and cell type consistency CI) were used to evaluate the slice results after rotation (45°, 90°, 135°, 180°, 225°, and 270°) for five different alignment methods. The Pearson correlation coefficient PCC and cell type consistency CI were calculated using the following formulas, and all calculation results were visualized. Figure 3 , Figure 4 :

[0067]

[0068] in This indicates that the cell / spot pair to be aligned is formed by cell / spot i in the slice and the cell / spot j in the reference slice that has the closest spatial distance to it. This indicates the number of cells / spots in the slice to be aligned. This represents the Pearson correlation coefficient between the i-th cell / spot in the aligned slice and gene expression. express Cell types, express Cell types.

[0069] Combination Figure 3 , Figure 4As can be seen, in all samples, the Pearson correlation coefficient (PCC) and cell type consistency (CI) of the present invention are higher than those of existing methods in the rigid change alignment scenario, and the present invention has good robustness under different angle rotations of the slices, proving that the present invention can accurately align rigid change scenarios.

[0070] Simulation Experiment 2 uses 12 slices of human dorsolateral prefrontal cortex (DLPFC) generated by 10x Visium technology for simulation experiments, and aligns them in a scenario with partial missing data.

[0071] Simulation Experiment 2 of this invention uses the present invention and existing technologies (PASTE2, SLAT, SANTO, Moscot) to simulate 12 slices of the human dorsolateral prefrontal cortex (DLPFC), obtaining alignment results for five methods in partially missing scenarios. The alignment visualization results are shown below. Figure 5 As shown. Figure 5 The image includes a visualization of the alignment results after rotating the aligned slices by 30° and cropping them to a 60% overlap area. Each point in the image represents a spot, and different colors represent different cell types. Figure 5 Each point in the diagram represents the location of a spot within the organizational space. Figure 5 It can be seen that the present invention achieves good alignment after rotating the slice by 30° and cutting to a 60% overlap area, while the existing methods PASTE2 and SLAT are not effective and make it difficult to further analyze these spots.

[0072] To further verify the simulation experiment effect of the present invention, the same evaluation index as simulation experiment 1 was used, and all calculation results were visualized. Figure 6 , Figure 7 Combining Figure 6 , Figure 7 As can be seen, in all samples, the Pearson correlation coefficient (PCC) and cell type consistency (CI) of the present invention after alignment in partially missing alignment scenarios are higher than those of existing methods under most conditions, proving that the present invention can accurately align partially missing scenarios. However, the alignment effect of the present invention is not good in scenarios with high tissue loss rate and small overlapping area. Simulation Experiment 3 uses 20 slices of Drosophila embryos that have been developing for 8-10 hours, generated by stereo-seq technology, for simulation experiments, and aligns them under a non-rigid change scenario.

[0073] Simulation Experiment 3 of this invention uses the present invention and existing technologies (PASTE, SLAT, SANTO, Moscot, GPSA) to simulate 20 slices of Drosophila embryos, obtaining alignment results for six methods under non-rigid change scenarios. The alignment visualization results are shown below. Figure 8 As shown. Figure 8 It includes visualizations of slice alignment and cell type visualizations, with each point in the figure representing a spot. Figure 8 Each point in the diagram represents the location of a spot within the organizational space. Figure 8 In the first row, blue represents the reference slice, green represents the slice to be aligned, and red represents the slice after alignment. Figure 8 In the second row, different colors represent different cell types. Figure 8 It can be seen that the present invention achieves good alignment after non-rigid changes occur in the slices, while existing methods cannot recover the non-rigid changes that occur in the slices well, making it difficult to further analyze these spots.

[0074] To further verify the simulation experiment effect of the present invention, the same evaluation index as simulation experiment 1 was used, and all calculation results were visualized. Figure 9 Combining Figure 9 As can be seen, in all samples, the Pearson correlation coefficient (PCC) and cell type consistency (CI) of the present invention are higher than those of existing methods in non-rigid alignment scenarios, proving that the present invention can accurately align non-rigid alignment scenarios.

[0075] Simulation Experiment 4 uses 24 slices of hypothalamic preoptic area data from two mouse brains generated by MERFISH technology to perform simulation experiments and perform alignment in a multi-slice alignment scenario.

[0076] Simulation Experiment 4 of this invention uses the present invention and existing technologies (PASTE, SLAT, SANTO, Moscot) to simulate 24 slices of hypothalamic preoptic area data from two mouse brains, obtaining alignment results for five methods in a multi-slice alignment scenario. The alignment visualization results are shown below. Figure 10 As shown. Figure 8 The image contains the result of aligning 12 slices and stacking the aligned results for visualization. Each dot in the image represents a cell, and different colors represent different cell types. Figure 10 Each point in the image represents the location of a spot in organizational space. The second row is a visualization of each slice randomly rotated from 0° to 45°. Figure 10 It can be seen that the present invention has a good alignment effect in multi-slice alignment scenarios, while existing methods such as PASTE cannot perform multi-slice joint alignment well and it is difficult to further analyze these spots.

[0077] To further verify the simulation experiment effect of the present invention, the same evaluation index as simulation experiment 1 was used, and all calculation results were visualized. Figure 11 and Figure 12 . Figure 11 This is the result of aligning multiple slices without random rotation. Figure 12 The result of aligning multiple slices by randomly rotating the slices from 0° to 45°, combined with Figure 11 and Figure 12 As can be seen, in all samples, the Pearson correlation coefficient (PCC) and cell type consistency (CI) of the present invention after alignment in multi-slice alignment scenarios are higher than those of existing methods, proving that the present invention can accurately align multi-slice alignment scenarios.

[0078] The simulation experiments above show that the present invention can robustly align data in different scenarios and is applicable to spatial transcriptome data with low tissue loss rates and significant overlap. It can adaptively align rigid changes, partial loss, and non-rigid change scenarios without requiring active selection by the user.

[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A spatial transcriptome slice adaptive alignment method based on a generative model, characterized in that, Includes the following steps: S1: Obtain the raw spatial transcriptome data of slice A to be aligned and target slice B; the raw data includes the spatial coordinates and gene expression vectors of each cell / space capture unit; S2: After preprocessing the raw spatial transcriptome data, candidate cell matching pairs between slice A and slice B are obtained by mutual KNN screening; S3: Based on the candidate cell matching, complete the coarse alignment of slice A and target slice B; S4: Construct an initial generative probability model based on a generative model and adaptively align it to different scenarios; S5: Input the coarsely aligned slice A and target slice B data into the initial generative probability model, and iteratively optimize the initial generative probability model by maximizing the posterior probability to obtain the optimized generative probability model; S6: Based on the optimized generative probability model, the final alignment of complete slice A and target slice B.

2. The adaptive alignment method for spatial transcriptome slices based on a generative model according to claim 1, characterized in that, The initial generative probability model described in step S4 is as follows: in, This represents the generation probability of the nth cell / spatial capture unit pair in target slice B. This represents the probability of overlapping points. This represents the distribution of non-overlapping points. This represents the probability that the nth cell / spatial capture unit in target slice B aligns with the mth cell / spatial capture unit in slice A at the gene expression information level. This represents the probability that the nth cell / spatial capture unit in target slice B is aligned with the mth cell / spatial capture unit in slice A at the spatial location information level. This represents the probability that the nth cell / spatial capture unit in target slice B aligns with the mth cell / spatial capture unit in slice A during the current iteration; This represents the spatial information of the nth cell / spatial capture unit in target slice B. This represents the gene information of the nth cell / spatial capture unit in target slice B. Indicates whether the nth cell / spatial capture unit in target slice B is an overlap point. This indicates whether the nth cell / spatial capture unit in target slice B participates in alignment. This indicates the spatial location information of all cells / spatial capture units in slice A. This indicates gene expression information for all cells / spatial capture units in slice A; yes The variance of the spatial location error is calculated using the normal distribution. This represents the probability of being an overlapping point; This represents the positional information of the m-th cell / spatial capture unit in slice A after undergoing both rigid and non-rigid transformations. This represents a rigid transformation of the m-th cell / spatial capture unit in slice A, where R represents the rotation matrix and t represents the displacement matrix. This indicates that a non-rigid change is performed on the m-th cell / space capture unit in slice A after a rigid change. The mean is covariance is Gaussian process.

3. The adaptive alignment method for spatial transcriptome slices based on a generative model according to claim 2, characterized in that, Step S5 includes: S51: Construct the posterior probability that the target slice B is aligned with slice A: in, This represents the set of latent variables, specifically including: rotation matrix. R Displacement matrix t Gaussian process parameters, overlapping indicator variables Auxiliary variables Overlap probability ,variance ; Indicates slice A, This represents slice B; This represents the prior knowledge of the set of latent variables given that slice A is known. This represents the likelihood of slice B given slice A and the latent variables. S52: Take the logarithm of both sides of the above posterior probability and simultaneously introduce a variational distribution. To approximate the true posterior distribution, we obtain the following equation: S53: On the right side of the above equation Integrating, we get the following formula: in, LEBO is the lower bound of evidence. The formula for calculating the kl divergence is used to measure the variational distribution. Similarity to the true posterior distribution; S54: Using the above formula, the original posterior maximization problem is equivalently transformed into a maximization ELBO objective optimization problem: S55: Iteratively update the variational distribution based on mean-field theory and the coordinate block descent method. The optimal latent variable is obtained when ELBO reaches its maximum. According to the optimal hidden variables The optimized generative probability model is obtained.

4. The adaptive alignment method for spatial transcriptome slices based on a generative model according to any one of claims 1-3, characterized in that, S2 includes: Pearson correlation coefficients were calculated for each cell / spatial capture unit in target slice B and sequentially compared with cell / spatial capture units in slice A. The Pearson correlation coefficients were then sorted by power of 1, and the top K correlation coefficients with cell / spatial capture units in slice A were used to obtain N. A Individual cell / space capture unit pairs; Pearson correlation coefficients were calculated for each cell / space capture unit in slice A and each cell / space capture unit in target slice B. The Pearson correlation coefficients were then sorted by power of 1, and the top K correlation coefficients with the cell / space capture units in target slice B were used to obtain N. B Individual cell / space capture unit pairs; The N A Cell / space capture unit pairs and N B Each cell / space capture unit pair is merged to obtain a candidate cell matching pair.

5. The adaptive alignment method for spatial transcriptome slices based on a generative model according to claim 4, characterized in that, S3 includes: Based on the candidate cell matching pairs, a least squares model is constructed to solve for the globally optimal rotation and displacement matrices. Based on the rotation and displacement matrices, coarse alignment of slice A and target slice B is completed. The least squares model is as follows: Where R represents the rotation matrix, t represents the translation matrix, and n represents the number of candidate cell matching pairs. This indicates the cells in the candidate cell matching pair that belong to slice A. This indicates the cells in the candidate cell matching pair that belong to target slice B. This represents the weight of the candidate cell matching pair.

6. The adaptive alignment method for spatial transcriptome slices based on a generative model according to claim 5, characterized in that, S3 further includes: Based on the candidate cell matching pairs, a least squares model is constructed to obtain the globally optimal rotation and displacement matrices; Based on the rotation matrix and the displacement matrix, slice A and target slice B are initially coarsely aligned; Calculate the alignment error between the two slices after the initial coarse alignment. If the alignment error is within the preset error range, the final coarse alignment of slice A and target slice B is completed. If the alignment error is outside the preset error range, slice A is flipped first to complete the final coarse alignment of slice A and target slice B.