Spatial transcriptomic spatial domain identification method and system based on dual contrast learning

CN122392639APending Publication Date: 2026-07-14HAINAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HAINAN UNIV
Filing Date
2026-04-17
Publication Date
2026-07-14

Smart Images

  • Figure CN122392639A_ABST
    Figure CN122392639A_ABST
Patent Text Reader

Abstract

The application relates to a spatial transcriptome spatial domain identification method and system based on double contrast learning. The method comprises the following steps: performing Gaussian smoothing processing on gene expression data to obtain smoothed gene expression data; constructing an initial adjacency matrix based on spatial coordinate data, performing edge pruning to obtain an optimized adjacency matrix; inputting the smoothed gene expression data and the optimized adjacency matrix into a graph convolution network encoder to obtain low-dimensional latent features and reconstruction features, and calculating a reconstruction loss; inputting the low-dimensional latent features into a multi-branch multi-layer perception fusion module to obtain enhanced features; constructing a regional contrast learning task, calculating a regional contrast loss, constructing a topological contrast learning task, and calculating a topological contrast loss; optimizing model parameters through a total loss, using an optimized model to perform spatial domain identification, and obtaining a spatial domain identification result. The spatial domain identification accuracy can be improved and the cost can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a spatial domain identification method and system for spatial transcriptomics based on dual contrastive learning. Background Technology

[0002] Physiological activities in organisms are driven by complex regulatory mechanisms across multiple cell types. Linking gene expression within cells with their spatial information is crucial for understanding the tissue microenvironment. Spatial transcriptomics (ST) integrates gene expression and spatial information, enabling the analysis of tissue structure and identification of pathological features, achieving spatial localization of gene expression and analysis of the tissue microenvironment. Furthermore, recent advancements in high-throughput sequencing technologies (such as 10xVisium, Slide-seq, and DBiT-seq) have significantly increased the amount of spatial transcriptomics data generated, thus driving the development of this field. Therefore, spatial transcriptomics research is of great significance for exploring the growth and development of organisms. However, limitations in sequencing technology mean that spatial transcriptomics data generally suffer from sparse gene expression signals, discontinuous spatial distribution, and numerous high-dimensional redundant features, which are important factors affecting spatial transcriptomics research.

[0003] Current spatial domain identification methods are mainly divided into two categories: manual annotation methods and AI-based automated methods. Manual annotation relies on biological professionals to analyze gene expression, morphological features, and spatial location point by point to determine the type of region to which a cell or spot belongs. While this method has some reference value, it requires high levels of expertise, has extremely low annotation efficiency, is costly, and has poor reproducibility, making it difficult to adapt to the analysis needs of high-throughput, large-scale spatial transcriptome data. AI-based automated methods mainly include non-spatial clustering methods and spatial clustering methods. Non-spatial clustering methods (such as K-means, Louvain, and Seurat) cluster solely based on gene expression data, completely ignoring spatial location information. This fails to reflect the spatial structural continuity of tissues, resulting in significant deviations between the identification results and the actual anatomical structure, and blurred spatial domain boundaries. Spatial clustering methods (such as SpaGCN, GraphST, STAIG, DeepST, stDCL, SEDR, and stlearn) attempt to integrate spatial proximity relationships with gene expression, using graph neural networks, autoencoders, and other models to learn spatial features, thus improving spatial consistency to some extent.

[0004] However, traditional spatial domain identification methods often suffer from low accuracy and high cost due to their reliance on manual annotation, high cost, and reliance on gene expression alone, which makes it difficult to effectively extract high-dimensional, sparse, and noisy spatial transcriptome features. Summary of the Invention

[0005] In order to solve the above-mentioned technical problems, a spatial transcriptomics spatial domain identification method and system based on dual contrast learning is provided, which can improve the accuracy of spatial domain identification and reduce costs.

[0006] A spatial domain identification method for spatial transcriptomics based on dual-contrast learning, the method comprising:

[0007] Acquire spatial transcriptome data, which includes gene expression data and spatial coordinate data; perform Gaussian smoothing on the gene expression data to obtain smoothed gene expression data; construct an initial adjacency matrix based on the spatial coordinate data; and prune the edges of the initial adjacency matrix according to the smoothed gene expression data to obtain an optimized adjacency matrix.

[0008] The smoothed gene expression data and the optimized adjacency matrix are input into the graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and the reconstruction loss is calculated.

[0009] The low-dimensional latent features are input into the multi-branch multilayer perceptron fusion module to obtain enhanced features;

[0010] Based on the smoothed gene expression data, pseudo-labels are generated, a region contrast learning task is constructed, and the region contrast loss is calculated; based on the optimized adjacency matrix and the enhanced features, a topology contrast learning task is constructed, and the topology contrast loss is calculated.

[0011] The reconstruction loss, region comparison loss, and topology comparison loss are weighted and fused into a total loss. The model parameters are then optimized using the total loss. The optimized model is then used for spatial domain recognition to obtain the spatial domain recognition result.

[0012] In one embodiment, the gene expression data is subjected to Gaussian smoothing to obtain smoothed gene expression data, including:

[0013] Based on the spatial coordinate data, calculate the spatial Euclidean distance between any two data points;

[0014] The Gaussian smoothing weights are calculated based on the spatial Euclidean distance, and the Gaussian smoothing radius is twice the average distance between the nearest neighbor of each data point.

[0015] The gene expression data is weighted and smoothed using the Gaussian smoothing radius to obtain smoothed gene expression data.

[0016] In one embodiment, an initial adjacency matrix is ​​constructed based on the spatial coordinate data, and the edges of the initial adjacency matrix are pruned according to the smoothed gene expression data to obtain an optimized adjacency matrix, including:

[0017] An initial adjacency matrix is ​​constructed based on the spatial coordinate data using the K-nearest neighbor method;

[0018] For each pair of data points with edges in the initial adjacency matrix, calculate the cosine distance between smoothed gene expressions;

[0019] For each data point, find the neighbor with the largest cosine distance and remove the edges to obtain the trimmed adjacency matrix;

[0020] The trimmed adjacency matrix is ​​then symmetricized to obtain the optimized adjacency matrix.

[0021] In one embodiment, the smoothed gene expression data and the optimized adjacency matrix are input into a graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and the reconstruction loss is calculated, including:

[0022] A two-layer graph convolutional network encoder is used to encode the smoothed gene expression data and the optimized adjacency matrix to output low-dimensional latent features.

[0023] A two-layer graph convolutional network decoder, symmetrical to the encoder structure, is used to reconstruct the gene expression of the low-dimensional latent features to obtain the reconstructed features.

[0024] The reconstruction loss is calculated based on the mean squared error between the gene expression data and the reconstructed features.

[0025] In one embodiment, the low-dimensional latent features are input into a multi-branch multilayer perceptron fusion module to obtain enhanced features, including:

[0026] The low-dimensional latent features are input into each parallel two-layer perceptron branch, and nonlinear transformations are performed through each perceptron branch to calculate the output features of each perceptron branch.

[0027] The output features are concatenated along the feature dimension to obtain a high-dimensional concatenated feature.

[0028] The high-dimensional stitched features are input into the projection layer, and then dimensionality reduction mapping is performed through a single-layer fully connected network to obtain enhanced features.

[0029] In one embodiment, pseudo-labels are generated based on the smoothed gene expression data, a region contrast learning task is constructed, and the region contrast loss is calculated, including:

[0030] K-means clustering was performed on the smoothed gene expression data to assign each data point to a cluster, thus obtaining a pseudo-label for each data point.

[0031] Using each data point as an anchor point, data points that are adjacent to the anchor point space and have the same pseudo-label in the optimized adjacency matrix are taken as positive samples, and data points that have different pseudo-labels from the anchor point are taken as negative samples.

[0032] Define a cosine similarity function to calculate the cosine similarity between the low-dimensional latent features of data points;

[0033] For the anchor point, the ratio of the sum of cosine similarities of the positive samples to the sum of cosine similarities of the negative samples is calculated, and the region contrast loss of the anchor point is obtained based on the ratio.

[0034] In one embodiment, a topology contrast learning task is constructed based on the optimized adjacency matrix and the enhanced features, and the topology contrast loss is calculated, including:

[0035] Data points connected by edges in the optimized adjacency matrix are identified as positive samples, and data points not connected by edges are identified as negative samples, thus constructing a topological comparison learning task.

[0036] According to the topological comparison learning task, the cosine similarity between any two data points is calculated based on the enhanced features, and then a mapping process is performed to obtain the mapped similarity.

[0037] Using the optimized adjacency matrix as the true label and the mapped similarity as the predicted value, the topological contrast loss is calculated.

[0038] In one embodiment, the reconstruction loss, region contrast loss, and topology contrast loss are weighted and fused into a total loss. The model parameters are then optimized using this total loss. The optimized model is used for spatial domain identification to obtain spatial domain identification results, including:

[0039] The total loss is obtained by weighted summing of the reconstruction loss, region comparison loss, and topology comparison loss.

[0040] With the goal of minimizing the total loss, the Adam optimizer is used to iteratively update the learnable parameters in the graph convolutional network encoder and the multi-branch multilayer perceptron fusion module until the preset maximum number of iterations is reached or the total loss converges, thus completing the model training.

[0041] The spatial transcriptome data to be analyzed is input into the trained model, and forward propagation is performed to obtain the low-dimensional latent features of each data point. Cluster analysis is then performed on the low-dimensional latent features to assign each data point to the corresponding spatial domain, thus obtaining the spatial domain identification result.

[0042] In one embodiment, the method further includes:

[0043] Identify the datasets with real labels and the datasets without real labels during model training;

[0044] The dataset with real labels was quantitatively evaluated using the adjusted RAND index and normalized mutual information.

[0045] The dataset without real labels was quantitatively evaluated using silhouette coefficient and DB index.

[0046] A spatial domain identification system for spatial transcriptomics based on dual-contrast learning, the system comprising:

[0047] The data processing module is used to acquire spatial transcriptome data, which includes gene expression data and spatial coordinate data; to perform Gaussian smoothing on the gene expression data to obtain smoothed gene expression data; to construct an initial adjacency matrix based on the spatial coordinate data; and to perform edge trimming on the initial adjacency matrix according to the smoothed gene expression data to obtain an optimized adjacency matrix.

[0048] The feature extraction and reconstruction module is used to input the smoothed gene expression data and the optimized adjacency matrix into the graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and to calculate the reconstruction loss.

[0049] The feature enhancement module is used to input the low-dimensional latent features into the multi-branch multilayer perceptron fusion module to obtain enhanced features;

[0050] The dual-contrast learning module is used to generate pseudo-labels based on the smoothed gene expression data, construct a region contrast learning task, and calculate the region contrast loss; and to construct a topology contrast learning task based on the optimized adjacency matrix and the enhanced features, and calculate the topology contrast loss.

[0051] The model optimization and spatial domain identification module is used to weight and fuse the reconstruction loss, region comparison loss, and topology comparison loss into a total loss, optimize the model parameters using the total loss, and use the optimized model to perform spatial domain identification to obtain the spatial domain identification result.

[0052] The aforementioned spatial domain identification method and system based on dual-contrast learning in spatial transcriptomics effectively alleviates the spatial discontinuity of gene expression signals, reduces sparse noise interference, and highlights spatial regional features by Gaussian smoothing of gene expression data. Edge pruning of the initial adjacency matrix based on smoothed gene expression eliminates false neighbors, improving the accuracy and rationality of the graph structure. The graph convolutional network encoder efficiently extracts low-dimensional latent features from high-dimensional gene expression data, reducing data dimensionality while preserving key information. The enhancement of latent features by combining a multi-branch multilayer perceptron fusion module enriches feature representation and improves the ability to capture fine-grained structures. Joint optimization through a dual-contrast learning mechanism consisting of region contrast learning and topology contrast learning simultaneously enhances feature cohesion within regions and distinguishes between regions, while reinforcing subtle differences in spatial topology. Weighted fusion of reconstruction loss, region contrast loss, and topology contrast loss during model training achieves an optimal balance between information preservation, region identification, and detail extraction, significantly improving the accuracy and robustness of spatial domain identification, effectively reducing noise interference, and more accurately identifying fine tissue structures and functional regions. Attached Figure Description

[0053] Figure 1 This is an application environment diagram of a spatial domain identification method for spatial transcriptomics based on dual contrast learning in one embodiment;

[0054] Figure 2 This is a flowchart illustrating a spatial domain identification method for spatial transcriptomics based on dual contrast learning in one embodiment.

[0055] Figure 3 This is a model framework diagram of STAMGC, which is applied to the spatial domain identification method of spatial transcriptomics based on dual contrast learning in one embodiment.

[0056] Figure 4 This is a schematic diagram illustrating the performance of STAMGC on the human breast cancer dataset.

[0057] Figure 5 This is a schematic diagram illustrating the performance of STAMGC on the mouse olfactory bulb dataset.

[0058] Figure 6 This is a schematic diagram illustrating the performance of STAMGC on a mouse neocortex dataset.

[0059] Figure 7 This is a schematic diagram illustrating the performance of STAMGC in multi-slice data;

[0060] Figure 8 This is a schematic diagram illustrating the performance of STAMGC in adjacent slice data;

[0061] Figure 9This is a schematic diagram comparing the results of ablation experiments;

[0062] Figure 10 This is a block diagram of a spatial domain identification system for spatial transcriptomics based on dual contrast learning in one embodiment;

[0063] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0065] The spatial domain identification method for spatial transcriptomics based on dual-contrast learning provided in this application can be applied to, for example... Figure 1 The application environment shown. For example... Figure 1 As shown, the application environment includes computer device 110. Computer device 110 can acquire spatial transcriptome data, which includes gene expression data and spatial coordinate data; it performs Gaussian smoothing on the gene expression data to obtain smoothed gene expression data; it constructs an initial adjacency matrix based on the spatial coordinate data, and then trims the edges of the initial adjacency matrix according to the smoothed gene expression data to obtain an optimized adjacency matrix; computer device 110 can input the smoothed gene expression data and the optimized adjacency matrix into a graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and calculate the reconstruction loss; computer device 110 can input the low-dimensional latent features into a multi-branch multilayer perceptron fusion module to obtain enhanced features; computer device 110 can generate pseudo-labels based on the smoothed gene expression data, construct a region contrast learning task, and calculate the region contrast loss; it can construct a topology contrast learning task based on the optimized adjacency matrix and enhanced features, and calculate the topology contrast loss; computer device 110 can weightedly fuse the reconstruction loss, region contrast loss, and topology contrast loss into a total loss, optimize the model parameters using the total loss, and use the optimized model for spatial domain recognition to obtain the spatial domain recognition result. Among them, computer equipment 110 may include, but is not limited to, various personal computers, laptops, smartphones, robots, unmanned aerial vehicles, tablets, and other devices.

[0066] In one embodiment, such as Figure 2 As shown, a spatial domain identification method for spatial transcriptomics based on dual contrastive learning is provided, including the following steps:

[0067] Step 202: Obtain spatial transcriptome data, which includes gene expression data and spatial coordinate data; perform Gaussian smoothing on the gene expression data to obtain smoothed gene expression data; construct an initial adjacency matrix based on the spatial coordinate data, and prune the edges of the initial adjacency matrix according to the smoothed gene expression data to obtain an optimized adjacency matrix.

[0068] First, the computer equipment can use the SCANPY package to filter the raw gene expression counts, removing genes with low total expression levels, small distribution ranges, and certain specific genes. Then, 3000 highly variable genes were selected for analysis. Next, the gene expression counts for each point were normalized, logarithmically transformed, and standardized to unit variance.

[0069] First, the computer device can merge the gene expression matrices of different slices by preserving the shared gene sets between them. For slices containing inherently different gene types, such as newt brain slices at different developmental stages, the union of gene sets between slices is used to maintain the integrity of all gene types. The gene expression matrices of different slices are then vertically spliced ​​to construct a matrix. : ; slice 1 to The gene expression matrices are respectively represented as ,all The total number of points in each slice is used This indicates that the number of gene types after splicing is used... Indicates; slice 1 to The spatial coordinates are respectively expressed as Vertical splicing forms a matrix : .

[0070] In one embodiment, a spatial domain identification method for spatial transcriptomics based on dual contrastive learning may further include a Gaussian smoothing process, specifically including: calculating the spatial Euclidean distance between any two data points based on spatial coordinate data; calculating Gaussian smoothing weights based on the spatial Euclidean distance, and using twice the average distance between the nearest neighbor of each data point as the Gaussian smoothing radius; and using the Gaussian smoothing radius to perform weighted smoothing on the gene expression data to obtain smoothed gene expression data.

[0071] Computer equipment can apply Gaussian smoothing to the gene expression matrix to obtain a smoothed gene expression matrix. Specifically, [the following text is incomplete and requires further context: "point"] The smoothed gene expression values ​​are based on points The distances to all other points are weighted and summed. This process smooths sparse gene expression, improves its continuity, and establishes a spatially continuous expression pattern. It also highlights regions with dense and high gene expression, while diluting sparse or low-expression points by incorporating surrounding points, thereby reducing the impact of outliers and emphasizing regional characteristics. and points Gaussian smoothing weights between The calculation formula is: The weight matrix is ​​used in this context. In other words, the Gaussian smoothing radius is expressed as... This is expressed as twice the average distance between each point and its nearest neighbor. Point spatial coordinates, This describes the calculation of vector norm. The smoothed gene expression matrix. The weighted calculation formula is: ;in, Represents the gene expression matrix, with symbols This represents matrix multiplication.

[0072] In one embodiment, a spatial transcriptomics spatial domain identification method based on dual contrastive learning may further include an adjacency graph construction process, specifically including: constructing an initial adjacency matrix based on spatial coordinate data using the K-nearest neighbor method; for each pair of data points with edges in the initial adjacency matrix, calculating the cosine distance between smoothed gene expressions; for each data point, finding the neighbor with the largest cosine distance and removing the edge to obtain a pruned adjacency matrix; and symmetricizing the pruned adjacency matrix to obtain an optimized adjacency matrix.

[0073] The smoothed gene expression data was then used to construct an adjacency matrix. The adjacency graph for each slice was obtained by removing edges between regions with significantly different gene expression from the initial adjacency matrix, which was constructed using the k-nearest neighbor method based on spatial coordinates. Finally, the computer device merged the adjacency matrices of each slice diagonally to form an adjacency matrix used for training.

[0074] For each slice, the computer device can construct an initial adjacency matrix based on the spatial coordinates of each point using the k-nearest neighbor method. Specifically, in, Let represent an edge between points i and j, and N represent the total number of data points. Next, the computer can calculate the smoothed cosine distance of gene expression between each pair of connected points in the initial adjacency matrix, using the following formula: That is, if there is an edge between point i and point j in the initial adjacency matrix, This represents the cosine distance between the smoothed gene expression of these two points. Finally, the edges corresponding to the maximum cosine distance for each point are removed. The calculation formula is: in, Representing point j, Represents the initial adjacency matrix The set of neighboring points of midpoint i.

[0075] Since the adjacency graph is undirected, the adjacency matrix must be symmetric. Therefore, the computer device also needs to perform symmetry processing; the edge between points i and j is only removed when they are neighbors with the lowest cosine similarity in the smoothed gene expression, indicating a significant difference in gene expression between the two points. This edge removal operation aims to reduce false neighbors of anchor points, thereby minimizing the interference from points with different gene characteristics during anchor point optimization. The K value is typically between 3 and 6; if the data comes from a 10xVisium platform, K is set to 6; if the data points are dense, K is set to 3; by default, K is set to 5.

[0076] For multi-slice tasks, the computing device can integrate the adjacency matrix of each slice along the diagonal, calculated as follows: in, This represents the final adjacency matrix. arrive It is the adjacency matrix of each individual slice.

[0077] Step 204: Input the smoothed gene expression data and the optimized adjacency matrix into the graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and calculate the reconstruction loss.

[0078] In one embodiment, a spatial transcriptomics domain identification method based on dual-contrast learning can be applied to the STAMGC framework, the structure of which is as follows: Figure 3 As shown, a dual-contrast learning framework based on graph convolutional networks is presented. It utilizes a joint optimization model of region contrastive learning and topological contrastive learning to effectively reduce noise in spatial domain recognition and enhance the extraction of detailed features. In this application, Gaussian smoothing, initially developed in image processing, is introduced for the first time into ST data, proposing a novel perspective to alleviate the spatial discontinuity of gene expression signals.

[0079] like Figure 3As shown, the STAMGC workflow is roughly divided into three stages: data preparation, model training, and downstream task analysis. The data preparation stage includes: STAMGC integrating gene expression and spatial information from different slices; then performing routine preprocessing on the integrated gene expression; for single-slice tasks, the integration step is skipped, and gene expression is preprocessed directly; next, to better combine gene expression with spatial information and ensure that gene expression exhibits a continuous spatial pattern, Gaussian smoothing is applied to spatial distances to obtain smoothed gene expression; the smoothed gene expression is then used to construct an adjacency matrix; the adjacency graph of each slice is obtained by removing edges between regions with significantly different smoothed gene expression from the initial adjacency matrix, which is constructed based on spatial coordinates using the k-nearest neighbor method; finally, the adjacency matrices of each slice are merged along the diagonal to form the adjacency matrix used for training.

[0080] The model training phase can include a model architecture comprising a GCN encoder, a GCN decoder, and a multi-branch multilayer perceptron (MLP) fusion module. In this architecture, the GCN autoencoder processes preprocessed gene expression and adjacency matrices to extract low-dimensional latent features and reconstructed features. To enhance the expression of these latent features, a multi-branch MLP fusion module is introduced. Traditionally, the mean squared error (MSE) loss function is used to minimize the difference between the reconstructed feature H and the original feature X, thereby maximizing information retention in the latent space. In STAMGC's topological contrastive learning, fine-grained features in ST data are amplified and subtle differences within small-scale regions are revealed by minimizing the binary cross-entropy (BCE) loss between the similarity matrix and adjacency matrix of the enhanced latent feature expression. In region contrastive learning, pseudo-labels obtained from k-means clustering based on smoothed gene expression are used to divide positive and negative samples. By optimizing the region contrastive loss, latent features within the same cluster are enhanced, while the distinctions between clusters are further strengthened.

[0081] Downstream task analysis can include: using data derived from latent features during model training; downstream tasks include spatial domain identification, gene distribution patterns, multi-slice processing, and new region discovery; these downstream tasks not only validate model performance but also reveal new biological insights.

[0082] In one embodiment, a spatial domain identification method for spatial transcriptomics based on dual contrastive learning may further include a feature reconstruction and loss calculation process. The specific process includes: using a two-layer graph convolutional network encoder to encode the smoothed gene expression data and the optimized adjacency matrix to output low-dimensional latent features; using a two-layer graph convolutional network decoder symmetrical to the encoder structure to reconstruct the gene expression of the low-dimensional latent features to obtain reconstructed features; and calculating the reconstruction loss based on the mean squared error between the gene expression data and the reconstructed features.

[0083] The computer device constructs positive and negative samples through region-contrast learning and topological-contrast learning respectively, and optimizes model performance using a dual-contrast learning mechanism. The encoded latent features can capture valuable information from spatial transcriptome data. Specifically, the latent feature Z is obtained through a two-layer GCN encoder using an integrated adjacency graph G(X, A), and the reconstructed feature H is obtained through a two-layer GCN decoder. The inference formula for the l-th layer of the graph convolutional network is: in, For the first The output of the layer GCN, express Activation function; Representing the adjacency matrix The degree matrix; Representing the adjacency matrix Add a self-loop; and They represent the first The weight matrix and bias matrix of the convolutional layer in the layer diagram. The low-dimensional latent features output by the encoder are represented as follows. The reconstructed features output by the decoder are represented as

[0084] To preserve as much useful information from spatial transcriptome (ST) data as possible in the latent features, this is achieved by minimizing the difference between the original features and the reconstructed features. The MSE loss function is used to achieve this optimization objective and is defined as the reconstruction loss in the STAMGC framework. : in, Represents the reconstructed features of the i-th point. This represents the original feature of the i-th point.

[0085] Step 206: Input the low-dimensional latent features into the multi-branch multilayer perceptron fusion module to obtain enhanced features.

[0086] Prior to topological contrastive learning, computer devices introduced a multi-branch MLP fusion module to capture diverse representations.

[0087] In one embodiment, a spatial domain identification method for spatial transcriptomics based on dual contrastive learning may further include a feature enhancement process, specifically including: inputting low-dimensional latent features into each parallel two-layer perceptron branch, performing nonlinear transformations through each perceptron branch, and calculating the output features of each perceptron branch; concatenating the output features along the feature dimension to obtain high-dimensional concatenated features; inputting the high-dimensional concatenated features into a projection layer, and performing dimensionality reduction mapping through a single-layer fully connected network to obtain enhanced features.

[0088] The multi-branch multilayer perceptron fusion module consists of four branches, each containing a two-layer MLP followed by a projection layer. Each branch's MLP aims to learn different patterns in the data. Features learned from the four branches are concatenated before module processing to enhance feature representation. Subsequently, the concatenated high-dimensional features are dimensionality-reduced through the projection layer to reduce redundancy and computational complexity, preparing them for the next processing step.

[0089] This multi-branch MLP fusion module effectively enhances the representation of latent features, which aligns with the goal of topological contrastive learning to reveal subtle and specific expressions and emphasize detailed features. Therefore, it has also been applied to facilitate topological contrastive learning of latent features. Specifically, the computation formula for single-branch MLP is: The high-dimensional connectivity features are projected into output features M through a projection layer: in, This indicates the first branch in the multi-branch MLP fusion module. One branch, Indicates the first The output of each branch; since each branch consists of two layers of MLP. and These represent the weight matrices for the two layers, respectively. and Corresponding to the bias matrix; activation function The ReLU function is used; for the projection layer of the fusion module, and These represent the weight matrix and the bias matrix, respectively.

[0090] Step 208: Generate pseudo-labels based on smoothed gene expression data, construct a region contrast learning task, and calculate the region contrast loss; construct a topology contrast learning task based on the optimized adjacency matrix and enhanced features, and calculate the topology contrast loss.

[0091] In one embodiment, a spatial transcriptomics domain identification method based on dual contrastive learning may further include a region contrastive learning process, specifically comprising: performing K-means clustering on smoothed gene expression data, assigning each data point to a cluster to obtain a pseudo-label for each data point; using each data point as an anchor point, identifying data points that are spatially adjacent to the anchor point in the optimized adjacency matrix and have the same pseudo-label as positive samples, and data points with different pseudo-labels from the anchor point as negative samples; defining a cosine similarity function to calculate the cosine similarity between the low-dimensional latent features of the data points; and for the anchor point, calculating the ratio of the sum of the cosine similarities of positive samples to the sum of the cosine similarities of negative samples, and obtaining the region contrastive loss of the anchor point based on the ratio.

[0092] In region comparison learning, the initial step is to smooth the gene expression matrix using Gaussian smoothing. K-means clustering is performed to obtain pseudo-labels for each point. Since the smoothed gene expression is the result of Gaussian smoothing based on spatial location, points with similar spatial proximity will exhibit similar smoothed gene expression patterns, causing them to be assigned the same pseudo-label after clustering. Therefore, points sharing the same pseudo-label form a region. Next, the computer can select positive and negative samples: points adjacent to the anchor point are designated as positive samples, while points with different pseudo-labels from the anchor point are classified as negative samples. By reducing the differences between positive samples and increasing the differences between negative samples, the consistency of point features within the same region and the discriminativeness of point features between different regions can be promoted, enhancing region identification capabilities and making the feature representation in the latent space clearer.

[0093] The specific expression of the region contrast loss function is as follows: in, Point The set of neighbors in adjacency matrix A, where Represents point j; This represents the pseudo-label of point k. Region contrastive learning enhances cohesion within groups, weakens coupling between groups, and reduces the impact of anomalous expression.

[0094] In one embodiment, a spatial transcriptomics spatial domain identification method based on dual contrastive learning may further include a topological contrastive learning process. Specifically, this process includes: identifying data points connected by edges in the optimized adjacency matrix as positive samples and unconnected data points as negative samples, thus constructing a topological contrastive learning task; calculating the cosine similarity between any two data points based on enhanced features according to the topological contrastive learning task, and performing mapping processing to obtain the mapped similarity; and calculating the topological contrastive loss using the optimized adjacency matrix as the true label and the mapped similarity as the predicted value.

[0095] In topological contrastive learning, the BCE loss function is applied to the features enhanced by the multi-branch MLP fusion module. The loss function here is defined as topological contrastive loss. Contrastive learning distinguishes positive and negative samples from the perspective of the topological adjacency graph. Specifically, adjacent points are considered positive samples, and non-adjacent points are considered negative samples. In this way, the distance between an anchor point and its adjacent points can be reduced, while the distance between an anchor point and non-adjacent points can be increased. Topological contrastive learning plays a key role in enhancing fine-grained features, enabling the model to reveal subtle and hard-to-detect features in the data, thereby improving the model's accuracy. Furthermore, when constructing the adjacency graph, removing false neighbors ensures that adjacent points have small spatial distances and similar gene expression, while non-adjacent points are either spatially far apart or have significantly different gene expression, further enhancing the effectiveness of topological contrastive learning. In the STAMGC framework, the topological contrastive loss used for topological contrastive learning is defined as: Among them, the function Calculate the cosine similarity between two vectors; if This enhances the point. and points In features The similarity of features is enhanced if (A_{ij}=0), but weakened if (A_{ij}=0). Topological contrastive learning can highlight fine-grained features, thereby improving the feature extraction process and the representation of these features.

[0096] Step 210: The reconstruction loss, region contrast loss, and topology contrast loss are weighted and fused into a total loss. The model parameters are optimized using the total loss. The optimized model is then used for spatial domain identification to obtain the spatial domain identification result.

[0097] In one embodiment, a spatial transcriptomics spatial domain identification method based on dual contrastive learning may further include a model optimization and spatial domain identification process. Specifically, this process includes: weighted summation of reconstruction loss, region contrastive loss, and topological contrastive loss to obtain a total loss; using the Adam optimizer to iteratively update the learnable parameters in the graph convolutional network encoder and the multi-branch multilayer perceptron fusion module with the goal of minimizing the total loss, until a preset maximum number of iterations is reached or the total loss converges, thus completing model training; inputting the spatial transcriptomics data to be analyzed into the trained model, forward propagating to obtain low-dimensional latent features for each data point, performing cluster analysis on the low-dimensional latent features, and assigning each data point to its corresponding spatial domain to obtain the spatial domain identification result.

[0098] The gene expression features of each sequencing spot (spot), optimized through region-contrast learning, i.e., the low-dimensional latent features, exhibit high cohesion and low coupling, effectively avoiding the problem of low-dimensional latent features being scattered in complete topological contrastive learning. Furthermore, topological contrastive learning can further refine the small-scale low-dimensional latent features constructed based on region-contrast learning. Region-contrast learning improves the robustness and anti-interference ability of feature representations in the latent space, while topological contrastive learning focuses on enhancing key details. In addition to the basic reconstruction loss, the STAMGC model utilizes dual contrastive learning to jointly optimize the objective.

[0099] The learnable parameters are set by default as follows: the encoder input layer, hidden layer, and output layer are 3000, 128, and 64 dimensions respectively, and the decoder is symmetrical to them; each of the four perceptrons outputs 32 dimensions, and the projection layer outputs 64 dimensions; the Adam optimizer is used, and the learning rate is... The weight decays to dropout=0.1; the default number of iterations is 300. The coefficient ratios of the three loss functions can be adjusted appropriately depending on the different datasets.

[0100] In this embodiment, the computer device can perform a weighted summation of the calculated reconstruction loss, region contrast loss, and topology contrast loss according to preset hyperparameter weights to obtain the total loss of model training. The total loss function is: in, , and These are hyperparameters used to balance the proportion of each loss function in the total loss function during training, thereby achieving the optimization objective. Indicates the reconstruction loss; Indicates regional contrast loss; This represents the topological contrast loss.

[0101] The computer device can optimize by minimizing the total loss, using an optimizer to iteratively update all trainable parameters in the model, including: graph convolutional encoder, graph convolutional decoder, multi-branch MLP fusion module, projection layer, and the weights and biases of each contrastive learning branch. By continuously calculating the loss through forward propagation and updating the gradient through backpropagation, the model gradually converges, ultimately yielding the optimized model.

[0102] Finally, the computer equipment can input the spatial transcriptome data to be analyzed into the optimized model to extract stable low-dimensional latent features; cluster the low-dimensional latent features to obtain the category of each spot; combine the spatial location information with the clustering results to complete the spatial domain division and output the final spatial domain identification result. The performance of the model can also be evaluated through comparative experiments, ablation experiments, etc.

[0103] In this embodiment, the data used comes from latent features during the model training process, while downstream tasks include spatial domain identification, gene distribution patterns, multi-slice processing, and new region discovery. These downstream tasks are not only used to validate the model's performance but also to reveal new biological insights.

[0104] In one embodiment, a spatial domain identification method for spatial transcriptomics based on dual contrastive learning may further include a quantitative evaluation process, specifically including: determining the dataset with real labels and the dataset without real labels during model training; performing quantitative evaluation on the dataset with real labels using adjusted RAND index and normalized mutual information; and performing quantitative evaluation on the dataset without real labels using silhouette coefficient and DB index.

[0105] Spatial transcriptomics research largely relies on the recognition performance of the spatial domain. Here, the recognition performance of the spatial domain is used as an evaluation of the effectiveness of the features extracted by the model. The extracted latent features are clustered. For datasets with real labels, the adjusted Rand index (ARI) and normalized mutual information (NMI) are used for quantitative evaluation. For datasets without real labels, the silhouette coefficient (SC) and Davies-Bouldin index (DB) are used for quantitative evaluation of clustering performance. There is also a visual qualitative evaluation.

[0106] Specifically, in this embodiment, four commonly used metrics can be used for evaluation: Adjusted Rand Index (ARI), Normalized Mutual Information (NMI), Silhouette Coefficient (SC), and Davies-Bouldin Index (DB). The formulas for these metrics are described as follows: ; ; where TP represents a true positive, TN represents a true negative, FP represents a false positive, and FN represents a false negative; ; ; ; Where U represents the set of clustering results assigned, V represents the i-th cluster; V represents the set of actual label assignments. Indicates the j-th cluster; This represents the number of elements in the set being calculated; n represents the total number of data points; C represents the number of clusters obtained from C-clustering; and K represents the number of clusters with the true labels. in, Indicates intra-cluster dissimilarity, where point i is related to its cluster. The average distance to all other points in the middle; represents the dissimilarity between clusters, and is the average distance between point i and all points in the nearest neighbor cluster Ck (k≠i); in, The discreteness of cluster i is usually defined as the distance from any point in cluster i to its centroid. The average distance; Let i be the centroid of cluster i. With the centroid of cluster j The distance between them.

[0107] In one embodiment, to validate a spatial domain identification method based on dual-contrast learning in spatial transcriptomics, a human breast cancer dataset from the 10xVisium platform was analyzed. This dataset exhibits significant tumor specificity and a complex tissue microenvironment. First, the performance of seven benchmark models was compared using expert-annotated data, such as… Figure 4 As shown in figure a. For manually annotated datasets, quantitative evaluation was performed using the Adjusted Rand Index (ARI) and Normalized Mutual Information (NMI) metrics. STAMGC achieved the highest performance, with an ARI of 0.65 and an NMI of 0.71, showing the strongest consistency with manual annotation, as shown in figure a. Figure 4 As shown in c, it not only exhibits minimal intra-cluster noise but also successfully identifies the complete IDC_2 in invasive ductal carcinoma (IDC). Figure 4 (cyan area in b) and IDC_4 ( Figure 4 The orange area in b) and its boundaries are as follows: Figure 4 As shown in b. In the baseline model, only stlearn fully recognized the IDC_2 and IDC_4 regions, but it included too much noise when recognizing other regions, such as... Figure 4 As shown in d.

[0108] Furthermore, the analysis focused on Cluster 6 identified by STAMGC, which corresponds to the epithelial cell distribution hypothesized by Yahui L et al. First, differential expression analysis revealed significant transcriptional differences between Cluster 6 and other regions, showcasing the top ten differentially expressed genes (>0.25 log2FoldChange, denoted as log Fold Change; adjusted p-value <0.05), such as... Figure 4 As shown in e. Subsequently, gene ontology (GO) enrichment analysis was performed on the significantly upregulated genes in Cluster 6, revealing strong associations with supramolecular fibrous tissue, epidermal development, and glucose metabolism processes, such as Figure 4 As shown in f. For further investigation, several representative upregulated genes in Cluster 6 were visualized, including the cancer prognostic marker KRT14, the epithelial cell-specific marker S100A2, and MMP7, which is involved in extracellular matrix degradation, such as... Figure 4As shown in g. Furthermore, a literature review indicates that the clinically relevant biomarker PKP1 is also enriched in Cluster 6. In summary, these molecular and functional characteristics suggest that Cluster 6 represents a biologically significant epithelial-associated region and provides converging evidence for predicting the potential direction of cancer cell spread.

[0109] In summary, STAMGC not only identifies regions consistent with biological annotations in complex human breast cancer tissue sections, but also reveals finer structural details.

[0110] In one embodiment, a widely used mouse olfactory bulb dataset from a high-resolution Stereo-seq sequencing platform was used, which demonstrates the layered tissue structure for comparative evaluation of model performance. Initially, layered regions annotated on DAPI-stained images by Fu et al. were used as a reference. These layered regions include the olfactory nerve layer (ONL), bulbosome layer (GL), outer plexiform layer (EPL), olfactory bulb macrocell layer (MCL), inner plexiform layer (IPL), granule cell layer (GCL), and forward-moving canal (RMS), such as... Figure 5 As shown in Figure a, the silhouette coefficient (SC) and Davies-Bouldin index (DB) are used to quantitatively evaluate the clustering performance of latent features in datasets without manual annotation. In comparison with seven benchmark models, STAMGC achieved the highest SC value of 0.28 and DB index of 1.30, while only GraphST achieved a lower DB value, as shown in Figure a. Figure 5 As shown in c. Further analysis of the spatial clustering visualization results shows that STAMGC successfully identified the layered structure of the mouse olfactory bulb tissue, as shown in Figure c. Figure 5 As shown in b. Among the seven benchmark models, only stlearn, SpaGCN, SEDR, and GraphST can identify hierarchical structures, such as Figure 5 As shown in d, only GraphST detected the most layers with the least noise. However, it failed to distinguish between GL and EPL layers, and its UMAP visualization was more dispersed than STAMGC. Next, the clustering results of STAMGC were validated using region-specific marker genes, as shown... Figure 5 As shown in Figure e, the identified regions correspond to the spatial distribution of these marker genes. For example, the gene Nrgn, associated with neurological diseases, shows strong expression in the GCL, suggesting a potential role for this region in cognitive function. Overall, the STAMGC model demonstrates strong capabilities in handling high-resolution mouse olfactory bulb datasets and exhibits superior performance in capturing spatial organizational structures.

[0111] In one embodiment, the mouse neocortex ST dataset from the Slide-seqV2 sequencing platform was used to demonstrate that STAMGC can more accurately characterize mouse hippocampal tissue. As a reference standard, the coronal Allen brain atlas was used, which provides a detailed depiction of the structural anatomy of the mouse brain, marking the CA1 and CA3 subregions of the Cornu Ammonis (CA) region, and the dentate gyrus (DG) region of the hippocampus, as shown below. Figure 6 As shown in figure a, STAMGC successfully identified these three calibration regions, as follows. Figure 6 As shown in b. However, among the baseline models, only STAIG and GraphST can distinguish between the CA and DG regions, while other models cannot further distinguish between the CA1 and CA3 subregions, such as... Figure 6 As shown in c. Next, the spatial clustering results of STAMGC were further validated using marker genes, revealing that the CA region, CA1 and CA2 subregions, and DG region corresponded to areas of high marker gene expression in these regions, as shown in c. Figure 6 As shown in d. By using the Allen brain atlas and marker genes as references and comparing with benchmark models, STAMGC demonstrates superior performance on the mouse neocortex dataset generated by the Slide-seqV2 sequencing platform.

[0112] STAMGC can process multiple tissue slices simultaneously. The following verification was performed using the human dorsolateral prefrontal cortex (DLPFC) dataset from the 10xVisium platform and the salamander brain dataset from the Stereo-seq sequencing platform.

[0113] In the first example, DLPFC slices 151507 and 151508 were selected, with manual annotations used as the reference standard for evaluation, such as... Figure 7 As shown in figure a, STAMGC exhibits the highest performance compared to the baseline model, with an ARI of 0.54 and an NMI of 0.66. Figure 7 As shown in b. In spatial clustering visualization, STAMGC accurately captures the hierarchical structure of the organization while maintaining minimal noise within the identified regions, such as Figure 7 As shown in c.

[0114] Next, we explore the brain tissue structure of salamanders at different developmental stages. Although these two slices are at different developmental stages, the same spatial domains show corresponding relationships between the slices, such as... Figure 7 As shown in d. Since DeepST does not support processing tissue slices with different gene sets, only seven models, including STAMGC, were included in the comparison. In the spatial clustering visualization of these seven models, only STAMGC, stlearn, and SEDR were able to identify the region correspondence between two slices, as shown in d. Figure 7 As shown in f. In the quantitative evaluation, STAMGC showed the highest performance, with an ARI of 0.55 and an NMI of 0.69, as shown in f. Figure 7 As shown in e.

[0115] In summary, STAMGC is capable of processing continuous tissue sections as well as sections from different developmental stages. Comprehensive qualitative and quantitative analyses further demonstrate the overall robust performance of the STAMGC model.

[0116] In one embodiment, mouse brain slices from the 10xVisium platform were used as experimental data to demonstrate that STAMGC can integrate adjacent tissue slices and identify complete tissue structures. In the spatial clustering visualization, the features of the regions annotated in red boxes are highlighted, particularly the hippocampus and cerebellar regions in the stitched tissue slices. Figure 8 a) and the sagittal Allen map of the mouse brain ( Figure 8 b). STAMGC correctly identified these three regions and further distinguished the CA and DG subregions of the hippocampus, such as Figure 8 As shown in d. However, in the baseline models, DeepST failed to integrate adjacent slices, stDCL did not identify any features, STAIG, stlearn, and SpaGCN exhibited significant noise, SEDR failed to correctly distinguish between the CA and DG subregions, and while GraphST could correctly distinguish hippocampal subregions, it failed to identify cerebellar regions, such as... Figure 8 As shown in e. Next, in the quantitative comparison of clustering metrics, STAMGC outperforms the baseline model with SC of 0.34 and DB of 1.11, as shown in... Figure 8 As shown in c. Furthermore, the spatial clustering results of STAMGC were further validated by visualizing the spatial expression of marker genes in the mouse brain, such as... Figure 8 As shown in f, Pcp4 is enriched in clusters 5, 10, and 19 identified by STAMGC, while Mbp corresponds to clusters 16 and 24. These observations indicate that STAMGC maintains spatial continuity between slice boundaries. Furthermore, C1ql2 and Hpca exhibit consistent expression patterns in the DG and CA regions, respectively, confirming that the spatial domains identified by STAMGC accurately correspond to these regions.

[0117] In summary, the STAMGC model significantly outperforms the baseline model in clustering performance, recognition accuracy, and the ability to handle adjacent slices. This capability helps integrate multiple slices and provides valuable insights into the overall organizational structure.

[0118] In one embodiment, an ablation experiment was conducted on the spatial domain identification method of spatial transcriptomics based on dual contrastive learning proposed in this application, applied to the STAMGC framework. The aim was to evaluate the contributions of region contrastive learning, topological contrastive learning, and the multi-branch MLP fusion module to model optimization within the STAMGC framework, using anterior and posterior slices of the mouse brain as an example. To investigate these factors, three STAMGC variants were designed: STAMGC-w / o_r-con (removing only region contrastive learning), STAMGC-w / o_t-con (removing only topological contrastive learning), and STAMGC-w / o_m-mlp (removing only the multi-branch MLP fusion module).

[0119] First, the STAMGC model was used as a control group, such as Figure 9 As shown in Figure a. The clustering performance comparison results show that the STAMGC-w / o_m-mlp model achieved the best results, followed by the STAMGC model, then the STAMGC-w / o_t-con model, and finally the STAMGC-w / o_r-con model, as shown in Figure a. Figure 9 As shown in b. In the visualization analysis, the STAMGC-w / o_m-mlp model, considered to have the best clustering performance, was first analyzed. This model failed to distinguish between the CA and DG regions of the mouse hippocampus. The STAMGC-w / o_t-con model also failed to completely distinguish between the CA and DG regions and showed low accuracy in recognizing mouse cerebellar regions. Finally, the STAMGC-w / o_r-con model was able to recognize all CA and DG regions, but its clustering performance decreased due to higher noise levels, such as... Figure 9 As shown in c. These comparisons conclude that models with excellent clustering performance tend to have lower recognition accuracy, while models with high recognition accuracy tend to have poor clustering performance. Clearly, STAMGC achieves the optimal balance between clustering performance and recognition accuracy through dual contrastive learning. Furthermore, in topological contrastive learning, the multi-branch MLP fusion module enhances the representation of the latent space, aiming to extract subtle features that are difficult to detect.

[0120] Experimental results show that STAMGC outperforms existing methods in comprehensive evaluations across multiple datasets. Furthermore, STAMGC not only identifies finer structures in the mouse brain but also provides new insights for human breast cancer research.

[0121] It should be understood that although the steps in the flowchart above are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart above may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0122] In one embodiment, such as Figure 10 As shown, a spatial domain identification device for spatial transcriptomics based on dual-contrast learning is provided, comprising: a data processing module 1010, a feature extraction and reconstruction module 1020, a feature enhancement module 1030, a dual-contrast learning module 1040, and a model optimization and spatial domain identification module 1050, wherein:

[0123] Data processing module 1010 is used to acquire spatial transcriptome data, which includes gene expression data and spatial coordinate data; Gaussian smoothing is performed on the gene expression data to obtain smoothed gene expression data; an initial adjacency matrix is ​​constructed based on the spatial coordinate data; and edge trimming is performed on the initial adjacency matrix according to the smoothed gene expression data to obtain an optimized adjacency matrix.

[0124] The feature extraction and reconstruction module 1020 is used to input smoothed gene expression data and optimized adjacency matrix into the graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and to calculate the reconstruction loss.

[0125] Feature enhancement module 1030 is used to input low-dimensional latent features into the multi-branch multilayer perceptron fusion module to obtain enhanced features;

[0126] The dual-contrast learning module 1040 is used to generate pseudo-labels based on smoothed gene expression data, construct a region contrast learning task, and calculate the region contrast loss; it is also used to construct a topology contrast learning task based on the optimized adjacency matrix and enhanced features, and calculate the topology contrast loss.

[0127] The model optimization and spatial domain identification module 1050 is used to weight and fuse the reconstruction loss, region comparison loss and topology comparison loss into a total loss. The model parameters are optimized through the total loss, and the optimized model is used to perform spatial domain identification to obtain the spatial domain identification result.

[0128] In one embodiment, the data processing module 1010 is further configured to calculate the spatial Euclidean distance between any two data points based on the spatial coordinate data; calculate the Gaussian smoothing weight based on the spatial Euclidean distance, and use twice the average distance between the nearest neighbor of each data point as the Gaussian smoothing radius; and use the Gaussian smoothing radius to perform weighted smoothing on the gene expression data to obtain smoothed gene expression data.

[0129] In one embodiment, the data processing module 1010 is further configured to construct an initial adjacency matrix based on spatial coordinate data using the K-nearest neighbor method; for each pair of data points in the initial adjacency matrix that have an edge, calculate the cosine distance between smoothed gene expressions; for each data point, find the neighbor with the largest cosine distance and remove the edge to obtain a pruned adjacency matrix; and perform symmetry processing on the pruned adjacency matrix to obtain an optimized adjacency matrix.

[0130] In one embodiment, the feature extraction and reconstruction module 1020 is further configured to use a two-layer graph convolutional network encoder to encode the smoothed gene expression data and the optimized adjacency matrix to output low-dimensional latent features; use a two-layer graph convolutional network decoder symmetrical to the encoder structure to reconstruct the gene expression of the low-dimensional latent features to obtain reconstructed features; and calculate the reconstruction loss based on the mean square error between the gene expression data and the reconstructed features.

[0131] In one embodiment, the feature enhancement module 1030 is further configured to input low-dimensional latent features into each parallel two-layer perceptron branch, perform nonlinear transformations through each perceptron branch, calculate the output features of each perceptron branch, concatenate the output features along the feature dimension to obtain high-dimensional concatenated features, and input the high-dimensional concatenated features into the projection layer, perform dimensionality reduction mapping through a single-layer fully connected network to obtain enhanced features.

[0132] In one embodiment, the dual-contrast learning module 1040 is further configured to perform K-means clustering on the smoothed gene expression data, assigning each data point to a cluster to obtain a pseudo-label for each data point; using each data point as an anchor point, data points that are adjacent to the anchor point space in the optimized adjacency matrix and have the same pseudo-label are designated as positive samples, while data points with different pseudo-labels from the anchor points are designated as negative samples; a cosine similarity function is defined to calculate the cosine similarity between the low-dimensional latent features of the data points; for the anchor point, the ratio of the sum of the cosine similarities of the positive samples to the sum of the cosine similarities of the negative samples is calculated, and the region contrast loss of the anchor point is obtained based on the ratio.

[0133] In one embodiment, the dual contrast learning module 1040 is further used to find data points connected by edges in the optimized adjacency matrix as positive samples and data points not connected by edges as negative samples to construct a topological contrast learning task; according to the topological contrast learning task, the cosine similarity between any two data points is calculated based on the enhanced features and mapped to obtain the mapped similarity; the topological contrast loss is calculated using the optimized adjacency matrix as the true label and the mapped similarity as the predicted value.

[0134] In one embodiment, the model optimization and spatial domain identification module 1050 is further used to obtain the total loss by weighted summation of reconstruction loss, region contrast loss, and topology contrast loss; with the goal of minimizing the total loss, the Adam optimizer is used to iteratively update the learnable parameters in the graph convolutional network encoder and the multi-branch multilayer perceptron fusion module until the preset maximum number of iterations or the total loss converges, thus completing model training; the spatial transcriptome data to be analyzed is input into the trained model, forward propagation is performed to obtain the low-dimensional latent features of each data point, and cluster analysis is performed on the low-dimensional latent features to assign each data point to the corresponding spatial domain, thus obtaining the spatial domain identification result.

[0135] In one embodiment, an evaluation module is further included to determine the dataset with real labels and the dataset without real labels during model training; to quantitatively evaluate the dataset with real labels using the adjusted RAND index and normalized mutual information; and to quantitatively evaluate the dataset without real labels using the silhouette coefficient and DB index.

[0136] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When executed by the processor, the computer program implements a spatial domain identification method for spatial transcriptomics based on dual-contrast learning. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0137] Those skilled in the art will understand that Figure 11The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0138] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of a spatial transcriptomics spatial domain identification method based on dual contrastive learning.

[0139] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of a spatial transcriptomics spatial domain identification method based on dual contrastive learning.

[0140] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0141] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0142] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A spatial domain identification method for spatial transcriptomics based on dual-contrast learning, characterized in that, The method includes: Acquire spatial transcriptome data, which includes gene expression data and spatial coordinate data; perform Gaussian smoothing on the gene expression data to obtain smoothed gene expression data; construct an initial adjacency matrix based on the spatial coordinate data; and prune the edges of the initial adjacency matrix according to the smoothed gene expression data to obtain an optimized adjacency matrix. The smoothed gene expression data and the optimized adjacency matrix are input into the graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and the reconstruction loss is calculated. The low-dimensional latent features are input into the multi-branch multilayer perceptron fusion module to obtain enhanced features; Based on the smoothed gene expression data, pseudo-labels are generated, a region contrast learning task is constructed, and the region contrast loss is calculated; based on the optimized adjacency matrix and the enhanced features, a topology contrast learning task is constructed, and the topology contrast loss is calculated. The reconstruction loss, region comparison loss, and topology comparison loss are weighted and fused into a total loss. The model parameters are then optimized using the total loss. The optimized model is then used for spatial domain recognition to obtain the spatial domain recognition result.

2. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, The gene expression data is Gaussian smoothed to obtain smoothed gene expression data, including: Based on the spatial coordinate data, calculate the spatial Euclidean distance between any two data points; The Gaussian smoothing weights are calculated based on the spatial Euclidean distance, and the Gaussian smoothing radius is twice the average distance between the nearest neighbor of each data point. The gene expression data is weighted and smoothed using the Gaussian smoothing radius to obtain smoothed gene expression data.

3. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, An initial adjacency matrix is ​​constructed based on the spatial coordinate data. The edges of the initial adjacency matrix are then pruned according to the smoothed gene expression data to obtain an optimized adjacency matrix, including: An initial adjacency matrix is ​​constructed based on the spatial coordinate data using the K-nearest neighbor method; For each pair of data points with edges in the initial adjacency matrix, calculate the cosine distance between smoothed gene expressions; For each data point, find the neighbor with the largest cosine distance and remove the edges to obtain the trimmed adjacency matrix; The trimmed adjacency matrix is ​​then symmetricized to obtain the optimized adjacency matrix.

4. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, The smoothed gene expression data and the optimized adjacency matrix are input into the graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and the reconstruction loss is calculated, including: A two-layer graph convolutional network encoder is used to encode the smoothed gene expression data and the optimized adjacency matrix to output low-dimensional latent features. A two-layer graph convolutional network decoder, symmetrical to the encoder structure, is used to reconstruct the gene expression of the low-dimensional latent features to obtain the reconstructed features. The reconstruction loss is calculated based on the mean squared error between the gene expression data and the reconstructed features.

5. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, The low-dimensional latent features are input into a multi-branch multilayer perceptron fusion module to obtain enhanced features, including: The low-dimensional latent features are input into each parallel two-layer perceptron branch, and nonlinear transformations are performed through each perceptron branch to calculate the output features of each perceptron branch. The output features are concatenated along the feature dimension to obtain a high-dimensional concatenated feature. The high-dimensional stitched features are input into the projection layer, and then dimensionality reduction mapping is performed through a single-layer fully connected network to obtain enhanced features.

6. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, Based on the smoothed gene expression data, pseudo-labels are generated, a region contrast learning task is constructed, and the region contrast loss is calculated, including: K-means clustering was performed on the smoothed gene expression data to assign each data point to a cluster, thus obtaining a pseudo-label for each data point. Using each data point as an anchor point, data points that are adjacent to the anchor point space and have the same pseudo-label in the optimized adjacency matrix are taken as positive samples, and data points that have different pseudo-labels from the anchor point are taken as negative samples. Define a cosine similarity function to calculate the cosine similarity between the low-dimensional latent features of data points; For the anchor point, the ratio of the sum of cosine similarities of the positive samples to the sum of cosine similarities of the negative samples is calculated, and the region contrast loss of the anchor point is obtained based on the ratio.

7. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, Based on the optimized adjacency matrix and the enhanced features, a topological contrast learning task is constructed, and the topological contrast loss is calculated, including: Data points connected by edges in the optimized adjacency matrix are identified as positive samples, and data points not connected by edges are identified as negative samples, thus constructing a topological comparison learning task. According to the topological comparison learning task, the cosine similarity between any two data points is calculated based on the enhanced features, and then a mapping process is performed to obtain the mapped similarity. Using the optimized adjacency matrix as the true label and the mapped similarity as the predicted value, the topological contrast loss is calculated.

8. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, The reconstruction loss, region contrast loss, and topology contrast loss are weighted and fused into a total loss. The model parameters are then optimized using this total loss. The optimized model is used for spatial domain identification to obtain spatial domain identification results, including: The total loss is obtained by weighted summing of the reconstruction loss, region comparison loss, and topology comparison loss. With the goal of minimizing the total loss, the Adam optimizer is used to iteratively update the learnable parameters in the graph convolutional network encoder and the multi-branch multilayer perceptron fusion module until the preset maximum number of iterations is reached or the total loss converges, thus completing the model training. The spatial transcriptome data to be analyzed is input into the trained model, and forward propagation is used to obtain the low-dimensional latent features of each data point. Cluster analysis is then performed on the low-dimensional latent features to assign each data point to the corresponding spatial domain, thus obtaining the spatial domain identification result.

9. The spatial domain identification method for spatial transcriptomics based on dual-contrast learning according to claim 1, characterized in that, The method further includes: Identify the datasets with real labels and the datasets without real labels during model training; The dataset with real labels was quantitatively evaluated using the adjusted RAND index and normalized mutual information. The dataset without real labels was quantitatively evaluated using silhouette coefficient and DB index.

10. A spatial domain identification system for spatial transcriptomics based on dual-contrast learning, characterized in that, The system includes: The data processing module is used to acquire spatial transcriptome data, which includes gene expression data and spatial coordinate data; to perform Gaussian smoothing on the gene expression data to obtain smoothed gene expression data; to construct an initial adjacency matrix based on the spatial coordinate data; and to perform edge trimming on the initial adjacency matrix according to the smoothed gene expression data to obtain an optimized adjacency matrix. The feature extraction and reconstruction module is used to input the smoothed gene expression data and the optimized adjacency matrix into the graph convolutional network encoder to obtain low-dimensional latent features and reconstructed features, and to calculate the reconstruction loss. The feature enhancement module is used to input the low-dimensional latent features into the multi-branch multilayer perceptron fusion module to obtain enhanced features; The dual-contrast learning module is used to generate pseudo-labels based on the smoothed gene expression data, construct a region contrast learning task, and calculate the region contrast loss; and to construct a topology contrast learning task based on the optimized adjacency matrix and the enhanced features, and calculate the topology contrast loss. The model optimization and spatial domain identification module is used to weight and fuse the reconstruction loss, region comparison loss, and topology comparison loss into a total loss, optimize the model parameters using the total loss, and use the optimized model to perform spatial domain identification to obtain the spatial domain identification result.