Method and device for identifying spatial organization structure of spatial transcriptome data
By constructing sample maps and using graph sampling aggregate network model and adaptive map comparison learning model, the similarity between spatial location and gene expression data is fully utilized, and the accuracy of spatial organization structure recognition of spatial transcriptome data is improved.
Patent Information
- Application Number
- CN202411740995.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2044-11-29
AI Technical Summary
In the prior art, when identifying the spatial tissue structure of spatial transcriptome data, the spatial location data and gene expression data cannot be fully utilized, resulting in a low accuracy in the identification of spatial tissue structures of tissue samples.
By constructing a sample graph, the graph sampling aggregation network model is used to feature aggregate the gene feature data of neighboring nodes in the neighborhood of each node in the sample graph and the gene feature data of the node. Combining the adaptive graph to compare the learning model, the aggregation weight is adaptively adjusted to improve the accuracy of feature representation.
The accuracy of spatial tissue structure recognition of tissue samples is improved, and the similarity of gene expression data between adjacent nodes can be more accurately reflected, solving the problem of low recognition accuracy in the prior art.
Smart Images

Figure CN119673270B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and device for identifying the spatial organizational structure of spatial transcriptome data. Background Art
[0002] Spatial transcriptomics technology is an innovative molecular biology and genomics method that can simultaneously measure the gene expression data of cells in tissue samples and the precise spatial location of cells in the tissue (i.e., spatial location information). It provides important data references for studying the spatial organizational structure of cancer tumors, revealing the occurrence and development mechanisms of cancer, and formulating effective treatment plans for cancer patients.
[0003] Existing techniques typically combine spatial location data and gene expression data, using graph neural networks to learn a joint representation of these data to identify the spatial structure of tissue samples. However, these methods often fail to fully utilize both spatial location and gene expression data, resulting in low accuracy in identifying the spatial structure of tissue samples. Summary of the Invention
[0004] Based on the above problems, the present application provides a method and device for identifying the spatial organizational structure of spatial transcriptome data. The purpose is to fully utilize the similarity information of gene expression data between adjacent nodes in spatial positions during the feature aggregation process of nodes, so as to improve the accuracy of identifying the spatial organizational structure of tissue samples.
[0005] The embodiments of this application disclose the following technical solutions:
[0006] In a first aspect, the present application provides a method for identifying the spatial organization structure of spatial transcriptome data, the method comprising: obtaining a gene expression matrix and an adjacency matrix corresponding to the spatial transcriptome data of a sample tissue to be identified, wherein the gene expression matrix is a matrix determined by gene expression data in the spatial transcriptome data, and the adjacency matrix is a matrix determined by spatial position information corresponding to the gene expression data;
[0007] A sample graph is constructed based on the gene expression matrix and the adjacency matrix, wherein the sample graph is an undirected graph describing the similarity relationship of gene expression data between adjacent nodes;
[0008] The sample graph is input into a graph sampling aggregation network model, and the gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph are aggregated with the gene feature data of the node through the graph sampling aggregation network model to obtain a feature representation of the sample graph, wherein the neighboring nodes in the neighborhood of each node include nodes that are directly or indirectly adjacent to the node;
[0009] The recognition result of the spatial organizational structure corresponding to the sample tissue is obtained based on the feature representation.
[0010] In an optional implementation, obtaining the recognition result of the spatial organizational structure corresponding to the sample tissue based on the feature representation includes:
[0011] The feature representation is input into an adaptive graph contrastive learning model, the attention weight corresponding to each node in the feature representation is determined by the adaptive graph contrastive learning model, and the feature representation is aggregated based on the attention weight corresponding to each node to obtain an enhanced feature representation;
[0012] Cluster analysis is performed on the enhanced feature representation to obtain the recognition results of the spatial organizational structure corresponding to the sample tissue.
[0013] In an optional implementation, a graph sampling aggregation network model is used to perform feature aggregation on the gene feature data of neighboring nodes in the neighborhood of each node in the sample graph and the gene feature data of the node to obtain a feature representation of the sample graph, including:
[0014] Perform a feature extraction operation, starting from the i-th node in the sample graph, and iteratively extracting the gene feature data of M first-order neighbor nodes and L second-order neighbor nodes in the neighborhood of the i-th node, wherein the first-order neighbor node is adjacent to the i-th node, and the second-order neighbor node is adjacent to the first-order neighbor node corresponding to the i-th node, and M and L are both positive integers;
[0015] Performing a feature aggregation operation to perform feature aggregation on the gene feature data of the M first-order neighbor nodes to obtain a first aggregate feature; and performing feature aggregation on the gene feature data of the L second-order neighbor nodes to obtain a second aggregate feature;
[0016] Perform a feature splicing operation to splice the first aggregate feature, the second aggregate feature, and the gene feature data of the i-th node to obtain the embedded feature of the i-th node;
[0017] The feature extraction operation, feature aggregation operation, and feature splicing operation are performed multiple times until the embedded features corresponding to N nodes in the sample graph are obtained, and a feature representation is constructed based on the embedded features corresponding to the N nodes, where N is a positive integer.
[0018] In an optional implementation, the sample graph includes a positive sample graph and a negative sample graph, wherein the negative sample graph is a sample graph obtained by performing data augmentation processing on the positive sample graph, wherein the data augmentation processing is used to enhance the discrimination between the positive sample graph and the negative sample graph, and the data augmentation processing includes random masking and random shuffling; constructing the sample graph based on the gene expression matrix and the adjacency matrix includes:
[0019] Construct a positive sample graph based on the gene expression matrix and adjacency matrix;
[0020] The gene expression matrix corresponding to the positive sample graph is randomly masked with a preset probability to obtain a masked positive sample graph;
[0021] The nodes in the masked positive sample graph are randomly shuffled to obtain the negative sample graph.
[0022] In an optional implementation, before inputting the sample graph into the graph sampling aggregation network model, the method for identifying the spatial organization structure of the spatial transcriptome data further includes:
[0023] Inputting the positive sample image and the negative sample image into the initial image sampling aggregation network model respectively, obtaining a first feature representation of the positive sample image and a second feature representation of the negative sample image output by the initial image sampling aggregation network model;
[0024] Inputting the first feature representation into an initial adaptive graph contrastive learning model, and having the initial adaptive graph contrastive learning model perform feature aggregation on the first feature representation based on an initial attention weight corresponding to each node in the first feature representation, to obtain a first global feature representation; and inputting the second feature representation into the initial adaptive graph contrastive learning model, and having the initial adaptive graph contrastive learning model perform feature aggregation on the second feature representation based on an initial attention weight corresponding to each node in the second feature representation, to obtain a second global feature representation;
[0025] Based on the first feature representation, the second feature representation, the first global feature representation and the second global feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0026] In an optional implementation, performing feature aggregation on the first feature representation based on the initial attention weight corresponding to each node in the first feature representation to obtain a first global feature representation includes:
[0027] Determine the initial attention weight corresponding to each node in the first feature representation through the attention pooling layer in the initial adaptive graph contrastive learning model;
[0028] The attention pooling layer performs weighted aggregation of the embedded features corresponding to N nodes based on the initial attention weight corresponding to each node to obtain the aggregated feature representation;
[0029] The first global feature representation is determined based on the summarized feature representation through the attention pooling layer.
[0030] In an optional implementation, based on the first feature representation, the second feature representation, the first global feature representation, and the second global feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model, including:
[0031] A positive data pair is formed based on the embedded feature corresponding to each node in the positive sample graph and the first global feature representation, and a total of N first positive data pairs are obtained;
[0032] Based on the embedded features corresponding to each node in the positive sample graph and the second global feature representation, a negative data pair is formed to obtain a total of N first negative data pairs;
[0033] Based on the embedded features and the second global feature representation corresponding to each node in the negative sample graph, a positive data pair is formed to obtain a total of N second positive data pairs;
[0034] Based on the embedded features corresponding to each node in the negative sample graph and the first global feature representation, a negative data pair is formed, and a total of N second negative data pairs are obtained;
[0035] An initial graph sampling aggregation network model and an initial adaptive graph contrastive learning model are jointly trained based on N first positive data pairs, N first negative data pairs, N second positive data pairs, N second negative data pairs, first feature representations and second feature representations. When the training cutoff condition is met, the model training is stopped to obtain a graph sampling aggregation network model and an adaptive graph contrastive learning model.
[0036] In an optional implementation, an initial graph sampling aggregation network model and an initial adaptive graph contrastive learning model are jointly trained based on N first positive data pairs, N first negative data pairs, N second positive data pairs, N second negative data pairs, the first feature representation, and the second feature representation. When a training cutoff condition is met, the model training is stopped to obtain a graph sampling aggregation network model and an adaptive graph contrastive learning model, including:
[0037] Inputting N first positive data pairs into the discriminator in the initial adaptive graph contrastive learning model to obtain a first probability corresponding to each node in the positive sample graph, wherein the first probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the first global feature representation;
[0038] Inputting N first negative data pairs into the discriminator in the initial adaptive graph contrastive learning model to obtain a second probability corresponding to each node in the positive sample graph, wherein the second probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the second global feature representation;
[0039] Input N second positive data pairs into the discriminator to obtain a third probability corresponding to each node in the negative sample graph, wherein the third probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the second global feature representation;
[0040] Inputting N second negative data pairs into the discriminator, obtaining a fourth probability corresponding to each node in the negative sample graph, wherein the fourth probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the first global feature representation;
[0041] Based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability and the fourth probability, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0042] In an optional implementation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability, and the fourth probability. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model, including:
[0043] Determining a total loss value based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability, and the fourth probability, wherein the total loss value includes a loss value of the initial graph sampling aggregation network model and a loss value of the initial adaptive graph contrastive learning model;
[0044] The parameters of the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are iteratively updated based on the total loss value until the parameters meet the training cutoff condition, and the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0045] In a second aspect of the present application, a device for identifying the spatial organization structure of spatial transcriptome data is provided, the device comprising:
[0046] A data acquisition module, configured to acquire a gene expression matrix and an adjacency matrix corresponding to the spatial transcriptome data of the sample tissue to be identified, wherein the gene expression matrix is a matrix determined by the gene expression data in the spatial transcriptome data, and the adjacency matrix is a matrix determined by the spatial position information corresponding to the gene expression data;
[0047] A sample graph construction module is used to construct a sample graph based on the gene expression matrix and the adjacency matrix, wherein the sample graph is an undirected graph describing the similarity relationship of gene expression data between adjacent nodes;
[0048] A feature aggregation module is used to input the sample graph into the graph sampling aggregation network model, and perform feature aggregation on the gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph with the gene feature data of the node through the graph sampling aggregation network model to obtain a feature representation of the sample graph, wherein the neighboring nodes in the neighborhood of each node include nodes that are directly or indirectly adjacent to the node;
[0049] The recognition result acquisition module is used to obtain the recognition result of the spatial organizational structure corresponding to the sample tissue based on the feature representation.
[0050] In a third aspect of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the above-mentioned method for identifying the spatial organization structure of spatial transcriptome data is implemented.
[0051] In a fourth aspect of the present application, a processor is provided for running a computer program, which executes the above-mentioned method for identifying the spatial organization structure of spatial transcriptome data when the computer program is running.
[0052] Compared with the existing technology, this application has the following beneficial effects:
[0053] In the technical solution of the present application, the gene expression matrix and adjacency matrix corresponding to the spatial transcriptome data of the sample tissue to be identified are first obtained; secondly, a sample graph is constructed based on the gene expression matrix and the adjacency matrix; then the sample graph is input into a graph sampling aggregation network model, and the gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph are aggregated with the gene feature data of the node through the graph sampling aggregation network model to obtain a feature representation of the sample graph; finally, the recognition result of the spatial organizational structure corresponding to the sample tissue is obtained based on the feature representation. Among them, the gene expression matrix is a matrix determined by the gene expression data in the spatial transcriptome data, and the adjacency matrix is a matrix determined by the spatial position information corresponding to the gene expression data; the sample graph is an undirected graph that describes the similarity relationship of the gene expression data between adjacent nodes; the neighbor nodes in the neighborhood of each node include nodes that are directly or indirectly adjacent to the node.
[0054] In the technical solution of the present application, a sample graph used to describe the similarity relationship of gene expression data between adjacent nodes is input into a pre-trained graph sampling aggregation network model, and the gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph are feature aggregated with the gene feature data of the node through the graph sampling aggregation network model. Since the neighboring nodes in the neighborhood of each node in the sample graph include nodes that are directly or indirectly adjacent to the node, the similarity information of the gene expression data between adjacent nodes in spatial position can be fully utilized in the feature aggregation process of the node to obtain a feature representation that can accurately reflect the similarity of the gene expression data between adjacent nodes in the sample graph; therefore, a more accurate spatial organizational structure can be determined based on the feature representation, thereby improving the accuracy of spatial organizational structure recognition of tissue samples, thereby solving the technical problem that the prior art cannot fully utilize spatial transcriptome data (i.e., spatial position data and gene expression data), resulting in low accuracy in spatial organizational structure recognition of tissue samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0056] Figure 1 A flowchart of a method for identifying the spatial organization structure of spatial transcriptome data provided in an embodiment of the present application;
[0057] Figure 2 A flowchart of a process for obtaining a gene expression matrix and an adjacency matrix corresponding to spatial transcriptome data provided in an embodiment of the present application;
[0058] Figure 3 A flowchart of a process for obtaining a feature representation of a sample graph through a graph sampling aggregation network model provided in an embodiment of the present application;
[0059] Figure 4 A flowchart of a process for obtaining recognition results of a spatial organizational structure provided in an embodiment of the present application;
[0060] Figure 5 A flowchart of a process for constructing a positive sample image and a negative sample image provided in an embodiment of the present application;
[0061] Figure 6 A flowchart of a model joint training process provided in an embodiment of the present application;
[0062] Figure 7 A flowchart of another model joint training process provided in an embodiment of the present application;
[0063] Figure 8A A schematic diagram of a positive and negative data pair provided in an embodiment of the present application;
[0064] Figure 8B A schematic diagram of a discriminator provided in an embodiment of the present application;
[0065] Figure 9 A flowchart of another model joint training process provided in an embodiment of the present application;
[0066] Figure 10 A flowchart of another method for identifying the spatial organization structure of spatial transcriptome data provided in an embodiment of the present application;
[0067] Figure 11 A schematic diagram of a spatial organization structure identified by various spatial organization structure identification technologies provided in an embodiment of the present application;
[0068] Figure 12 A schematic diagram of an adjusted Rand index of a spatial organization structure identified by various spatial organization structure identification technologies provided in an embodiment of the present application;
[0069] Figure 13 A schematic diagram of a device for identifying the spatial organization structure of spatial transcriptome data provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] As previously described, current spatial structure recognition techniques typically combine spatial location data and gene expression data, using graph neural networks to learn a joint representation of these data to identify the spatial structure of biological tissue samples. However, these methods often fail to fully utilize both spatial location and gene expression data, resulting in low accuracy in identifying the spatial structure of tissue samples.
[0071] After research, the inventors input a sample graph used to describe the similarity relationship of gene expression data between adjacent nodes into a pre-trained graph sampling aggregation network model, and then perform feature aggregation on the gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph with the gene feature data of the node through the graph sampling aggregation network model. Since the neighboring nodes in the neighborhood of each node in the sample graph include nodes that are directly or indirectly adjacent to the node, the similarity information of the gene expression data between adjacent nodes in spatial position can be fully utilized in the feature aggregation process of the node to obtain a feature representation that can accurately reflect the similarity of the gene expression data between adjacent nodes in the sample graph; therefore, based on the feature representation, a more accurate spatial organizational structure can be determined, thereby improving the accuracy of spatial organizational structure recognition of tissue samples, thereby solving the technical problem of low accuracy in spatial organizational structure recognition of tissue samples due to the inability to fully utilize spatial transcriptome data in the prior art.
[0072] Definitions of Key Terms:
[0073] Spatial transcriptome data: refers to a data set containing information on gene expression levels at different locations in a biological tissue sample, obtained through spatial transcriptomics technology. This technology can measure mRNA molecules at specific spatial locations, thereby reflecting the distribution of cells within the tissue.
[0074] STAGATE: is an algorithm that uses an autoencoder architecture based on Graph Attention Networks (GATs) to reconstruct gene expression data and optimizes the model by minimizing the reconstruction error loss.
[0075] SpaGCN: is an algorithm for integrating gene expression, spatial location, and histological information to identify spatial domains and spatially variable genes (SVGs) in spatial transcriptome data.
[0076] CCST: is an unsupervised cell clustering method based on GCNs (Graph Convolutional Networks), which is used to improve de novo cell clustering and cell subtype discovery based on manually organized cell class annotations.
[0077] GraphST: is a graph self-supervised contrastive learning method that utilizes spatial information and gene expression profiles for spatial information clustering, integration, and cell type deconvolution.
[0078] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0079] Method Example
[0080] This application provides an embodiment of a method for identifying the spatial organization structure of spatial transcriptome data. It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system, such as a set of computer-executable instructions. Furthermore, although the flowcharts show a logical order, this is only provided as an example order. In some cases, the steps shown or described can be performed in a different order than shown here.
[0081] See also Figure 1 , which is a flow chart of a method for identifying the spatial organization structure of spatial transcriptome data provided by an embodiment of the present application, such as Figure 1 As shown, the method includes the following steps:
[0082] Step S101 : obtaining a gene expression matrix and an adjacency matrix corresponding to the spatial transcriptome data of a sample tissue to be identified.
[0083] In an optional embodiment, a system for identifying the spatial organization structure of spatial transcriptome data can be used as the execution body of the method for identifying the spatial organization structure of spatial transcriptome data in the embodiment of the present application. For the convenience of description, the system for identifying the spatial organization structure of spatial transcriptome data will be referred to as the identification system below.
[0084] Among them, the above-mentioned recognition system includes a data preprocessing module, a data enhancement module, an ST-GraphSAGE (full name Spatial Transcriptomics-Graph Sample and Aggregate, idle-graph sampling aggregation network) network model (referred to as the graph sampling aggregation network model in this application) and an adaptive graph contrast learning model.
[0085] In this embodiment, a sample tissue of a cancer patient is taken as an example, and the sample tissue of the cancer patient is used as the sample tissue to be identified.
[0086] In step S101, the gene expression matrix is a matrix determined by the gene expression data in the spatial transcriptome data, and the adjacency matrix is a matrix determined by the spatial position information corresponding to the gene expression data. The data preprocessing module of the system can obtain the gene expression matrix through the following steps:
[0087] S1, spatial transcriptome data were extracted by scanpy.pp.highly_variable_genes() method (i.e. Figure 2 The gene expression data in the spatial transcriptome shown in Figure 2 The top 2500 highly variable genes in the gene expression shown in . Among them, scanpy.pp.highly_variable_genes() is a function in the Scanpy library used to identify highly variable genes.
[0088] S2, the total cell counts are normalized to 10000 using the scanpy.pp.normalize_total() method. scanpy.pp.normalize_total() is a function in the Scanpy library that is used to normalize single-cell RNA sequencing data.
[0089] S3, the normalized data were subjected to Log transformation using the scanpy.pp.log1p() method to obtain the gene expression matrix (i.e. Figure 2 The preprocessed gene expression data are shown in ). scanpy.pp.log1p() is a function in the Scanpy library that applies a natural logarithm transformation to the data.
[0090] In this embodiment, if Figure 2 As shown, the data preprocessing module of the recognition system can use the K nearest neighbor algorithm to calculate the Euclidean distance between all points in the spatial position information corresponding to the gene expression data, and select the three nearest neighbors to output the adjacency matrix Among them, N s is the total number of nodes.
[0091] Step S102: constructing a sample graph based on the gene expression matrix and the adjacency matrix.
[0092] In step S102, the sample graph is an undirected graph describing the similarity relationship of gene expression data between adjacent nodes, wherein the node attribute of the undirected graph is gene expression, and the edges between the nodes describe the similarity relationship of gene expression data between adjacent nodes.
[0093] Step S103: input the sample graph into the graph sampling aggregation network model, and perform feature aggregation on the gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph and the gene feature data of the node through the graph sampling aggregation network model to obtain a feature representation of the sample graph.
[0094] In step S103 , the neighbor nodes in the neighborhood of each node include nodes that are directly or indirectly adjacent to the node.
[0095] In order to improve the accuracy of spatial organizational structure recognition of tissue samples and solve the problem in the prior art that the spatial organizational structure recognition of tissue samples is low due to the inability to fully utilize spatial position data and gene expression data, the recognition system of the present application can input a sample graph used to describe the similarity relationship of gene expression data between adjacent nodes into a pre-trained graph sampling aggregation network model, and perform feature aggregation on the gene feature data of neighboring nodes in the neighborhood of each node in the sample graph with the gene feature data of the node through the graph sampling aggregation network model. Since the neighboring nodes in the neighborhood of each node in the sample graph include nodes that are directly or indirectly adjacent to the node, the recognition system can fully utilize the similarity information of gene expression data between adjacent nodes in spatial position during the feature aggregation process of the node, thereby obtaining a feature representation that accurately reflects the similarity of gene expression data between adjacent nodes in the sample graph.
[0096] See also Figure 3 , which is a flowchart of a process of obtaining a feature representation of a sample graph through a graph sampling aggregation network model provided by an embodiment of the present application, as shown in FIG. Figure 3 As shown, the process includes the following steps:
[0097] Step S201, perform a feature extraction operation, starting from the i-th node in the sample graph, and iteratively extract the gene feature data of M first-order neighbor nodes and L second-order neighbor nodes in the neighborhood of the i-th node step by step, where M and L are both positive integers.
[0098] In this embodiment, the neighborhood includes multiple first-order neighbor nodes, multiple second-order neighbor nodes, multiple third-order neighbor nodes, multiple fourth-order neighbor nodes, ..., multiple K-order neighbor nodes corresponding to the i-th node, wherein the first-order neighbor node is adjacent to the i-th node, the second-order neighbor node is adjacent to the first-order neighbor node corresponding to the i-th node, the third-order neighbor node is adjacent to the second-order neighbor node corresponding to the i-th node, the fourth-order neighbor node is adjacent to the third-order neighbor node corresponding to the i-th node, ..., and so on. The above only uses the first-order neighbor nodes and second-order neighbor nodes corresponding to the i-th node as an example. In this embodiment, the recognition system can also extract genetic feature data of multiple third-order neighbor nodes, multiple fourth-order neighbor nodes, ..., multiple K-order neighbor nodes in sequence by performing feature extraction operations.
[0099] In other words, the recognition system of the present application can adopt an iterative hierarchical neighbor sampling method through a graph sampling aggregation network model. Starting from the i-th node, the first-order neighbor node of the i-th node is randomly selected, and its genetic feature data is extracted; then, using the selected first-order neighbor node as the starting point, the first-order neighbor node of the node (that is, the second-order neighbor node corresponding to the i-th node) is randomly selected, and its genetic feature data is extracted... and so on, iterating in sequence.
[0100] Step S202 , performing a feature aggregation operation to perform feature aggregation on the gene feature data of M first-order neighbor nodes to obtain a first aggregate feature; and performing feature aggregation on the gene feature data of L second-order neighbor nodes to obtain a second aggregate feature.
[0101] In step S202, the system may perform feature aggregation on the gene feature data of the neighboring nodes in the domain corresponding to the i-th node using formula (1).
[0102]
[0103] Where MeanAGG represents mean aggregation; k represents k-order neighbor sampling, k = 1, 2, 3, ...; N i is the neighborhood of the i-th node, Represents the neighborhood N of the i-th node i The aggregate features of the k-order neighbor nodes in, for example, k = 1, represents the first aggregate feature of the first-order neighbor node of the i-th node; k = 2, represents the second aggregate feature of the second-order neighbor node of the i-th node; j represents the neighbor node, j∈N i .
[0104] Step S203 : performing a feature splicing operation to splice the first aggregate feature, the second aggregate feature, and the gene feature data of the i-th node to obtain an embedded feature of the i-th node.
[0105] In step S203, the system may perform feature concatenation on the aggregated features of the neighboring nodes in the domain corresponding to the i-th node using formula (2).
[0106]
[0107] in, represents the k-th aggregated embedding feature of the i-th node; σ represents the nonlinear activation function ReLU; represents the k-1 aggregated embedding features of the i-th node; W k is a learnable weight matrix.
[0108] Step S204 , performing feature extraction operations, feature aggregation operations, and feature concatenation operations multiple times until embedding features corresponding to N nodes in the sample graph are obtained, and constructing feature representations based on the embedding features corresponding to the N nodes, where N is a positive integer.
[0109] In step S204, after the ST-GraphSAGE network model (i.e., graph sampling aggregation network model), the embedded features corresponding to the N nodes are Compositional Characterization E s :
[0110]
[0111] Among them, E ST-GraphSAGE (·) can represent the ST-GraphSAGE network model, N s Indicates the total number of nodes.
[0112] It should be noted that the graph sampling aggregation network model in the present application can adopt an iterative hierarchical neighbor sampling method to extract the gene feature data of the directly adjacent or indirectly adjacent neighbor nodes corresponding to each node in the sample graph, and perform feature aggregation on the extracted gene feature data of the above-mentioned neighbor nodes and the gene feature data of the node, so that in the feature aggregation process of the nodes, the similarity information of the gene expression data between adjacent nodes in spatial position can be fully utilized to obtain a feature representation that can accurately reflect the similarity of the gene expression data between adjacent nodes in the sample graph.
[0113] Step S104 : obtaining a recognition result of the spatial tissue structure corresponding to the sample tissue according to the feature representation.
[0114] In step S104, the recognition system can obtain a more accurate spatial organizational structure based on a feature representation that accurately reflects the similarity of gene expression data between adjacent nodes in the sample graph. For example, the recognition system can input the feature representation into a pre-trained adaptive graph contrastive learning model to obtain an enhanced feature representation output by the adaptive graph contrastive learning model. The recognition system can then perform cluster analysis on the enhanced feature representation to obtain a recognition result of the spatial organizational structure corresponding to the sample tissue.
[0115] Based on the scheme introduced in steps S101 to S104 above, it can be known that in the present application, a sample graph for describing the similarity relationship of gene expression data between adjacent nodes is constructed through the gene expression matrix and the adjacency matrix corresponding to the spatial transcriptome data of the sample tissue, and the sample graph is input into a pre-trained graph sampling aggregation network model. The gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph are feature aggregated with the gene feature data of the node through the graph sampling aggregation network model. Since the neighboring nodes in the neighborhood of each node in the sample graph include nodes directly or indirectly adjacent to the node, the similarity information of the gene expression data between adjacent nodes in spatial position can be fully utilized in the feature aggregation process of the node to obtain a feature representation that can accurately reflect the similarity of the gene expression data between adjacent nodes in the sample graph. Therefore, based on the feature representation, a more accurate spatial organizational structure can be determined, thereby improving the accuracy of spatial organizational structure recognition of tissue samples, thereby solving the technical problem that the prior art cannot fully utilize spatial transcriptome data, resulting in low accuracy in spatial organizational structure recognition of tissue samples.
[0116] When identifying the spatial structure of a tissue sample, existing technologies often learn a joint representation of the spatial location data and gene expression data of the existing tissue sample to obtain the spatial structure of the tissue sample. However, the spatial location data and gene expression data of different tissue samples may vary significantly. The learned joint representation is a unified feature learned from the spatial location data and gene expression data of the existing tissue sample. The aggregation weight during the feature aggregation process corresponds to the joint representation. In other words, existing technologies are unable to adaptively adjust the aggregation weights for the feature representations of different tissue samples. As a result, existing technologies are unable to accurately identify the spatial structure of tissue samples when faced with new, unknown tissue samples.
[0117] In order to solve the above problems and improve the accuracy of spatial tissue structure recognition of new tissue samples, the recognition system in this application obtains the recognition result of the spatial tissue structure corresponding to the sample tissue through the following process:
[0118] Step 1: Input the feature representation into the adaptive graph contrastive learning model, determine the attention weight corresponding to each node in the feature representation through the adaptive graph contrastive learning model, and perform feature aggregation on the feature representation based on the attention weight corresponding to each node to obtain an enhanced feature representation;
[0119] Step 2: Perform cluster analysis on the enhanced feature representation to obtain the recognition result of the spatial organizational structure corresponding to the sample tissue.
[0120] Through the above steps, the recognition system of the present application can be used to sample the graph aggregation network model (i.e. Figure 4 The ST-GraphSAGE network shown in Figure 2 outputs feature representations of input graphs for contrastive learning (i.e. Figure 4 In the adaptive graph contrastive learning (AGL) model, an attention pooling operation is performed on the feature representation to determine the attention weight corresponding to each node in the feature representation, and the feature representation is aggregated based on the attention weight corresponding to each node. Since in the feature aggregation process, the attention weight corresponding to each node (i.e., the aggregation weight) is the weight corresponding to the feature representation of the sample tissue to be identified, rather than the aggregation weight corresponding to the joint representation of multiple sample tissues, the recognition system of the present application can adaptively adjust the aggregation weight according to the feature data of different tissue samples, so that when facing new and unknown tissue samples, the recognition system can more accurately capture the key information in the feature representation according to its corresponding aggregation weight, and obtain an enhanced feature representation that can better reflect the similarity of gene expression data between adjacent nodes in the sample graph; then the recognition system performs cluster analysis on the enhanced feature representation based on a preset clustering algorithm to obtain a more accurate recognition result of the spatial organizational structure corresponding to the sample tissue.
[0121] In this embodiment, the preset clustering algorithm may be any one or more of the mclust clustering algorithm, the K-Means clustering algorithm, and the Louvain clustering algorithm. The clustering algorithm used may be selected for cluster analysis according to actual needs.
[0122] Optionally, in the method for identifying the spatial organization structure of spatial transcriptome data provided in an embodiment of the present application, the sample graph includes a positive sample graph and a negative sample graph, wherein the negative sample graph is a sample graph obtained after data enhancement processing is performed on the positive sample graph, and the data enhancement processing is used to enhance the discrimination between the positive sample graph and the negative sample graph, and the data enhancement processing includes random masking and random shuffling; constructing the sample graph based on the gene expression matrix and the adjacency matrix, including: constructing a positive sample graph based on the gene expression matrix and the adjacency matrix through the recognition system; randomly masking the gene expression matrix corresponding to the positive sample graph with a preset probability through the recognition system to obtain a masked positive sample graph; randomly shuffling the nodes in the masked positive sample graph through the recognition system to obtain a negative sample graph.
[0123] In order to increase the distinction between positive sample images and negative sample images, and thus provide accurate sample data for subsequent model joint training and spatial organization structure recognition, the recognition system in this application can be based on the gene expression matrix (i.e. Figure 5 Gene expression in ) and adjacency matrix construction Figure 5 The positive sample graph G shown in s , G s =(V,E), where V is the vertex set and E is the edge set; then, the recognition system keeps the adjacency matrix in the positive sample graph unchanged and randomly masks the gene expression matrix with a preset probability to obtain the masked positive sample graph G′ s , for example, randomly masking with a probability of 60%; Finally, the recognition system uses the masked positive sample graph G′ s Randomly shuffle the nodes in Figure 5 The negative sample map shown in in, It is composed of enhanced gene expression and adjacency matrix, where enhanced gene expression is the gene expression matrix after data enhancement processing. Among them, the recognition system can perform random scrambling and random masking processing through formula (3).
[0124]
[0125] in, It is the gene expression matrix after data augmentation; represents random shuffling; F is the gene expression matrix; Z represents the preset mask matrix, which obeys the Bernoulli distribution, where each element in Z is set to 1 with a probability of P% and is set to 0 with a probability of 1-P%. For example, each element is set to 1 with a probability of 60% and is set to 0 with a probability of 40%.
[0126] Figure 6 A flowchart of a model joint training process provided in an embodiment of the present application is as follows: Figure 6 As shown, the process includes the following steps:
[0127] Step S301: input the positive sample image and the negative sample image into the initial image sampling aggregation network model respectively, and obtain the first feature representation of the positive sample image and the second feature representation of the negative sample image output by the initial image sampling aggregation network model.
[0128] In step S301, the initial graph sampling aggregation network model is a model that has not been iteratively trained. The initial graph sampling aggregation network model is composed of an iterative layered neighbor sampling-aggregation layer and a loss function. The iterative layered neighbor sampling-aggregation layer in the initial graph sampling aggregation network model can obtain the first feature representation of the positive sample image and the second feature representation of the negative sample image through the above formula (1) and formula (2).
[0129] Step S302: input the first feature representation into the initial adaptive graph contrastive learning model, and the initial adaptive graph contrastive learning model performs feature aggregation on the first feature representation based on the initial attention weight corresponding to each node in the first feature representation to obtain a first global feature representation; and input the second feature representation into the initial adaptive graph contrastive learning model, and the initial adaptive graph contrastive learning model performs feature aggregation on the second feature representation based on the initial attention weight corresponding to each node in the second feature representation to obtain a second global feature representation.
[0130] In step S302, the initial adaptive graph contrastive learning model is a model that has not undergone iterative training, wherein the initial adaptive graph contrastive learning model includes an input layer, a feature encoding layer, an attention pooling layer, a discriminator and a loss function; the attention pooling layer includes two linear layers, an activation function, an attention weight, and L2 norm normalization.
[0131] Optionally, in this embodiment, feature aggregation is performed on the first feature representation based on the initial attention weight corresponding to each node in the first feature representation to obtain a first global feature representation, including: determining the initial attention weight corresponding to each node in the first feature representation through the attention pooling layer in the initial adaptive graph contrast learning model; weighted summarizing the embedded features corresponding to N nodes based on the initial attention weight corresponding to each node through the attention pooling layer to obtain an aggregated feature representation; and determining the first global feature representation based on the aggregated feature representation through the attention pooling layer.
[0132] In this embodiment, the attention pooling layer can obtain the first global feature representation G through formula (4) to formula (9): g .
[0133] G g =AP(E s ) (4)
[0134]
[0135] s=Linear2(ReLU(Linear1(E s ))) (6)
[0136]
[0137] Among them, G g represents the first global feature representation; D represents the feature dimension; AP represents attention pooling, ReLU represents the activation function; Linear1 and Linear2 represent linear layers; s is the feature vector after activation function and linear transformation, s i is an element in s; wi represents the attention weight; g represents the feature representation after aggregation under the attention mechanism; Represents the set of real numbers corresponding to the feature representation.
[0138] It should be noted that the attention pooling layer of the recognition system can also obtain the second global feature representation through formula (4) to formula (9) Therefore, the processing of the second global feature representation is not described in detail here.
[0139] Step S303: Based on the first feature representation, the second feature representation, the first global feature representation, and the second global feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0140] It should be noted that by jointly training the initial graph sampling aggregation network model and the initial adaptive graph contrast learning model based on the first feature representation, the second feature representation, the first global feature representation and the second global feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrast learning model can have a strong correlation, thereby improving the accuracy of the model, and then improving the accuracy of spatial tissue structure recognition of tissue samples.
[0141] Figure 7 A flowchart of another model joint training process provided in an embodiment of the present application is as follows: Figure 7 As shown, the process includes the following steps:
[0142] Step S401: A positive data pair is formed based on the embedded feature corresponding to each node in the positive sample graph and the first global feature representation, and a total of N first positive data pairs are obtained.
[0143] In step S401, the embedded features corresponding to each node in the positive sample graph, that is, the local features in the positive sample graph The system can form a positive data pair (i.e., the first global feature representation) by combining the local feature corresponding to each node with the global feature corresponding to the positive sample graph. Figure 8A ), a total of N first positive data pairs are obtained.
[0144] Step S402 : A negative data pair is constructed based on the embedded features corresponding to each node in the positive sample graph and the second global feature representation, thereby obtaining a total of N first negative data pairs.
[0145] In step S402, the system can form a negative data pair by combining the local feature corresponding to each node in the positive sample graph with the global feature (i.e., the second global feature representation) corresponding to the negative sample graph, and obtain a total of N first negative data pairs (i.e., Figure 8A negative data pairs shown in ).
[0146] Step S403: A positive data pair is constructed based on the embedded features corresponding to each node in the negative sample graph and the second global feature representation, thereby obtaining a total of N second positive data pairs.
[0147] In step S403, the embedded features corresponding to each node in the negative sample graph, that is, the local features in the negative sample graph The system can form a positive data pair (i.e., the local feature corresponding to each node and the global feature corresponding to the negative sample graph (i.e., the second global feature representation) Figure 8A ), a total of N second positive data pairs are obtained.
[0148] Step S404: A negative data pair is constructed based on the embedded feature corresponding to each node in the negative sample graph and the first global feature representation, thereby obtaining a total of N second negative data pairs.
[0149] In step S404, the system can construct a negative data pair by combining the local feature corresponding to each node in the negative sample graph with the global feature corresponding to the positive sample graph (i.e., the first global feature representation), and obtain a total of N second negative data pairs (i.e., Figure 8A negative data pairs shown in ).
[0150] Step S405, based on N first positive data pairs, N first negative data pairs, N second positive data pairs, N second negative data pairs, the first feature representation and the second feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0151] Optionally, based on N first positive data pairs, N first negative data pairs, N second positive data pairs, N second negative data pairs, the first feature representation and the second feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained, and the model training is stopped when a training cutoff condition is met, to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model, including the following steps:
[0152] Step 1: Input N first positive data pairs into the discriminator in the initial adaptive graph contrastive learning model to obtain the first probability corresponding to each node in the positive sample graph.
[0153] In step one, the first probability corresponding to each node is used to characterize the similarity between the embedded feature corresponding to the node and the first global feature representation, that is, the first probability is used to characterize the similarity between the local feature corresponding to the node in the positive sample graph and the global feature corresponding to the positive sample graph.
[0154] Alternatively, as Figure 8B As shown, the discriminator in this application is a discriminator composed of a bilinear function combined with spectral normalization, which can be expressed by formula (10):
[0155]
[0156] Among them, D s represents the discriminator; D represents the dimension of the feature; Represents the set of real numbers corresponding to the feature representation.
[0157] Step 2: Input N first negative data pairs into the discriminator to obtain the second probability corresponding to each node in the positive sample graph.
[0158] In step 2, the second probability corresponding to each node is used to characterize the similarity between the embedded feature corresponding to the node and the second global feature representation, that is, the second probability is used to characterize the similarity between the local feature corresponding to the node in the positive sample graph and the global feature corresponding to the negative sample graph.
[0159] Step 3: Input the N second positive data pairs into the discriminator to obtain the third probability corresponding to each node in the negative sample graph.
[0160] In step three, the third probability corresponding to each node is used to characterize the similarity between the embedded feature corresponding to the node and the second global feature representation, that is, the third probability is used to characterize the similarity between the local feature corresponding to the node in the negative sample graph and the global feature corresponding to the negative sample graph.
[0161] Step 4: Input the N second negative data pairs into the discriminator to obtain the fourth probability corresponding to each node in the negative sample graph.
[0162] In step four, the fourth probability corresponding to each node is used to characterize the similarity between the embedded feature corresponding to the node and the first global feature representation, that is, the fourth probability is used to characterize the similarity between the local feature corresponding to the node in the negative sample graph and the global feature corresponding to the positive sample graph.
[0163] Step five, based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability and the fourth probability, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0164] It should be noted that the probability values (i.e., the first probability, the second probability, the third probability, and the fourth probability) used to characterize the similarity between the local features corresponding to the nodes and the global features are obtained by the discriminator composed of a bilinear function combined with spectral normalization, as well as the first feature representation and the second feature representation. The initial graph sampling aggregation network model and the initial adaptive graph contrast learning model are jointly trained according to the similarity between the local features corresponding to the nodes and the global features, which further improves the accuracy of the model and thereby improves the accuracy of spatial tissue structure recognition of tissue samples.
[0165] Figure 9 A flowchart of another model joint training process provided in an embodiment of the present application is as follows: Figure 9 As shown, the process includes the following steps:
[0166] Step S501 : determining a total loss value based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability, and the fourth probability.
[0167] In step S501, the total loss value includes the loss value of the initial graph sampling aggregation network model and the loss value of the initial adaptive graph contrastive learning model. The total loss value can be obtained by the total loss function shown below:
[0168] L=λ1L r +λ2(L1+L2)
[0169] Among them, L r represents the loss function of the initial graph sampling aggregation network model; (L1+L2) represents the loss function of the initial adaptive graph contrastive learning model; λ1 and λ2 are weight factors; the loss function L of the initial graph sampling aggregation network model r As shown below:
[0170]
[0171] Among them, L r represents the loss function; fi represents the original gene expression data; r i represents the reconstructed gene expression data, that is, the gene expression data obtained by the decoder; F represents the Frobenius norm; N s is the total number of nodes. The recognition system can be represented by the first feature, the second feature and the loss function L r Determine the loss value of the initial graph sampling aggregation network model.
[0172] The loss value of the initial adaptive graph contrastive learning model can be obtained by the loss function (12) as shown below:
[0173]
[0174]
[0175] Among them, L2 is the symmetric form of L1; E ST-GraphSAGE () represents the output result of the ST-GraphSAGE network model, for example, the first feature representation and the second feature representation mentioned above, wherein E in the above loss function (12) ST-GraphSAGE (F,M) is used to represent the first feature representation, Used to represent the second feature representation; D s () is used to represent the probability of similarity between the local feature corresponding to the discriminator calculation node and the global feature, such as the first probability, second probability, third probability and fourth probability mentioned above, where, represents the first probability, represents the second probability, represents the third probability, represents the fourth probability; G g is the first global feature representation; is the second global feature representation; the embedded feature corresponding to each node in the negative sample graph (i.e. local features); embedded features corresponding to each node in the positive sample graph (ie local features). The recognition system obtains the loss value of the initial adaptive graph contrast learning model through the first feature representation, the second feature representation, the first probability, the second probability, the third probability, the fourth probability and the loss function (12).
[0176] Step S502 , iteratively update the parameters of the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the total loss value until the parameters meet the training cutoff condition, and stop model training to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0177] In step S502, the model is trained for 25,000 epochs and at a learning rate of 0.0001. The system uses the Adam optimizer in PyTorch to update parameters during the backpropagation phase using the total loss function value, resulting in a graph sampling aggregation network model and an adaptive graph contrast learning model.
[0178] It should be noted that by iteratively updating the parameters of the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the total loss value, a strong correlation can be established between the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model, thereby improving the accuracy of the model.
[0179] See also Figure 10 , which is a flow chart of another method for identifying the spatial organization structure of spatial transcriptome data provided by an embodiment of the present application, such as Figure 10 As shown, the recognition system of the present application first obtains the gene expression matrix and adjacency matrix corresponding to the spatial transcriptome data of the sample tissue to be identified (for the specific process, see Figure 2 ), and then construct the positive and negative sample graph based on the gene expression matrix and the adjacency matrix (for the specific process, see Figure 5 ), then the recognition system can input the positive and negative sample images into the graph sampling aggregation network model to obtain the feature representation of the sample image. The recognition system then inputs the feature representation into the adaptive graph contrastive learning model, constructs positive and negative data pairs based on the output results of the graph sampling aggregation network model and the global feature representation obtained by the attention pooling mechanism, and then the recognition system can input the positive and negative data pairs into the discriminator constructed by the bilinear function and spectral normalization (see Figure 8B ), and obtain enhanced feature representation (the specific process can be found in Figure 4 ). Finally, the recognition system obtains the recognition result of the spatial organizational structure through cluster analysis.
[0180] Furthermore, taking breast cancer tissue samples as an example, the spatial organization structure obtained by the method provided by this application (abbreviated as GATCL) and four latest existing technology methods: STAGATE, SpaGCN, CCST, and GraphST is compared with the manually labeled spatial organization structure. The comparison results can be shown as follows: Figure 11 As shown, it can be seen that the method provided by this application is closest to manual labeling. The accuracy evaluation index of spatial organizational structure recognition is the Adjusted Rand Index (ARI). The ARI of the method provided by this application is 0.6182, the ARI of STAGATE is 0.4638, the ARI of SpaGCN is 0.4411, the ARI of CCST is 0.5109, and the ARI of GraphST is 0.5480. Figure 12 It can be seen that the ARI of the method provided in this application is the highest, that is, the accuracy of the spatial organizational structure identified by the method provided in this application is the highest, and the method provided in this application is superior to the methods in the prior art.
[0181] The method for identifying the spatial organizational structure of spatial transcriptome data provided by the embodiments of the present application can fully utilize the similarity information of gene expression data between adjacent nodes in spatial positions during the feature aggregation process of nodes, and obtain a feature representation that can accurately reflect the similarity of gene expression data between adjacent nodes in the sample graph. Therefore, based on the feature representation, a more accurate spatial organizational structure can be determined, thereby improving the accuracy of identifying the spatial organizational structure of tissue samples, and further solving the technical problem of low accuracy in identifying the spatial organizational structure of tissue samples due to the inability of existing technologies to fully utilize spatial transcriptome data.
[0182] The method for identifying the spatial organizational structure of spatial transcriptome data provided by the embodiment of the present application can also realize adaptive adjustment of aggregation weights according to the characteristic data of different tissue samples. Therefore, when faced with new and unknown tissue samples, the identification system can more accurately capture the key information in the feature representation according to its corresponding aggregation weight, and obtain an enhanced feature representation that can better reflect the similarity of gene expression data between adjacent nodes in the sample graph, thereby improving the accuracy of identifying the spatial organizational structure of new tissue samples, and thus solving the problem that the existing technology cannot accurately identify the spatial organizational structure of tissue samples when faced with new and unknown tissue samples.
[0183] Device embodiment
[0184] The embodiment of the present application provides a device for identifying the spatial organization structure of spatial transcriptome data, wherein: Figure 13 A schematic diagram of a device for identifying the spatial organization structure of spatial transcriptome data provided in an embodiment of the present application is shown in FIG. Figure 13 As shown, the device includes: a data acquisition module 11, a sample graph construction module 12, a feature aggregation module 13 and a recognition result acquisition module 14. Figure 13 You can see the connection relationship between several modules.
[0185] The data acquisition module is used to obtain the gene expression matrix and adjacency matrix corresponding to the spatial transcriptome data of the sample tissue to be identified, wherein the gene expression matrix is a matrix determined by the gene expression data in the spatial transcriptome data, and the adjacency matrix is a matrix determined by the spatial position information corresponding to the gene expression data;
[0186] A sample graph construction module is used to construct a sample graph based on the gene expression matrix and the adjacency matrix, wherein the sample graph is an undirected graph describing the similarity relationship of gene expression data between adjacent nodes;
[0187] A feature aggregation module is used to input the sample graph into the graph sampling aggregation network model, and perform feature aggregation on the gene feature data of the neighboring nodes in the neighborhood of each node in the sample graph with the gene feature data of the node through the graph sampling aggregation network model to obtain a feature representation of the sample graph, wherein the neighboring nodes in the neighborhood of each node include nodes that are directly or indirectly adjacent to the node;
[0188] The recognition result acquisition module is used to obtain the recognition result of the spatial organizational structure corresponding to the sample tissue based on the feature representation.
[0189] Optionally, the recognition result acquisition module further includes: a feature enhancement module and a cluster analysis module.
[0190] The feature enhancement module is used to input the feature representation into the adaptive graph contrastive learning model, determine the attention weight corresponding to each node in the feature representation through the adaptive graph contrastive learning model, and perform feature aggregation on the feature representation based on the attention weight corresponding to each node to obtain an enhanced feature representation;
[0191] The cluster analysis module is used to perform cluster analysis on the enhanced feature representation to obtain the recognition result of the spatial organizational structure corresponding to the sample organization.
[0192] Optionally, the feature aggregation module includes: a feature extraction unit, a feature aggregation unit, a feature splicing unit and an execution unit.
[0193] The feature extraction unit is configured to perform a feature extraction operation, starting from the i-th node in the sample graph, and iteratively extracting gene feature data of M first-order neighbor nodes and L second-order neighbor nodes in the neighborhood of the i-th node, wherein the first-order neighbor node is adjacent to the i-th node, and the second-order neighbor node is adjacent to the first-order neighbor node corresponding to the i-th node, and M and L are both positive integers;
[0194] A feature aggregation unit is configured to perform a feature aggregation operation to perform feature aggregation on the gene feature data of the M first-order neighbor nodes to obtain a first aggregate feature; and to perform feature aggregation on the gene feature data of the L second-order neighbor nodes to obtain a second aggregate feature;
[0195] a feature splicing unit, configured to perform a feature splicing operation to splice the first aggregate feature, the second aggregate feature, and the gene feature data of the i-th node to obtain an embedded feature of the i-th node;
[0196] An execution unit is used to perform feature extraction operations, feature aggregation operations, and feature splicing operations multiple times until embedded features corresponding to N nodes in the sample graph are obtained, and a feature representation is constructed based on the embedded features corresponding to the N nodes, where N is a positive integer.
[0197] Optionally, the sample graph construction module includes: a construction unit, a random shielding unit and a random shuffling unit.
[0198] The construction unit is used to construct a positive sample graph based on the gene expression matrix and the adjacency matrix;
[0199] A random masking unit is used to randomly mask the gene expression matrix corresponding to the positive sample graph with a preset probability to obtain a masked positive sample graph;
[0200] The random shuffling unit is used to randomly shuffle the nodes in the masked positive sample graph to obtain a negative sample graph.
[0201] Optionally, the apparatus for identifying the spatial organization structure of spatial transcriptome data further includes: a first determination module, a second determination module, and a model training module.
[0202] The first determination module is configured to input the positive sample image and the negative sample image into the initial image sampling aggregation network model, respectively, to obtain a first feature representation of the positive sample image and a second feature representation of the negative sample image output by the initial image sampling aggregation network model;
[0203] a second determination module, configured to input the first feature representation into an initial adaptive graph contrastive learning model, and have the initial adaptive graph contrastive learning model perform feature aggregation on the first feature representation based on an initial attention weight corresponding to each node in the first feature representation to obtain a first global feature representation; and input the second feature representation into the initial adaptive graph contrastive learning model, and have the initial adaptive graph contrastive learning model perform feature aggregation on the second feature representation based on an initial attention weight corresponding to each node in the second feature representation to obtain a second global feature representation;
[0204] The model training module is used to jointly train the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the first feature representation, the second feature representation, the first global feature representation and the second global feature representation, stop the model training when the training cutoff condition is met, and obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0205] Optionally, the first determination module includes: a first determination unit, a weighted aggregation unit and a second determination unit.
[0206] The first determining unit is configured to determine an initial attention weight corresponding to each node in the first feature representation through an attention pooling layer in the initial adaptive graph contrastive learning model;
[0207] The weighted aggregation unit is used to perform weighted aggregation of the embedded features corresponding to N nodes based on the initial attention weight corresponding to each node through the attention pooling layer to obtain the aggregated feature representation;
[0208] The second determining unit is used to determine the first global feature representation according to the summarized feature representation through the attention pooling layer.
[0209] Optionally, the model training module includes: a first construction unit, a second construction unit, a third construction unit, a fourth construction unit and a model training unit.
[0210] The first construction unit is configured to construct a positive data pair based on the embedded feature corresponding to each node in the positive sample graph and the first global feature representation, thereby obtaining a total of N first positive data pairs;
[0211] The second construction unit is configured to construct a negative data pair based on the embedded feature corresponding to each node in the positive sample graph and the second global feature representation, thereby obtaining a total of N first negative data pairs;
[0212] A third construction unit is configured to construct a positive data pair based on the embedded features corresponding to each node in the negative sample graph and the second global feature representation, thereby obtaining a total of N second positive data pairs;
[0213] A fourth construction unit is configured to construct a negative data pair based on the embedded feature corresponding to each node in the negative sample graph and the first global feature representation, to obtain a total of N second negative data pairs;
[0214] A model training unit is used to jointly train an initial graph sampling aggregation network model and an initial adaptive graph contrastive learning model based on N first positive data pairs, N first negative data pairs, N second positive data pairs, N second negative data pairs, a first feature representation, and a second feature representation. When a training cutoff condition is met, the model training is stopped to obtain a graph sampling aggregation network model and an adaptive graph contrastive learning model.
[0215] Optionally, the model training unit includes: a first probability determination unit, a second probability determination unit, a third probability determination unit, a fourth probability determination unit and a model training subunit.
[0216] The first probability determination unit is configured to input N first positive data pairs into the discriminator in the initial adaptive graph contrastive learning model to obtain a first probability corresponding to each node in the positive sample graph, wherein the first probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the first global feature representation;
[0217] The second probability determination unit is used to input N first negative data pairs into the discriminator in the initial adaptive graph contrastive learning model to obtain the second probability corresponding to each node in the positive sample graph, wherein the second probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the second global feature representation
[0218] A third probability determination unit is configured to input the N second positive data pairs into the discriminator to obtain a third probability corresponding to each node in the negative sample graph, wherein the third probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the second global feature representation;
[0219] a fourth probability determination unit, configured to input the N second negative data pairs into the discriminator to obtain a fourth probability corresponding to each node in the negative sample graph, wherein the fourth probability corresponding to each node is used to represent the similarity between the embedded feature corresponding to the node and the first global feature representation;
[0220] The model training subunit is used to perform joint model training on the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability and the fourth probability, and stop the model training when the training cutoff condition is met to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0221] Optionally, the model training subunit includes: a loss value determination subunit and a model parameter updating subunit.
[0222] wherein the loss value determination subunit is configured to determine a total loss value based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability, and the fourth probability, wherein the total loss value includes the loss value of the initial graph sampling aggregation network model and the loss value of the initial adaptive graph contrastive learning model;
[0223] The model parameter updating subunit is used to iteratively update the parameters of the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the total loss value until the parameters meet the training cutoff condition, stopping the model training to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
[0224] Storage medium embodiment
[0225] The present application provides a computer-readable storage medium having a program stored thereon, wherein, when executed by a processor, the program implements some or all of the steps of the method for identifying the spatial organization structure of spatial transcriptome data described in the aforementioned method embodiment of the present application. The storage medium can be a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, among other media capable of storing program code.
[0226] Processor Embodiments
[0227] An embodiment of the present application provides a processor for running a program, wherein, when the program is running, some or all of the steps of the method for identifying the spatial organization structure of spatial transcriptome data introduced in the aforementioned method embodiment are executed.
[0228] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.
[0229] The above is merely one specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for identifying the spatial organization structure of spatial transcriptome data, characterized in that: include: Obtaining a gene expression matrix and an adjacency matrix corresponding to the spatial transcriptome data of the sample tissue to be identified, wherein the gene expression matrix is a matrix determined by the gene expression data in the spatial transcriptome data, and the adjacency matrix is a matrix determined by the spatial position information corresponding to the gene expression data; Constructing a sample graph based on the gene expression matrix and the adjacency matrix, wherein the sample graph is an undirected graph describing the similarity relationship of gene expression data between adjacent nodes; Inputting the sample graph into a graph sampling aggregation network model, and performing feature aggregation on the gene feature data of neighboring nodes in the neighborhood of each node in the sample graph and the gene feature data of the node through the graph sampling aggregation network model to obtain a feature representation of the sample graph, wherein the neighboring nodes in the neighborhood of each node include nodes directly or indirectly adjacent to the node; Obtaining an identification result of the spatial tissue structure corresponding to the sample tissue according to the feature representation; The step of performing feature aggregation on the gene feature data of neighboring nodes in the neighborhood of each node in the sample graph and the gene feature data of the node using the graph sampling aggregation network model to obtain a feature representation of the sample graph includes: Performing a feature extraction operation to extract, starting from the i-th node in the sample graph, gene feature data of M first-order neighbor nodes and gene feature data of L second-order neighbor nodes in the neighborhood of the i-th node in an iterative manner, wherein the first-order neighbor node is adjacent to the i-th node, and the second-order neighbor node is adjacent to the first-order neighbor node corresponding to the i-th node, and M and L are both positive integers; Performing a feature aggregation operation to perform feature aggregation on the gene feature data of the M first-order neighbor nodes to obtain a first aggregate feature; and performing feature aggregation on the gene feature data of the L second-order neighbor nodes to obtain a second aggregate feature; Performing a feature splicing operation to splice the first aggregate feature, the second aggregate feature, and the gene feature data of the i-th node to obtain an embedded feature of the i-th node; The feature extraction operation, the feature aggregation operation, and the feature splicing operation are performed multiple times until the embedded features corresponding to the N nodes in the sample graph are obtained, and the feature representation is constructed based on the embedded features corresponding to the N nodes, where N is a positive integer.
2. The method according to claim 1, characterized in that The obtaining of the recognition result of the spatial organizational structure corresponding to the sample tissue according to the feature representation includes: Inputting the feature representation into an adaptive graph contrastive learning model, determining an attention weight corresponding to each node in the feature representation through the adaptive graph contrastive learning model, and performing feature aggregation on the feature representation based on the attention weight corresponding to each node to obtain an enhanced feature representation; Cluster analysis is performed on the enhanced feature representation to obtain an identification result of the spatial organizational structure corresponding to the sample tissue.
3. The method according to claim 1, characterized in that The sample graph includes a positive sample graph and a negative sample graph, wherein the negative sample graph is a sample graph obtained by performing data enhancement processing on the positive sample graph, wherein the data enhancement processing is used to enhance the discrimination between the positive sample graph and the negative sample graph, and the data enhancement processing includes random masking and random shuffling; constructing the sample graph based on the gene expression matrix and the adjacency matrix includes: Constructing the positive sample graph based on the gene expression matrix and the adjacency matrix; Performing the random masking on the gene expression matrix corresponding to the positive sample graph with a preset probability to obtain a masked positive sample graph; The nodes in the shielded positive sample graph are randomly shuffled to obtain the negative sample graph.
4. The method according to claim 3, characterized in that Before inputting the sample graph into the graph sampling aggregation network model, the method further includes: Inputting the positive sample image and the negative sample image into an initial image sampling aggregation network model respectively, to obtain a first feature representation of the positive sample image and a second feature representation of the negative sample image output by the initial image sampling aggregation network model; Inputting the first feature representation into an initial adaptive graph contrastive learning model, and having the initial adaptive graph contrastive learning model perform feature aggregation on the first feature representation based on the initial attention weight corresponding to each node in the first feature representation, to obtain a first global feature representation; and inputting the second feature representation into the initial adaptive graph contrastive learning model, and having the initial adaptive graph contrastive learning model perform feature aggregation on the second feature representation based on the initial attention weight corresponding to each node in the second feature representation, to obtain a second global feature representation; Based on the first feature representation, the second feature representation, the first global feature representation and the second global feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
5. The method according to claim 4, characterized in that The performing feature aggregation on the first feature representation based on the initial attention weight corresponding to each node in the first feature representation to obtain a first global feature representation includes: Determining an initial attention weight corresponding to each of the nodes in the first feature representation through an attention pooling layer in the initial adaptive graph contrastive learning model; Performing weighted aggregation of the embedded features corresponding to the N nodes based on the initial attention weight corresponding to each node through the attention pooling layer to obtain an aggregated feature representation; The first global feature representation is determined through the attention pooling layer based on the summarized feature representation.
6. The method according to claim 4, characterized in that The method of performing joint model training on the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the first feature representation, the second feature representation, the first global feature representation, and the second global feature representation, stopping model training when a training cutoff condition is met, and obtaining the graph sampling aggregation network model and the adaptive graph contrastive learning model includes: Constructing a positive data pair based on the embedded feature corresponding to each node in the positive sample graph and the first global feature representation, obtaining a total of N first positive data pairs; Constructing a negative data pair based on the embedded feature corresponding to each node in the positive sample graph and the second global feature representation, obtaining a total of N first negative data pairs; A positive data pair is formed based on the embedded feature corresponding to each node in the negative sample graph and the second global feature representation, thereby obtaining a total of N second positive data pairs; Constructing a negative data pair based on the embedded feature corresponding to each node in the negative sample graph and the first global feature representation, obtaining a total of N second negative data pairs; Based on N first positive data pairs, N first negative data pairs, N second positive data pairs, N second negative data pairs, the first feature representation and the second feature representation, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
7. The method according to claim 6, characterized in that The method of performing joint model training on the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the N first positive data pairs, the N first negative data pairs, the N second positive data pairs, the N second negative data pairs, the first feature representation, and the second feature representation, stopping model training when a training cutoff condition is met, and obtaining the graph sampling aggregation network model and the adaptive graph contrastive learning model includes: Inputting N first positive data pairs into the discriminator in the initial adaptive graph contrastive learning model to obtain a first probability corresponding to each of the nodes in the positive sample graph, wherein the first probability corresponding to each of the nodes is used to represent the similarity between the embedded feature corresponding to the node and the first global feature representation; Inputting N first negative data pairs into the discriminator to obtain a second probability corresponding to each of the nodes in the positive sample graph, wherein the second probability corresponding to each of the nodes is used to represent the similarity between the embedded feature corresponding to the node and the second global feature representation; Inputting N second positive data pairs into the discriminator to obtain a third probability corresponding to each of the nodes in the negative sample graph, wherein the third probability corresponding to each of the nodes is used to represent the similarity between the embedded feature corresponding to the node and the second global feature representation; Inputting N second negative data pairs into the discriminator to obtain a fourth probability corresponding to each of the nodes in the negative sample graph, wherein the fourth probability corresponding to each of the nodes is used to represent the similarity between the embedded feature corresponding to the node and the first global feature representation; Based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability and the fourth probability, the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are jointly trained. When the training cutoff condition is met, the model training is stopped to obtain the graph sampling aggregation network model and the adaptive graph contrastive learning model.
8. The method according to claim 7, characterized in that The method of performing joint model training on the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability, and the fourth probability, stopping model training when a training cutoff condition is met, and obtaining the graph sampling aggregation network model and the adaptive graph contrastive learning model includes: Determining a total loss value based on the first feature representation, the second feature representation, the first probability, the second probability, the third probability, and the fourth probability, wherein the total loss value includes a loss value of the initial graph sampling aggregation network model and a loss value of the initial adaptive graph contrastive learning model; The parameters of the initial graph sampling aggregation network model and the initial adaptive graph contrastive learning model are iteratively updated based on the total loss value, and the model training is stopped when the parameters meet the training cutoff condition, thereby obtaining the graph sampling aggregation network model and the adaptive graph contrastive learning model.
9. A device for identifying the spatial organization structure of spatial transcriptome data, characterized in that: include: A data acquisition module, configured to acquire a gene expression matrix and an adjacency matrix corresponding to the spatial transcriptome data of the sample tissue to be identified, wherein the gene expression matrix is a matrix determined by the gene expression data in the spatial transcriptome data, and the adjacency matrix is a matrix determined by the spatial position information corresponding to the gene expression data; A sample graph construction module, configured to construct a sample graph based on the gene expression matrix and the adjacency matrix, wherein the sample graph is an undirected graph describing the similarity relationship of gene expression data between adjacent nodes; a feature aggregation module, configured to input the sample graph into a graph sampling aggregation network model, and perform feature aggregation on the gene feature data of neighboring nodes in the neighborhood of each node in the sample graph and the gene feature data of the node through the graph sampling aggregation network model to obtain a feature representation of the sample graph, wherein the neighboring nodes in the neighborhood of each node include nodes directly or indirectly adjacent to the node; an identification result acquisition module, configured to acquire an identification result of the spatial organizational structure corresponding to the sample tissue based on the feature representation; The feature aggregation module includes: a feature extraction unit, a feature aggregation unit, a feature splicing unit and an execution unit; The feature extraction unit is configured to perform a feature extraction operation, starting from the i-th node in the sample graph, and iteratively extracting gene feature data of M first-order neighbor nodes and L second-order neighbor nodes in the neighborhood of the i-th node, wherein the first-order neighbor node is adjacent to the i-th node, and the second-order neighbor node is adjacent to the first-order neighbor node corresponding to the i-th node, and M and L are both positive integers; The feature aggregation unit is configured to perform a feature aggregation operation to perform feature aggregation on the gene feature data of the M first-order neighbor nodes to obtain a first aggregate feature; and perform feature aggregation on the gene feature data of the L second-order neighbor nodes to obtain a second aggregate feature; The feature splicing unit is configured to perform a feature splicing operation to splice the first aggregate feature, the second aggregate feature, and the gene feature data of the i-th node to obtain an embedded feature of the i-th node; The execution unit is used to perform the feature extraction operation, the feature aggregation operation and the feature splicing operation multiple times until the embedded features corresponding to the N nodes in the sample graph are obtained, and the feature representation is constructed based on the embedded features corresponding to the N nodes, where N is a positive integer.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for identifying the spatial organization structure of spatial transcriptome data according to any one of claims 1 to 8 is implemented.
11. A processor, characterized in that: Used to run a computer program, which, when running, executes the method for identifying the spatial organization structure of spatial transcriptome data according to any one of claims 1 to 8.
Citation Information
Patent Citations
Spatial domain identification method based on spatial transcriptomics data feature extraction
CN116189785A
Method and device for determining cell type based on space transcriptome deconvolution of GraphSAGE
CN118098356A