A spatial transcriptome cell abundance prediction method and system
By constructing a two-dimensional gene topology map and cross-domain adaptive training, the interdomain differences between single-cell and spatial transcriptomes were resolved, improving the prediction accuracy of low-abundance cell types and achieving higher prediction accuracy and stability.
Patent Information
- Application Number
- CN202611387668.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-08
- Publication Date
- 2026-11-27
AI Technical Summary
Existing spatial transcriptome deconvolution techniques suffer from interdomain differences between single cells and spatial transcriptomes, neglecting intergene structural relationships and making it difficult to accurately predict low-abundance cell types.
Two-dimensional gene topology maps are constructed by gene alignment to generate two-dimensional structured expression images. Combining visual feature extraction and context-gated fusion, a cross-domain adaptive training model is used to predict cell abundance, thereby reducing inter-domain differences and improving prediction accuracy.
It improved the stability and accuracy of spatial transcriptome cell abundance prediction, especially the prediction effect of low abundance cell types, and achieved higher Pearson correlation and improved prediction results.
Smart Images

Figure CN123182768A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical fields of bioinformatics and deep learning, and in particular to a method and system for predicting the spatial transcriptome cell abundance. Background Technology
[0002] Spatial transcriptomics technology can measure gene expression levels while preserving tissue spatial location information, providing an important tool for analyzing the tumor microenvironment, tissue heterogeneity, and cell spatial distribution. However, the resolution of spatial transcriptomics data is usually lower than that of single-cell transcriptomics data. A single spatial spot often contains mixed expression signals from multiple cells, so it is necessary to infer the abundance ratio of different cell types at each spatial spot by calculating deconvolution methods.
[0003] Existing spatial transcriptome deconvolution techniques mainly suffer from the following problems:
[0004] First, there is a significant domain shift between single-cell transcriptome data and spatial transcriptome data. Deconvolution typically requires single-cell transcriptome data as a reference template, but single-cell and spatial transcriptomes originate from different experimental platforms or workflows, exhibiting significant differences in sequencing depth, dropout patterns, expression noise, and batch effects, resulting in a domain gap. This difference makes it difficult for models trained on single-cell transcriptome data to directly generalize to real spatial transcriptome samples, thus affecting the stability and accuracy of spatial deconvolution.
[0005] Second, traditional methods mostly treat gene expression as an unstructured vector. Most existing bioinformatics methods directly perform regression fitting or probabilistic decomposition on the gene expression matrix, essentially still treating gene expression as a one-dimensional vector, ignoring the potential structural relationships between genes and the reconstructable two-dimensional topological features. Therefore, these methods often struggle to fully utilize local expression patterns, co-expression structures, and spatial neighborhood relationships that visual models excel at capturing.
[0006] Third, predicting low-abundance cell types is difficult. In real tissues, immune cells such as T cells and myeloid cells often account for only a small proportion, and their expression signals are weak and fluctuate greatly. Their signals are easily masked by high-abundance cell types during training. Existing methods often exhibit low Pearson correlation, large magnitude prediction bias, and even negative correlation for low-abundance cells.
[0007] Therefore, there is an urgent need for a technical solution that can fully utilize the two-dimensional topological information of gene expression and solve the distribution shift in the migration from the single-cell reference domain to the spatial target domain through a cross-domain adaptive mechanism, thereby improving the overall prediction accuracy, especially the prediction effect of low-abundance cell types. Summary of the Invention
[0008] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for predicting the spatial transcriptome cell abundance.
[0009] To achieve the above objectives, the technical solution provided by this invention is as follows:
[0010] A method for predicting spatial transcriptomic cell abundance includes the following steps:
[0011] S1. Gene alignment is performed between single-cell transcriptome data and spatial transcriptome data to construct a key gene set, and a two-dimensional gene topology map is generated based on the expression correlation between genes in the key gene set.
[0012] S2. Based on the two-dimensional gene topology map, the expression of pseudo-space samples and real space transcriptome samples constructed from single-cell transcriptome data are respectively mapped into two-dimensional structured expression images, wherein the pseudo-space samples are labeled with cell abundance and used as source domain training samples, and the real space transcriptome samples are used as target domain training samples.
[0013] S3. Cluster the real spatial transcriptome samples to obtain multiple spatial organization domains, and extract the context prior vector of each spatial organization domain.
[0014] S4. Construct a cell abundance prediction model, which includes a visual feature extraction module, a spatial context-gated fusion module, a cell abundance prediction head, and a domain discrimination branch. The two-dimensional structured representation image is input into the visual feature extraction module to obtain a visual principal feature vector. The visual principal feature vector and the context prior vector are input into the spatial context-gated fusion module for gated fusion to obtain a fused feature. The fused feature is then input into the cell abundance prediction head to output the cell abundance prediction result. Simultaneously, the visual principal feature vector is fed into the domain discrimination branch through a gradient inversion layer to determine whether the visual principal feature vector originates from the source domain or the target domain.
[0015] S5. Using the source domain training samples and their cell abundance labels, and the target domain training samples, the cell abundance prediction model is trained by combining a composite loss function and a two-stage training strategy: the first stage combines the source domain supervision loss, the domain adversarial loss and the target domain pseudo-label consistency loss to perform cross-domain feature alignment; the second stage removes or weakens the domain adversarial loss and performs fine-tuning of the main task with a small learning rate, thereby reducing the distribution offset between the source domain and the target domain.
[0016] S6. Construct a two-dimensional structured expression image of the spatial transcriptome sample to be predicted according to the gene alignment, mapping and preprocessing method consistent with the training stage, and obtain its context prior vector. Input the trained cell abundance prediction model, and output the abundance ratio of each cell type in the spatial transcriptome sample to be predicted.
[0017] Further, the gene alignment in step S1 includes: screening for common genes between the single-cell transcriptome data and the spatial transcriptome data; screening for highly variable genes within the common gene range to obtain a candidate gene set; and incorporating lineage anchoring genes related to lymphocytes, myeloid cells, stromal cells, and epithelial cells into the candidate gene set to obtain the key gene set.
[0018] Further, in step S1, generating a two-dimensional gene topology map includes:
[0019] Based on the single-cell transcriptome data, a gene expression correlation coefficient matrix was constructed, and then... Calculate gene topological distance, where For the first The gene and the first The absolute value of the correlation coefficient between the expression of each gene;
[0020] Two-dimensional dimensionality reduction embedding is performed on the gene topological distances to obtain two-dimensional continuous coordinates for each gene; a functional partition bias is applied to the anchored genes, and the resulting coordinates are... :
[0021] ;
[0022] ;
[0023] in, For two-dimensional embedding positions; To anchor the center of the functional region to which the gene belongs; These are the weighting coefficients;
[0024] The biased two-dimensional continuous coordinates are discretized into a fixed-size two-dimensional grid to form a two-dimensional gene topology map with one gene and one location and no overlap. For genes mapped to the same discrete location, a neighborhood search is used to allocate the nearest available vacancy.
[0025] Further, step S2 includes:
[0026] According to the expression of the sample Perform normalization and logarithmic transformation, where For the first The expression value of each gene, To normalize the total amount, To prevent constants with zero denominators, the transformed expression values are written into the pixel positions corresponding to the two-dimensional gene topology map to construct a two-dimensional structured expression image.
[0027] Further, step S3 includes:
[0028] After normalizing and logarithmically transforming the spatial transcriptome expression matrix of real spatial transcriptome samples, dimensionality reduction and graph clustering were performed to obtain... A spatial organization domain;
[0029] The number is calculated using the following formula. The central representation vector of each spatial organization domain:
[0030] ;
[0031] in, This refers to the set of spatial sites contained within the corresponding spatial organization domain; For the first The expression vector of each spatial site;
[0032] The central expression vector Encoded as fixed-dimensional context prior vectors .
[0033] Further, in step S4, the visual main feature vector and the context prior vector are input into the spatial context gating fusion module for gating fusion to obtain fused features, including:
[0034] context prior vector Input the context encoder to obtain the context representation. , Indicates the context encoding function;
[0035] Combining visual principal feature vectors With context representation Generate context-gated vectors :
[0036] ;
[0037] [⋅;⋅] indicates vector concatenation; This represents the Sigmoid activation function; and Indicates the gating parameters;
[0038] Contextual features after production gating :
[0039] ;
[0040] ⊙ represents element-wise multiplication;
[0041] Generate fusion features :
[0042] .
[0043] Furthermore, in step S4, the fused features are... Input a cell abundance prediction header, and output the log probability distribution of each cell type:
[0044] ;
[0045] This represents the cell abundance prediction head mapping; Indicates the predicted cell abundance ratio;
[0046] The cell abundance prediction head output is normalized using LogSoftmax, resulting in:
[0047] ;
[0048] This ensures that the output can be directly interpreted as the proportion of multiple cell types. For cell type indexing, This represents the total number of cell types.
[0049] Furthermore, in step S5, the process of constructing the composite loss function includes:
[0050] Constructing KL divergence loss :
[0051] Let the true label of the source domain sample be... The predicted cell abundance ratio vector is The KL divergence loss is then expressed as:
[0052] ;
[0053] For cell type indexing, Total number of cell types;
[0054] Constructing Pearson related loss :
[0055] Suppose a batch has a first... The predicted value vector of the cell type is The true value vector is Then the Pearson correlation coefficient Represented as:
[0056] ;
[0057] To prevent constants with a denominator of zero;
[0058] Then the Pearson related loss is :
[0059] ;
[0060] Constructing the log-mean squared error loss:
[0061] Let the predicted proportion and the actual proportion be respectively and Then the logarithmic mean square error loss is:
[0062] ;
[0063] Constructing domain-adversarial losses:
[0064] Let the source domain training samples be labeled 0 and the target domain training samples be labeled 1. The outputs of the domain discriminator are respectively... and The domain adversarial loss is:
[0065] ;
[0066] Constructing pseudo-label consistency loss:
[0067] Let the distribution of the filtered and saved pseudo-labels be... The current model predicts the distribution as follows: Then the pseudo-label consistency loss is:
[0068] ;
[0069] Finally, the composite loss function is obtained:
[0070] ;
[0071] The weights are Pearson correlation loss values; The weights are the log-mean squared error loss. Loss weights for domain adversarial; The weights for consistency loss due to pseudo-labels.
[0072] Furthermore, in the two-stage training strategy: the first stage is based on the training progress... Gradually increase the gradient reversal strength And the weights of domain adversarial loss and pseudo-label consistency loss, among which For the current training round, The total number of training rounds is 1; the second phase removes or reduces the influence of domain adversarial branches, focusing on optimizing KL divergence loss, Pearson correlation loss, and log-mean squared error loss using the learning rate.
[0073] Furthermore, a spatial transcriptome cell abundance prediction system is provided for implementing the above-mentioned spatial transcriptome cell abundance prediction method. This system includes:
[0074] The gene map construction module is used to perform key gene set construction and two-dimensional gene topology map generation;
[0075] The sample mapping module is used to map source domain pseudospace samples and target domain real space transcriptome samples into two-dimensional structured expression images;
[0076] The context prior building module is used to construct spatial organization domain context prior vectors;
[0077] The prediction network module includes a visual feature extraction module, a spatial context gating fusion module, a cell abundance prediction head, and a domain discrimination branch;
[0078] The training module is used to perform cross-domain adaptive training, target domain pseudo-label self-training, and a two-stage training strategy.
[0079] The prediction output module is used to output the abundance ratio of each cell type for the sample to be predicted.
[0080] Compared with existing technologies, the principles and advantages of this technical solution are as follows:
[0081] 1. It is not limited to a specific network, but establishes a scalable general framework that integrates bioinformatics representation modeling, visual structure learning, and data domain adaptation, and has strong versatility.
[0082] 2. High-dimensional gene expression is reconstructed into a two-dimensional structured expression image, and a visual model is introduced to learn local patterns and multi-scale features. This enables the traditional bioinformatics deconvolution problem to obtain a new representation form and modeling method, and can make full use of the local topological relationships and co-expression patterns of genes.
[0083] 3. By using domain adversarial and target domain pseudo-labeling mechanisms, the inter-domain differences between single cells and spatial transcriptomes are reduced. Combined with a two-stage training strategy, the cross-domain transfer and main task accuracy are balanced, thereby improving the model's generalization ability and training stability on real spatial transcriptome samples.
[0084] 4. By employing mechanisms such as logarithmic mean square error, trend constraints, contextual priors, and moderately enhanced sampling, the problem of unstable prediction of low-abundance cell types can be effectively alleviated, especially showing a significant effect on improving the correlation of immune cells.
[0085] 5. Based on the experimental results, this technical solution achieved a high average Pearson correlation level in the spatial transcriptome cell abundance prediction task, and improved the correlation between the negative correlation and the stable positive correlation of difficult-to-predict cells such as T-cells, which has good practical value and engineering application potential. Attached Figure Description
[0086] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0087] Figure 1 This is a flowchart illustrating the principle of a spatial transcriptome cell abundance prediction method according to the present invention.
[0088] Figure 2 The training flowchart for the cell abundance prediction model;
[0089] Figure 3 This is a visualization of the experimental results of this invention on a human breast cancer dataset;
[0090] Figure 4 This is a connection block diagram of a spatial transcriptome cell abundance prediction system according to the present invention. Detailed Implementation
[0091] The present invention will be further described below with reference to specific embodiments:
[0092] like Figure 1 As shown in this embodiment, a spatial transcriptome cell abundance prediction method includes the following steps:
[0093] S1. Gene alignment is performed between single-cell transcriptome data and spatial transcriptome data to construct a key gene set, and a two-dimensional gene topology map is generated based on the expression correlation between genes in the key gene set.
[0094] In this step,
[0095] Gene alignment includes: screening for common genes between the single-cell transcriptome data and the spatial transcriptome data; screening for highly variable genes within the common gene range to obtain a candidate gene set; and incorporating lineage anchoring genes related to lymphocytes, myeloid cells, stromal cells, and epithelial cells into the candidate gene set to obtain the key gene set.
[0096] Generating a two-dimensional gene topology map includes:
[0097] Based on the single-cell transcriptome data, a gene expression correlation coefficient matrix was constructed, and then... Calculate gene topological distance, where For the first The gene and the first The absolute value of the correlation coefficient between the expression of each gene;
[0098] Two-dimensional dimensionality reduction embedding is performed on the gene topological distances to obtain two-dimensional continuous coordinates for each gene; a functional partition bias is applied to the anchored genes, and the resulting coordinates are... :
[0099] ;
[0100] ;
[0101] in, For two-dimensional embedding positions; To anchor the center of the functional region to which the gene belongs; These are the weighting coefficients;
[0102] The biased two-dimensional continuous coordinates are discretized into a fixed-size two-dimensional grid to form a two-dimensional gene topology map with one gene and one location and no overlap. For genes mapped to the same discrete location, a neighborhood search is used to allocate the nearest available vacancy.
[0103] S2. Based on the two-dimensional gene topology map, the expression of pseudo-space samples and real space transcriptome samples constructed from single-cell transcriptome data are respectively mapped into two-dimensional structured expression images, wherein the pseudo-space samples are labeled with cell abundance and used as source domain training samples, and the real space transcriptome samples are used as target domain training samples.
[0104] In this step, since real spatial transcriptome samples usually lack accurate spatial site cellular composition labels, this embodiment constructs pseudo-spatial samples using single-cell transcriptome data for supervised training.
[0105] Assume there is a total For each pseudospace sample, the proportion of each cell type is first sampled based on the Dirichlet distribution:
[0106] ;
[0107] in, This indicates the proportion of each cell type in the pseudo-sample. Then, within a given total number of cells, based on... A corresponding number of cells are extracted from single-cell transcriptome data and their expression is superimposed to form a pseudo-spatial sample expression vector.
[0108] After summing the expression of the sampled cells, normalization and logarithmic transformation are performed, and a certain proportion of random dropout can be applied to simulate the phenomenon of real spatial sequencing noise and some gene expression not being detected and showing zero values.
[0109] Let the first Cells were sampled If there are 1, then the corresponding supervision label is:
[0110] ;
[0111] This yields the cell abundance label vector:
[0112] ;
[0113] This label vector serves as a supervision signal for the model's main task.
[0114] This step describes the sample expression according to... Perform normalization and logarithmic transformation, where For the first The expression value of each gene, To normalize the total amount, To prevent constants with zero denominators, the transformed expression values are written into the pixel positions corresponding to the two-dimensional gene topology map to construct a two-dimensional structured expression image.
[0115] S3. Cluster the real spatial transcriptome samples to obtain multiple spatial organization domains, and extract the context prior vector of each spatial organization domain.
[0116] This step specifically includes:
[0117] After normalizing and logarithmically transforming the spatial transcriptome expression matrix of real spatial transcriptome samples, dimensionality reduction and graph clustering were performed to obtain... A spatial organization domain;
[0118] The number is calculated using the following formula. The central representation vector of each spatial organization domain:
[0119] ;
[0120] in, This refers to the set of spatial sites contained within the corresponding spatial organization domain; For the first The expression vector of each spatial site;
[0121] The central expression vector Encoded as fixed-dimensional context prior vectors .
[0122] For any spatial location, the corresponding spatial context vector can be obtained through its tissue domain index. This context prior describes the background expression state of the local tissue region, which helps the model distinguish different microenvironments such as tumor areas, immune-enriched areas, and stromal areas.
[0123] S4. Construct a cell abundance prediction model, which includes a visual feature extraction module, a spatial context-gated fusion module, a cell abundance prediction head, and a domain discrimination branch. The two-dimensional structured representation image is input into the visual feature extraction module to obtain a visual principal feature vector. The visual principal feature vector and the context prior vector are input into the spatial context-gated fusion module for gated fusion to obtain a fused feature. The fused feature is then input into the cell abundance prediction head to output the cell abundance prediction result. Simultaneously, the visual principal feature vector is fed into the domain discrimination branch through a gradient inversion layer to determine whether the visual principal feature vector originates from the source domain or the target domain.
[0124] In this step, the visual main feature vector and the context prior vector are input into the spatial context gating fusion module for gating fusion to obtain fused features, including:
[0125] context prior vector Input the context encoder to obtain the context representation. , Indicates the context encoding function;
[0126] Combining visual principal feature vectors With context representation Generate context-gated vectors :
[0127] ;
[0128] [⋅;⋅] indicates vector concatenation; This represents the Sigmoid activation function; and Indicates the gating parameters;
[0129] Contextual features after production gating :
[0130] ;
[0131] ⊙ represents element-wise multiplication;
[0132] Generate fusion features :
[0133] .
[0134] Next, the fusion features will be... Input a cell abundance prediction header, and output the log probability distribution of each cell type:
[0135] ;
[0136] This represents the cell abundance prediction head mapping; Indicates the predicted cell abundance ratio;
[0137] The cell abundance prediction head output is normalized using LogSoftmax, resulting in:
[0138] ;
[0139] This ensures that the output can be directly interpreted as the proportion of multiple cell types. For cell type indexing, This represents the total number of cell types.
[0140] S5, such as Figure 2 As shown, the cell abundance prediction model is trained using the source domain training samples and their cell abundance labels, the target domain training samples, and a composite loss function and a two-stage training strategy: the first stage combines the source domain supervision loss, the domain adversarial loss and the target domain pseudo-label consistency loss to perform cross-domain feature alignment; the second stage removes or weakens the domain adversarial loss and performs fine-tuning of the main task with a small learning rate, thereby reducing the distribution offset between the source domain and the target domain.
[0141] In this step, the construction process of the composite loss function includes:
[0142] Constructing KL divergence loss :
[0143] Let the true label of the source domain sample be... The predicted cell abundance ratio vector is The KL divergence loss is then expressed as:
[0144] ;
[0145] For cell type indexing, Total number of cell types;
[0146] Constructing Pearson related loss :
[0147] Suppose a batch has a first... The predicted value vector of the cell type is The true value vector is Then the Pearson correlation coefficient Represented as:
[0148] ;
[0149] To prevent constants with a denominator of zero;
[0150] Then the Pearson related loss is :
[0151] ;
[0152] Constructing the log-mean squared error loss:
[0153] Let the predicted proportion and the actual proportion be respectively and Then the logarithmic mean square error loss is:
[0154] ;
[0155] Constructing domain-adversarial losses:
[0156] Let the source domain training samples be labeled 0 and the target domain training samples be labeled 1. The outputs of the domain discriminator are respectively... and The domain adversarial loss is:
[0157] ;
[0158] Constructing pseudo-label consistency loss:
[0159] Let the distribution of the filtered and saved pseudo-labels be... The current model predicts the distribution as follows: Then the pseudo-label consistency loss is:
[0160] ;
[0161] Finally, the composite loss function is obtained:
[0162] ;
[0163] The weights are Pearson correlation loss values; The weights are the log-mean squared error loss. Loss weights for domain adversarial; The weights for consistency loss due to pseudo-labels.
[0164] In this two-stage training strategy: the first stage is based on the training progress. Gradually increase the gradient reversal strength And the weights of domain adversarial loss and pseudo-label consistency loss, among which For the current training round, The total number of training rounds is 1; the second phase removes or reduces the influence of domain adversarial branches, focusing on optimizing KL divergence loss, Pearson correlation loss, and log-mean squared error loss using the learning rate.
[0165] S6. Construct a two-dimensional structured expression image of the spatial transcriptome sample to be predicted according to the gene alignment, mapping and preprocessing method consistent with the training stage, and obtain its context prior vector. Input the trained cell abundance prediction model, and output the abundance ratio of each cell type in the spatial transcriptome sample to be predicted.
[0166] To demonstrate the effectiveness of this invention, the following experiment was conducted:
[0167] Single-cell transcriptome data from breast cancer were used as reference data, spatial transcriptome data as target data, and spatial site cell composition probability labels generated by cell2location were used as reference labels for evaluation. The corresponding data files include single-cell data (breast.h5ad), spatial transcriptome data (st.h5ad), and the reference label file (cell_probabilities.csv).
[0168] In this experiment, a unified gene set was first constructed based on preprocessed single-cell transcriptome data and spatial transcriptome data. Then, sample expression was mapped to a two-dimensional structured expression image according to a pre-generated two-dimensional gene atlas. The size of the two-dimensional expression image was set to 55×55. The model predicted nine cell types: B-cells, CAFs, Cancer Epithelial, Endothelial, Myeloid, Normal Epithelial, PVL, Plasmablasts, and T-cells.
[0169] Regarding training parameter settings, the batch size was set to 64, the initial learning rate to 8×10^-5, the number of main training epochs to 120, and the number of fine-tuning epochs to 20. The AdamW optimizer was used, with the StepLR learning rate scheduling strategy employed during the main training phase.
[0170] In terms of model structure, this experiment adopts a cell abundance prediction model based on a YOLO-style multi-scale convolutional backbone. This cell abundance prediction model includes a visual feature extraction module, a spatial context gating fusion module, a cell abundance prediction head, and a domain discrimination branch. The spatial context input dimension is set to 128 dimensions.
[0171] Regarding the loss function settings, this experiment employs a composite loss function for joint optimization. The main task loss includes KL divergence loss, Pearson correlation loss, and Log-MSE loss, with the Pearson loss weight set to 0.30 and the Log-MSE loss weight set to 0.35. Furthermore, during the cross-domain training phase, domain adversarial loss and pseudo-label consistency loss are introduced, with the low-entropy screening ratio for pseudo-label samples set to 0.20; the gradient reversal strength coefficient dynamically increases with training progress, reaching a maximum value of 0.25.
[0172] In terms of sample construction, this experiment uses single-cell reference data to generate pseudo-space samples as source domain training data, and sets up enhanced sampling strategies for low-abundance cell types such as Myeloid, PVL and T-cells to improve the model's ability to identify low-abundance cell types.
[0173] During the model evaluation phase, the trained model is applied to spatial transcriptome samples to output predicted cell abundance at each spatial site, which is then compared with the cell composition probabilities in the reference label file. Evaluation metrics include the Pearson correlation coefficient (PCC).
[0174] ;
[0175] Spearman correlation coefficient (SCC):
[0176] ;
[0177] Root Mean Square Error (RMSE):
[0178] ;
[0179] Jensen-Shannon distance (JSD):
[0180] ;
[0181] Simultaneously, the focusPCC index was calculated for three cell types: Myeloid, PVL, and T-cells.
[0182] ;
[0183] like Figure 3As shown, based on the latest experimental results of this study, the average Pearson correlation coefficient (AvgPCC) of model_v12_sprint_ep60.pth is 0.6426, the average Spearman correlation coefficient (AvgSCC) is 0.6556, the average root mean square error (AvgRMSE) is 0.1275, and the average Jensen-Shannon distance (AvgJSD) is 0.3577.
[0184] The PCC values for B-cells were 0.3939, CAFs 0.8689, Cancer Epithelial 0.8043, Endothelial 0.8918, Myeloid 0.2498, Normal Epithelial 0.7269, PVL 0.5390, Plasmablasts 0.8373, and T-cells 0.4715. The focus PCC for the three key cell types—Myeloid, PVL, and T-cells—was 0.4201. These results indicate that the method of this invention can accurately predict the abundance of different cell types and achieve high correlations across multiple cell types.
[0185] like Figure 4 As shown, this embodiment also includes a spatial transcriptome cell abundance prediction system for implementing the above-described spatial transcriptome cell abundance prediction method. This system includes:
[0186] The gene map construction module is used to perform key gene set construction and two-dimensional gene topology map generation;
[0187] The sample mapping module is used to map source domain pseudospace samples and target domain real space transcriptome samples into two-dimensional structured expression images;
[0188] The context prior building module is used to construct spatial organization domain context prior vectors;
[0189] The prediction network module includes a visual feature extraction module, a spatial context gating fusion module, a cell abundance prediction head, and a domain discrimination branch;
[0190] The training module is used to perform cross-domain adaptive training, target domain pseudo-label self-training, and a two-stage training strategy.
[0191] The prediction output module is used to output the abundance ratio of each cell type for the sample to be predicted.
[0192] The above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Therefore, any changes made in accordance with the shape and principle of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for predicting the spatial transcriptome cell abundance, characterized in that, Includes the following steps: S1. Gene alignment is performed between single-cell transcriptome data and spatial transcriptome data to construct a key gene set, and a two-dimensional gene topology map is generated based on the expression correlation between genes in the key gene set. S2. Based on the two-dimensional gene topology map, the expression of pseudo-space samples and real space transcriptome samples constructed from single-cell transcriptome data are respectively mapped into two-dimensional structured expression images, wherein the pseudo-space samples are labeled with cell abundance and used as source domain training samples, and the real space transcriptome samples are used as target domain training samples. S3. Cluster the real spatial transcriptome samples to obtain multiple spatial organization domains, and extract the context prior vector of each spatial organization domain. S4. Construct a cell abundance prediction model, which includes a visual feature extraction module, a spatial context-gated fusion module, a cell abundance prediction head, and a domain discrimination branch. The two-dimensional structured representation image is input into the visual feature extraction module to obtain a visual principal feature vector. The visual principal feature vector and the context prior vector are input into the spatial context-gated fusion module for gated fusion to obtain a fused feature. The fused feature is then input into the cell abundance prediction head to output the cell abundance prediction result. Simultaneously, the visual principal feature vector is fed into the domain discrimination branch through a gradient inversion layer to determine whether the visual principal feature vector originates from the source domain or the target domain. S5. Using the source domain training samples and their cell abundance labels, and the target domain training samples, the cell abundance prediction model is trained by combining a composite loss function and a two-stage training strategy: the first stage combines the source domain supervision loss, the domain adversarial loss and the target domain pseudo-label consistency loss to perform cross-domain feature alignment; the second stage removes or weakens the domain adversarial loss and performs fine-tuning of the main task with a small learning rate, thereby reducing the distribution offset between the source domain and the target domain. S6. Construct a two-dimensional structured expression image of the spatial transcriptome sample to be predicted according to the gene alignment, mapping and preprocessing method consistent with the training stage, and obtain its context prior vector. Input the trained cell abundance prediction model, and output the abundance ratio of each cell type in the spatial transcriptome sample to be predicted.
2. The spatial transcriptome cell abundance prediction method according to claim 1, characterized in that, The gene alignment in step S1 includes: screening for common genes between the single-cell transcriptome data and the spatial transcriptome data; screening for highly variable genes within the common gene range to obtain a candidate gene set; and incorporating lineage anchoring genes related to lymphocytes, myeloid cells, stromal cells, and epithelial cells into the candidate gene set to obtain the key gene set.
3. The spatial transcriptome cell abundance prediction method according to claim 1, characterized in that, In step S1, generating a two-dimensional gene topology map includes: Based on the single-cell transcriptome data, a gene expression correlation coefficient matrix was constructed, and then... Calculate gene topological distance, where For the first The gene and the first The absolute value of the correlation coefficient between the expression of each gene; Two-dimensional dimensionality reduction embedding is performed on the gene topological distances to obtain two-dimensional continuous coordinates for each gene; a functional partition bias is applied to the anchored genes, and the resulting coordinates are... : ; ; in, For two-dimensional embedding positions; To anchor the center of the functional region to which the gene belongs; These are the weighting coefficients; The biased two-dimensional continuous coordinates are discretized into a fixed-size two-dimensional grid to form a two-dimensional gene topology map with one gene and one location and no overlap. For genes mapped to the same discrete location, a neighborhood search is used to allocate the nearest available vacancy.
4. The spatial transcriptome cell abundance prediction method according to claim 3, characterized in that, Step S2 includes: According to the expression of the sample Perform normalization and logarithmic transformation, where For the first The expression value of each gene, To normalize the total amount, To prevent constants with zero denominators, the transformed expression values are written into the pixel positions corresponding to the two-dimensional gene topology map to construct a two-dimensional structured expression image.
5. The spatial transcriptome cell abundance prediction method according to claim 1, characterized in that, Step S3 includes: After normalizing and logarithmically transforming the spatial transcriptome expression matrix of real spatial transcriptome samples, dimensionality reduction and graph clustering were performed to obtain... A spatial organization domain; The number is calculated using the following formula. The central representation vector of each spatial organization domain: ; in, This refers to the set of spatial sites contained within the corresponding spatial organization domain; For the first The expression vector of each spatial location; The central expression vector Encoded as fixed-dimensional context prior vectors .
6. The spatial transcriptome cell abundance prediction method according to claim 1, characterized in that, In step S4, the visual main feature vector and the context prior vector are input into the spatial context gating fusion module for gating fusion to obtain fused features, including: context prior vector Input the context encoder to obtain the context representation. , Indicates the context encoding function; Combining visual principal feature vectors With context representation Generate context-gated vectors : ; [⋅;⋅] indicates vector concatenation; This represents the Sigmoid activation function; and Indicates the gating parameters; Contextual features after production gating : ; ⊙ represents element-wise multiplication; Generate fusion features : 。 7. The spatial transcriptome cell abundance prediction method according to claim 6, characterized in that, In step S4, the fused features are... Input a cell abundance prediction header, and output the log probability distribution of each cell type: ; This represents the cell abundance prediction head mapping; Indicates the predicted cell abundance ratio; The cell abundance prediction head output is normalized using LogSoftmax, resulting in: ; This ensures that the output can be directly interpreted as the proportion of multiple cell types, where c is the cell type index. This represents the total number of cell types.
8. The spatial transcriptome cell abundance prediction method according to claim 1, characterized in that, In step S5, the construction process of the composite loss function includes: Constructing KL divergence loss : Let the true label of the source domain sample be... The predicted cell abundance ratio vector is The KL divergence loss is then expressed as: ; c is the cell type index. Total number of cell types; Constructing Pearson related loss : Let the predicted value vector of the c-th type of cells in a batch be . The true value vector is Then the Pearson correlation coefficient Represented as: ; To prevent constants with a denominator of zero; Then the Pearson related loss is : ; Constructing the log-mean squared error loss: Let the predicted proportion and the actual proportion be respectively and Then the logarithmic mean square error loss is: ; Constructing domain-adversarial losses: Let the label of the source domain training samples be 0, and the label of the target domain training samples be 1. The outputs of the domain discriminator are respectively and The domain adversarial loss is: ; Constructing pseudo-label consistency loss: Let the distribution of the filtered and saved pseudo-labels be... The current model predicts the distribution as follows: Then the pseudo-label consistency loss is: ; Finally, the composite loss function is obtained: ; The weights are Pearson correlation loss values; The weights are the log-mean squared error loss. Loss weights for domain adversarial; The weights for consistency loss due to pseudo-labels.
9. The spatial transcriptome cell abundance prediction method according to claim 1, characterized in that, In the two-stage training strategy: the first stage is based on the training progress. Gradually increase the gradient reversal strength And the weights of domain adversarial loss and pseudo-label consistency loss, among which For the current training round, The total number of training rounds is 1; the second phase removes or reduces the influence of domain adversarial branches, focusing on optimizing KL divergence loss, Pearson correlation loss, and log-mean squared error loss using the learning rate.
10. A spatial transcriptome cell abundance prediction system, used to implement the spatial transcriptome cell abundance prediction method according to any one of claims 1-9, characterized in that, include: The gene map construction module is used to perform key gene set construction and two-dimensional gene topology map generation; The sample mapping module is used to map source domain pseudospace samples and target domain real space transcriptome samples into two-dimensional structured expression images; The context prior building module is used to construct spatial organization domain context prior vectors; The prediction network module includes a visual feature extraction module, a spatial context gating fusion module, a cell abundance prediction head, and a domain discrimination branch; The training module is used to perform cross-domain adaptive training, target domain pseudo-label self-training, and a two-stage training strategy. The prediction output module is used to output the abundance ratio of each cell type for the sample to be predicted.
