Gene feature relationship generation method and device based on space contrast graph migration
By introducing spatial comparison map migration technology and self-attention mechanism into the gene feature relationship generation method, the problems of low efficiency and poor accuracy of existing methods are solved, and more accurate and efficient gene feature relationship generation is achieved.
Patent Information
- Application Number
- CN202510017961.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-01-06
AI Technical Summary
The existing gene feature relationship generation methods are inefficient and have poor accuracy, and cannot effectively adapt to the analysis of cell behavior in complex tissue microenvironments.
Using a spatial comparison graph migration method, the original expression data is enhanced through a graph transformer, and the original and enhanced data are encoded by a variational autoencoder to generate gene feature relationships. This method introduces self-attention mechanism and manifold structural constraints, improving the accuracy of encoding and decoding.
It improves the accuracy and efficiency of gene feature relationship generation, and can more accurately display gene feature relationships, thereby improving the analysis of cell behavior in complex tissue microenvironments.
Smart Images

Figure CN120015116A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method and device for generating gene feature relationships based on spatial comparison graph migration. Background Art
[0002] The study of complex tissues is not limited to the analysis of molecular characteristics of a large number of cells, but also requires an understanding of how the spatial environment affects the state or function of cells. The transcriptional state of cells can be regulated by the Gene Regulatory Network (GRN), which is a collection of regulatory relationships between transcription factors (TF) and their downstream target genes. In recent years, breakthroughs in spatially resolved transcriptomics (SRT) technology have made it possible to perform transcriptome feature analysis while retaining positional information, thus providing unprecedented opportunities to capture transcriptional states with spatial context.
[0003] At present, the existing inference methods of GRN based on SRT data can be analyzed based on Bayesian SpaceX and graph-based Hotspot. However, the above methods usually rely on input prior knowledge (such as cell clustering or data annotation) to guide network inference, which cannot meet the needs of accurate cell segmentation, nor can they effectively adapt to the extraction and identification of diverse features in SRT data, making the inference of gene regulatory networks not accurate enough and unable to effectively show the relationship between gene features, thus affecting the analysis of cell behavior in complex tissue microenvironments. Summary of the invention
[0004] In view of this, the present application provides a method and device for generating gene feature relationships based on spatial comparison graph migration, the main purpose of which is to solve the problems of low efficiency and poor accuracy of existing gene feature relationship generation.
[0005] According to one aspect of the present application, a method for generating gene feature relationships based on spatial comparison map migration is provided, comprising:
[0006] Acquire original expression data of tissue genes, and use a graph transformer to perform image enhancement on the original expression data to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism;
[0007] The original expression data and the enhanced expression data are respectively encoded by a variational autoencoder, and global distribution information and local distribution information of the original expression data and the enhanced expression data are respectively determined according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure;
[0008] Under the condition that the global distribution information and the local distribution information are aligned, the gene feature relationship of the tissue gene is generated.
[0009] Furthermore, before respectively encoding the original expression data and the enhanced expression data by the variational autoencoder, the method further includes:
[0010] Acquire gene encoding sample data, wherein the gene encoding sample data includes an original expression matrix and an enhanced expression matrix represented as a first input sample, and a gene feature relationship represented as a first output sample, wherein the gene feature relationship includes a spatial relationship matrix and a gene regulation relationship matrix;
[0011] Constructing the variational autoencoder, wherein the variational autoencoder includes an encoder, a decoder, and a deep self-characterizer;
[0012] Performing model training on the variational autoencoder based on the gene encoding sample data, so as to respectively encode the original expression data and the enhanced expression data through the variational autoencoder that has completed the model training;
[0013] When the deep self-characterizer is subjected to model training, the target loss function of the variational autoencoder is constructed by using the manifold structure and spatial local features to complete the model training.
[0014] Furthermore, the method further comprises:
[0015] Acquire a spatial omics data set, and determine target modality data from the spatial omics data set;
[0016] The nearest neighbor is determined according to the point distance of the target modality data, and the adjacency matrix of the original expression matrix is constructed in the nearest neighbor through the Euclidean distance to obtain the spatial local features.
[0017] Furthermore, before performing image enhancement on the original expression data using the graph transformer to obtain enhanced expression data, the method further includes:
[0018] Acquire gene expression sample data, wherein the gene expression sample data includes an original expression matrix of a cell sample and a gene locus characterized as a second input sample, and an enhanced expression matrix of a cell sample and a gene locus characterized as a second output sample;
[0019] Constructing a neural network model that introduces a self-attention mechanism, wherein the attention weight in the neural network model is determined based on the position encoding;
[0020] The neural network model is trained based on the gene expression sample data to obtain the graph transformer that has completed the model training.
[0021] Furthermore, the method further comprises:
[0022] A gene singular matrix is obtained, and an adjacency matrix of the gene singular matrix is decomposed based on a singular value decomposition algorithm to generate a position code.
[0023] Further, the determining the global distribution information and the local distribution information of the original expression data and the enhanced expression data respectively according to the coding level includes:
[0024] Obtaining original reconstructed data and enhanced reconstructed data reconstructed by a decoder in the variational autoencoder in sequence according to the coding level;
[0025] Determining global distribution information corresponding to the original reconstructed data and the enhanced reconstructed data based on the maximum mean difference;
[0026] Local distribution information corresponding to the original reconstructed data and the enhanced reconstructed data is determined based on the spatial neighbor points of the original expression data and the enhanced expression data.
[0027] Furthermore, before generating the gene feature relationship of the tissue gene, the method further includes:
[0028] Comparing the first global distribution information of the original expression data in each of the coding levels with the second global distribution information of the enhanced expression data, and comparing the first local distribution information of the original expression data in each of the coding levels with the second local distribution information of the enhanced expression data;
[0029] The gene characteristic relationship for generating the tissue gene comprises:
[0030] If the comparison result is less than the first preset loss condition, and the overall loss value is calculated based on the global distribution information, the local distribution information and the loss weight, and when the overall loss value is less than the second preset loss condition, the gene feature relationship of the tissue gene is generated.
[0031] According to another aspect of the present application, a device for generating gene feature relationships based on spatial comparison graph migration is provided, comprising:
[0032] An acquisition module is used to acquire the original expression data of tissue genes and perform image enhancement on the original expression data using a graph transformer to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism;
[0033] A determination module, configured to encode the original expression data and the enhanced expression data respectively through a variational autoencoder, and determine the global distribution information and the local distribution information of the original expression data and the enhanced expression data respectively according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure;
[0034] A generation module is used to generate the gene feature relationship of the tissue gene under the condition that the global distribution information and the local distribution information are aligned.
[0035] Furthermore, the device also includes: a construction module, a training module,
[0036] The acquisition module is further used to acquire gene encoding sample data, wherein the gene encoding sample data includes an original expression matrix and an enhanced expression matrix represented as a first input sample, and a gene feature relationship represented as a first output sample, wherein the gene feature relationship includes a spatial relationship matrix and a gene regulation relationship matrix;
[0037] The building module is used to build the variational autoencoder, wherein the variational autoencoder includes an encoder, a decoder, and a deep self-characterizer;
[0038] The training module is used to perform model training on the variational autoencoder based on the gene encoding sample data, so as to encode the original expression data and the enhanced expression data respectively through the variational autoencoder that has completed the model training;
[0039] When the deep self-characterizer is subjected to model training, the target loss function of the variational autoencoder is constructed by using the manifold structure and spatial local features to complete the model training.
[0040] Further,
[0041] The acquisition module is further used to acquire a spatial omics data set and determine target modality data from the spatial omics data set;
[0042] The construction module is also used to determine the nearest neighbor according to the point distance of the target modality data, and construct the adjacency matrix of the original expression matrix in the nearest neighbor through the Euclidean distance to obtain the spatial local features.
[0043] Further,
[0044] The acquisition module is further used to acquire gene expression sample data, wherein the gene expression sample data includes an original expression matrix of a cell sample and a gene locus characterized as a second input sample, and an enhanced expression matrix of a cell sample and a gene locus characterized as a second output sample;
[0045] The building module is further used to build a neural network model that introduces a self-attention mechanism, and the attention weight in the neural network model is determined based on the position encoding;
[0046] The training module is also used to perform model training on the neural network model based on the gene expression sample data to obtain the graph converter that completes the model training.
[0047] Further,
[0048] The acquisition module is also used to acquire a gene singular matrix, and decompose the adjacency matrix of the gene singular matrix based on a singular value decomposition algorithm to generate a position code.
[0049] Furthermore, the determination module is specifically used to obtain the original reconstructed data and enhanced reconstructed data reconstructed by the decoder in the variational autoencoder in sequence according to the coding level; determine the global distribution information corresponding to the original reconstructed data and the enhanced reconstructed data based on the maximum mean difference; determine the local distribution information corresponding to the original reconstructed data and the enhanced reconstructed data based on the spatial neighbor points of the original expression data and the enhanced expression data.
[0050] Furthermore, the device also includes:
[0051] A comparison module, configured to compare the first global distribution information of the original expression data in each of the coding levels with the second global distribution information of the enhanced expression data, and to compare the first local distribution information of the original expression data in each of the coding levels with the second local distribution information of the enhanced expression data;
[0052] The generation module is also used to generate the gene feature relationship of the tissue gene if the comparison result is less than the first preset loss condition, and calculate the overall loss value based on the global distribution information, the local distribution information and the loss weight, and when the overall loss value is less than the second preset loss condition.
[0053] According to another aspect of the present application, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the above-mentioned method for generating gene feature relationships based on spatial comparison map migration.
[0054] According to another aspect of the present application, a terminal is provided, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus;
[0055] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned gene feature relationship generation method based on spatial comparison map migration.
[0056] By means of the above technical solution, the technical solution provided by the embodiment of the present application has at least the following advantages:
[0057] The present application provides a method and device for generating gene feature relationships based on spatial contrast graph migration. Compared with the prior art, the embodiment of the present application obtains the original expression data of tissue genes, and uses a graph transformer to perform image enhancement on the original expression data to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism; the original expression data and the enhanced expression data are respectively encoded by a variational autoencoder, and the global distribution information and local distribution information of the original expression data and the enhanced expression data are respectively determined according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure; under the condition that the global distribution information and the local distribution information are aligned, the gene feature relationship of the tissue genes is generated, and a self-supervised learning framework is constructed by using a spatial distribution alignment method, and the learning purpose of inferring and spatially representing gene regulatory networks is achieved at the same time, which is helpful to explore the microenvironment changes of cell types and functional domains from the perspective of molecular regulation based on the self-supervised framework, thereby improving the accuracy of gene feature relationship generation, so as to improve the analysis basis of gene relationships.
[0058] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0060] Figure 1 A flow chart of a gene feature relationship generation method based on spatial comparison map migration provided in an embodiment of the present application is shown;
[0061] Figure 2 A schematic diagram of a SpaGTL model architecture for generating gene feature relationships provided in an embodiment of the present application is shown;
[0062] Figure 3A schematic diagram of model fine-tuning provided in an embodiment of the present application is shown;
[0063] Figure 4 A block diagram of a gene feature relationship generation device based on spatial comparison graph migration provided by an embodiment of the present application is shown;
[0064] Figure 5 A schematic diagram of the structure of a terminal provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0065] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0066] The present application embodiment provides a method for generating gene feature relationships based on spatial comparison graph migration, such as Figure 1 As shown, the method includes:
[0067] 101. Obtain original expression data of tissue genes, and use a graph transformer to perform image enhancement on the original expression data to obtain enhanced expression data.
[0068] In the embodiment of the present application, the current execution subject, as the processing end generated by the gene feature relationship, can be a terminal device, or it can be a cloud server, etc., in order to obtain the original expression data of the tissue gene that needs to be generated by the gene feature relationship. Wherein, the tissue gene can be the gene image of the tissue cell obtained by different species through different dimensions in the large-scale spatiotemporal group data set, or it can be the gene image of the tissue cell collected in real time, and the embodiment of the present application is not specifically limited. In addition, in order to carry out the processing of gene feature dimensions, the original expression data is used to characterize the matrix of cell dimension and feature dimension, and then as the model input, it is input into the graph converter, image enhancement is performed, and enhanced expression data is obtained. At this time, the graph converter is constructed for the neural network model introducing the self-attention mechanism, so that the original expression data is encoded and decoded, preferably, the neural network model introducing the attention mechanism is the Transformer model, and the embodiment of the present application is not specifically limited.
[0069] 102. Encode the original expression data and the enhanced expression data respectively through a variational autoencoder, and determine the global distribution information and the local distribution information of the original expression data and the enhanced expression data respectively according to the encoding level.
[0070] In the embodiment of the present application, the variational autoencoder constrains encoding and decoding based on the manifold structure for contrast learning of encoding and decoding of spatial graph representation. Figure 2 As shown, the current execution end encodes and decodes the original expression data X1 and the enhanced expression data X2 respectively, obtains the encoding results of different encoding levels, and hierarchically determines the global distribution information and the local distribution information based on the encoding results of different encoding levels. Among them, the global distribution information is represented as the result of clustering the encoding from a global perspective, and the local distribution information is represented as the result of clustering the encoding from a local perspective, so as to align the global distribution with the local distribution.
[0071] 103. Under the condition that the global distribution information and the local distribution information are aligned, generate a gene feature relationship of the tissue gene.
[0072] In an embodiment of the present application, the current execution end compares the global distribution information with the local distribution information in each coding level one by one. If the global distribution information and the local distribution information in each coding level match the preset loss condition, it means that the graph representation matrix containing the gene feature relationship encoded at this time can optimally express the gene regulatory network and the cell space representation. Therefore, the gene feature relationship of the component gene can be generated.
[0073] In another embodiment of the present invention, for further definition and explanation, before the step of encoding the original expression data and the enhanced expression data respectively by the variational autoencoder, the method further includes:
[0074] Obtaining genetically encoded sample data;
[0075] Constructing the variational autoencoder;
[0076] The variational autoencoder is subjected to model training based on the gene encoding sample data, so that the original expression data and the enhanced expression data are respectively encoded by the variational autoencoder that has completed the model training.
[0077] In order to achieve the purpose of analyzing gene relationships based on graph structure of artificial intelligence model, the current execution end pre-trains the variational autoencoder model. At this time, the gene encoding sample data includes the original expression matrix and enhanced expression matrix characterized as the first input sample, and the gene feature relationship characterized as the first output sample, and the gene feature relationship includes a spatial relationship matrix and a gene regulation relationship matrix. Among them, the gene encoding sample data can be obtained based on the SRT database of humans, monkeys and mice. At this time, the SRT database includes data such as STOmics, SOAR, SpatialDB, CROST, 10x Genomics website (available through 10x Genomics) and Census (available through Cellxgene), for example, including 96,700,729 cells / points from 7,367 tissue sections, covering 365 tissue cells, including lungs, skin, brain, liver, kidneys, spinal cord and embryos, and covering normal tissues and various diseases, such as pancreatic ductal adenocarcinoma, amyotrophic lateral sclerosis, non-small cell lung cancer and hepatocellular carcinoma, which are not specifically limited in the embodiments of this application. In addition, the variational autoencoder includes an encoder, a decoder, and a deep self-representer. When the deep self-representer is trained, the target loss function of the variational autoencoder is constructed through the manifold structure and the spatial local features to complete the model training. In the training process, the encoder extracts the encoding representation from the original representation sample and the enhanced representation sample. The gene expression representation of the i-th layer encoder is denoted as and
[0078]
[0079] in, represents the activation function of the i-th layer, W (i) is the weight matrix, b (i) is the bias term, and l is the number of encoding layers. The matrices of the original representation sample and the enhanced representation sample are represented as X1 and X2, respectively, and are simplified to and After the encoder encoding process, the decoder is used to reconstruct the data, that is, the representation of the i-th layer is recorded as:
[0080]
[0081] Among them, ψ i is the activation function of the i-th layer decoder, L is the total number of encoding-decoding layers, which is equal to l×2. ψ i , W (i) and b (i) Shared in views of original representation samples and enhanced representation samples.
[0082] It should be noted that in order to better reflect the complex SRT data structure, the target loss function of the variational autoencoder is constructed through the manifold structure and spatial local features. The manifold structure Z is expressed as: the relationship matrix of the gene locus spot to constrain the encoding and decoding operations. At this time, the manifold structure not only reduces the impact of data sparsity on representation learning, but also enables the model to learn consistent graph representations from the original and enhanced views, achieving higher learning effects. The target loss function is defined as: Among them, B is the local feature of the space, the parameter α is adjustable and can be flexibly set according to needs to control the learning effect of the local structure of the space on the spatial graph representation, F is the norm, Z represents the relationship between the spots that need to be learned, and I refers to the unit matrix.
[0083] In another embodiment of the present invention, for further definition and description, the steps further include:
[0084] Acquire a spatial omics data set, and determine target modality data from the spatial omics data set;
[0085] The nearest neighbor is determined according to the point distance of the target modality data, and the adjacency matrix of the original expression matrix is constructed in the nearest neighbor through the Euclidean distance to obtain the spatial local features.
[0086] In order to improve the learning ability of multimodal histological images, thereby improving the recognition accuracy of gene feature relationships, the current execution end pre-generates spatial local features before constructing the target loss function of the variational autoencoder. Among them, the SRT data set also includes the spatial position spot of the point / cell, and can also include other modal information, such as histological images, to construct a spatial local map for spatial perception map representation learning. Specifically, when determining the target modality data, the Euclidean distance between the points can be calculated based on the available modalities in the spatial omics data set as the target modality data. At this time, according to the Euclidean distance and position coordinates, each point spot selects k nearest neighbors, preferably the default k = 10, for 10xVisium data set, k = 30, for Slide-seqV2 and Stereo-seq data sets. In the embodiment of the present application, the point spot coordinates are two-dimensional, i.e., the xy axis; and when the slices of multiple target modality data are integrated, the coordinates will be expanded to three dimensions, i.e., the xyz axis. For a three-dimensional dataset, all slices are projected along the z-axis onto a common two-dimensional (i.e., xy) plane, and the nearest neighbors in the adjacent slices are selected as fair neighbors, i.e., nearest neighbors. Furthermore, the current execution end constructs a weighted adjacency graph B, B∈R N×N, N is the number of spots / cells, matrix B is the adjacency matrix between spots, and each value is the weight value of each spot and its neighboring spots. At this time, the weighted adjacency graph B can reflect the spatial local structure in the SRT dataset. In addition, each weight is embedded in U∈R by principal component analysis PCA of the expression data. K×N It can be calculated that K is the number of the first K principal components, and the formula is as follows:
[0087]
[0088] Among them, B i,j represents the normalized similarity between point i and point j, i.e., the spatial local feature, U i ,U j > represents the Euclidean distance in the PCA latent space, ||U i || and ||U j || are vectors U i and U j The model, D ij is the similarity between point i and point j.
[0089] In another embodiment of the present invention, for further definition and explanation, the step uses a graph transformer to perform image enhancement on the original expression data to obtain enhanced expression data, and before the method further comprises:
[0090] Obtain gene expression sample data;
[0091] Build a neural network model that introduces the self-attention mechanism;
[0092] The neural network model is trained based on the gene expression sample data to obtain the graph transformer that has completed the model training.
[0093] In order to enhance the original expression data, the current execution end pre-trains the neural network with the attention mechanism to encode and decode the original expression data and the enhanced expression data to obtain a graph representation of the gene feature relationship. The gene expression sample data includes the original expression matrix of the cell sample and the gene site represented as the second input sample, and the enhanced expression matrix of the cell sample and the gene site represented as the second output sample, so as to train the neural network model based on the gene expression sample data. Specifically, the original expression matrix X1∈R M×N , M is the number of genes, N is the number of sites / cells, and the enhanced expression matrix X2∈R M×N At this time, constructing a neural network model that introduces the self-attention mechanism is to construct a learnable relationship graph S∈R between genes M×M, which is used to learn the gene relationship in the enhanced expression matrix. In addition, in the neural network model with the self-attention mechanism, since the self-attention mechanism allows information to be transferred across different genes, so that the original representation matrix can be reconstructed into an enhanced representation matrix, a multi-head attention mechanism is introduced to train the neural network model based on the gene expression sample data. Specifically, the attention weight in the neural network model is determined based on the position encoding. For example, in the self-attention of the ξth layer, the attention weight S is obtained. ξ and the enhanced representation matrix as follows:
[0094]
[0095] in, denote the query, key, and value of the t-th head in the ξ-th layer, respectively; d t is the query and key dimension, and concat(*) represents concatenation along the rows. For simplicity, the original expression matrix X1 is denoted as Enhanced expression matrix at this time, is the attention weight of the t-th head in the ξ-th layer. The average attention weight S is used to measure the gene-gene relationship, and the calculation formula is: Among them, Γ is the number of heads of the attention multi-head, the parameter μ is set to non-zero only in the pre-training stage, and the default value is 0.2. It is used to control the biological significance of the inferred network S based on the prior gene network knowledge. At this time, these prior gene networks serve as the gold standard reference for the position encoding P during the pre-training process, and the standardized confidence scores of the gene networks are used as the weight values of the adjacency matrix A.
[0096] In another embodiment of the present invention, for further definition and description, the steps further include:
[0097] A gene singular matrix is obtained, and an adjacency matrix of the gene singular matrix is decomposed based on a singular value decomposition algorithm to generate a position code.
[0098] In order to implement the position code P as the input of the attention mechanism and update the attention weights in each attention, the current execution end obtains the gene singular matrix, represented as U, V, U, V ∈ R M×r , respectively containing the first r left and right singular matrices, and then, based on the singular value decomposition algorithm (Singular Value Decomposition), the adjacency matrix A of the gene singular matrix is decomposed to generate the position code, which is expressed as follows:
[0099]
[0100] Among them, Σ∈R γ×γis a diagonal matrix, || represents column concatenation, W PE ∈R 2γ×N is the learned projection matrix, P∈R M×N Encode the position.
[0101] In another embodiment of the present invention, for further definition and explanation, the step of determining the global distribution information and the local distribution information of the original expression data and the enhanced expression data respectively according to the coding level includes:
[0102] Obtaining original reconstructed data and enhanced reconstructed data reconstructed by a decoder in the variational autoencoder in sequence according to the coding level;
[0103] Determining global distribution information corresponding to the original reconstructed data and the enhanced reconstructed data based on the maximum mean difference;
[0104] Local distribution information corresponding to the original reconstructed data and the enhanced reconstructed data is determined based on the spatial neighbor points of the original expression data and the enhanced expression data.
[0105] Since the distribution of spots can be reflected by clustering, in order to promote the preservation of the manifold structure and thus achieve consistent clustering from a global perspective, the current execution end obtains the original reconstructed data and enhanced reconstructed data reconstructed by the variational autoencoder decoder in sequence according to the encoding level, such as Figure 2 shown and Etc., and then determine the original reconstructed data based on the maximum mean difference Enhanced reconstruction data The corresponding global distribution information, at this time, the global distribution information is used to characterize the global distribution loss, which is expressed by the global distribution loss function:
[0106]
[0107] Among them, the definition of MMD metric is characterized as:
[0108] Among them, ψ(·) is the function that projects the data into the reborn Hilbert space, is a metric for measuring the distance of data in this reborn Hilbert space, is a Gaussian kernel function used to measure the distance between vectors, and N is the number of samples. At the same time, the local distribution information corresponding to the original reconstructed data and the enhanced reconstructed data is determined based on the spatial neighbor points of the original expression data and the enhanced expression data. At this time, the local distribution information is used to characterize the local distribution loss, which is expressed by the local distribution loss function as follows: in, They represent the representation of the spatial neighbor spots of the i-th layer in the original and enhanced data, respectively, K is the K-th spot, and Nei is the spatial neighbor of the K-th spot.
[0109] In another embodiment of the present invention, for further definition and explanation, before the step of generating the gene feature relationship of the tissue gene, the method further includes:
[0110] Comparing the first global distribution information of the original expression data in each of the coding levels with the second global distribution information of the enhanced expression data, and comparing the first local distribution information of the original expression data in each of the coding levels with the second local distribution information of the enhanced expression data;
[0111] The gene characteristic relationship for generating the tissue gene comprises:
[0112] If the comparison result is less than the first preset loss condition, and the overall loss value is calculated based on the global distribution information, the local distribution information and the loss weight, and when the overall loss value is less than the second preset loss condition, the gene feature relationship of the tissue gene is generated.
[0113] In order to better constrain the learning effect of the model and improve the accuracy of learning the gene feature relationship, and not prevent the data drift of each point in the distribution alignment, the current execution end predefines the contrast loss function as the first preset loss condition as a constraint. Specifically, the first global distribution information of the original expression data is compared with the second global distribution information of the enhanced expression data, and the first local distribution information of the original expression data is compared with the second local distribution information of the enhanced expression data. Both need to satisfy the contrast loss function. At this time, the contrast loss function is expressed as:
[0114]
[0115] Furthermore, when the gene feature relationship of the tissue gene is finally generated, specifically, in addition to the comparison result being less than the first preset loss condition, it is also necessary to determine whether the overall loss meets the condition to deepen the training effect of the neural network model. The overall loss value is calculated based on the overall loss function, and the overall loss function is expressed as: in, Variational autoencoder loss for original representation samples and enhanced representation samples. Adjustable parameters λ1 and λ2 can be set based on demand to control the point-level graph representation learning and keep the model performance undisturbed within a certain range based on the sensitivity analysis of the parameters.
[0116] In a specific application scenario in the embodiment of the present application, Figure 2As shown in the model architecture for executing steps 101-103 in this application, it can be named as follows Figure 3 The SpaGTL model shown, after completing the pre-training of this SpaGTL model, uses the pre-training parameters and specific spatiotemporal omics data as fine-tuning training samples to fine-tune the visibility of the SpaGTL model to execute the gene feature relationship generation method for tissue genes in the embodiment of the present application, thereby obtaining a matrix representation containing a gene regulatory network and a matrix representation of a spatial graph representation, which is not specifically limited in the embodiment of the present application.
[0117] The embodiment of the present application provides a method for generating gene feature relationships based on spatial contrast graph migration. Compared with the prior art, the embodiment of the present application obtains original expression data of tissue genes, and uses a graph transformer to perform image enhancement on the original expression data to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism; the original expression data and the enhanced expression data are respectively encoded by a variational autoencoder, and the global distribution information and local distribution information of the original expression data and the enhanced expression data are respectively determined according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure; under the condition that the global distribution information and the local distribution information are aligned, the gene feature relationship of the tissue genes is generated, and a self-supervised learning framework is constructed by using a spatial distribution alignment method, and the learning purpose of inferring and spatially representing gene regulatory networks is achieved at the same time, which is helpful to explore the microenvironment changes of cell types and functional domains from the perspective of molecular regulation based on the self-supervised framework, thereby improving the accuracy of gene feature relationship generation, so as to improve the basis for analyzing gene relationships.
[0118] Furthermore, as a response to the above Figure 1 The implementation of the method shown in the embodiment of the present application provides a gene feature relationship generation device based on spatial comparison map migration, such as Figure 4 As shown, the device comprises:
[0119] An acquisition module 21 is used to acquire original expression data of tissue genes and perform image enhancement on the original expression data using a graph transformer to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism;
[0120] A determination module 22, configured to encode the original expression data and the enhanced expression data respectively through a variational autoencoder, and determine the global distribution information and the local distribution information of the original expression data and the enhanced expression data respectively according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure;
[0121] The generating module 23 is used to generate the gene feature relationship of the tissue gene under the condition that the global distribution information and the local distribution information are aligned.
[0122] Furthermore, the device also includes: a construction module, a training module,
[0123] The acquisition module is further used to acquire gene encoding sample data, wherein the gene encoding sample data includes an original expression matrix and an enhanced expression matrix represented as a first input sample, and a gene feature relationship represented as a first output sample, wherein the gene feature relationship includes a spatial relationship matrix and a gene regulation relationship matrix;
[0124] The building module is used to build the variational autoencoder, wherein the variational autoencoder includes an encoder, a decoder, and a deep self-characterizer;
[0125] The training module is used to perform model training on the variational autoencoder based on the gene encoding sample data, so as to encode the original expression data and the enhanced expression data respectively through the variational autoencoder that has completed the model training;
[0126] When the deep self-characterizer is subjected to model training, the target loss function of the variational autoencoder is constructed by using the manifold structure and spatial local features to complete the model training.
[0127] Further,
[0128] The acquisition module is further used to acquire a spatial omics data set and determine target modality data from the spatial omics data set;
[0129] The construction module is also used to determine the nearest neighbor according to the point distance of the target modality data, and construct the adjacency matrix of the original expression matrix in the nearest neighbor through the Euclidean distance to obtain the spatial local features.
[0130] Further,
[0131] The acquisition module is further used to acquire gene expression sample data, wherein the gene expression sample data includes an original expression matrix of a cell sample and a gene locus characterized as a second input sample, and an enhanced expression matrix of a cell sample and a gene locus characterized as a second output sample;
[0132] The building module is further used to build a neural network model that introduces a self-attention mechanism, and the attention weight in the neural network model is determined based on the position encoding;
[0133] The training module is also used to perform model training on the neural network model based on the gene expression sample data to obtain the graph converter that completes the model training.
[0134] Further,
[0135] The acquisition module is also used to acquire a gene singular matrix, and decompose the adjacency matrix of the gene singular matrix based on a singular value decomposition algorithm to generate a position code.
[0136] Furthermore, the determination module is specifically used to obtain the original reconstructed data and enhanced reconstructed data reconstructed by the decoder in the variational autoencoder in sequence according to the coding level; determine the global distribution information corresponding to the original reconstructed data and the enhanced reconstructed data based on the maximum mean difference; determine the local distribution information corresponding to the original reconstructed data and the enhanced reconstructed data based on the spatial neighbor points of the original expression data and the enhanced expression data.
[0137] Furthermore, the device also includes:
[0138] A comparison module, configured to compare the first global distribution information of the original expression data in each of the coding levels with the second global distribution information of the enhanced expression data, and to compare the first local distribution information of the original expression data in each of the coding levels with the second local distribution information of the enhanced expression data;
[0139] The generation module is also used to generate the gene feature relationship of the tissue gene if the comparison result is less than the first preset loss condition, and calculate the overall loss value based on the global distribution information, the local distribution information and the loss weight, and when the overall loss value is less than the second preset loss condition.
[0140] The present application provides a device for generating gene feature relationships based on spatial contrast graph migration. Compared with the prior art, the embodiment of the present application obtains original expression data of tissue genes, and uses a graph transformer to perform image enhancement on the original expression data to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism; the original expression data and the enhanced expression data are respectively encoded by a variational autoencoder, and the global distribution information and the local distribution information of the original expression data and the enhanced expression data are respectively determined according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure; under the condition that the global distribution information and the local distribution information are aligned, the gene feature relationship of the tissue gene is generated, and a self-supervised learning framework is constructed by using a spatial distribution alignment method, and the learning purpose of inferring and spatially representing the gene regulatory network is achieved at the same time, which is helpful to explore the microenvironment changes of cell types and functional domains from the perspective of molecular regulation based on the self-supervised framework, thereby improving the accuracy of gene feature relationship generation, so as to improve the analysis basis of gene relationships.
[0141] According to one embodiment of the present application, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the gene feature relationship generation method based on spatial comparison map migration in any of the above method embodiments.
[0142] Figure 5 A schematic diagram of the structure of a terminal provided according to an embodiment of the present application is shown, and the specific embodiment of the present application does not limit the specific implementation of the terminal.
[0143] like Figure 5 As shown, the terminal may include: a processor (processor) 302 , a communication interface (Communications Interface) 304 , a memory (memory) 306 , and a communication bus 308 .
[0144] The processor 302 , the communication interface 304 , and the memory 306 communicate with each other via the communication bus 308 .
[0145] The communication interface 304 is used to communicate with other devices such as clients or other servers.
[0146] The processor 302 is used to execute the program 310, and specifically can execute the relevant steps in the above-mentioned embodiment of the gene feature relationship generation method based on spatial comparison map migration.
[0147] Specifically, the program 310 may include program codes, which include computer operation instructions.
[0148] The processor 302 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the terminal may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0149] The memory 306 is used to store the program 310. The memory 306 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0150] The program 310 may be specifically configured to enable the processor 302 to perform the following operations:
[0151] Acquire original expression data of tissue genes, and use a graph transformer to perform image enhancement on the original expression data to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism;
[0152] The original expression data and the enhanced expression data are respectively encoded by a variational autoencoder, and global distribution information and local distribution information of the original expression data and the enhanced expression data are respectively determined according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure;
[0153] Under the condition that the global distribution information and the local distribution information are aligned, the gene feature relationship of the tissue gene is generated.
[0154] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0155] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for generating gene feature relationships based on spatial comparison graph migration, characterized in that: include: Acquire original expression data of tissue genes, and perform image enhancement on the original expression data using a graph transformer to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism; The original expression data and the enhanced expression data are respectively encoded by a variational autoencoder, and global distribution information and local distribution information of the original expression data and the enhanced expression data are respectively determined according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure; Under the condition that the global distribution information and the local distribution information are aligned, the gene feature relationship of the tissue gene is generated.
2. The method according to claim 1, characterized in that Before respectively encoding the original expression data and the enhanced expression data by the variational autoencoder, the method further includes: Acquire gene encoding sample data, wherein the gene encoding sample data includes an original expression matrix and an enhanced expression matrix represented as a first input sample, and a gene feature relationship represented as a first output sample, wherein the gene feature relationship includes a spatial relationship matrix and a gene regulation relationship matrix; Constructing the variational autoencoder, wherein the variational autoencoder includes an encoder, a decoder, and a deep self-characterizer; Performing model training on the variational autoencoder based on the gene encoding sample data, so as to respectively encode the original expression data and the enhanced expression data through the variational autoencoder that has completed the model training; When the deep self-characterizer is subjected to model training, the target loss function of the variational autoencoder is constructed by using the manifold structure and spatial local features to complete the model training.
3. The method according to claim 2, characterized in that The method further comprises: Acquire a spatial omics data set, and determine target modality data from the spatial omics data set; The nearest neighbor is determined according to the point distance of the target modality data, and the adjacency matrix of the original expression matrix is constructed in the nearest neighbor through the Euclidean distance to obtain the spatial local features.
4. The method according to claim 1, characterized in that: Before performing image enhancement on the original expression data using the graph transformer to obtain enhanced expression data, the method further comprises: Acquire gene expression sample data, wherein the gene expression sample data includes an original expression matrix of a cell sample and a gene locus characterized as a second input sample, and an enhanced expression matrix of a cell sample and a gene locus characterized as a second output sample; Constructing a neural network model that introduces a self-attention mechanism, wherein the attention weight in the neural network model is determined based on the position encoding; The neural network model is trained based on the gene expression sample data to obtain the graph transformer that has completed the model training.
5. The method according to claim 4, characterized in that The method further comprises: A gene singular matrix is obtained, and an adjacency matrix of the gene singular matrix is decomposed based on a singular value decomposition algorithm to generate a position code.
6. The method according to claim 1, characterized in that The determining of the global distribution information and the local distribution information of the original expression data and the enhanced expression data respectively according to the coding level comprises: Obtaining original reconstructed data and enhanced reconstructed data reconstructed by a decoder in the variational autoencoder in sequence according to the coding level; Determining global distribution information corresponding to the original reconstructed data and the enhanced reconstructed data based on the maximum mean difference; Local distribution information corresponding to the original reconstructed data and the enhanced reconstructed data is determined based on the spatial neighbor points of the original expression data and the enhanced expression data.
7. The method according to claim 1, characterized in that Before generating the gene feature relationship of the tissue gene, the method further comprises: Comparing the first global distribution information of the original expression data in each of the coding levels with the second global distribution information of the enhanced expression data, and comparing the first local distribution information of the original expression data in each of the coding levels with the second local distribution information of the enhanced expression data; The gene characteristic relationship for generating the tissue gene comprises: If the comparison result is less than the first preset loss condition, and the overall loss value is calculated based on the global distribution information, the local distribution information and the loss weight, and when the overall loss value is less than the second preset loss condition, the gene feature relationship of the tissue gene is generated.
8. A gene feature relationship generation device based on spatial comparison graph migration, characterized in that: include: An acquisition module is used to acquire the original expression data of tissue genes and perform image enhancement on the original expression data using a graph transformer to obtain enhanced expression data, wherein the graph transformer is constructed by introducing a neural network model with a self-attention mechanism; A determination module, configured to encode the original expression data and the enhanced expression data respectively through a variational autoencoder, and determine the global distribution information and the local distribution information of the original expression data and the enhanced expression data respectively according to the encoding level, wherein the variational autoencoder constrains encoding and decoding based on a manifold structure; A generation module is used to generate the gene feature relationship of the tissue gene under the condition that the global distribution information and the local distribution information are aligned.
9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to claim 1 are implemented.
10. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method of claim 1.
Citation Information
Patent Citations
Method and system for identifying spatial transcriptome cell expression pattern
CN115732034A
Spatial transcriptome spatial domain division method and system based on nonlinear depth auto-encoder
CN116525003A
Data processing method and device, equipment and medium
CN116978464A
Single cell depth clustering method fused with variational graph attention auto-encoder
CN118335189A
RNA-drug correlation prediction method based on graph converter self-coding and Attention-DNN
CN118645161A
Cited By
Gene and brain image feature representation method based on deep self-coding collaborative representation
CN121034426A