A method for single-cell to spatial transcriptome mapping based on artificial intelligence

By employing techniques such as adaptive adjacency matrix and graph contrastive attention encoder, the problems of heterogeneity capture and insufficient robustness in single-cell to spatial transcriptome mapping were solved, achieving accurate mapping in complex tissues and high-noise environments, and improving the model's robustness and biological analytical capabilities.

CN121260244BActive Publication Date: 2026-03-13QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing single-cell to spatial transcriptome mapping technologies have shortcomings in capturing spatial data heterogeneity, enhancing feature expression capabilities, improving cross-modal alignment accuracy and model robustness, especially under complex tissue structures and high-noise data.

Method used

We employ a combination of adaptive adjacency matrix construction, graph contrastive attention encoder, residual connections, local skip connections, and contrastive learning projection layers, along with multiple optimal transport strategies, to achieve precise mapping between single cells and spatial transcriptomes.

Benefits of technology

It effectively captures the heterogeneous structure of dense and sparse regions, improves the robustness of graph representation and cross-modal alignment accuracy, and enhances the robustness and biological interpretability of the model in complex tissues and high-noise environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121260244B_ABST
    Figure CN121260244B_ABST
Patent Text Reader

Abstract

This invention relates to the interdisciplinary field of bioinformatics and deep learning, and discloses an artificial intelligence-based method for mapping single cells to spatial transcriptomes. First, single-cell and spatial transcriptome data are preprocessed, and a spatial adjacency matrix is ​​constructed based on local density adaptation. Then, a graph contrastive attention encoder integrating GATv2, residual connections, local skip connections, and contrastive learning is trained to obtain low-dimensional embedding representations of cells and spatial sites, and a combined cost matrix integrating gene expression differences and multi-dimensional distance matrices is constructed. Finally, an optimal transport strategy is employed to achieve accurate mapping. This scheme can accurately capture spatial heterogeneity, enhance feature transfer stability and embedding robustness, improve mapping accuracy and scene adaptability, and provide technical support for the analysis of biological mechanisms in complex tissues and disease research.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of bioinformatics and deep learning, specifically to a method for mapping single cells to spatial transcriptomes based on artificial intelligence. Background Technology

[0002] As the carriers of genetic information that determine the traits of organisms, the capture of the transcriptome is crucial for monitoring and regulating the growth, development, function, and reproduction processes of organisms. Currently, the mainstream transcriptome sequencing technologies mainly include single-cell transcriptome sequencing and spatial transcriptomics. While these two technologies are complementary, they each have their limitations: single-cell transcriptome sequencing can resolve cellular heterogeneity at high resolution, but it loses spatial location information during the capture process, becoming a major obstacle to understanding the regulatory mechanisms of the tissue microenvironment; while spatial transcriptomics can preserve spatial information, it often faces problems such as low resolution or insufficient transcript coverage.

[0003] To integrate the advantages of these two technologies, single-cell to spatial transcriptome mapping technology has gradually developed. The core of this technology is to integrate single-cell and spatial data through computational models, accurately matching molecular features at single-cell resolution with spatial sites, thereby constructing a complete analytical system for cell identity, spatial location, and functional phenotype. In recent years, various deep learning methods have been applied to this mapping task. For example, Tangram uses a multilayer perceptron neural network to achieve end-to-end mapping by minimizing gene expression reconstruction errors and cell density consistency losses; CytoSPACE is based on a graph matching framework, combining cell number constraints to optimize mapping relationships; and Celloc uses a graph attention autoencoder to learn low-dimensional embeddings and optimizes the correspondence between cells and spatial points through multiple loss functions.

[0004] However, existing methods still have significant shortcomings. First, the inability to effectively capture the heterogeneous structure of spatial data in dense and sparse regions limits the realism of graph representation learning. Second, the vanishing gradient problem easily occurs during deep network training, affecting the stable transfer of multi-scale features. Furthermore, these methods have limited expressive power for complex organizational structures, and their prediction accuracy and model robustness on noisy datasets still need improvement. They also lack flexible matching strategies that can adapt to different data scales and organizational types. Therefore, there is an urgent need to develop a new mapping method that can achieve a better balance between capturing spatial heterogeneity, enhancing feature expressive power, improving cross-modal alignment accuracy, and maintaining biological interpretability. Summary of the Invention

[0005] The purpose of this invention is to provide an artificial intelligence-based method for mapping single cells to spatial transcriptomes, which can achieve accurate and robust mapping between single cells and spatial transcriptomes, providing technical support for the analysis of biological laws in complex tissues.

[0006] To achieve the above objectives, the present invention employs the following technical solutions.

[0007] An artificial intelligence-based method for single-cell to spatial transcriptome mapping includes the following steps:

[0008] S1. Data preprocessing: Acquire single-cell RNA-seq data and spatial transcriptome data, perform data preprocessing on the two types of data to obtain single-cell feature data and spatial site feature data suitable for subsequent analysis;

[0009] S2. Spatial adjacency matrix construction: Based on local density adaptive determination of the number of neighbors of each node, an undirected adjacency matrix reflecting the topological characteristics of spatial data is constructed. The nodes include cell nodes corresponding to single-cell feature data and spatial site nodes corresponding to spatial site feature data.

[0010] S3. Training of graph contrastive attention encoder: Construct a graph contrastive attention encoder that includes a GATv2-based encoder, residual connections, local skip connections, a symmetric decoding module and a contrastive learning projection layer. Input the preprocessed feature data and adjacency matrix into the encoder. Optimize the encoder by combining reconstruction loss and contrastive loss to learn low-dimensional embedding representations of cell nodes and spatial site nodes.

[0011] S4. Construction of distance matrix and cost matrix: Construct a single-cell distance matrix to quantify the structural similarity between single cells and a spatial site distance matrix to quantify the physical proximity between spatial sites. Then integrate the gene expression difference distance with the above distance matrices to construct a combined cost matrix to quantify the comprehensive dissimilarity of single cells and spatial sites.

[0012] S5. Optimal Transport Mapping: Based on the combined cost matrix and the distribution information of single cells and spatial sites, the optimal transport matrix is ​​calculated using at least one optimal transport strategy to achieve accurate mapping from single cells to the spatial transcriptome.

[0013] Furthermore, the data preprocessing in step S1 includes the following steps:

[0014] S11. Remove low-expression genes that are expressed in fewer than a preset number of cells in single-cell RNA-seq data and spatial transcriptome data;

[0015] S12. Subset single-cell data and spatial transcriptome data, retaining only the genes that overlap between the two types of data;

[0016] S13. Perform normalization and logarithmic transformation on single-cell data and spatial transcriptome data;

[0017] S14. Perform principal component analysis on the standardized single-cell feature data, extract a preset number of principal components as the core features of single cells, and achieve dimensionality reduction and extraction of the main variation features of single-cell data.

[0018] Furthermore, the spatial adjacency matrix construction described in step S2 includes the following steps:

[0019] S21. For each node, calculate the average nearest neighbor distance to the default number of neighbors, use the reciprocal of the average distance as the local density, normalize the local density to [0,1], linearly map the normalized local density to the preset neighbor number interval and round it down, thereby obtaining the adaptive number of neighbors for each node.

[0020] S22. Construct an undirected k-nearest neighbor graph that reflects the local neighborhood associations of spatial locations based on the adaptive number of neighbors of each node, and further construct a spatial adjacency matrix;

[0021] The formula for local density normalization is:

[0022] , ,

[0023] in, Let be the average nearest neighbor distance from node i to the default number of neighbors. , These represent the minimum and maximum values ​​of the local density index, respectively. This is a local density index;

[0024] The formula for obtaining the adaptive neighbor number of node i from the local density after linear mapping normalization is:

[0025] ,

[0026] in, , These are the preset minimum and maximum number of neighbors, respectively;

[0027] The edge set of the undirected k-nearest neighbor graph is: ,in Let i represent the set of k nearest neighbors of node i.

[0028] Furthermore, the GATv2-based encoder described in step S3 includes at least two GATv2 convolutional layers, and the feature update process for each convolutional layer is as follows:

[0029] A linear transformation is performed on the input features to obtain a high-dimensional feature representation;

[0030] For any edge in an undirected k-nearest neighbor graph The attention score between node i and its neighbor j is calculated using an activation function, where the attention score represents the correlation between node i and its neighbor j.

[0031] The attention scores of all neighbors of each node i are normalized by using the softmax function to obtain normalized weights that reflect the information contribution of neighboring nodes to the target node i. Based on the normalized weights, the features of the target node and its neighboring nodes are aggregated to obtain the output features of the current layer.

[0032] Furthermore, the residual connection described in step S3 is implemented as follows: if the input feature dimension of the current coding layer is... With output feature dimension Inconsistency, input features Through linear mapping matrix After adapting the dimensions, it is compared with the output features of the current layer. Add them together and activate them through the exponential linear unit:

[0033] ;

[0034] If the dimensions are the same, the input features are directly added to the output features of the current layer before activation.

[0035] Further, the local skip connection in step S3 is as follows: a symmetric normalized neighborhood average term is constructed on the first layer output features of the encoder, and after being mapped through a linear layer, it is added to the output features of the second coding layer.

[0036] Furthermore, the implementation of the contrastive learning projection layer in step S3 includes:

[0037] Constructing an enhanced view: Perturb the node order of the input features to randomly permutate the rows of the feature matrix, thus obtaining the original view and the enhanced view;

[0038] Encoding and Projection: The original view and the enhanced view are input into the encoder to obtain the corresponding embedded representations, which are then mapped into projection vectors through a shared multilayer perceptron projection head;

[0039] Calculate the similarity matrix: Perform L2 normalization on the projected vectors and calculate the cosine similarity matrix between the normalized projected vectors;

[0040] The similarity of source view embeddings is constrained by the InfoNCE loss in the form of cross-entropy, maximizing the similarity between the original view embedding and its corresponding augmented view embedding, while minimizing the similarity with other mismatched augmented view embeddings.

[0041] Further, the distance matrix in step S4 includes:

[0042] A single-cell distance matrix using Pearson correlation coefficient distance to measure the structural similarity of single cells:

[0043] ,

[0044] in, , Single-cell and eigenvectors, The Pearson correlation coefficient;

[0045] The spatial point distance matrix, which reflects the geometric and topological relationships between spatial points, is calculated using Euclidean distance:

[0046] ,

[0047] in, and These are the two-dimensional spatial coordinates of spatial points i and j, respectively;

[0048] The formula for constructing the combined cost matrix is ​​as follows:

[0049] ,

[0050] in, This is the original expression difference matrix. To reconstruct the expression difference matrix;

[0051] KL divergence was used to calculate the differences in gene expression between single cells and spatial loci:

[0052] The difference between single-cell and spatial site embedding representations was calculated using the Pearson correlation coefficient distance.

[0053] Furthermore, the optimal transmission strategy described in step S5 includes at least one of the following:

[0054] The standard Sinkhorn algorithm minimizes the weighted sum of transmission cost and entropy through entropy regularization;

[0055] The Gromov-Wasserstein method is integrated: it jointly considers the feature space distance and the structural space distance to achieve matching of the internal structure of the source data and the target data;

[0056] Unbalanced optimal transport: Introducing a KL divergence penalty term to penalize the marginal distribution from the given distribution. and The deviation between them.

[0057] Furthermore, it also includes a spatial location cell number prediction step:

[0058] The average cell count is preset, and the sum of gene expression values ​​after normalized logarithmic transformation at each spatial point is calculated.

[0059] A prediction model based on the linear relationship between RNA reads and cell count in spatial transcriptome data is used to obtain the integer cell count contained in each spatial site by inputting the total RNA reads for that site.

[0060] The advantages of this invention are:

[0061] The adaptive adjacency matrix construction method can dynamically adjust the number of neighbors according to the local density, effectively capturing the heterogeneous structural features of spatial data in dense and sparse regions, improving the robustness of graph representation, and making the model perform consistently under different organizational densities.

[0062] The introduction of residual connections alleviates the gradient vanishing problem in deep networks, preserves the original feature information of shallow layers, facilitates multi-scale feature fusion, and enhances the ability to capture global biological signals. Local skip connections improve the structural smoothness and local consistency of node representation through neighborhood average feature transfer, and avoid the isolation of noisy nodes or error amplification.

[0063] The GATv2 attention mechanism makes attention weights dependent on the joint feature representation of node pairs. Compared with the traditional GAT, it captures nonlinear relationships between nodes more flexibly, is more sensitive to local topological changes, and significantly improves the expressive power of complex organizational structures.

[0064] The contrastive learning projection layer enhances the contrast constraints of the view, making the embedding space more discriminative and consistent across samples. This improves the robustness of the model in high-noise, cross-batch, and cross-platform scenarios, and enables it to learn stable biological representations that are independent of noise.

[0065] Diverse optimal transfer strategies adapt to different data scenarios: The Sinkhorn algorithm is fast and stable, suitable for scenarios where mass conservation is required; FGW combines structural and expression features, adapting to complex tissue structures; UOT allows for mass imbalance, which is more in line with the biological reality of differences in the number of single cells and spatial data, significantly improving the model's scenario adaptability and biological interpretability. Attached Figure Description

[0066] Figure 1 This is a flowchart of the artificial intelligence-based single-cell to spatial transcriptome mapping method of the present invention;

[0067] Figure 2 This is a flowchart of the adaptive adjacency graph construction process of the present invention;

[0068] Figure 3 This is a diagram comparing the attention encoder model framework of the present invention;

[0069] Figure 4 This is a flowchart of the encoder of the present invention;

[0070] Figure 5 This is a flowchart of the comparative learning projection layer of the present invention;

[0071] Figure 6 This is a flowchart of the optimal transmission strategy of the present invention. Detailed Implementation

[0072] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0073] This embodiment discloses a method for mapping single cells to spatial transcriptomes based on artificial intelligence. Please refer to [link / reference]. Figure 1 The steps include:

[0074] S1. Data preprocessing: Acquire single-cell RNA-seq data and spatial transcriptome data, perform data preprocessing on the two types of data to obtain single-cell feature data and spatial site feature data suitable for subsequent analysis;

[0075] S2. Spatial Site Cell Count Prediction: Preset average cell count, calculate the sum of gene expression values ​​after normalized logarithmic transformation for each spatial site, fit a prediction model based on the linear relationship between RNA reads and cell count in spatial transcriptome data, input the total RNA reads for each spatial site, and obtain the integer cell count contained in that spatial site.

[0076] S3. Spatial Adjacency Matrix Construction: Based on local density adaptive determination of the number of neighbors of each node, an undirected adjacency matrix reflecting the topological characteristics of spatial data is constructed. The nodes include cell nodes corresponding to single-cell feature data and spatial site nodes corresponding to spatial site feature data.

[0077] S4. Training of the graph contrastive attention encoder: Construct a graph contrastive attention encoder that includes a GATv2-based encoder, residual connections, local skip connections, a symmetric decoding module and a contrastive learning projection layer. Input the preprocessed feature data and the adjacency matrix into the encoder. Optimize the encoder by jointly using reconstruction loss and contrastive loss to learn low-dimensional embedding representations of cell nodes and spatial site nodes.

[0078] S5. Construction of distance and cost matrices: Construct a single-cell distance matrix that quantifies the structural similarity between single cells and a spatial site distance matrix that quantifies the physical proximity between spatial sites. Then, integrate the gene expression difference distance with the above distance matrices to construct a combined cost matrix that quantifies the combined dissimilarity of single cells and spatial sites.

[0079] S6. Optimal Transport Mapping: Based on the combined cost matrix and the distribution information of single cells and spatial sites, the optimal transport matrix is ​​calculated using at least one optimal transport strategy to achieve accurate mapping from single cells to the spatial transcriptome.

[0080] Specifically, this embodiment uses five publicly available datasets as examples for detailed description with reference to the accompanying drawings: (i) mouse cerebellum; (ii) mouse hippocampus; (iii) human ductal carcinoma in situ (DCIS); (iv) human HER2-positive breast cancer (HER2+); and (v) myocardial infarction (MI). These datasets cover different tissue types and biological backgrounds to comprehensively verify the robustness and accuracy of this method in diverse scenarios.

[0081] Step 1: Data preprocessing. Single-cell RNA-seq data. and spatial transcriptome data As input data, For single cell count, This refers to the number of spatial sites. This represents the number of genes.

[0082] First, to reduce noise, sparse zero counts, and lower the computational burden, gene filtering is performed on single-cell and spatial transcriptome data to filter and eliminate genes in single-cell data. and spatial transcriptome data Genes expressed in fewer than one cell.

[0083] Perform single-cell data and spatial transcriptome data Subsetting, retaining only the intersection genes This is to ensure consistency of gene characteristics in subsequent analyses. The subsetted data will still be used... and It indicates that its genetic dimension is .

[0084] To eliminate the impact of sequencing depth differences, normalization and logarithmic transformation were performed on both single-cell and spatial transcriptome data. The formula for this process is as follows:

[0085] ,

[0086] in This represents the gene expression value of the original gene j at cell site i. These are the gene expression values ​​after normalization and logarithmic transformation.

[0087] To reduce dimensionality and extract the main variation features of single-cell data, principal component analysis (PCA) was performed on the normalized single-cell data, retaining the first 50 principal components, denoted as . .

[0088] Step 2: Predict the number of cells at each spatial point, aiming to predict the integer number of cells contained in each spatial transcriptome site.

[0089] First, a preset average cell count is established. For each spatial location Calculate the sum of their normalized logarithmic gene expression values. .

[0090] Determine a minimum Read volume ,if Then the corresponding minimum number of cells ;otherwise .

[0091] Use minimum RNA read volume and the corresponding minimum number of cells and average RNA read volume and its prior mean cell number Fit a straight line to depict an approximate linear relationship between RNA readout and cell number.

[0092] Total RNA reads at each spatial site Substitute the values ​​into the fitted linear equation to obtain the predicted cell count, and round the result to obtain the integer cell count. To ensure biological rationality, if The initial prediction was 0 and If so, then adjust it to 1.

[0093] Step 3: Construct the spatial adjacency matrix. Please refer to [link / reference]. Figure 2 For each node, calculate its path to the default node. Average distance between nearest neighbors for a number of neighbors:

[0094] ,

[0095] The reciprocal of the average distance is used as the local density. And normalize the local density to [0,1]: .

[0096] The normalized local density is linearly mapped to a preset neighbor number interval. Then, round down to obtain the adaptive number of neighbors for each node. , Describes the set of k nearest neighbors of node i. For local density indicators, The distance is Euclidean.

[0097] The aforementioned adaptive method can effectively capture the heterogeneity of spatial data, avoid the problem of too many edges in dense regions or too few edges in sparse regions, and improve the robustness of graph representation.

[0098] Adaptive neighbor count for each node Construct an undirected k-nearest neighbor graph that reflects the local neighborhood associations of spatial locations, and further construct a spatial adjacency matrix. The edge set of an undirected k-nearest neighbor graph is: .

[0099] Because single-cell data lacks physical spatial coordinates, the adjacency matrix constructed using cell distances after PCA dimensionality reduction cannot directly use geometric distance to define adjacency. PCA (Principal Component Analysis) reduces high-dimensional gene expression data to a low-dimensional space that captures major biological variations; the distances between cells effectively reflect their biological similarity. Therefore, the adjacency matrix constructed based on PCA-reduced cell distances actually reflects a network of similarity in cell function or state, rather than physical proximity.

[0100] Step 4: Construct the Graph Contrastive Attention Encoder (GCATE) model. Please refer to [link / reference]. Figure 3 .

[0101] GCATE consists of five main parts: a two-layer GATv2 encoder, residual links, local skip connections, a symmetric decoder, and a contrastive learning projection layer. The node feature matrices and adjacency matrices of single-cell and spatial transcriptome data are encapsulated into PyG Data objects and input into the encoder. Dynamic attention between points is calculated to dynamically represent the relationships between neighboring points, allowing for more accurate updates of node gene expression based on neighbor information. Residual links preserve shallow global features, and the local skip connections in the second layer enhance the correlation of the graph structure, improving the structured representation of the embeddings. Simultaneously, the input features are reconstructed through the symmetric decoder, and contrastive learning enhances the resulting node embeddings to achieve stronger discriminativity and robustness.

[0102] Encoder process as follows Figure 4 As shown, the encoder includes at least two GATv2 convolutional layers, and the feature update process for each convolutional layer is as follows:

[0103] For input features (Right now or The encoder learns features layer by layer, starting with the first convolutional layer, where the input features are passed through... Through a linear transformation get .

[0104] For any edge in an undirected k-nearest neighbor graph The attention score between node i and its neighbor j is calculated using the LeakyReLU activation function. Let represent the correlation between node i and its neighbor j. This is a learnable attention vector.

[0105] Then, the attention scores of all neighbors of each node i are normalized using the softmax function to obtain normalized weights that reflect the information contribution of neighboring nodes to the target node i. , is used to represent the information contribution of node j to node i during feature update.

[0106] The new features of node i are achieved by aggregating its neighbors. The features are obtained and weighted by attention weights: .

[0107] To avoid vanishing gradients and preserve low-level features, linear residual connections are introduced. The purpose of residual connections is to directly add the original input or features from the previous layer to the output of the current layer, helping the model learn deeper features and mitigating the vanishing gradient problem.

[0108] If the input feature dimension of the current encoding layer With output feature dimension Inconsistency, input features Through linear mapping matrix After adapting the dimensions, it is compared with the output features of the current layer. Add them together and activate them through the exponential linear unit:

[0109] ;

[0110] If the dimensions are the same, the input features are directly added to the output features of the current layer before activation.

[0111] To enhance structural smoothness and introduce richer local structural information during the second-layer aggregation, the model outputs in the first layer... A symmetrically normalized neighborhood average term is constructed above. This helps to capture the average features of the neighborhood, smooth the feature representation, and pass it as local structural information to the next layer.

[0112] The neighborhood average term for symmetric normalization is defined as:

[0113] ,

[0114] in, Let i be the set of neighboring nodes. Let i be the degree of node i. This is the original feature vector of node j in the first layer of the encoder;

[0115] Then through the linear layer After mapping, we get And add it to the output features of the second coding layer.

[0116] The second GATv2 convolutional layer uses As input, its output yes Similarly, after residual connection And add additional local jump connect terms. .

[0117] Finally, the second layer output embedding is: ,in The node embeddings learned by the encoder incorporate multi-hop neighbor information, residual features, and local structural smoothness.

[0118] The decoder also consists of two GATv2 layers, employing a weight-binding strategy to ensure structural symmetry and reduce the number of parameters. The decoder's goal is to learn from the embeddedness... Reconstruct the original input features.

[0119] The decoding process is as follows and The reconstructed feature matrix is ​​obtained. This is used to constrain the model to retain biological information at the expression level.

[0120] For the implementation of the contrastive learning projection layer, please refer to [link / reference]. Figure 5 In order to enhance To improve the consistency and robustness of representation, the model introduces InfoNCE contrastive loss.

[0121] During the input phase, in addition to the original features... , It also constructs an enhanced view:

[0122] ,

[0123] The enhancement method here involves perturbing the node order of the input features (i.e., randomly permuting the rows of the feature matrix), while preserving the core feature information. Perturbing the node order of the input features, thus randomly permuting the rows of the feature matrix, yields the original view. With Enhanced View .

[0124] The original view and the enhanced view are input into the encoder to obtain the corresponding embedded representations, which are then projected through a shared multilayer perceptron projection head. Mapped to projection vector and The projection head is a network consisting of two multilayer perceptrons (MLPs) with a ReLU activation function sandwiched in between. The specific formula is as follows:

[0125] ,

[0126] ,

[0127] , .

[0128] Calculate the similarity matrix: for the projected vectors , L2 normalization is performed to obtain and And calculate the cosine similarity matrix between the normalized projection vectors. :

[0129] .

[0130] Based on the InfoNCE loss in the form of cross-entropy, the similarity of source view embeddings is constrained, maximizing the similarity between the original view embedding and its corresponding augmented view embedding, while minimizing the similarity with other mismatched augmented view embeddings:

[0131] .

[0132] This loss encourages the model to learn embeddings that have high similarity to features in different views of the same node, but low similarity to features in augmented views of different nodes.

[0133] Joint optimization objective and training strategy. The overall objective function of the model consists of reconstruction error and contrastive loss, aiming to simultaneously preserve the biological information at the original expression level and enhance the discriminativeness and robustness of the embedding.

[0134] Measure the features reconstructed by the decoder Compared with the original input features The difference between them is expressed here as mean squared error (MSE): The weighted sum of reconstruction loss and contrast loss ,in The loss weighting coefficients are used to compare the importance of the two types of losses.

[0135] To achieve optimal transport mapping between single cells and spatial sites, it is necessary to construct various distance matrices and expression difference matrices to quantify the relationships between them.

[0136] The distance matrix includes the single-cell distance matrix and the spatial site distance matrix:

[0137] A single-cell distance matrix using Pearson correlation coefficient distance to measure the structural similarity of single cells:

[0138] ,

[0139] in, , Single-cell and Feature vectors (from) ), The Pearson correlation coefficient;

[0140] The spatial point distance matrix, which reflects the geometric and topological relationships between spatial points, is calculated using Euclidean distance:

[0141] ,

[0142] in, and These are the two-dimensional spatial coordinates of spatial points i and j, respectively.

[0143] The formula for constructing the combined cost matrix is:

[0144] ,

[0145] in, This is the original expression difference matrix. To reconstruct the expression difference matrix, this combination method ensures that, in the optimal transmission process, not only gene expression matching is considered, but also deeper biological and structural similarities learned through graph neural networks.

[0146] The Kullback-Leibler Divergence (KL Divergence) is used to measure single-cell [diversity]. Gene expression Spatial location Gene expression The difference lies in the expression spectrum. Before using KL divergence, the expression spectrum is normalized to a probability distribution and a small positive number is added. To avoid taking the logarithm of zero, the formula is: .in and Single-cell and spatial location The normalized probability distribution of gene k. This matrix The dissimilarity of single cells and spatial sites at the gene expression level was quantified.

[0147] Pearson correlation coefficient distance is used to measure single cell distance. and spatial location Reconstructed feature vectors and The difference between them is defined as .

[0148] Please refer to Figure 6 The Optimal Transport (OT) method is designed to utilize a constructed combined cost matrix. Based on the information on single-cell and spatial site distribution, an optimal transfer matrix is ​​calculated. The elements of this matrix Indicates single-cell Transmission to spatial location The "quality" or matching strength.

[0149] This invention provides three optimal transmission strategies to adapt to different data scenarios:

[0150] Standard Sinkhorn algorithm: Solves the optimal transport problem with entropy regularization. Given a source distribution... (The "mass" or prior count of each single cell) and target distribution (Predicted number of cells at each spatial location), and cost matrix The Sinkhorn algorithm finds the optimal transfer matrix through an iterative process: .in It is the entropy of the transfer matrix. It is the entropy regularization parameter. The larger the value, the smoother the transition. The algorithm iteratively updates the two scale factor vectors until convergence, obtaining the optimal transfer matrix. .

[0151] The Fusion Gromov-Wasserstein (FGW) method considers both feature space and structure space distances, aiming to find a transfer matrix that minimizes not only the transfer cost but also better matches the internal structures of the source and target data. It combines the traditional Wasserstein distance with the Gromov-Wasserstein distance. The specific formula is as follows:

[0152] .

[0153] in, It is a structural distance matrix between single cells. It is the structural distance matrix between spatial locations. To balance the parameters, the weights between feature similarity (expression spectrum distance) and structural similarity (graph structure distance) are controlled.

[0154] Non-equilibrium optimal transport (UOT): Standard optimal transport assumes that the total quality of the source and target distributions are equal and must be perfectly matched. However, in biological scenarios, single-cell sequencing data and spatial transcriptome data often exhibit quantity mismatches, leading to a mismatch in the total quality of the source and target distributions. Non-equilibrium optimal transport relaxes the quality conservation constraint, allowing for quality loss or gain. It introduces a KL divergence penalty term into the objective function to penalize marginal distributions from the given distribution. and The deviation between them. The specific formula is:

[0155] .

[0156] in and These are the transmission matrices The sum of rows and columns (i.e., the marginal distribution after transmission). It is the KL divergence. and These are marginal relaxation parameters. These parameters control the permissible degree of mass imbalance.

[0157] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method of artificial intelligence-based single-cell-to-spatial transcriptome mapping, characterized in that, The method comprises the steps of: S1. Data preprocessing: obtaining single-cell RNA-seq data and spatial transcriptome data, and preprocessing the two types of data to obtain single-cell feature data and spatial site feature data suitable for subsequent analysis; S2. Spatial adjacency matrix construction: based on local density self-adaption, the number of neighbors of each node is determined, and an undirected adjacency matrix reflecting the topological characteristics of spatial data is constructed, wherein the nodes include cell nodes corresponding to single-cell feature data and spatial site nodes corresponding to spatial site feature data; S3. Graph contrastive attention encoder training: a graph contrastive attention encoder containing an encoder based on GATv2, residual connection, local skip connection, symmetric decoding module and contrastive learning projection layer is constructed, the preprocessed feature data and the adjacency matrix are input into the encoder, and the low-dimensional embedding representation of the cell nodes and the spatial site nodes is learned through joint optimization of reconstruction loss and contrastive loss; The encoder based on GATv2 comprises at least two layers of GATv2 convolution layers, and the feature updating process of each convolution layer is as follows: performing linear transformation on the input feature to obtain a high-dimensional feature representation; For any edge in the undirected k-neighborhood graph a score of attention of node i to neighbor j is calculated by an activation function, which represents the relevance of node i to neighbor j. normalizing the attention scores of all neighbors of each node i through a softmax function to obtain normalized weights reflecting the information contribution of the neighbor nodes to the target node i, and aggregating the features of the target node and its neighbor nodes based on the normalized weights to obtain the output feature of the current layer; The residual connection is implemented as follows: if the input feature dimension of the current coding layer is... With output feature dimension Inconsistency, input features Through linear mapping matrix After adapting the dimensions, it is compared with the output features of the current layer. Add them together and activate them through the exponential linear unit: ; if the dimensions are consistent, the input feature and the output feature of the current layer are directly added and activated; The local skip connection is to construct a symmetric normalized neighborhood average item on the output feature of the first layer of the encoder, map it through a linear layer, and then add it to the output feature of the second layer of the encoding layer; The implementation of the contrastive learning projection layer includes: Constructing an enhanced view: performing node order disturbance on the input feature to randomly permute the rows of the feature matrix to obtain an original view and an enhanced view; Encoding and projection: inputting the original view and the enhanced view into the encoder to obtain corresponding embedding representations, and mapping them into projection vectors through a shared multi-layer perception projection head; Calculating the similarity matrix: L2 normalizing the projection vectors and calculating the cosine similarity matrix between the normalized projection vectors; The InfoNCE loss based on cross-entropy form constrains the similarity of homologous view embeddings, maximizes the similarity between the original view embedding and its corresponding enhanced view embedding, and minimizes the similarity with other unmatched enhanced view embeddings; S4. Distance matrix and cost matrix construction: constructing a single-cell distance matrix quantifying the structural similarity between single cells, a spatial site distance matrix quantifying the physical proximity between spatial sites, and a combined cost matrix quantifying the comprehensive dissimilarity between single cells and spatial sites by integrating the gene expression difference distance and the above distance matrices; S5. Optimal transport mapping: based on the combined cost matrix and the distribution information of single cells and spatial sites, at least one optimal transport strategy is used to calculate an optimal transport matrix to realize precise mapping of single cells to spatial transcriptomes; The optimal transport strategy includes at least one of the following: Standard Sinkhorn algorithm: minimize the weighted sum of the transportation cost and entropy by entropy regularization; Fused Gromov-Wasserstein method: jointly consider the feature space distance and the structure space distance to realize the matching of the internal structure of the source data and the target data; Non-equilibrium optimal transport: Introduce a KL divergence penalty term to penalize the deviation between the marginal distribution and a given distribution and .

2. The method of mapping single-cell to spatial transcriptomes based on artificial intelligence of claim 1, wherein, The data preprocessing in step S1 includes the following steps: S11. Remove lowly expressed genes expressed in less than a preset number of cells in single-cell RNA-seq data and spatial transcriptome data; S12. Subset the single-cell data and the spatial transcriptome data, and only retain the intersection genes in the two types of data; S13. Perform normalization and logarithmic transformation on the single-cell data and the spatial transcriptome data; S14. Perform principal component analysis on the normalized single-cell feature data, extract a preset number of principal components as single-cell core features, realize dimension reduction, and extract the main variation features of the single-cell data.

3. The method of mapping single-cell to spatial transcriptomes based on artificial intelligence of claim 1, wherein, The construction of the spatial adjacency matrix in step S2 includes the following steps: S21. For each node, calculate the average distance to the default number of neighbors, take the inverse of the average distance as the local density, normalize the local density to [0, 1], linearly map the normalized local density to a preset neighbor number interval and take the integer part, thereby obtaining the adaptive neighbor number of each node; S22. Based on the adaptive neighbor number of each node, construct an undirected k-neighbor graph reflecting the local neighborhood correlation of the spatial sites, and further form a spatial adjacency matrix; The formula for normalizing the local density is: , , wherein, is the average distance of node i to the default number of neighbors, , are the minimum and maximum values of the local density indicator, respectively, is the local density indicator; The formula for obtaining the adaptive neighbor number of node i by linearly mapping the normalized local density is: , wherein, , are respectively preset minimum and maximum numbers of neighbors; The edge set of the undirected k-nearest neighbor graph is: where denotes the k-nearest neighbor set of node i.

4. The method of mapping single-cell to spatial transcriptomes based on artificial intelligence of claim 1, wherein, The distance matrix in step S4 includes: The single-cell distance matrix using the Pearson correlation coefficient distance to measure the structural similarity of single cells: , wherein , are the feature vectors of single cells and respectively, is the Pearson correlation coefficient; The spatial site distance matrix using the Euclidean distance to reflect the geometric topological relationship between spatial sites: , wherein, and are the two-dimensional spatial coordinates of spatial sites i and j, respectively; The formula for constructing the combined cost matrix is: , wherein, is the original expression difference matrix, is the reconstructed expression difference matrix; Gene expression differences between single cells and spatial sites were calculated using KL divergence: The difference between single-cell and spatial-site embedding representations was computed using the Pearson correlation coefficient distance.

5. The method of mapping single-cell to spatial transcriptomes based on artificial intelligence of claim 1, wherein, It also includes a spatial site cell number prediction step: A preset average cell number is calculated, and the sum of the normalized logarithmically transformed gene expression values of each spatial site is calculated; Based on the linear relationship fitting prediction model between the RNA read quantity of the spatial transcriptome data and the cell number, the total RNA read quantity of each spatial site is input to obtain the integer cell number contained in the spatial site.

Citation Information

Patent Citations

  • Method for predicting protein function based on transfer learning and three-channel combination GNN

    CN118969060A

  • Hyperspectral point cloud waste plastic bottle intelligent sorting method based on cross-modal image fusion

    CN120708004A