Method and device for generating gene feature relationships based on spatial comparison graph migration
By introducing a neural network model and a variational autoencoder to image enhancement and encoding the gene expression data, the problems of low efficiency and poor accuracy of gene feature relationship generation in the prior art are solved, and more accurate gene feature relationship generation and cell behavior analysis are achieved.
Patent Information
- Application Number
- CN202510017961.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-08-19
- 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.
By obtaining the original expression data of tissue genes, using a neural network model that introduces a self-attention mechanism for image enhancement, combining with a variant autoencoder for encoding, and constraining encoding and decoding based on the manifold structure to generate a gene feature relationship that is aligned with global and local distribution information.
A self-supervised learning framework is realized, the accuracy of gene feature relationship generation is improved, the microenvironment changes in cell types and functional domains can be explored, and the basis for gene relationship analysis is enhanced.
Smart Images

Figure CN120015116B_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 contrast image migration. Background Art
[0002] The study of complex tissues is not limited to the molecular characteristics of a large number of cells, but also requires an understanding of how the spatial environment affects cell state or function. The transcriptional state of a cell can be regulated by a gene regulatory network (GRN), which is a collection of regulatory relationships between transcription factors (TFs) and their downstream target genes. In recent years, breakthroughs in spatially resolved transcriptomics (SRT) technology have made it possible to analyze transcriptome features while retaining positional information, providing unprecedented opportunities to capture transcriptional states with spatial context.
[0003] Currently, existing methods for inferring GRNs based on SRT data include Bayesian SpaceX and graph-based Hotspot analysis. However, these methods typically rely on prior knowledge (such as cell clustering or data annotation) to guide network inference. This fails to meet the requirements for precise cell segmentation and cannot effectively adapt to the extraction and recognition of diverse features in SRT data. This results in inaccurate inference of gene regulatory networks and an inability to effectively demonstrate gene feature relationships, thus hindering 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 graph migration is provided, comprising:
[0006] Obtaining original expression data of tissue genes and performing 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;
[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 genes is generated.
[0009] Furthermore, before encoding the original expression data and the enhanced expression data respectively by the variational autoencoder, the method further includes:
[0010] Obtaining gene encoding sample data, the gene encoding sample data including 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, the gene feature relationship including 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 trained, the target loss function of the variational autoencoder is constructed by using the manifold structure and the spatial local features to complete the model training.
[0014] Furthermore, the method further comprises:
[0015] Acquiring a spatial omics dataset, and determining target modality data from the spatial omics dataset;
[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 feature.
[0017] Furthermore, before performing image enhancement on the original expression data using the image transformer to obtain enhanced expression data, the method further includes:
[0018] Acquiring gene expression sample data, the gene expression sample data including an original expression matrix of a cell sample and gene loci represented as a second input sample, and an enhanced expression matrix of a cell sample and gene loci represented as a second output sample;
[0019] Constructing a neural network model that introduces a self-attention mechanism, wherein the attention weights in the neural network model are determined based on position encoding;
[0020] The neural network model is trained based on the gene expression sample data to obtain the graph converter that completes 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] Furthermore, 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 the 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 genes, the method further includes:
[0028] Comparing the first global distribution information of the original expression data in each coding level 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 coding level with the second local distribution information of the enhanced expression data;
[0029] The gene characteristic relationship of generating the tissue gene includes:
[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 obtain 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. The graph transformer is constructed by a neural network model that introduces 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 global distribution information and 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 generating module is used to generate the gene feature relationship of the tissue genes under the condition that the global distribution information and the local distribution information are aligned.
[0035] Furthermore, the device further comprises: a construction module, a training module,
[0036] The acquisition module is further configured to acquire gene encoding sample data, the gene encoding sample data including 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, the gene feature relationship including a spatial relationship matrix and a gene regulation relationship matrix;
[0037] The building module is used to build the variational autoencoder, which 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 trained, the target loss function of the variational autoencoder is constructed by using the manifold structure and the spatial local features to complete the model training.
[0040] Further,
[0041] The acquisition module is further configured to acquire a spatial omics dataset and determine target modality data from the spatial omics dataset;
[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 configured 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 represented as a second input sample, and an enhanced expression matrix of a cell sample and a gene locus represented as a second output sample;
[0045] The building module is further used to build a neural network model that introduces a self-attention mechanism, where the attention weight in the neural network model is determined based on the position encoding;
[0046] The training module is further 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 further 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; and 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 further comprises:
[0051] a comparison module, configured to compare the first global distribution information of the original expression data in each coding level 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 coding level with the second local distribution information of the enhanced expression data;
[0052] The generation module is also used to calculate the overall loss value based on the global distribution information, the local distribution information and the loss weight if the comparison result is less than the first preset loss condition, and generate the gene feature relationship of the tissue gene 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 the storage medium stores at least one executable instruction, and the executable instruction enables a processor to perform 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, there is provided a terminal, 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 via 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 method for generating gene feature relationships 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. 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. 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 using a spatial distribution alignment method, while achieving the learning purpose of inferring and spatial representation of gene regulatory networks, which helps to explore the microenvironmental 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 and improving the basis for analysis 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 skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0060] Figure 1 A flow chart of a method for generating gene feature relationships based on spatial comparison graph migration provided in an embodiment of the present application is shown;
[0061] Figure 2 A schematic diagram of the 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] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although 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. Rather, 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 perform image enhancement on the original expression data using an image converter to obtain enhanced expression data.
[0068] In the embodiment of the present application, the current execution subject is as the processing end generated by gene feature relationship, it can be terminal equipment, it can also be cloud server etc., in order to obtain the original expression data of the tissue gene that needs to carry out gene feature relationship generation.Wherein, tissue gene can be the gene image of the tissue cell that different species obtain through different dimensions in large-scale spatiotemporal group data set, it can also be the gene image of the tissue cell collected in real time, and the embodiment of the present application does not do specific limitation.In addition, in order to carry out the processing of gene feature dimension, original expression data is used to characterize the matrix of cell dimension and feature dimension, and then as model input, input in graph converter, carry out image enhancement, obtain enhanced expression data, now, graph converter is for introducing the neural network model construction of self-attention mechanism, so that original expression data is encoded, decoded, preferably, the neural network model introducing attention mechanism is Transformer model, and the embodiment of the present application does not do specific limitation.
[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 comparative learning of encoding and decoding of spatial graph representation. In this case, Figure 2 As shown, the current execution end encodes and decodes the original expression data X1 and enhanced expression data X2 respectively to obtain encoding results at different encoding levels, and hierarchically determines global distribution information and local distribution information based on the encoding results at different encoding levels. The global distribution information is represented by the result of clustering the encoding from a global perspective, and the local distribution information is represented by the result of clustering the encoding from a local perspective, thereby aligning the global distribution and 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 genes.
[0072] In an embodiment of the present application, the current execution end compares the global distribution information and 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 conditions, it means that the graph representation matrix containing the gene feature relationship encoded at this time can optimally express the gene regulatory network and 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] Obtain 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 as to encode the original expression data and the enhanced expression data respectively through the variational autoencoder that has completed the model training.
[0077] In order to achieve the purpose of graph structure analysis of gene relationships based on artificial intelligence models, the current execution end pre-trains the variational autoencoder model. At this time, the gene encoding sample data includes the original expression matrix and the enhanced expression matrix represented as the first input sample, and the gene feature relationship represented as the first output sample. The gene feature relationship includes a spatial relationship matrix and a gene regulatory 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, it contains 96,700,729 cells / points from 7,367 tissue sections, covering 365 tissue cells, including lung, skin, brain, liver, kidney, spinal cord and embryo, and covering normal tissues and various diseases, such as pancreatic ductal adenocarcinoma, amyotrophic lateral sclerosis, non-small cell lung cancer and hepatocellular carcinoma. The embodiments of this application are not specifically limited. In addition, the variational autoencoder includes an encoder, a decoder, and a deep self-representer. When training the deep self-representer, the target loss function of the variational autoencoder is constructed through the manifold structure and spatial local features to complete the model training. During 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, which 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 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 site 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 space, the parameter α is adjustable and can be flexibly set according to needs to control the learning effect of the local structure of space on the spatial graph representation, F is the norm, Z represents the relationship between 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 explanation, the steps further include:
[0084] Acquiring a spatial omics dataset, and determining target modality data from the spatial omics dataset;
[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 feature.
[0086] In order to improve the learning ability of multimodal histological images and thus improve 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 dataset 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 dataset as the target modality data. At this time, based on the Euclidean distance and position coordinates, each point spot selects k nearest neighbors, preferably with the default k = 10 for the 10xVisium dataset and k = 30 for the Slide-seqV2 and Stereo-seq datasets. In the embodiment of the present application, the point spot coordinates are two-dimensional, i.e., the xy axis; and when slices of multiple target modality data are integrated, the coordinates are expanded to three dimensions, i.e., the xyz axis. For a three-dimensional dataset, all slices are projected onto a common two-dimensional (i.e., xy) plane along the z-axis, 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, the 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 The calculated value is K, which is the number of the first K principal components. 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, before the step of performing image enhancement on the original expression data using the image converter to obtain the enhanced expression data, the method further includes:
[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 converter that completes 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 by encoding and decoding based on 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, the original representation matrix can be reconstructed into an enhanced representation matrix. Therefore, 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 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 dimension of query and key, concat(*) means concatenation along the row. For simplicity, the original expression matrix X1 is written 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 is calculated as: Where Γ is the number of heads in the attention multi-head, and the parameter μ is set to non-zero only during the pre-training phase, with a default value of 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 weights in the adjacency matrix A.
[0096] In another embodiment of the present invention, for further definition and explanation, 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-based encoding P as the input of the attention mechanism and thus update the attention weights of 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] Where Σ∈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 the 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] where ψ(·) is the function that projects the data into the reborn Hilbert space, is a metric for measuring data distances 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 point spot 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 genes, the method further includes:
[0110] Comparing the first global distribution information of the original expression data in each coding level 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 coding level with the second local distribution information of the enhanced expression data;
[0111] The gene characteristic relationship of generating the tissue gene includes:
[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 data drift at each point in the distribution alignment, the current execution end predefines a contrast loss function as a 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, which is expressed as: in, The variational autoencoder loss of the original representation sample and the enhanced representation sample, the 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 2The model architecture shown as executing steps 101-103 in this application 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 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. 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. 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 using a spatial distribution alignment method, while achieving the learning purpose of inferring and spatial representation of gene regulatory networks, which helps to explore the microenvironmental 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 and improving the basis for analysis of gene relationships.
[0118] Furthermore, as a response to the above Figure 1 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 includes:
[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. The graph transformer is constructed by a neural network model that introduces 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 global distribution information and 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 configured to generate the gene feature relationship of the tissue genes under the condition that the global distribution information and the local distribution information are aligned.
[0122] Furthermore, the device further comprises: a construction module, a training module,
[0123] The acquisition module is further configured to acquire gene encoding sample data, the gene encoding sample data including 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, the gene feature relationship including a spatial relationship matrix and a gene regulation relationship matrix;
[0124] The building module is used to build the variational autoencoder, which 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 trained, the target loss function of the variational autoencoder is constructed by using the manifold structure and the spatial local features to complete the model training.
[0127] Further,
[0128] The acquisition module is further configured to acquire a spatial omics dataset and determine target modality data from the spatial omics dataset;
[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 configured 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 represented as a second input sample, and an enhanced expression matrix of a cell sample and a gene locus represented as a second output sample;
[0132] The building module is further used to build a neural network model that introduces a self-attention mechanism, where the attention weight in the neural network model is determined based on the position encoding;
[0133] The training module is further 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 further 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; and 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 further comprises:
[0138] a comparison module, configured to compare the first global distribution information of the original expression data in each coding level 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 coding level with the second local distribution information of the enhanced expression data;
[0139] The generation module is also used to calculate the overall loss value based on the global distribution information, the local distribution information and the loss weight if the comparison result is less than the first preset loss condition, and generate the gene feature relationship of the tissue gene 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 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. 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. 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 using a spatial distribution alignment method, while achieving the learning purpose of inferring and spatial representation of gene regulatory networks, which helps to explore the microenvironmental 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 and improving the basis for analysis 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 contrast 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. 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 302 , a communications interface 304 , a memory 306 , and a communication bus 308 .
[0144] The processor 302 , the communication interface 304 , and the memory 306 communicate with each other via a 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 configured to execute the program 310 , and specifically to execute the relevant steps in the above-mentioned embodiment of the method for generating gene feature relationships based on spatial comparison graph migration.
[0147] Specifically, the program 310 may include program codes, which include computer operation instructions.
[0148] Processor 302 may be a central processing unit (CPU), 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 cause the processor 302 to perform the following operations:
[0151] Obtaining original expression data of tissue genes and performing 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;
[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 genes is generated.
[0154] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Alternatively, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into separate integrated circuit modules, or multiple modules or steps 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 merely a preferred embodiment of the present application and is not intended to limit the present application. Persons skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for generating gene feature relationships based on spatial comparison graph migration, characterized in that: include: Obtaining original expression data of tissue genes and performing 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; generating a gene feature relationship of the tissue genes under the condition that the global distribution information and the local distribution information are aligned; Before encoding the original expression data and the enhanced expression data respectively by the variational autoencoder, the method further includes: Obtaining gene encoding sample data, the gene encoding sample data including 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, the gene feature relationship including 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; Wherein, when the deep self-characterizer is trained, the target loss function of the variational autoencoder is constructed by using the manifold structure and the spatial local features to complete the model training; Before performing image enhancement on the original expression data using the image converter to obtain enhanced expression data, the method further includes: Acquiring gene expression sample data, the gene expression sample data including an original expression matrix of a cell sample and gene loci represented as a second input sample, and an enhanced expression matrix of a cell sample and gene loci represented as a second output sample; Constructing a neural network model that introduces a self-attention mechanism, wherein the attention weights in the neural network model are determined based on position encoding; The neural network model is trained based on the gene expression sample data to obtain the graph converter that completes the model training.
2. The method according to claim 1, characterized in that The method further comprises: Acquiring a spatial omics dataset, and determining target modality data from the spatial omics dataset; 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 feature.
3. The method according to claim 1, 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.
4. The method according to claim 1, wherein 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: Obtaining original reconstructed data and enhanced reconstructed data reconstructed by the 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.
5. The method according to claim 1, characterized in that Before generating the gene feature relationship of the tissue genes, the method further includes: Comparing the first global distribution information of the original expression data in each coding level 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 coding level with the second local distribution information of the enhanced expression data; The gene characteristic relationship of generating the tissue gene includes: 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.
6. A gene feature relationship generation device based on spatial comparison graph migration, characterized in that: include: An acquisition module is used to obtain 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. The graph transformer is constructed by a neural network model that introduces 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 global distribution information and 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 generating module, configured to generate a gene feature relationship of the tissue genes under the condition that the global distribution information and the local distribution information are aligned; The device also includes: a construction module, a training module, The acquisition module is further configured to acquire gene encoding sample data, the gene encoding sample data including 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, the gene feature relationship including a spatial relationship matrix and a gene regulation relationship matrix; The building module is used to build the variational autoencoder, which includes an encoder, a decoder and a deep self-characterizer; 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; Wherein, when the deep self-characterizer is trained, the target loss function of the variational autoencoder is constructed by using the manifold structure and the spatial local features to complete the model training; The acquisition module is further configured 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 represented as a second input sample, and an enhanced expression matrix of a cell sample and a gene locus represented as a second output sample; The building module is further used to build a neural network model that introduces a self-attention mechanism, where the attention weight in the neural network model is determined based on the position encoding; The training module is further 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.
7. 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.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the steps of the method according to claim 1.