A spatial transcriptome gene expression prediction method, system and terminal
By constructing a gene expression prediction model and learning the potential correlation between image features and gene features, the problem of insufficient utilization of gene expression data in existing technologies is solved, and high-precision gene expression prediction is achieved.
Patent Information
- Application Number
- CN202411787192.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-12-06
AI Technical Summary
In existing technologies, spatial transcriptome gene expression prediction models only use histological image features and fail to make full use of gene expression data, resulting in inaccurate prediction results.
A gene expression prediction model is constructed, including an image feature extraction module, a gene feature extraction module, and a prediction module. The model is trained to learn the potential correlation between image features and gene features. The ViT model and the self-attention model are used for feature extraction, and the multilayer perceptron model is used for prediction. The model parameters are optimized by combining contrastive loss and MSE loss functions.
High-precision gene expression prediction was achieved, and the accuracy of gene expression prediction was improved through mutual learning of data from different modalities.
Smart Images

Figure CN119943145B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and in particular to a spatial transcriptome gene expression prediction method, system, terminal, and computer-readable storage medium. Background Technology
[0002] All RNA transcribed from DNA in a cell is called the transcriptome. Transcriptome sequencing technology can obtain the transcriptome sequence in a cell. These sequences represent gene expression at the cellular level, allowing researchers to conduct detailed analysis of gene expression patterns in each cell, track gene expression changes during cell development and differentiation, gain a deeper understanding of cell fate and differentiation pathways, and also help researchers understand key cell types and key genes in pathophysiological processes, thus enhancing their understanding of cells and tissues.
[0003] The development of transcriptome sequencing technology has mainly gone through three stages: The first stage was transcriptome sequencing of large numbers of mixed cells. The second stage was transcriptome sequencing of single cells, which advanced the understanding of cellular gene expression to the single-cell level. The third stage saw transcriptome research enter the spatial transcriptome stage, a technology that can simultaneously obtain spatial location information of cells, gene expression data, and measurement information of tissue slices.
[0004] With the development of various neural network technologies, models for predicting gene expression in spatial transcriptomes have been proposed. Bioinformatic researchers have put forward some methods to predict spatial transcriptome data. These methods can help to further understand the structure and function of cells and tissues. However, the current prediction models are all based on feature extraction from histological images and use the obtained features to predict gene expression data. They fail to make full use of gene expression data, resulting in inaccurate prediction results for gene expression.
[0005] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0006] The main objective of this invention is to provide a spatial transcriptome gene expression prediction method, system, terminal, and computer-readable storage medium, aiming to solve the problem in the prior art that gene expression prediction only uses image features to predict gene expression data, which fails to make full use of gene expression data and results in inaccurate prediction results.
[0007] To achieve the above objectives, the present invention provides a spatial transcriptome gene expression prediction method, which includes the following steps:
[0008] A gene expression prediction model is constructed, and the gene expression prediction model is trained to obtain a target gene expression prediction model;
[0009] A target histological image to be predicted is acquired, the target histological image is preprocessed to obtain a preprocessed image, and the preprocessed image is divided into multiple sub-image blocks according to the coordinates of the capture site, wherein each sub-image block contains a capture site;
[0010] Multiple sub-image blocks are input into the target gene expression prediction model for feature extraction to obtain the target image features corresponding to each sub-image block. Gene expression prediction is performed based on the multiple target image features to obtain the target gene expression result.
[0011] Optionally, in the spatial transcriptome gene expression prediction method, the gene expression prediction model includes: an image feature extraction module, a gene feature extraction module, a projection module, and a prediction module.
[0012] Optionally, in the spatial transcriptome gene expression prediction method, the step of training the gene expression prediction model further includes:
[0013] Acquire historical data, which includes historical histological images and the actual gene expression information corresponding to the historical histological images;
[0014] The historical histological images are used as training samples, and the real gene expression information corresponding to the historical histological images is used as labels to construct a dataset.
[0015] The dataset is divided into a training set, a test set, and a validation set according to a preset ratio. The training set is used to train the gene expression prediction model, the test set is used to evaluate the gene expression prediction model in each round of training, and the validation set is used to evaluate the trained gene expression prediction model.
[0016] Optionally, in the spatial transcriptome gene expression prediction method, the feature extraction module is a ViT model, the gene feature extraction module is a self-attention model, and the prediction module is a multilayer perceptron model containing two fully connected layers.
[0017] Optionally, in the spatial transcriptome gene expression prediction method, training the gene expression prediction model to obtain the target gene expression prediction model specifically includes:
[0018] The training samples in the training set are segmented based on the coordinates of the capture sites in the spatial transcriptome data to obtain multiple pixel blocks;
[0019] The multiple pixel blocks and their corresponding real gene expression information are respectively input into the image feature extraction module and the gene feature extraction module for feature extraction to obtain image features and gene features.
[0020] The image features are projected onto the prediction module through the projection module to obtain the predicted gene expression results;
[0021] The total loss function is calculated based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information.
[0022] The backpropagation gradient is set according to the total loss function. Based on the backpropagation gradient and the backpropagation algorithm, the network hyperparameters of the gene expression prediction model are adjusted, and the model is evaluated based on the test set.
[0023] The gene expression prediction model is trained again based on the adjusted network parameters until the total loss function reaches the preset convergence condition, thus obtaining the trained gene expression prediction model.
[0024] The training gene expression prediction model is evaluated using the validation set. If the error between the prediction result and the label in the validation set is lower than a preset threshold, the target gene expression prediction model is obtained.
[0025] Optionally, the spatial transcriptome gene expression prediction method, wherein calculating the total loss function based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information specifically includes:
[0026] Based on the image features, gene features, predicted gene expression results, and actual gene expression information, the contrast loss and MSE loss are calculated:
[0027]
[0028] Among them, L con Z represents the comparative loss. ci z represents the image feature of the i-th pixel block. gi X represents the gene feature corresponding to the i-th pixel block. i X represents the true gene expression information of the capture site corresponding to the i-th pixel block. i h ci L represents the predicted gene expression result of the capture site corresponding to the i-th pixel block; MSE q represents the MSE loss, i represents the index of the capture site corresponding to the pixel block or block, and q represents the total number of genes.
[0029] The total loss function L is calculated based on the contrast loss and the MSE loss:
[0030] L = L con +L MSE.
[0031] Optionally, the spatial transcriptome gene expression prediction method, wherein the step of inputting multiple sub-image patches into the target gene expression prediction model for feature extraction to obtain target image features corresponding to each sub-image patch, and performing gene expression prediction based on the multiple target image features to obtain the target gene expression result, specifically includes:
[0032] The multiple sub-image blocks are respectively input into the image feature extraction module for feature extraction, so as to obtain the target image features corresponding to each sub-image block;
[0033] Multiple target image features are projected onto the prediction module through the projection module to predict gene expression, thereby obtaining the target gene expression results of the target histological image.
[0034] 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:
[0035] The target model training module is used to construct a gene expression prediction model and train the gene expression prediction model to obtain a target gene expression prediction model.
[0036] The image data acquisition module is used to acquire the target histological image to be predicted, preprocess the target histological image to obtain a preprocessed image, and divide the preprocessed image into multiple sub-image blocks according to the coordinates of the capture site, wherein each sub-image block contains a capture site;
[0037] The gene expression prediction module is used to input multiple sub-image blocks into the target gene expression prediction model for feature extraction, obtain the target image features corresponding to each sub-image block, and perform gene expression prediction based on the multiple target image features to obtain the target gene expression result.
[0038] In addition, 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.
[0039] In addition, 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.
[0040] In this invention, a gene expression prediction model is constructed and trained to obtain a target gene expression prediction model. A target histological image to be predicted is acquired and preprocessed to obtain a preprocessed image. The preprocessed image is then segmented into multiple sub-image blocks according to the coordinates of the capture sites, with each sub-image block containing one capture site. These sub-image blocks are then input into the target gene expression prediction model for feature extraction, yielding target image features for each sub-image block. Gene expression prediction is then performed based on these multiple target image features to obtain the target gene expression result. This invention views the prediction task as a mutual learning process between different modalities of data: a model is established to learn the potential correlation between two features, and finally, a prediction module is used to predict features of another modality using one feature, enabling high-precision gene expression prediction. Attached Figure Description
[0041] Figure 1 This is a flowchart of a preferred embodiment of the spatial transcriptome gene expression prediction method of the present invention;
[0042] Figure 2 This is an overall architecture diagram of the gene expression prediction model in the spatial transcriptome gene expression prediction method of this invention;
[0043] Figure 3 This is a flowchart of training the gene expression prediction model in the spatial transcriptome gene expression prediction method of the present invention;
[0044] Figure 4 This is a pseudocode diagram of the target gene expression prediction model obtained by training the gene expression prediction model in the spatial transcriptome gene expression prediction method of the present invention.
[0045] Figure 5 This is a structural diagram of a preferred embodiment of the spatial transcriptome gene expression prediction system of the present invention;
[0046] Figure 6 This is a schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0047] This application provides a method, system, and terminal for spatial transcriptome gene expression prediction. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description is provided with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit this application.
[0048] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0049] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0050] The spatial transcriptome gene expression prediction method described in the preferred embodiment of the present invention, such as... Figure 1 As shown, the spatial transcriptome gene expression prediction method includes the following steps:
[0051] Step S10: Construct a gene expression prediction model, train the gene expression prediction model, and obtain the target gene expression prediction model.
[0052] Specifically, such as Figure 2 As shown, the gene expression prediction model includes: an image feature extraction module, a gene feature extraction module, a projection module, and a prediction module. It is understood that the purpose of the gene expression prediction model of this invention is to learn the potential relationship between the histological image corresponding to each capture site and the corresponding gene expression data, thereby predicting the corresponding gene expression information by extracting the histological image features of the capture site.
[0053] The process of training the gene expression prediction model further includes, prior to:
[0054] Acquire historical data, which includes historical histological images and the actual gene expression information corresponding to the historical histological images;
[0055] The historical histological images are used as training samples, and the real gene expression information corresponding to the historical histological images is used as labels to construct a dataset.
[0056] The dataset is divided into a training set, a test set, and a validation set according to a preset ratio. The training set is used to train the gene expression prediction model, the test set is used to evaluate the gene expression prediction model in each round of training, and the validation set is used to evaluate the trained gene expression prediction model.
[0057] In this embodiment, historical histological images and the corresponding real gene expression information are obtained as data for model training. The historical histological images are used as training samples, and the corresponding real gene expression information is used as the real labels to construct a dataset.
[0058] The preprocessed data is divided into a training set, a test set, and a validation set according to a preset ratio (e.g., the ratio of training set, test set, and validation set is 6:2:2). The training set is used to train the gene expression prediction model and optimize the model's parameters, while the test set is used to detect the accuracy of the prediction results of the trained gene expression prediction model, thereby evaluating the model's performance.
[0059] Furthermore, in the gene expression prediction model, the feature extraction module is a ViT model (VisionTransformer, a model that applies the Transformer architecture to computer vision tasks), the gene feature extraction module is a self-attention model, and the prediction module is a multilayer perceptron model containing two fully connected layers. It should be noted that the algorithms for extracting image and gene features proposed in this invention can be replaced by other algorithms, and the prediction module can also be replaced by models such as Transformer or GNN. This is merely an example and not a limitation.
[0060] like Figure 3 As shown, further, training the gene expression prediction model to obtain the target gene expression prediction model specifically includes:
[0061] S101. The training samples in the training set are segmented according to the coordinates of the capture sites in the spatial transcriptome data to obtain multiple pixel blocks.
[0062] It is understandable that capture sites in spatial transcriptome data refer to the locations of RNA molecules in specific regions of tissue sections during spatial transcriptome sequencing. These sites not only record the location information of RNA molecules, but also associate this location information with gene expression data through sequencing technology, thereby achieving spatial localization of gene expression in tissue sections.
[0063] The historical histological images in the training set are segmented according to the coordinates of the capture sites in the spatial transcriptome data. For example, the histological image C can be cut into small image blocks of 112*112 pixels according to the coordinates of the capture sites, where each small image block contains one capture site.
[0064] S102. Input the multiple pixel blocks and the corresponding real gene expression information into the image feature extraction module and the gene feature extraction module respectively for feature extraction to obtain image features and gene features.
[0065] First, for histological images, this invention uses the ViT model to extract image features. Multiple pixel blocks are input into the ViT model to obtain information about image block C. i Image features z ci The formula is expressed as: z ci =f img (C i ), where f img This represents the ViT model used to extract image features.
[0066] Furthermore, for the true gene expression information (capture site-gene matrix) X, where the rows of the gene matrix represent the gene expression information at each capture site, and the columns represent the expression of each gene at different capture sites, denoted as X. p*q It contains p capture sites and q genes. A self-attention model is used to extract features from the gene expression data. For the gene expression X at the i-th capture site... i In other words, obtaining gene characteristics z xi The formula is expressed as: z xi =f gene (X i ), where f gene This represents a self-attention model used to extract gene features.
[0067] S103. The image features are projected onto the prediction module through the projection module for calculation to obtain the predicted gene expression results.
[0068] The prediction module uses image features to predict corresponding gene expression results. This prediction module is a multilayer perceptron model containing two fully connected layers. The predicted gene expression result h is obtained through the prediction module. ci The formula is expressed as: h ci =f pro (z ci ), where f pro This indicates the prediction module.
[0069] S104. Calculate the total loss function based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information.
[0070] Specifically, the contrast loss and MSE loss are calculated based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information:
[0071]
[0072] Among them, L con Z represents the comparative loss. ci z represents the image feature of the i-th pixel block. gi X represents the gene feature corresponding to the i-th pixel block. i X represents the true gene expression information of the capture site corresponding to the i-th pixel block. i h ci L represents the predicted gene expression result of the capture site corresponding to the i-th pixel block; MSE q represents the MSE loss, i represents the index of the capture site corresponding to the pixel block or block, and q represents the total number of genes.
[0073] Furthermore, the total loss function L is calculated based on the contrast loss and the MSE loss: L = L con +L MSE .
[0074] It is understood that in this invention, the loss function of the gene expression prediction model includes two parts. The first part is the contrast loss between image features and gene features. The contrast loss is set to calculate the cosine similarity between the two features to narrow the distance between them, so that the model can learn the potential association between gene features and image features. The second part is the MSE (mean-square error) loss between the prediction result and the actual gene expression data.
[0075] S105. Set the backpropagation gradient according to the total loss function, adjust the network hyperparameters of the gene expression prediction model according to the backpropagation algorithm based on the backpropagation gradient, and evaluate the model based on the test set.
[0076] In this embodiment, the network parameters of the ViT model, self-attention model, and multilayer perceptron model in the gene expression prediction model are adjusted by the backpropagation algorithm. The total loss function of mean squared error plus contrast loss is adopted to ensure that the error between the predicted value and the true value is minimized. The backpropagation gradient is set according to the loss function. Based on the backpropagation gradient, the network parameters are adjusted according to the backpropagation algorithm. Finally, the updated model is evaluated using the test set.
[0077] S106. Based on the adjusted network parameters, continue training the gene expression prediction model until the total loss function reaches the preset convergence condition, thus obtaining the trained gene expression prediction model.
[0078] The loss function is a function that measures the difference between the model's predicted value and the true value. The smaller the value, the more accurate the model's prediction. During training, the model's parameters are continuously adjusted to minimize the loss function until a preset convergence condition is reached. The convergence condition is usually determined by observing the value of the loss function. When the change in the loss value is very small or no longer changes, the model can be considered to have converged.
[0079] S107. Use the validation set to judge the prediction results of the trained gene expression prediction model. If the error between the prediction results and the labels in the validation set is lower than a preset threshold, then the target gene expression prediction model is obtained.
[0080] After the model is fitted on the training set, the model is used to make predictions on the validation set, and the validation error of the model is quantitatively calculated. If the error between the prediction result and the label in the validation set is lower than a preset threshold, the target gene expression prediction model is obtained. This step helps to judge the model's performance on unseen data, thereby enabling model selection and parameter tuning.
[0081] Furthermore, such as Figure 4 As shown, this invention provides the code (pseudonym) implementation process for training the gene expression prediction model to obtain the target gene expression prediction model.
[0082] Step S20: Obtain the target histological image to be predicted, preprocess the target histological image to obtain a preprocessed image, and divide the preprocessed image into multiple sub-image blocks according to the coordinates of the capture site, wherein each sub-image block contains a capture site.
[0083] Specifically, for target histological images whose gene expression needs to be predicted, image data preprocessing is performed to improve data quality and the accuracy of model predictions. First, the target histological images are denoised. Data denoising refers to preprocessing data to eliminate or reduce noise, thereby improving data quality, accuracy, and reliability. Common denoising methods include mean filtering, singular value decomposition, and wavelet transform. Next, the denoised data is standardized. Standardization may include data cleaning, data transformation, and data normalization to ensure data consistency, accuracy, and comparability. These data preprocessing steps provide high-quality input for subsequent model learning, ensuring data accuracy and consistency, and improving the model's prediction accuracy.
[0084] Furthermore, after obtaining the preprocessed image, the preprocessed image is divided into multiple sub-image blocks according to the coordinates of the capture site. The coordinates of the capture site are used to capture the location points of RNA molecules in specific regions of the preprocessed image, and these location information are associated with gene expression data to achieve spatial localization of gene expression in tissue slices. Each sub-image block contains a capture site.
[0085] Step S30: Input the multiple sub-image blocks into the target gene expression prediction model for feature extraction to obtain the target image features corresponding to each sub-image block. Perform gene expression prediction based on the multiple target image features to obtain the target gene expression result.
[0086] Specifically, the multiple sub-image blocks are respectively input into the image feature extraction module for feature extraction to obtain the target image features corresponding to each sub-image block;
[0087] Multiple target image features are projected onto the prediction module through the projection module to predict gene expression, thereby obtaining the target gene expression results of the target histological image.
[0088] As can be seen, this invention proposes a spatial transcriptome data prediction algorithm that predicts corresponding gene expression data given a histological image. By treating gene expression data and histological image data as different representations of the same capture site across different modalities, the gene expression prediction task becomes predicting gene modality data given the capture site in the image modality data. In the field of spatial transcriptome gene expression prediction, this invention views the prediction task as a mutual learning between different modalities: by considering image features and gene expression features as different expressions of the capture site's modality features, a model is established to learn the potential correlation between the two features. Finally, the prediction module uses one feature to predict the features of another modality, thus completing the gene expression prediction task.
[0089] Furthermore, such as Figure 5 As shown, based on the above-described spatial transcriptome gene expression prediction method, the present invention also provides a spatial transcriptome gene expression prediction system, wherein the spatial transcriptome gene expression prediction system includes:
[0090] The target model training module 51 is used to construct a gene expression prediction model and train the gene expression prediction model to obtain a target gene expression prediction model.
[0091] The image data acquisition module 52 is used to acquire the target histological image to be predicted, preprocess the target histological image to obtain a preprocessed image, and divide the preprocessed image into multiple sub-image blocks according to the coordinates of the capture site, wherein each sub-image block contains a capture site.
[0092] The gene expression prediction module 53 is used to input multiple sub-image blocks into the target gene expression prediction model for feature extraction, obtain the target image features corresponding to each sub-image block, and perform gene expression prediction based on the multiple target image features to obtain the target gene expression result.
[0093] Furthermore, such as Figure 6 As shown, based on the above-mentioned spatial transcriptome gene expression prediction method and system, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 6 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.
[0094] 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, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card. 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 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.
[0095] 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.
[0096] 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.
[0097] In one embodiment, when processor 10 executes spatial transcriptome gene expression prediction program 40 in memory 20, the following steps are performed:
[0098] A gene expression prediction model is constructed, and the gene expression prediction model is trained to obtain a target gene expression prediction model;
[0099] A target histological image to be predicted is acquired, the target histological image is preprocessed to obtain a preprocessed image, and the preprocessed image is divided into multiple sub-image blocks according to the coordinates of the capture site, wherein each sub-image block contains a capture site;
[0100] Multiple sub-image blocks are input into the target gene expression prediction model for feature extraction to obtain the target image features corresponding to each sub-image block. Gene expression prediction is performed based on the multiple target image features to obtain the target gene expression result.
[0101] The gene expression prediction model includes: an image feature extraction module, a gene feature extraction module, a projection module, and a prediction module.
[0102] The process of training the gene expression prediction model further includes, prior to:
[0103] Acquire historical data, which includes historical histological images and the actual gene expression information corresponding to the historical histological images;
[0104] The historical histological images are used as training samples, and the real gene expression information corresponding to the historical histological images is used as labels to construct a dataset.
[0105] The dataset is divided into a training set, a test set, and a validation set according to a preset ratio. The training set is used to train the gene expression prediction model, the test set is used to evaluate the gene expression prediction model in each round of training, and the validation set is used to evaluate the trained gene expression prediction model.
[0106] The feature extraction module is a ViT model, the gene feature extraction module is a self-attention model, and the prediction module is a multilayer perceptron model containing two fully connected layers.
[0107] The step of training the gene expression prediction model to obtain the target gene expression prediction model specifically includes:
[0108] The training samples in the training set are segmented based on the coordinates of the capture sites in the spatial transcriptome data to obtain multiple pixel blocks;
[0109] The multiple pixel blocks and their corresponding real gene expression information are respectively input into the image feature extraction module and the gene feature extraction module for feature extraction to obtain image features and gene features.
[0110] The image features are projected onto the prediction module through the projection module to obtain the predicted gene expression results;
[0111] The total loss function is calculated based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information.
[0112] The backpropagation gradient is set according to the total loss function. Based on the backpropagation gradient and the backpropagation algorithm, the network hyperparameters of the gene expression prediction model are adjusted, and the model is evaluated based on the test set.
[0113] The gene expression prediction model is trained again based on the adjusted network parameters until the total loss function reaches the preset convergence condition, thus obtaining the trained gene expression prediction model.
[0114] The training gene expression prediction model is evaluated using the validation set. If the error between the prediction result and the label in the validation set is lower than a preset threshold, the target gene expression prediction model is obtained.
[0115] Specifically, calculating the total loss function based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information includes:
[0116] Based on the image features, gene features, predicted gene expression results, and actual gene expression information, the contrast loss and MSE loss are calculated:
[0117]
[0118] Among them, L con Z represents the comparative loss. ci z represents the image feature of the i-th pixel block. gi X represents the gene feature corresponding to the i-th pixel block. i X represents the true gene expression information of the capture site corresponding to the i-th pixel block. i h ciL represents the predicted gene expression result of the capture site corresponding to the i-th pixel block; MSE q represents the MSE loss, i represents the index of the capture site corresponding to the pixel block or block, and q represents the total number of genes.
[0119] The total loss function L is calculated based on the contrast loss and the MSE loss:
[0120] L = L con +L MSE .
[0121] Specifically, the step of inputting multiple sub-image blocks into the target gene expression prediction model for feature extraction to obtain target image features corresponding to each sub-image block, and performing gene expression prediction based on multiple target image features to obtain target gene expression results includes:
[0122] The multiple sub-image blocks are respectively input into the image feature extraction module for feature extraction, so as to obtain the target image features corresponding to each sub-image block;
[0123] Multiple target image features are projected onto the prediction module through the projection module to predict gene expression, thereby obtaining the target gene expression results of the target histological image.
[0124] 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.
[0125] In summary, this invention proposes a spatial transcriptome gene expression prediction method, system, and terminal. The method includes: constructing a gene expression prediction model; training the gene expression prediction model to obtain a target gene expression prediction model; acquiring a target histological image to be predicted; preprocessing the target histological image to obtain a preprocessed image; segmenting the preprocessed image into multiple sub-image blocks according to the coordinates of the capture sites, wherein each sub-image block contains a capture site; inputting the multiple sub-image blocks into the target gene expression prediction model for feature extraction to obtain the target image features corresponding to each sub-image block; and performing gene expression prediction based on the multiple target image features to obtain the target gene expression result. This invention views the prediction task as mutual learning between different modalities of data: establishing a model to learn the potential correlation between two features, and finally using a prediction module to predict the features of another modality through one feature, thus achieving high-precision gene expression prediction.
[0126] 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.
[0127] 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. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0128] 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 spatial transcriptome gene expression prediction method, characterized in that, The spatial transcriptome gene expression prediction method includes: A gene expression prediction model is constructed, and the gene expression prediction model is trained to obtain a target gene expression prediction model; A target histological image to be predicted is acquired, the target histological image is preprocessed to obtain a preprocessed image, and the preprocessed image is divided into multiple sub-image blocks according to the coordinates of the capture site, wherein each sub-image block contains a capture site; Multiple sub-image blocks are respectively input into the target gene expression prediction model for feature extraction to obtain the target image features corresponding to each sub-image block. Gene expression prediction is performed based on the multiple target image features to obtain the target gene expression result. The step of training the gene expression prediction model to obtain the target gene expression prediction model specifically includes: The training samples in the training set are segmented based on the coordinates of the capture sites in the spatial transcriptome data to obtain multiple pixel blocks; The multiple pixel blocks and their corresponding real gene expression information are respectively input into the image feature extraction module and the gene feature extraction module for feature extraction to obtain image features and gene features; The image features are projected onto the prediction module through the projection module for calculation to obtain the predicted gene expression results; The total loss function is calculated based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information. The backpropagation gradient is set according to the total loss function. Based on the backpropagation gradient and the backpropagation algorithm, the network hyperparameters of the gene expression prediction model are adjusted, and the model is evaluated based on the test set. The gene expression prediction model is trained again based on the adjusted network parameters until the total loss function reaches the preset convergence condition, thus obtaining the trained gene expression prediction model. The prediction results of the trained gene expression prediction model are judged using a validation set. If the error between the prediction results and the labels in the validation set is lower than a preset threshold, the target gene expression prediction model is obtained. The step of calculating the total loss function based on the image features, the gene features, the predicted gene expression results, and the actual gene expression information specifically includes: Based on the image features, gene features, predicted gene expression results, and actual gene expression information, the contrast loss and MSE loss are calculated: Among them, L con Z represents the comparative loss. ci z represents the image feature of the i-th pixel block. gi X represents the gene feature corresponding to the i-th pixel block. i X represents the true gene expression information of the capture site corresponding to the i-th pixel block. i h ci L represents the predicted gene expression result of the capture site corresponding to the i-th pixel block; MSE q represents the MSE loss, i represents the index of the capture site corresponding to the pixel block or block, and q represents the total number of genes. The total loss function L is calculated based on the contrast loss and the MSE loss: L=L con +L MSE 。 2. The spatial transcriptome gene expression prediction method according to claim 1, characterized in that, The gene expression prediction model includes: an image feature extraction module, a gene feature extraction module, a projection module, and a prediction module.
3. The spatial transcriptome gene expression prediction method according to claim 2, characterized in that, The process of training the gene expression prediction model further includes, prior to: Acquire historical data, which includes historical histological images and the actual gene expression information corresponding to the historical histological images; The historical histological images are used as training samples, and the real gene expression information corresponding to the historical histological images is used as labels to construct a dataset. The dataset is divided into a training set, a test set, and a validation set according to a preset ratio. The training set is used to train the gene expression prediction model, the test set is used to evaluate the gene expression prediction model in each round of training, and the validation set is used to evaluate the trained gene expression prediction model.
4. The spatial transcriptome gene expression prediction method according to claim 3, characterized in that, The feature extraction module is a ViT model, the gene feature extraction module is a self-attention model, and the prediction module is a multilayer perceptron model containing two fully connected layers.
5. The spatial transcriptome gene expression prediction method according to claim 2, characterized in that, The step of inputting multiple sub-image blocks into the target gene expression prediction model for feature extraction to obtain target image features corresponding to each sub-image block, and performing gene expression prediction based on multiple target image features to obtain target gene expression results, specifically includes: The multiple sub-image blocks are respectively input into the image feature extraction module for feature extraction, so as to obtain the target image features corresponding to each sub-image block; Multiple target image features are projected onto the prediction module through the projection module to predict gene expression, thereby obtaining the target gene expression results of the target histological image.
6. 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 according to any one of claims 1-5, wherein the spatial transcriptome gene expression prediction system comprises: The target model training module is used to construct a gene expression prediction model and train the gene expression prediction model to obtain a target gene expression prediction model. The image data acquisition module is used to acquire the target histological image to be predicted, preprocess the target histological image to obtain a preprocessed image, and divide the preprocessed image into multiple sub-image blocks according to the coordinates of the capture site, wherein each sub-image block contains a capture site; The gene expression prediction module is used to input multiple sub-image blocks into the target gene expression prediction model for feature extraction, obtain the target image features corresponding to each sub-image block, and perform gene expression prediction based on the multiple target image features to obtain the target gene expression result.
7. 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-5.
8. 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-5.
Citation Information
Patent Citations
Histological image-based space gene expression level prediction method, device and equipment
CN118629498A
Method and system for predicting transcription factor-target gene relationship, device and medium
WO2024183096A1