Method, system, terminal and storage medium for predicting spatial transcriptomic gene expression
Patent Information
- Application Number
- CN202511498497.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-10-20
AI Technical Summary
[0005]本发明的主要目的在于提供一种空间转录组基因表达的预测方法、系统、终端及计算机可读存储介质,旨在解决现有技术中进行基因表达预测时,仅从图像维度考虑,忽视了生物学特征,从而导致对基因表达预测的准确性低的问题
[0016] In this invention, multiple tissue slices of a target region are obtained, gene counts are extracted for each locus in each tissue slice, multiple target loci are determined based on all gene counts, and the target region is segmented according to all target loci to obtain multiple image patches and a locus type for each target locus. Each image patch is projected into a latent space, and image feature embeddings for each image patch are extracted. Based on each projection result and all locus types, enhanced gene expression features for each target locus are constructed. A graph structure is constructed based on all enhanced gene expression features, and gene expression feature embeddings for each target locus are extracted based on the graph structure. A loss function is constructed based on the similarity between all gene expression feature embeddings and all image feature embeddings, and the feature extraction model is optimized and trained based on the loss function. A test region is input into the trained feature extraction model, and the predicted gene expression result for the test region is output. This invention captures the latent relationship between histological images and gene expression, and utilizes this latent relationship to predict gene expression through histological images, significantly improving the accuracy of gene prediction.
Smart Images

Figure CN121354663B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of bioinformatics technology, and in particular to a method, system, terminal, and computer-readable storage medium for predicting spatial transcriptome gene expression. Background Technology
[0002] The number of RNAs transcribed from gene expression can be counted, and the expression of each gene corresponds to a different RNA. The transcriptome is the collection of all RNAs transcribed from a specific tissue or cell. By obtaining RNA counts through transcriptome sequencing technology, we can determine the expression status of genes within the cell. The different expression levels of each gene are important criteria for judging different cell functions and morphological characteristics. Compared to traditional transcriptomics, spatial transcriptome sequencing technology can perform high-throughput RNA sequencing on the entire tissue section while preserving the spatial information of cell location within the tissue section, allowing researchers to visually observe the spatial distribution of gene expression.
[0003] Existing spatial transcriptome gene expression prediction technologies only consider using histological images for prediction, while ignoring the role of cell type; and using relatively general and simple methods to extract features from images cannot effectively capture the rich and detailed biological features in histological images, ignoring deeper correlations.
[0004] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0005] The main objective of this invention is to provide a method, system, terminal, and computer-readable storage medium for predicting gene expression in spatial transcriptomes. This invention aims to address the problem that existing technologies for gene expression prediction only consider the image dimension and neglect biological characteristics, resulting in low accuracy in gene expression prediction.
[0006] To achieve the above objectives, the present invention provides a method for predicting spatial transcriptome gene expression, the method comprising the following steps: Multiple tissue slices of the target region are obtained, gene counts of each site in each tissue slice are extracted, multiple target sites are determined based on all the gene counts, and the target region is cut according to all the target sites to obtain multiple image patches and the site type of each target site; Each image patch is projected into a latent space, and the image feature embedding of each image patch is extracted. Based on each projection result and all the site types, the enhanced gene expression features of each target site are constructed. A graph structure is constructed based on all the enhanced gene expression features, and the gene expression feature embedding of each target site is extracted based on the graph structure. A loss function is constructed based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and the feature extraction model is optimized and trained based on the loss function; The test region is input into the trained feature extraction model, which outputs the predicted gene expression results of the test region.
[0007] Optionally, the method for predicting spatial transcriptome gene expression, wherein obtaining multiple tissue slices of the target region, extracting gene counts for each site in each tissue slice, and determining multiple target sites based on all gene counts, specifically includes: Multiple initial tissue slices of the target region are obtained, all genes in each initial tissue slice are extracted, and the spatial coordinates of all genes in each initial tissue slice and the gene expression of each gene are determined. The number of times each of the aforementioned genes appears at all sites in all the initial tissue sections is counted to obtain the gene count; If the gene count of the current gene is greater than a preset number, then the current gene is defined as a hypervariable gene, and the site where each hypervariable gene appears is defined as a target site.
[0008] Optionally, the spatial transcriptome gene expression prediction method, wherein the step of cutting the target region according to all the target sites to obtain multiple image patches and the site type of each target site specifically includes: Based on the spatial coordinates of all the hypervariable genes, the spatial coordinates of each target site are determined, and the target region is segmented based on the spatial coordinates of each site to obtain multiple image patches; After color normalization of each image patch, it is input into the image segmentation model, which obtains all cell nucleus types at all target sites in each image patch; For each target site, the site type with the highest number of cell nucleus types is defined as the site type of the target site and output.
[0009] Optionally, the spatial transcriptome gene expression prediction method, wherein projecting each image patch into a latent space to extract image feature embeddings for each image patch, and constructing enhanced gene expression features for each target site based on each projection result and all site types, specifically includes: All image patches, after color normalization, are input into an image encoder, which projects all image patches into a latent space to obtain the projection result for each image patch: ; in, Indicates the first Image feature embedding of image patches Indicates the target area. Indicates the index of the image patch. Indicates an image encoder. This represents a supervised learning model. Indicates the first Image blocks; Based on each projection result, the spatial coordinates of each target site in each image patch are determined. Based on each spatial coordinate, each site type, and the gene expression of each target site, the enhanced gene expression characteristics of each target site are determined. ; in, Indicates the first Enhanced gene expression characteristics at each target site An index representing the target site. Indicates gene expression at the target site. Indicates the first The x-coordinate of each target location, Indicates the first The ordinate of each target location, Indicates the first The site type of each target site.
[0010] Optionally, in the spatial transcriptome gene expression prediction method, the graph structure includes a functional graph and a spatial graph. The step of constructing a graph structure based on all the enhanced gene expression features, and extracting gene expression feature embeddings for each target site based on the graph structure, specifically includes: Each target site is defined as a node, and each enhanced gene expression feature is defined as a corresponding node feature; Based on the similarity of the features of each node, multiple neighboring nodes of each node are determined to construct the functional graph, and the node information of each node is updated using a graph attention mechanism to obtain the functional gene expression of the functional graph. Calculate the Euclidean distance between each node and other nodes. For each node, determine multiple neighbor nodes based on all the Euclidean distances of the node to construct the spatial graph. Then, use a graph attention mechanism to update the node information of each node to obtain the spatial gene expression of the spatial graph. The functional gene expression and the spatial gene expression are fused through a fusion layer to obtain the gene expression feature embedding for each target site: ; ; in, Indicates the first [number] after splicing Gene expression at each target site, Indicates the first Functional gene expression at each target site Indicates the first Spatial gene expression at target loci Indicates the first Embedding of gene expression features at each target site and Both represent linear transformations. This represents the activation function.
[0011] Optionally, the spatial transcriptome gene expression prediction method, wherein constructing a loss function based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and optimizing the feature extraction model based on the loss function, specifically includes: For the current training round, a single tissue slice is iteratively read. If an image and gene expression at the same coordinate position exist in the tissue slice, the image and gene expression are defined as a positive sample pair; otherwise, they are defined as a negative sample pair. A functional loss function is constructed based on the embeddings of all the gene expression features, a spatial loss function is constructed based on the embeddings of all the image features, and a total loss function is constructed based on the functional loss function and the spatial loss function: ; ; ; in, Represents the functional loss function. Represents the space loss function, This represents the number of all sample pairs. Indicates the first in the slice Embedding of gene expression features at each target site Indicates the first in the slice Image feature embedding of each target site Indicates the temperature coefficient. Represents the first of all sample pairs. Image feature embedding of each target site Represents the first of all sample pairs. Embedding of gene expression features at each target site express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them Represents the total loss function; The feature extraction model is optimized and trained using the total loss function to maximize the cosine similarity between gene expression feature embeddings and image feature embeddings between positive sample pairs, and to minimize the cosine similarity between gene expression feature embeddings and image feature embeddings between negative sample pairs.
[0012] Optionally, the spatial transcriptome gene expression prediction method, wherein inputting the test region into the trained feature extraction model and outputting the predicted gene expression results of the test region specifically includes: Obtain all test target sites in the test area and input all the test target sites into the trained feature extraction model; The feature extraction model outputs the test image feature embedding for each of the test target sites; The similarity between each pair of gene expression feature embeddings and test image feature embeddings is calculated in the shared embedding space and sorted to obtain a reference set; Based on all the similarities, a preset number of final loci are selected from the reference set, and the actual gene expression of all the final loci is weighted and aggregated according to the similarity of all the final loci to obtain the predicted gene expression results of the test region.
[0013] Furthermore, to achieve the above objectives, the present invention also provides a spatial transcriptome gene expression prediction system, wherein the spatial transcriptome gene expression prediction system comprises: The data preprocessing module is used to acquire multiple tissue slices of the target region, extract gene counts for each site in each tissue slice, determine multiple target sites based on all the gene counts, and cut the target region according to all the target sites to obtain multiple image patches and the site type of each target site; The feature extraction module is used to project each of the image patches into a latent space to extract the image feature embedding of each of the image patches, construct the enhanced gene expression features of each target site based on each projection result and all the site types, construct a graph structure based on all the enhanced gene expression features, and extract the gene expression feature embedding of each target site based on the graph structure. The contrastive learning module is used to construct a loss function based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and to optimize and train the feature extraction model based on the loss function; The aggregation prediction module is used to input the test region into the trained feature extraction model and output the predicted gene expression results of the test region.
[0014] Furthermore, to achieve the above objectives, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a spatial transcriptome gene expression prediction program stored in the memory and executable on the processor, wherein when the spatial transcriptome gene expression prediction program is executed by the processor, it implements the steps of the spatial transcriptome gene expression prediction method as described above.
[0015] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a spatial transcriptome gene expression prediction program, which, when executed by a processor, implements the steps of the spatial transcriptome gene expression prediction method as described above.
[0016] In this invention, multiple tissue slices of a target region are obtained, gene counts are extracted for each locus in each tissue slice, multiple target loci are determined based on all gene counts, and the target region is segmented according to all target loci to obtain multiple image patches and a locus type for each target locus. Each image patch is projected into a latent space, and image feature embeddings for each image patch are extracted. Based on each projection result and all locus types, enhanced gene expression features for each target locus are constructed. A graph structure is constructed based on all enhanced gene expression features, and gene expression feature embeddings for each target locus are extracted based on the graph structure. A loss function is constructed based on the similarity between all gene expression feature embeddings and all image feature embeddings, and the feature extraction model is optimized and trained based on the loss function. A test region is input into the trained feature extraction model, and the predicted gene expression result for the test region is output. This invention captures the latent relationship between histological images and gene expression, and utilizes this latent relationship to predict gene expression through histological images, significantly improving the accuracy of gene prediction. Attached Figure Description
[0017] Figure 1 This is a flowchart of a preferred embodiment of the spatial transcriptome gene expression prediction method of the present invention; Figure 2 This is an overall framework diagram of a preferred embodiment of the spatial transcriptome gene expression prediction method of the present invention; Figure 3This is a structural diagram of a preferred embodiment of the spatial transcriptome gene expression prediction system of the present invention; Figure 4 This is a structural diagram of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0019] Genes are segments of DNA that have hereditary effects. The process of gene expression controls the shape of an organism, influencing the morphology, structure, and other characteristics of various tissues and cells. Understanding the structure of cells and tissues and how this structure affects function is a fundamental pursuit for life science researchers. The number of RNA molecules transcribed from gene expression can be counted, and the expression of each gene corresponds to a different RNA.
[0020] However, the existing methods for gene expression data prediction have several problems in the prediction process: First, these methods only consider the use of histological images for prediction, while ignoring the role of cell type; second, the above methods use relatively general and simple methods to extract features from images, failing to effectively capture the rich and detailed biological features in histological images; third, the above methods either fail to effectively utilize spatial location information, or only consider the spatial proximity between points, ignoring deeper correlations.
[0021] Therefore, this invention proposes a spatial transcriptome data prediction algorithm, which introduces a better histological image feature extraction method, designs a map structure that better meets the needs of biological conditions, and incorporates cell type data to improve the accuracy of prediction results.
[0022] The spatial transcriptome gene expression prediction method described in the preferred embodiment of the present invention, such as... Figure 1 As shown, the method for predicting spatial transcriptome gene expression includes the following steps: Step S10: Obtain multiple tissue slices of the target region, extract gene counts for each site in each tissue slice, determine multiple target sites based on all gene counts, and cut the target region based on all target sites to obtain multiple image blocks and the site type of each target site.
[0023] In order to obtain high-accuracy gene expression data, in the embodiments disclosed in this invention, the gene data of the target region is first preprocessed to improve the robustness of the subsequent model.
[0024] Specifically, multiple initial tissue slices of the target region are obtained, all genes in each initial tissue slice are extracted, and the spatial coordinates of all genes in each initial tissue slice and the gene expression of each gene are determined; the number of times each gene appears at all sites in all initial tissue slices is counted to obtain a gene count; if the gene count of a current gene is greater than a preset number, the current gene is defined as a hypervariable gene, and the site where each hypervariable gene appears is defined as a target site.
[0025] In one embodiment of this invention, for gene expression data, the first 1000 hypervariable genes in each tissue slice of the target region are identified. Then, genes expressing fewer than 1000 sites across all tissue slices are removed from these hypervariable genes. (For each slice, gene expression at different locations is measured; each location is called a site, and it has spatial coordinates and gene expression data. The gene expression data is a two-dimensional matrix m x n, representing the expression of n genes at m sites. The two-dimensional matrix of all slices is statistically analyzed; if a gene is expressed at a site (i.e., the matrix value is not 0), the count is incremented by one.) This eliminates noise interference from low-expression genes, improves the model's generalization ability, significantly reduces resource waste, and makes the training process more efficient.
[0026] For the selected target loci, the gene count of each target locus is standardized. First, the gene count of each locus is divided by the total count of the target locus and multiplied by a scaling factor (in this embodiment, the scaling factor is set to 1,000,000) to achieve gene count standardization. Then, the standardized count value is converted to a logarithmic scale using the natural logarithm transformation formula.
[0027] Further, based on the spatial coordinates of all the hypervariable genes, the spatial coordinates of each target site are determined. Based on the spatial coordinates of each site, the target region is segmented to obtain multiple image blocks. After color normalization processing, each image block is input into an image segmentation model. The image segmentation model obtains all cell nucleus types of all target sites in each image block. For each target site, the site type with the most cell nucleus types is defined as the site type of the target site and output.
[0028] For image data, the spatial coordinates of each hypervariable gene are obtained, and each tissue slice is divided into 224×224 pixel image patches. Color normalization is performed on each patch to eliminate color differences between different staining batches. By adjusting the color distribution of the image as a whole, the problem of tone difference during multi-source image stitching can be effectively solved. Furthermore, only the color statistical features are changed during the migration process without destroying the geometric and texture information of the image, thus preserving key features and making all images have a consistent staining appearance.
[0029] Furthermore, for each image block, an image segmentation model is used to predict the nucleus type (i.e., site type) of each target site in each image block; wherein, the nucleus type of all nuclei at each target site in each image block is determined, and the type with the most nuclei at each target site is determined after statistics and defined as the site type; wherein, in the embodiments disclosed in this invention, the nucleus types include: neoplastic, inflammatory, connective, dead, non-tumor epithelial, and unlabeled types.
[0030] Step S20: Project each image patch into a latent space to extract the image feature embedding of each image patch; construct the enhanced gene expression features of each target site based on each projection result and all site types; construct a graph structure based on all the enhanced gene expression features; and extract the gene expression feature embedding of each target site based on the graph structure.
[0031] In this invention, based on preprocessed image data, the spatial transcriptome data prediction algorithm disclosed in this invention is used to treat gene expression data and histological image data as different representations of different modalities corresponding to the same capture site. Using known histological image modalities, gene expression data at the same capture site is predicted, such as... Figure 2 As shown, gene encoders and image encoders are used to learn gene features and image features respectively. A loss function is designed to capture the potential association between the two and complete the alignment between the two modalities. Then, the gene expression of the k gene features most similar to the image features is obtained by weighted aggregation to obtain the corresponding predicted basic expression.
[0032] Specifically, all image patches after color normalization are input into an image encoder, which projects all image patches into a latent space to obtain the projection result of each image patch: ; in, Indicates the first Image feature embedding of image patches Indicates the target area. Indicates the index of the image patch. Indicates an image encoder. This represents a supervised learning model. Indicates the first Each image patch; based on each projection result, the spatial coordinates of each target site in each image patch are determined; based on each spatial coordinate, each site type, and the gene expression of each target site, the enhanced gene expression characteristics of each target site are determined. ; in, Indicates the first Enhanced gene expression characteristics at each target site An index representing the target site. Indicates gene expression at the target site. Indicates the first The x-coordinate of each target location, Indicates the first The ordinate of each target location, Indicates the first The site type of each target site.
[0033] Among them, such as Figure 2 As shown in (a), for each image patch, the trained Phikon-v2 (supervised learning model) is used to extract image features (image feature embeddings). The supervised learning model is a self-supervised learning model specifically designed for histopathology. Compared to other models, Phikon-v2 performs better in the embodiments disclosed in this invention. Furthermore, the extracted image feature embeddings are projected into the latent space to facilitate subsequent fusion with the corresponding gene expression feature embeddings.
[0034] Further, each target site is defined as a node, and each enhanced gene expression feature is defined as a corresponding node feature; based on the similarity of each node feature, multiple neighboring nodes of each node are determined to construct the functional graph, and the node information of each node is updated using a graph attention mechanism to obtain the functional gene expression of the functional graph; the Euclidean distance between each node and other nodes is calculated, and for each node, multiple neighboring nodes are determined based on all the Euclidean distances of the node to construct the spatial graph, and the node information of each node is updated using a graph attention mechanism to obtain the spatial gene expression of the spatial graph; the functional gene expression and the spatial gene expression are fused through a fusion layer to obtain the gene expression feature embedding of each target site: ; ; in, Indicates the first [number] after splicing Gene expression at each target site, Indicates the first Functional gene expression at each target site Indicates the first Spatial gene expression at target loci Indicates the first Embedding of gene expression features at each target site and Both represent linear transformations. This represents the activation function.
[0035] The graph structure includes a functional graph and a spatial graph. After obtaining the image feature embedding and gene expression feature embedding of each target site, a graph-based deep learning method is used to update the features of these target sites. This process can be achieved through two graph construction strategies: the functional graph path and the spatial graph path, to consider the functional similarity and spatial proximity between spots respectively. Then, the updated gene expressions obtained from the two paths are fused to obtain the final gene expression.
[0036] First, each spot is treated as a node, and the enhanced gene expression features of the spot are used as the node's features, thus constructing a graph structure. In the functional graph, the similarity of features between each node and other nodes is calculated, and the k closest nodes are selected as neighbor nodes. In the spatial graph, the Euclidean distance between each pair of nodes is calculated using their position coordinates, and the k nearest neighbors are selected as neighbor nodes. For both the functional graph and the neighbor graph, a graph attention mechanism is used to update node information, and a fusion layer is used to obtain the final gene expression feature embedding, thereby achieving the alignment process between the two modalities.
[0037] Step S30: Construct a loss function based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and optimize and train the feature extraction model based on the loss function.
[0038] Specifically, for the current training round, a single tissue slice is iteratively read. If an image and gene expression at the same coordinate position exist in the tissue slice, the image and gene expression are defined as a positive sample pair; otherwise, they are defined as a negative sample pair. A functional loss function is constructed based on the embeddings of all gene expression features, a spatial loss function is constructed based on the embeddings of all image features, and a total loss function is constructed based on the functional loss function and the spatial loss function. ; ; ; in, Represents the functional loss function. Represents the space loss function, This represents the number of all sample pairs. Indicates the first in the slice Embedding of gene expression features at each target site Indicates the first in the slice Image feature embedding of each target site Indicates the temperature coefficient. Represents the first of all sample pairs. Image feature embedding of each target site Represents the first of all sample pairs. Embedding of gene expression features at each target site express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them Let represent the total loss function; the feature extraction model is optimized and trained using the total loss function to maximize the cosine similarity between gene expression feature embeddings and image feature embeddings between positive sample pairs, and to minimize the cosine similarity between gene expression feature embeddings and image feature embeddings between negative sample pairs.
[0039] In particular, existing methods, which extract features solely from images, fail to effectively capture the rich and detailed biological features in histological images. Figure 2 As shown in (b), the present invention constructs corresponding loss functions for image embedding features and gene expression embedding features respectively for comparative learning and uses them for model training, thereby capturing the potential correlation between image features and gene features, considering the global features of gene prediction, and improving the accuracy of gene prediction results.
[0040] Specifically, through the feature extraction module, for each slice in each round of training, image feature embeddings and gene expression feature embeddings corresponding to each target site have been generated. Image feature embeddings and gene expression feature embeddings from the same spot are considered as a positive sample pair, so there are a total of... One positive sample pair, The training objective is to maximize the cosine similarity between positive sample pairs, minimize the cosine similarity between negative sample pairs, reduce the distance between positive sample pairs, and increase the distance between negative sample pairs, thereby achieving information fusion between images and gene expression.
[0041] Step S40: Input the test region into the trained feature extraction model and output the predicted gene expression results of the test region.
[0042] Specifically, all test target sites in the test region are obtained, and all test target sites are input into a pre-trained feature extraction model; the feature extraction model outputs a test image feature embedding for each test target site; the similarity between each pair of gene expression feature embeddings and test image feature embeddings is calculated in a shared embedding space, and sorted to obtain a reference set; based on all the similarities, a preset number of final sites are selected from the reference set, and the true gene expression of all the final sites is weighted and aggregated based on the similarity of all the final sites to obtain the predicted gene expression result of the test region.
[0043] Among them, such as Figure 2 As shown in (c), the training dataset is used as a reference database for model output prediction. For a given test image, it undergoes the same processing as the feature extraction module, segmenting it into image patches and extracting feature representations using a pre-trained image encoder, which are then projected into a shared embedding space. Subsequently, the similarity between the test image features and the gene expression features of all reference spots is calculated in the shared embedding space. Based on similarity ranking, the top k most similar spots are selected to form a reference set. Finally, using similarity as weight, the true gene expression of these k spots is aggregated to obtain the predicted gene expression of the image being predicted.
[0044] In the field of spatial transcriptome gene expression prediction, this invention treats the prediction task as an alignment task of different modalities; it uses contrastive learning to capture the potential relationship between histological images and gene expression, and utilizes this potential relationship to shorten the distance between positive samples of two modalities; it constructs a bipath graph structure that considers both functional similarity and spatial proximity; it uses a large model of a specific domain for image feature extraction; and it introduces cell type data to enhance the model's effect, significantly improving the accuracy of gene prediction through histological image prediction.
[0045] Furthermore, such as Figure 3 As shown, based on the above-described method for predicting spatial transcriptome gene expression, this invention also provides a system for predicting spatial transcriptome gene expression, wherein the system comprises: The data preprocessing module 51 is used to acquire multiple tissue slices of the target region, extract the gene count of each site in each tissue slice, determine multiple target sites based on all the gene counts, and cut the target region according to all the target sites to obtain multiple image blocks and the site type of each target site. The feature extraction module 52 is used to project each of the image patches into a latent space to extract the image feature embedding of each of the image patches, construct the enhanced gene expression features of each target site based on each projection result and all the site types, construct a graph structure based on all the enhanced gene expression features, and extract the gene expression feature embedding of each target site based on the graph structure. The contrastive learning module 53 is used to construct a loss function based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and to optimize and train the feature extraction model based on the loss function; The aggregation prediction module 54 is used to input the test region into the trained feature extraction model and output the predicted gene expression results of the test region.
[0046] Furthermore, such as Figure 4 As shown, based on the above-mentioned method and system for predicting spatial transcriptome gene expression, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 4 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0047] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code installed on the terminal. The memory 20 may also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a spatial transcriptome gene expression prediction program 40, which can be executed by the processor 10 to implement the spatial transcriptome gene expression prediction method of this application.
[0048] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as executing the spatial transcriptome gene expression prediction method.
[0049] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface. The components of the terminal communicate with each other via a system bus.
[0050] In one embodiment, when processor 10 executes a spatial transcriptome gene expression prediction program 40 in the memory 20, the following steps are performed: Multiple tissue slices of the target region are obtained, gene counts of each site in each tissue slice are extracted, multiple target sites are determined based on all the gene counts, and the target region is cut according to all the target sites to obtain multiple image patches and the site type of each target site; Each image patch is projected into a latent space, and the image feature embedding of each image patch is extracted. Based on each projection result and all the site types, the enhanced gene expression features of each target site are constructed. A graph structure is constructed based on all the enhanced gene expression features, and the gene expression feature embedding of each target site is extracted based on the graph structure. A loss function is constructed based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and the feature extraction model is optimized and trained based on the loss function; The test region is input into the trained feature extraction model, which outputs the predicted gene expression results of the test region.
[0051] Specifically, obtaining multiple tissue slices of the target region, extracting gene counts for each site in each tissue slice, and determining multiple target sites based on all gene counts includes: Multiple initial tissue slices of the target region are obtained, all genes in each initial tissue slice are extracted, and the spatial coordinates of all genes in each initial tissue slice and the gene expression of each gene are determined. The number of times each of the aforementioned genes appears at all sites in all the initial tissue sections is counted to obtain the gene count; If the gene count of the current gene is greater than a preset number, then the current gene is defined as a hypervariable gene, and the site where each hypervariable gene appears is defined as a target site.
[0052] Specifically, the step of cutting the target region according to all the target sites to obtain multiple image blocks and the site type of each target site includes: Based on the spatial coordinates of all the hypervariable genes, the spatial coordinates of each target site are determined, and the target region is segmented based on the spatial coordinates of each site to obtain multiple image patches; After color normalization of each image patch, it is input into the image segmentation model, which obtains all cell nucleus types at all target sites in each image patch; For each target site, the site type with the highest number of cell nucleus types is defined as the site type of the target site and output.
[0053] Specifically, the step of projecting each image patch into a latent space to extract image feature embeddings for each image patch, and constructing enhanced gene expression features for each target locus based on each projection result and all locus types, includes: All image patches, after color normalization, are input into an image encoder, which projects all image patches into a latent space to obtain the projection result for each image patch: ; in, Indicates the first Image feature embedding of image patches Indicates the target area. Indicates the index of the image patch. Indicates an image encoder. This represents a supervised learning model. Indicates the first Image blocks; Based on each projection result, the spatial coordinates of each target site in each image patch are determined. Based on each spatial coordinate, each site type, and the gene expression of each target site, the enhanced gene expression characteristics of each target site are determined. ; in, Indicates the first Enhanced gene expression characteristics at each target site An index representing the target site. Indicates gene expression at the target site. Indicates the first The x-coordinate of each target location, Indicates the first The ordinate of each target location, Indicates the first The site type of each target site.
[0054] The graph structure includes: a functional graph and a spatial graph; The step of constructing a graph structure based on all the enhanced gene expression features, and extracting gene expression feature embeddings for each target site based on the graph structure, specifically includes: Each target site is defined as a node, and each enhanced gene expression feature is defined as a corresponding node feature; Based on the similarity of the features of each node, multiple neighboring nodes of each node are determined to construct the functional graph, and the node information of each node is updated using a graph attention mechanism to obtain the functional gene expression of the functional graph. Calculate the Euclidean distance between each node and other nodes. For each node, determine multiple neighbor nodes based on all the Euclidean distances of the node to construct the spatial graph. Then, use a graph attention mechanism to update the node information of each node to obtain the spatial gene expression of the spatial graph. The functional gene expression and the spatial gene expression are fused through a fusion layer to obtain the gene expression feature embedding for each target site: ; ; in, Indicates the first [number] after splicing Gene expression at each target site, Indicates the first Functional gene expression at each target site Indicates the first Spatial gene expression at target loci Indicates the first Embedding of gene expression features at each target site and Both represent linear transformations. This represents the activation function.
[0055] Specifically, the step of constructing a loss function based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and optimizing and training the feature extraction model based on the loss function, includes: For the current training round, a single tissue slice is iteratively read. If an image and gene expression at the same coordinate position exist in the tissue slice, the image and gene expression are defined as a positive sample pair; otherwise, they are defined as a negative sample pair. A functional loss function is constructed based on the embeddings of all the gene expression features, a spatial loss function is constructed based on the embeddings of all the image features, and a total loss function is constructed based on the functional loss function and the spatial loss function: ; ; ; in, Represents the functional loss function. Represents the space loss function, This represents the number of all sample pairs. Indicates the first positive sample pair Embedding of gene expression features at each target site Indicates the first positive sample pair Image feature embedding of each target site Indicates the temperature coefficient. Represents the first of all sample pairs. Image feature embedding of each target site Represents the first of all sample pairs. Embedding of gene expression features at each target site express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them Represents the total loss function; The feature extraction model is optimized and trained using the total loss function to maximize the cosine similarity between gene expression feature embeddings and image feature embeddings between positive sample pairs, and to minimize the cosine similarity between gene expression feature embeddings and image feature embeddings between negative sample pairs.
[0056] Specifically, inputting the test region into the trained feature extraction model and outputting the predicted gene expression results of the test region includes: Obtain all test target sites in the test area and input all the test target sites into the trained feature extraction model; The feature extraction model outputs the test image feature embedding for each of the test target sites; The similarity between each pair of gene expression feature embeddings and test image feature embeddings is calculated in the shared embedding space and sorted to obtain a reference set; Based on all the similarities, a preset number of final loci are selected from the reference set, and the actual gene expression of all the final loci is weighted and aggregated according to the similarity of all the final loci to obtain the predicted gene expression results of the test region.
[0057] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a spatial transcriptome gene expression prediction program, which, when executed by a processor, implements the steps of the spatial transcriptome gene expression prediction method as described above.
[0058] In summary, this invention provides a method and related equipment for predicting gene expression in spatial transcriptomes. The method includes: acquiring multiple tissue slices of a target region; extracting gene counts for each locus in each tissue slice; determining multiple target loci based on all gene counts; and cutting the target region according to all target loci to obtain multiple image patches and a locus type for each target locus; projecting each image patch into a latent space; extracting image feature embeddings for each image patch; constructing enhanced gene expression features for each target locus based on each projection result and all locus types; constructing a graph structure based on all enhanced gene expression features; and extracting gene expression feature embeddings for each target locus based on the graph structure; constructing a loss function based on the similarity between all gene expression feature embeddings and all image feature embeddings; and optimizing and training a feature extraction model based on the loss function; inputting a test region into the trained feature extraction model; and outputting the predicted gene expression result for the test region. This invention captures the latent relationship between histological images and gene expression, and utilizes this latent relationship to predict gene expression through histological images, significantly improving the accuracy of gene prediction.
[0059] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0060] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.). The program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The computer-readable storage medium can be a memory, magnetic disk, optical disk, etc.
[0061] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A method for predicting gene expression based on spatial transcriptome, characterized in that, The method for predicting spatial transcriptome gene expression includes: Multiple tissue slices of the target region are obtained, gene counts of each site in each tissue slice are extracted, multiple target sites are determined based on all the gene counts, and the target region is cut according to all the target sites to obtain multiple image patches and the site type of each target site; Each image patch is projected into a latent space, and the image feature embedding of each image patch is extracted. Based on each projection result and all the site types, the enhanced gene expression features of each target site are constructed. A graph structure is constructed based on all the enhanced gene expression features, and the gene expression feature embedding of each target site is extracted based on the graph structure. The step of projecting each image patch into a latent space to extract image feature embeddings for each image patch, and constructing enhanced gene expression features for each target locus based on each projection result and all locus types, specifically includes: All image patches, after color normalization, are input into an image encoder, which projects all image patches into a latent space to obtain the projection result for each image patch: ; in, Indicates the first Image feature embedding of image patches Indicates the target area. Indicates the index of the image patch. Indicates an image encoder. This represents a supervised learning model. Indicates the first Image blocks; Based on each projection result, the spatial coordinates of each target site in each image patch are determined. Based on each spatial coordinate, each site type, and the gene expression of each target site, the enhanced gene expression characteristics of each target site are determined. ; in, Indicates the first Enhanced gene expression characteristics at each target site An index representing the target site. Indicates the first Gene expression at each target site, Indicates the first The x-coordinate of each target location, Indicates the first The ordinate of each target location, Indicates the first The site type of each target site; The graph structure includes: a functional graph and a spatial graph; The step of constructing a graph structure based on all the enhanced gene expression features, and extracting gene expression feature embeddings for each target site based on the graph structure, specifically includes: Each target site is defined as a node, and each enhanced gene expression feature is defined as a corresponding node feature; Based on the similarity of the features of each node, multiple neighboring nodes of each node are determined to construct the functional graph, and the node information of each node is updated using a graph attention mechanism to obtain the functional gene expression of the functional graph. Calculate the Euclidean distance between each node and other nodes. For each node, determine multiple neighbor nodes based on all the Euclidean distances of the node to construct the spatial graph. Then, use a graph attention mechanism to update the node information of each node to obtain the spatial gene expression of the spatial graph. The functional gene expression and the spatial gene expression are fused through a fusion layer to obtain the gene expression feature embedding for each target site: ; ; in, Indicates the first [number] after splicing Gene expression at each target site, Indicates the first Functional gene expression at each target site Indicates the first Spatial gene expression at target loci Indicates the first in the slice Embedding of gene expression features at each target site and Both represent linear transformation layers. Indicates the activation function; A loss function is constructed based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and the feature extraction model is optimized and trained based on the loss function; The step of constructing a loss function based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and optimizing and training the feature extraction model based on the loss function, specifically includes: For the current training round, a single tissue slice is iteratively read. If an image and gene expression at the same coordinate position exist in the tissue slice, the image and gene expression are defined as a positive sample pair; otherwise, they are defined as a negative sample pair. A functional loss function is constructed based on the embeddings of all the gene expression features, a spatial loss function is constructed based on the embeddings of all the image features, and a total loss function is constructed based on the functional loss function and the spatial loss function: ; ; ; in, Represents the functional loss function. Represents the space loss function, This represents the number of all sample pairs. Represents the first of all sample pairs. Image feature embedding of each target site Indicates the temperature coefficient. Represents the first of all sample pairs. Image feature embedding of each target site Represents the first of all sample pairs. Embedding of gene expression features at each target site express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them express and Cosine similarity between them Represents the total loss function; The feature extraction model is optimized and trained using the total loss function to maximize the cosine similarity between gene expression feature embeddings and image feature embeddings between positive sample pairs and minimize the cosine similarity between gene expression feature embeddings and image feature embeddings between negative sample pairs. The test region is input into the trained feature extraction model, which outputs the predicted gene expression results of the test region.
2. The method for predicting spatial transcriptome gene expression according to claim 1, characterized in that, The process of obtaining multiple tissue slices of the target region, extracting gene counts for each locus in each tissue slice, and determining multiple target loci based on all gene counts specifically includes: Multiple initial tissue slices of the target region are obtained, all genes in each initial tissue slice are extracted, and the spatial coordinates of all genes in each initial tissue slice and the gene expression of each gene are determined. The number of times each of the aforementioned genes appears at all sites in all the initial tissue sections is counted to obtain the gene count; If the gene count of the current gene is greater than a preset number, then the current gene is defined as a hypervariable gene, and the site where each hypervariable gene appears is defined as a target site.
3. The method for predicting spatial transcriptome gene expression according to claim 2, characterized in that, The step of segmenting the target region based on all the target sites to obtain multiple image patches and the site type of each target site specifically includes: Based on the spatial coordinates of all the hypervariable genes, the spatial coordinates of each target site are determined, and the target region is segmented based on the spatial coordinates of each site to obtain multiple image patches; After color normalization of each image patch, it is input into the image segmentation model, which obtains all cell nucleus types at all target sites in each image patch; For each target site, the site type with the highest number of cell nucleus types is defined as the site type of the target site and output.
4. The method for predicting gene expression based on spatial transcriptome according to claim 1, characterized in that, The step of inputting the test region into the trained feature extraction model and outputting the predicted gene expression results of the test region specifically includes: Obtain all test target sites in the test area and input all the test target sites into the trained feature extraction model; The feature extraction model outputs the test image feature embedding for each of the test target sites; The similarity between each pair of gene expression feature embeddings and test image feature embeddings is calculated in the shared embedding space and sorted to obtain a reference set; Based on all the similarities, a preset number of final loci are selected from the reference set, and the actual gene expression of all the final loci is weighted and aggregated according to the similarity of all the final loci to obtain the predicted gene expression results of the test region.
5. A spatial transcriptome gene expression prediction system, characterized in that, The spatial transcriptome gene expression prediction system is applied to the spatial transcriptome gene expression prediction method as described in any one of claims 1-4, wherein the spatial transcriptome gene expression prediction system comprises: The data preprocessing module is used to acquire multiple tissue slices of the target region, extract gene counts for each site in each tissue slice, determine multiple target sites based on all the gene counts, and cut the target region according to all the target sites to obtain multiple image patches and the site type of each target site; The feature extraction module is used to project each of the image patches into a latent space to extract the image feature embedding of each of the image patches, construct the enhanced gene expression features of each target site based on each projection result and all the site types, construct a graph structure based on all the enhanced gene expression features, and extract the gene expression feature embedding of each target site based on the graph structure. The contrastive learning module is used to construct a loss function based on the similarity between all the gene expression feature embeddings and all the image feature embeddings, and to optimize and train the feature extraction model based on the loss function; The aggregation prediction module is used to input the test region into the trained feature extraction model and output the predicted gene expression results of the test region.
6. A terminal, characterized in that, The terminal includes: a memory, a processor, and a spatial transcriptome gene expression prediction program stored in the memory and executable on the processor. When the spatial transcriptome gene expression prediction program is executed by the processor, it implements the steps of the spatial transcriptome gene expression prediction method as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a spatial transcriptome gene expression prediction program, which, when executed by a processor, implements the steps of the spatial transcriptome gene expression prediction method as described in any one of claims 1-4.