Spatial transcriptome cell type identification and annotation method based on dimension reduction and sampling reduction
By using dimensionality reduction and downsampling methods, single-cell transcriptome data are clustered into metacells, and spatial transcriptome cell types are identified hierarchically. The multilayer perceptron model solves the problems of high computational cost and low accuracy in existing technologies, achieving efficient and accurate cell type annotation.
Patent Information
- Application Number
- CN202511095313.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-11-14
AI Technical Summary
In existing spatial transcriptome data analysis, the sparse matrix of single-cell transcriptome data leads to huge computational costs and collinearity, which affects the accuracy of analysis results. Furthermore, the lack of spatial information in single-cell data results in inaccurate cell type annotation.
By using dimensionality reduction and downsampling methods, single-cell transcriptome data are clustered into metacells, spatial transcriptome cell types are identified hierarchically, and a multilayer perceptron model is used for prediction, reducing computational load and improving accuracy.
It significantly reduces the computational load of the analysis process, improves the accuracy and stability of spatial transcriptome cell type annotation, and adapts to the nonlinear structure of the data.
Smart Images

Figure CN120954521A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of bioinformatics analysis technology, and in particular to a spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling. Background Technology
[0002] With continuous innovation in transcriptome experimental and analytical techniques, spatial transcriptomics technology has been developed and widely adopted. As a cutting-edge technology combining spatial and gene expression information, it can resolve the spatial distribution patterns of gene expression on tissue sections. This technology effectively overcomes the limitations of single-cell transcriptomics, which lacks spatial information, allowing scientists to study changes in gene expression within the context of tissue structure. The core of spatial transcriptomics technology lies in fixing tissue sections using specific methods to ensure transcripts are preserved in situ. Then, special spatial positioning markers, such as barcodes and fluorescent probes, are used to capture or label the transcripts, followed by high-throughput sequencing to obtain the transcript sequence information. The spatial barcodes in the sequencing results are used to accurately map gene expression information back to the original tissue location, and finally, bioinformatics analysis is used to reconstruct the spatial gene expression map. These technologies have shown broad application prospects in various fields such as tumor microenvironment research, tissue development and regeneration research, neuroscience research, and immune system research.
[0003] As the foundation for personalized data analysis of spatial transcriptome data, the accuracy of spatial cell type annotation has a significant impact on the reliability of subsequent analysis results. In spatial transcriptomics, the most widely used method is cell type mapping based on single-cell transcriptomes. This involves using algorithms to build a transformation model from fully annotated single-cell transcriptome data of the same species and tissue type, and then using this model to predict cell types at all spatial locations within the spatial transcriptome data. Software examples include Cell2location and RCTD. However, these software programs analyze all cells and all genes, resulting in enormous computational demands. Furthermore, because single-cell data is a sparse matrix, collinearity naturally exists between the expression levels of many genes, which can affect the accuracy of the analysis results. Summary of the Invention
[0004] This application provides a spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling, which at least solves the above-mentioned technical problems existing in the prior art.
[0005] According to a first aspect of this application, a spatial transcriptome cell type identification annotation method based on dimensionality reduction and downsampling is provided, comprising the following steps: S101 provides a spatial transcriptome gene expression matrix and a single-cell transcriptome gene expression matrix annotated with cell types; the cell types include two levels, the first level being cell categories and the second level being cell subtypes; S102, the single-cell transcriptome gene expression matrix is split according to cell subtype, cells of the same cell subtype are clustered and a metacell gene expression matrix is generated; S103 identifies the major cell class at each spatial site in the spatial transcriptome marker gene expression matrix; S104 identifies the cell subtype at each spatial site in the spatial transcriptome marker gene expression matrix under each cell class.
[0006] In some embodiments of the first aspect of this application, in step S101, spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix are filtered.
[0007] In some embodiments of the first aspect of this application, the method for filtering spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix is as follows: S1011, calculate the gene expression ratio for each gene using the following formula:
[0008] in For genes The proportion of gene expression, To express genes Number of spatial sites This represents the total number of spatial sites. S1012, if gene If the gene expression rate is lower than a set first threshold, then the gene will be... It was identified as a gene with low spatial expression. S1013, delete spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix.
[0009] In some embodiments of the first aspect of this application, in step S102, the method for splitting the single-cell transcriptome gene expression matrix according to cell subtype, clustering cells of the same cell subtype, and generating a meta-cell gene expression matrix is as follows: S1021. Select single-cell transcriptome data belonging to the same cell subtype from the single-cell transcriptome gene expression matrix, and perform normalization, standardization, high-variance gene calculation, and PCA dimensionality reduction to obtain the cell-PCA dimensionality reduction matrix. S1022, based on the cell-PCA dimensionality reduction matrix, calculates the k most similar cells for each cell; S1023, Generate the metacell gene expression matrix, set the expected number of metacells N; randomly select N cells in the cell-PCA dimensionality reduction matrix; for each of the N cells, merge the original gene expression matrix of each cell with the original gene expression matrix of the k most similar cells and calculate the average expression level of each gene to obtain the corresponding metacell gene expression matrix. S1024, repeat S1021 to S1023 for each cell subtype, that is, N metacellular gene expression matrices can be obtained for each cell subtype.
[0010] In some embodiments of the first aspect of this application, in S1022, the method for calculating the k most similar cells for each cell is as follows: Calculate the Euclidean distance between each cell in the cell-PCA dimensionality reduction matrix. Based on the Euclidean distance between cells, use the k-means algorithm to cluster the cells into several classes. For each cell, use the k nearest neighbor algorithm to calculate the k cells with the smallest Euclidean distance to that cell, and take them as the k most similar cells to that cell.
[0011] In some embodiments of the first aspect of this application, the method for identifying the cell class of each spatial site in the spatial transcriptome marker gene expression matrix in step S103 is as follows: S1031, calculate the marker genes for each cell class in the metacellular gene expression matrix, and remove non-marker genes from the spatial transcriptome gene expression matrix to obtain the spatial transcriptome class marker gene expression matrix, and remove non-marker genes from the metacellular gene expression matrix to obtain the metacellular class marker gene expression matrix. S1032, the dimensionality reduction of the metacellular class marker gene expression matrix and the spatial transcriptome class marker gene expression matrix is performed respectively to obtain the metacellular class dimensionality reduction matrix and the spatial class dimensionality reduction matrix; S1033 uses cells as samples and the cell categories corresponding to the cells as classification information. A cell category prediction model is established using a multilayer perceptron and trained using the metacell category dimensionality reduction matrix as the training set. S1034, using the spatial category dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell category prediction score for each spatial site, and take the cell category with the highest score as the cell category annotation for that spatial site.
[0012] In some embodiments of the first aspect of this application, in S1031, the method for calculating the marker genes of each cell class in the metacellular gene expression matrix is as follows: S10311, normalize the metacellular gene expression matrix; S10312, using the FindAllMarkers function and Wilcox difference test method of Seurat software, calculate the significance level and logarithmic fold change of each gene in each cell class in the normalized metacellular gene expression matrix; within each cell class, sort the genes by significance level from smallest to largest, and for genes with the same significance level, sort them by logarithmic fold change from largest to smallest; retain only the first number of marker genes in each cell class, thus obtaining the marker genes of each cell class.
[0013] In some embodiments of the first aspect of this application, the method for dimensionality reduction of the metacellular major class marker gene expression matrix and the spatial transcriptome major class marker gene expression matrix in step S1032 is as follows: Construct the PCA projection matrix; The dimensionality reduction matrix of the metacellular class is obtained by multiplying the expression matrix of the metacellular class marker genes with the PCA projection matrix; The spatial class dimension reduction matrix is obtained by multiplying the expression matrix of spatial transcriptome class marker genes with the PCA projection matrix.
[0014] In some embodiments of the first aspect of this application, the PCA projection matrix retains only the first 100 PCs.
[0015] In some embodiments of the first aspect of this application, the method for identifying the cell subtype of each spatial site in the spatial transcriptome marker gene expression matrix under each cell class in step S104 is as follows: S1041, Select cells and spatial sites of the same cell class in the metacellular gene expression matrix and spatial transcriptome gene expression matrix, and calculate the marker genes of each cell subtype under the cell class. Delete non-marker genes from the spatial transcriptome gene expression matrix of the cell class to obtain the spatial transcriptome subtype marker gene expression matrix. Delete non-marker genes from the metacellular gene expression matrix of the cell class to obtain the metacellular subtype marker gene expression matrix. S1042, the dimensionality of the metacellular subtype marker gene expression matrix and the spatial transcriptome subtype marker gene expression matrix is reduced respectively to obtain the metacellular subtype dimensionality reduction matrix and the spatial subtype dimensionality reduction matrix; S1043 uses cells as samples and cell subtypes corresponding to cells as classification information. A cell subtype prediction model is established using a multilayer perceptron and trained using the metacell subtype dimensionality reduction matrix as the training set. S1044, using the spatial subtype dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell subtype prediction score for each spatial site, and take the cell subtype with the highest score as the cell subtype annotation for that spatial site. S1045, for all cell categories, annotate the cell subtypes of all spatial sites under each cell category one by one, following the steps from S1041 to S1044. According to a second aspect of this application, a spatial transcriptome cell type identification annotation system based on dimensionality reduction and downsampling is provided, comprising: The data providing module provides a spatial transcriptome gene expression matrix and a single-cell transcriptome gene expression matrix annotated with cell types; the cell types include two levels, the first level being cell major categories and the second level being cell subtypes; The clustering module splits the single-cell transcriptome gene expression matrix according to cell subtypes, clusters cells of the same cell subtype, and generates a metacell gene expression matrix. The first identification module identifies the major cell class at each spatial site in the spatial transcriptome marker gene expression matrix; The second identification module identifies the cell subtype at each spatial site in the spatial transcriptome marker gene expression matrix under each major cell category.
[0016] In some embodiments of the second aspect of this application, the data providing module filters spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix.
[0017] In some embodiments of the second aspect of this application, the method for filtering spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix is as follows: The gene expression ratio of each gene is calculated using the following formula:
[0018] in For genes The proportion of gene expression, To express genes Number of spatial sites This represents the total number of spatial sites. If genes If the gene expression rate is lower than a set first threshold, then the gene will be... It was identified as a gene with low spatial expression. Deleting spatially low-expression genes from the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix.
[0019] In some embodiments of the second aspect of this application, the clustering module splits the single-cell transcriptome gene expression matrix according to cell subtypes, clusters cells of the same cell subtype, and generates a meta-cell gene expression matrix as follows: Single-cell transcriptome data belonging to the same cell subtype were selected from the single-cell transcriptome gene expression matrix, and normalization, standardization, high-variance gene calculation, and PCA dimensionality reduction were performed to obtain the cell-PCA dimensionality reduction matrix. Based on the cell-PCA dimensionality reduction matrix, calculate the k most similar cells for each cell; Generate a metacell gene expression matrix and set the expected number of metacells N; randomly select N cells from the cell-PCA dimensionality reduction matrix; for each of the N cells, merge the original gene expression matrix of each cell with the original gene expression matrix of the k most similar cells and calculate the average expression level of each gene to obtain the corresponding metacell gene expression matrix. The above method is repeated for each cell subtype, that is, N metacellular gene expression matrices can be obtained for each cell subtype.
[0020] In some embodiments of the second aspect of this application, the method for calculating the k most similar cells for each cell is as follows: Calculate the Euclidean distance between each cell in the cell-PCA dimensionality reduction matrix. Based on the Euclidean distance between cells, use the k-means algorithm to cluster the cells into several classes. For each cell, use the k nearest neighbor algorithm to calculate the k cells with the smallest Euclidean distance to that cell, and take them as the k most similar cells to that cell.
[0021] In some embodiments of the second aspect of this application, the method for identifying the cell class of each spatial site in the spatial transcriptome marker gene expression matrix in the first identification module is as follows: The marker genes for each cell class in the metacellular gene expression matrix are calculated, and non-marker genes are removed from the spatial transcriptome gene expression matrix to obtain the spatial transcriptome marker gene expression matrix. Non-marker genes are then removed from the metacellular gene expression matrix to obtain the metacellular marker gene expression matrix. The dimensionality reduction of the metacellular class marker gene expression matrix and the spatial transcriptome class marker gene expression matrix were performed respectively to obtain the metacellular class dimensionality reduction matrix and the spatial class dimensionality reduction matrix. Using cells as samples and the cell categories corresponding to the cells as classification information, a cell category prediction model is established using a multilayer perceptron, and the metacell category dimensionality reduction matrix is used as the training set for training. Using the spatial category dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell category prediction score for each spatial site, and take the cell category with the highest score as the cell category annotation for that spatial site.
[0022] In some embodiments of the second aspect of this application, the method for calculating the marker genes for each cell class in the metacellular gene expression matrix is as follows: The metacellular gene expression matrix was normalized. The significance level and logarithmic fold change of each gene in each cell class were calculated using the FindAllMarkers function and Wilcox difference test in the Seurat software. Within each cell class, genes were sorted from smallest to largest significance level. For genes with the same significance level, they were sorted from largest to smallest logarithmic fold change. Only the top number of marker genes for each cell class were retained, thus obtaining the marker genes for each cell class.
[0023] In some embodiments of the second aspect of this application, the method for identifying the cell subtype of each spatial site in the spatial transcriptome marker gene expression matrix under each cell class in the second identification module is as follows: Cells and spatial loci of the same cell class are selected from the metacellular gene expression matrix and the spatial transcriptome gene expression matrix, and the marker genes of each cell subtype under the cell class are calculated. Non-marker genes are deleted from the spatial transcriptome gene expression matrix of the cell class to obtain the spatial transcriptome subtype marker gene expression matrix. Non-marker genes are deleted from the metacellular gene expression matrix of the cell class to obtain the metacellular subtype marker gene expression matrix. The dimensionality reduction of the metacellular subtype marker gene expression matrix and the spatial transcriptome subtype marker gene expression matrix were performed to obtain the metacellular subtype dimensionality reduction matrix and the spatial subtype dimensionality reduction matrix, respectively. Using cells as samples and cell subtypes as classification information, a cell subtype prediction model is established using a multilayer perceptron, and trained using a metacell subtype dimensionality reduction matrix as the training set. Using the spatial subtype dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell subtype prediction score for each spatial site, and take the cell subtype with the highest score as the cell subtype annotation for that spatial site. For all cell categories, annotate the cell subtypes at all spatial sites within each cell category following the steps described above.
[0024] Compared with the prior art, this application has the following advantages: This application uses meta-cellular processing to cluster and merge sparse single-cell transcriptome data into a dense meta-cellular gene expression matrix. By dividing cell types into two levels—cell major categories and cell subtypes—it reduces feature interference from similar cell types and amplifies differences between similar cell types. A predictive model is then established to sequentially identify the annotation results of cell major categories and subtypes at each spatial location, improving the adaptability to the nonlinear structure of the data. Therefore, compared with existing technologies, the technical solution provided in this application significantly reduces the computational load of the analysis process, improves analysis efficiency, and increases the accuracy and stability of annotation.
[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0026] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of this application are illustrated in the drawings by way of example and not limitation, in which: In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
[0027] Figure 1 A flowchart illustrating the overall method of Embodiment 1 of this application is shown.
[0028] Figure 2 The results of cell class annotation for each spatial site of the spatial transcriptome in Embodiment 1 of this application are shown.
[0029] Figure 3 The results of cellular subtype annotation for each spatial site of the spatial transcriptome in Embodiment 1 of this application are shown.
[0030] Figure 4 A system structure diagram of Embodiment 2 of this application is shown. Detailed Implementation
[0031] To make the objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0032] Example 1: This embodiment provides a spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling. Please refer to... Figure 1 This includes the following steps: S101 provides a spatial transcriptome gene expression matrix as shown in Table 1 and a single-cell transcriptome gene expression matrix annotated with cell types as shown in Table 2; the cell types include two levels, the first level being cell major categories and the second level being cell subtypes.
[0033] As shown in Table 3, the major cell categories include: epithelial cells, stromal cells, immune cells, stem cells, etc. Each major cell category is further subdivided into at least one cell subtype. For example, fibroblasts and mesothelial cells belong to the stromal cell category, while B cells, NKT cells, and myeloid cells belong to the immune cell category.
[0034] Table 1: Gene expression matrix of the original spatial transcriptome
[0035] Table 2: Gene expression matrix of single-cell transcriptome annotated with cell type
[0036] Table 3: Correspondence between cell categories and cell subtypes
[0037] In both spatial transcriptome gene expression matrices and single-cell transcriptome gene expression matrices, there are a certain number of spatially low-expressed genes. These spatially low-expressed genes increase the data dimensionality (e.g., too many genes), leading to a surge in computational load (e.g., cluster analysis, machine learning model training) and reducing analysis efficiency.
[0038] Therefore, to improve analysis efficiency, in step S101, the spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix are statistically analyzed and filtered; this includes the following steps: S1011, calculate the spatial expression ratio of each gene in the spatial transcriptome gene expression matrix using the following formula;
[0039] in For genes The proportion of gene expression, To express genes Number of spatial sites This represents the total number of spatial sites. S1012, if gene If the gene expression rate is lower than a set first threshold, then the gene will be... Genes are identified as having low spatial expression; the first proportion threshold can be 0.5%, 1%, or 2%, preferably 1%.
[0040] S1013, delete spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix, as shown in Tables 1 and 2. Mark the spatially low-expression genes and delete the corresponding row data to obtain the gene expression matrix as shown in Tables 4 and 5.
[0041] Table 4: Spatial transcriptome gene expression matrix after filtering out spatially low-expression genes
[0042] Table 5: Gene expression matrix of single-cell transcriptomes after filtering out spatially low-expression genes.
[0043] S102, the single-cell transcriptome gene expression matrix is split according to cell subtype, cells of the same cell subtype are clustered and a meta-cell gene expression matrix is generated.
[0044] The specific implementation method of S102 is as follows: S1021. Select single-cell transcriptome data belonging to the same cell subtype (such as NKT cells) from the single-cell transcriptome gene expression matrix, and use the NormalizeData, FindVariableFeatures, ScaleData, and RunPCA functions of the Seurat software to perform normalization, standardization, high-variable gene calculation, and PCA dimensionality reduction processing to obtain the cell-PCA dimensionality reduction matrix shown in Table 6.
[0045] The core of feature reduction is to reduce the number of features while preserving the key information of the data to the greatest extent, thereby improving the efficiency and generalization ability of the model. PCA (Principal Component Analysis) is an unsupervised feature reduction method that projects high-dimensional data into a low-dimensional orthogonal space (principal components, i.e., PCs) through linear transformation, preserving the maximum variance information. Its core is the eigenvalue decomposition of the covariance matrix, achieving data compression by selecting the top few principal components (those with the largest contribution). The PCA algorithm itself has advantages such as noise removal, reduction of redundant features, mitigation of the curse of dimensionality, and elimination of correlations between features.
[0046] Table 6: Cell-PCA Dimensionality Reduction Matrix (NKT Cells)
[0047] S1022, based on the cell-PCA dimensionality reduction matrix, calculates the k most similar cells for each cell.
[0048] The method for calculating the k most similar cells for each cell is as follows: Calculate the Euclidean distance between each cell in the cell-PCA dimensionality reduction matrix. Based on the Euclidean distance, use the k-means algorithm to cluster the cells into several classes. The number of clusters can be 5, 10, or 20, preferably 10. For each cell, use the k-nearest neighbor algorithm (KNN) to calculate the k cells with the smallest Euclidean distance to that cell (the smaller the Euclidean distance, the more similar the cells). These k cells are considered the k most similar cells for that cell. k is a hyperparameter that can be adjusted according to the number of cells and is set to any integer greater than 1, typically 25.
[0049] S1023, Generate the metacell gene expression matrix and set the expected number of metacells N; the number of metacells N ranges from 100 to 1000, and is 1% of the number of cells for this classification label; however, when the number of cells for this classification label is less than 10,000, N is set to 100; when the number of cells for this cell type is greater than 100,000, N is set to 1000.
[0050] N cells are randomly selected from the cell-PCA dimensionality reduction matrix (these N cells are non-overlapping and must be distributed in all 10 k-means clusters obtained in step S1022). For these N cells, the original gene expression matrices of each cell are merged with the original gene expression matrices of its k most similar cells to obtain the gene expression matrix shown in Table 7, and the average expression level of each gene is calculated to obtain the metacellular gene expression matrix shown in Table 8.
[0051] Table 7: Gene expression matrix of randomly selected cells and their k most similar cells
[0052] Table 8: Metacellular gene expression matrix
[0053] As shown in Table 9, N cells generate N metacellular gene expression counting matrices.
[0054] Table 9: Gene Expression Matrix of N Metacellular Cells
[0055] S1024. Repeat S1021 to S1023 for each cell subtype. That is, N metacellular gene expression matrices can be obtained for each cell subtype. After merging, the metacellular gene expression matrices of all cell subtypes are shown in Table 10.
[0056] Table 10: Metacytic gene expression matrix for all cell subtypes
[0057] S103 identifies the major cell classes at each spatial site in the spatial transcriptome marker gene expression matrix.
[0058] The specific methods for identification are as follows: S1031, calculate the marker genes for each cell class in the metacellular gene expression matrix, and remove non-marker genes from the spatial transcriptome gene expression matrix to obtain the spatial transcriptome class marker gene expression matrix. Remove non-marker genes from the metacellular gene expression matrix to obtain the metacellular class marker gene expression matrix.
[0059] The method for calculating the marker genes for each cell class in the metacellular gene expression matrix is as follows: S10311, normalizes the metacellular gene expression matrix and the spatial transcriptome gene expression matrix.
[0060] The normalization method is illustrated using the metacellular gene expression matrix as an example: The expression level of each gene on each blast cell was normalized using the following formula:
[0061] in, This represents the expression level after gene normalization. Counting the expression of a single gene in a single cellular unit cell. This represents the sum of expression counts for all genes in a single blastomere. The normalized blastomere gene expression matrix is shown in Table 11. Similarly, the normalized spatial transcriptome gene expression matrix is shown in Table 12.
[0062] Table 11: Normalized cellular gene expression matrix
[0063] Table 12: Normalized spatial transcriptome gene expression matrix
[0064] S10312, Calculate the marker genes for each cell class based on the normalized metacellular gene expression matrix. Use the FindAllMarkers function and Wilcox difference test in the Seurat software to calculate the avg_log2FC (fold change after log2 processing) and p-value (i.e., significance level) for each gene in each cell class within the normalized metacellular gene expression matrix. Essentially, this involves performing a Wilcox rank-sum test on the genes of each metacellular cell class against the genes of the remaining metacellular cells in other cell classes to obtain genes specifically highly expressed in each cell class. Within each cell class, genes are sorted by p-value from smallest to largest; for genes with the same p-value, they are sorted by avg_log2FC from largest to smallest. As shown in Table 13, only the top 50 marker genes for each cell class are retained (the number of retained marker genes can be set manually), thus obtaining the marker genes for each cell class. The marker genes of all cell classes are then merged into a cell class marker gene set.
[0065] Table 13: Set of the top 50 marker genes for major cell classes
[0066] Finally, by deleting non-marker genes from the spatial transcriptome gene expression matrix, we obtained the spatial transcriptome major class marker gene expression matrix as shown in Table 14. By deleting non-marker genes from the metacellular gene expression matrix, we obtained the metacellular major class marker gene expression matrix as shown in Table 15.
[0067] Table 14: Spatial Transcriptome Major Class Marker Gene Expression Matrix
[0068] Table 15: Expression Matrix of Marker Genes in Mesenchymal Classes
[0069] S1032, the dimensionality reduction of the metacellular class marker gene expression matrix and the spatial transcriptome class marker gene expression matrix is performed respectively to obtain the metacellular class dimensionality reduction matrix and the spatial class dimensionality reduction matrix.
[0070] It is worth mentioning that the methods for dimensionality reduction of the metacellular major class marker gene expression matrix and the spatial transcriptome major class marker gene expression matrix are as follows: Constructing the PCA projection matrix ; Based on the expression matrix of marker genes of the metacellular class With PCA projection matrix The multiplication yields the dimensionality reduction matrix of the metacellular class as shown in Table 16. ;Right now The PCA projection matrix retains only the first 100 PCs.
[0071] Table 16: Dimensionality Reduction Matrix of Metacellular Categories
[0072] Similarly, the spatial class dimension reduction matrix is obtained by multiplying the spatial transcriptome class marker gene expression matrix with the PCA projection matrix, as shown in Table 17.
[0073] Table 17: Spatial Category Dimensionality Reduction Matrix
[0074] S1033 uses cells as samples and the corresponding cell categories as classification information. A cell category prediction model is established using a multilayer perceptron. Since the multilayer perceptron has high nonlinearity, it has a high adaptability to the nonlinear structure of biological data. The model is trained using the metacell category dimensionality reduction matrix as the training set.
[0075] S1034, using the spatial category dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell category prediction score for each spatial site. The calculation results are shown in Table 18.
[0076] Table 18: Predicted scores for major cell categories
[0077] Finally, as shown in Table 19 and Figure 2 As shown, the cell class with the highest score is taken as the cell class annotation for that spatial location.
[0078] Table 19: Cell category annotation results for each spatial site in the spatial transcriptome data
[0079] S104 identifies the cell subtype at each spatial site in the spatial transcriptome marker gene expression matrix under each cell class.
[0080] The specific method is as follows: S1041, select cells and spatial loci of the same cell class from the metacellular gene expression matrix and the spatial transcriptome gene expression matrix. Then, referring to the method in S1031, calculate the marker genes for each cell subtype under this cell class. Remove non-marker genes from the spatial transcriptome gene expression matrix of this cell class to obtain the spatial transcriptome subtype marker gene expression matrix as shown in Table 20. Remove non-marker genes from the metacellular gene expression matrix of this cell class to obtain the metacellular subtype marker gene expression matrix as shown in Table 21.
[0081] Table 20: Expression matrix of spatial transcriptomic subtype marker genes
[0082] Table 21: Expression matrix of marker genes for metacytic subtypes
[0083] S1042, the dimensionality reduction of the metacellular subtype marker gene expression matrix and the spatial transcriptome subtype marker gene expression matrix is performed respectively to obtain the metacellular subtype dimensionality reduction matrix and the spatial subtype dimensionality reduction matrix. For specific methods, please refer to S1032, and will not be repeated here.
[0084] S1043 uses cells as samples and cell subtypes corresponding to cells as classification information. A cell subtype prediction model is established using a multilayer perceptron and trained using the metacell subtype dimensionality reduction matrix as the training set. S1044, using the spatial subtype dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell subtype prediction score for each spatial site, and take the cell subtype with the highest score as the cell subtype annotation for that spatial site. S1055, for all cell classes, annotate the cell subtypes at all spatial sites within each cell class, following steps S1041 to S1044. Please refer to Table 22 for the annotation results. Figure 3 .
[0085] Table 22: Cell subtype annotation results for each spatial site in the spatial transcriptome data
[0086] Example 2: This second embodiment provides a spatial transcriptome cell type identification and annotation system based on dimensionality reduction and downsampling. Please refer to... Figure 4 It includes a data provision module, a clustering module, a first identification module, and a second identification module.
[0087] The data providing module provides a spatial transcriptome gene expression matrix and a single-cell transcriptome gene expression matrix annotated with cell types; the cell types include two levels, the first level being cell major categories and the second level being cell subtypes.
[0088] Simultaneously, spatially low-expression genes in the spatial transcriptome gene expression matrix and single-cell transcriptome gene expression matrix are filtered out.
[0089] The method for filtering spatially low-expression genes in spatial transcriptome gene expression matrices and single-cell transcriptome gene expression matrices is as follows: The gene expression ratio of each gene is calculated using the following formula:
[0090] in For genes The proportion of gene expression, To express genes Number of spatial sites This represents the total number of spatial sites. If genes If the gene expression rate is lower than a set first threshold, then the gene will be... It was identified as a gene with low spatial expression. Deleting spatially low-expression genes from the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix.
[0091] The clustering module splits the single-cell transcriptome gene expression matrix according to cell subtypes, clusters cells of the same cell subtype, and generates a meta-cell gene expression matrix.
[0092] The specific method is as follows: Single-cell transcriptome data belonging to the same cell subtype were selected from the single-cell transcriptome gene expression matrix, and normalization, standardization, high-variance gene calculation, and PCA dimensionality reduction were performed to obtain the cell-PCA dimensionality reduction matrix. Based on the cell-PCA dimensionality reduction matrix, calculate the k most similar cells for each cell; The method for calculating the k most similar cells for each cell is as follows: Calculate the Euclidean distance between each cell in the cell-PCA dimensionality reduction matrix. Based on the Euclidean distance between cells, use the k-means algorithm to cluster the cells into several classes. For each cell, use the k nearest neighbor algorithm to calculate the k cells with the smallest Euclidean distance to that cell, and take them as the k most similar cells to that cell.
[0093] Generate a metacell gene expression matrix and set the expected number of metacells N; randomly select N cells from the cell-PCA dimensionality reduction matrix; for each of the N cells, merge the original gene expression matrix of each cell with the original gene expression matrix of the k most similar cells and calculate the average expression level of each gene to obtain the corresponding metacell gene expression matrix. The above method is repeated for each cell subtype, that is, N metacellular gene expression matrices can be obtained for each cell subtype.
[0094] The first identification module identifies the major cell class at each spatial locus in the spatial transcriptome marker gene expression matrix. The specific method is as follows: The marker genes for each cell class in the metacellular gene expression matrix are calculated, and non-marker genes are removed from the spatial transcriptome gene expression matrix to obtain the spatial transcriptome marker gene expression matrix. Non-marker genes are then removed from the metacellular gene expression matrix to obtain the metacellular marker gene expression matrix. The method for calculating the marker genes for each cell class in the metacellular gene expression matrix is as follows: The metacellular gene expression matrix was normalized. The significance level and logarithmic fold change of each gene in each cell class were calculated using the FindAllMarkers function and Wilcox difference test in the Seurat software. Within each cell class, genes were sorted from smallest to largest significance level. For genes with the same significance level, they were sorted from largest to smallest logarithmic fold change. Only the top number of marker genes for each cell class were retained, thus obtaining the marker genes for each cell class.
[0095] The dimensionality reduction of the metacellular class marker gene expression matrix and the spatial transcriptome class marker gene expression matrix were performed respectively to obtain the metacellular class dimensionality reduction matrix and the spatial class dimensionality reduction matrix. Using cells as samples and the cell categories corresponding to the cells as classification information, a cell category prediction model is established using a multilayer perceptron, and the metacell category dimensionality reduction matrix is used as the training set for training. Using the spatial category dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell category prediction score for each spatial site, and take the cell category with the highest score as the cell category annotation for that spatial site.
[0096] The second identification module identifies the cell subtype at each spatial locus in the spatial transcriptome marker gene expression matrix within each major cell category. The specific method is as follows: The method for identifying the cell subtype at each spatial locus in the spatial transcriptome marker gene expression matrix under each major cell class is as follows: Cells and spatial loci of the same cell class are selected from the metacellular gene expression matrix and the spatial transcriptome gene expression matrix, and the marker genes of each cell subtype under the cell class are calculated. Non-marker genes are deleted from the spatial transcriptome gene expression matrix of the cell class to obtain the spatial transcriptome subtype marker gene expression matrix. Non-marker genes are deleted from the metacellular gene expression matrix of the cell class to obtain the metacellular subtype marker gene expression matrix. The dimensionality reduction of the metacellular subtype marker gene expression matrix and the spatial transcriptome subtype marker gene expression matrix were performed to obtain the metacellular subtype dimensionality reduction matrix and the spatial subtype dimensionality reduction matrix, respectively. Using cells as samples and cell subtypes as classification information, a cell subtype prediction model is established using a multilayer perceptron, and trained using a metacell subtype dimensionality reduction matrix as the training set. Using the spatial subtype dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell subtype prediction score for each spatial site, and take the cell subtype with the highest score as the cell subtype annotation for that spatial site. For all cell categories, annotate the cell subtypes at all spatial sites within each cell category following the steps described above.
[0097] The methods and working principles mentioned in the above functional modules are described in Example 1, and will not be repeated here.
[0098] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0099] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0100] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling, characterized in that, Includes the following steps: S101 provides a spatial transcriptome gene expression matrix and a single-cell transcriptome gene expression matrix annotated with cell types; the cell types include two levels, the first level being cell categories and the second level being cell subtypes; S102, the single-cell transcriptome gene expression matrix is split according to cell subtype, cells of the same cell subtype are clustered and a metacell gene expression matrix is generated; S103 identifies the major cell class at each spatial site in the spatial transcriptome marker gene expression matrix; S104 identifies the cell subtype at each spatial site in the spatial transcriptome marker gene expression matrix under each cell class.
2. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 1, characterized in that, In step S101, spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix are filtered.
3. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 2, characterized in that, The method for filtering spatially low-expression genes in spatial transcriptome gene expression matrices and single-cell transcriptome gene expression matrices is as follows: S1011, calculate the gene expression ratio for each gene using the following formula: in For genes The proportion of gene expression, To express genes Number of spatial sites This represents the total number of spatial sites. S1012, if gene If the gene expression rate is lower than a set first threshold, then the gene will be... It was identified as a gene with low spatial expression. S1013, delete spatially low-expression genes in the spatial transcriptome gene expression matrix and the single-cell transcriptome gene expression matrix.
4. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 1, characterized in that, In step S102, the method for splitting the single-cell transcriptome gene expression matrix according to cell subtype, clustering cells of the same cell subtype, and generating a meta-cell gene expression matrix is as follows: S1021. Select single-cell transcriptome data belonging to the same cell subtype from the single-cell transcriptome gene expression matrix, and perform normalization, standardization, high-variance gene calculation, and PCA dimensionality reduction to obtain the cell-PCA dimensionality reduction matrix. S1022, based on the cell-PCA dimensionality reduction matrix, calculates the k most similar cells for each cell; S1023, Generate the metacell gene expression matrix, set the expected number of metacells N; randomly select N cells in the cell-PCA dimensionality reduction matrix; for each of the N cells, merge the original gene expression matrix of each cell with the original gene expression matrix of the k most similar cells and calculate the average expression level of each gene to obtain the corresponding metacell gene expression matrix. S1024, repeat S1021 to S1023 for each cell subtype, that is, N metacellular gene expression matrices can be obtained for each cell subtype.
5. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 4, characterized in that, In S1022, the method for calculating the k most similar cells for each cell is as follows: Calculate the Euclidean distance between each cell in the cell-PCA dimensionality reduction matrix. Based on the Euclidean distance between cells, use the k-means algorithm to cluster the cells into several classes. For each cell, use the k nearest neighbor algorithm to calculate the k cells with the smallest Euclidean distance to that cell, and take them as the k most similar cells to that cell.
6. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 1, characterized in that, In S103, the method for identifying the cell class at each spatial site in the spatial transcriptome marker gene expression matrix is as follows: S1031, calculate the marker genes for each cell class in the metacellular gene expression matrix, and remove non-marker genes from the spatial transcriptome gene expression matrix to obtain the spatial transcriptome class marker gene expression matrix, and remove non-marker genes from the metacellular gene expression matrix to obtain the metacellular class marker gene expression matrix. S1032, the dimensionality reduction of the metacellular class marker gene expression matrix and the spatial transcriptome class marker gene expression matrix is performed respectively to obtain the metacellular class dimensionality reduction matrix and the spatial class dimensionality reduction matrix; S1033 uses cells as samples and the cell categories corresponding to the cells as classification information. A cell category prediction model is established using a multilayer perceptron and trained using the metacell category dimensionality reduction matrix as the training set. S1034, using the spatial category dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell category prediction score for each spatial site, and take the cell category with the highest score as the cell category annotation for that spatial site.
7. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 6, characterized in that, In S1031, the method for calculating the marker genes of each cell class in the metacellular gene expression matrix is as follows: S10311, normalize the metacellular gene expression matrix; S10312, using the FindAllMarkers function and Wilcox difference test method of Seurat software, calculate the significance level and logarithmic fold change of each gene in each cell class in the normalized metacellular gene expression matrix; within each cell class, sort the genes by significance level from smallest to largest, and for genes with the same significance level, sort them by logarithmic fold change from largest to smallest; retain only the first number of marker genes in each cell class, thus obtaining the marker genes of each cell class.
8. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 6, characterized in that, In S1032, the method for dimensionality reduction of the metacellular major class marker gene expression matrix and the spatial transcriptome major class marker gene expression matrix is as follows: Construct the PCA projection matrix; The dimensionality reduction matrix of the metacellular class is obtained by multiplying the expression matrix of the metacellular class marker genes with the PCA projection matrix; The spatial class dimension reduction matrix is obtained by multiplying the expression matrix of spatial transcriptome class marker genes with the PCA projection matrix.
9. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 8, characterized in that, The PCA projection matrix retains only the first 100 PCs.
10. The spatial transcriptome cell type identification and annotation method based on dimensionality reduction and downsampling according to claim 1, characterized in that, In S104, the method for identifying the cell subtype at each spatial site in the spatial transcriptome marker gene expression matrix under each cell class is as follows: S1041, Select cells and spatial sites of the same cell class in the metacellular gene expression matrix and spatial transcriptome gene expression matrix, and calculate the marker genes of each cell subtype under the cell class. Delete non-marker genes from the spatial transcriptome gene expression matrix of the cell class to obtain the spatial transcriptome subtype marker gene expression matrix. Delete non-marker genes from the metacellular gene expression matrix of the cell class to obtain the metacellular subtype marker gene expression matrix. S1042, the dimensionality of the metacellular subtype marker gene expression matrix and the spatial transcriptome subtype marker gene expression matrix is reduced respectively to obtain the metacellular subtype dimensionality reduction matrix and the spatial subtype dimensionality reduction matrix; S1043 uses cells as samples and cell subtypes corresponding to cells as classification information. A cell subtype prediction model is established using a multilayer perceptron and trained using the metacell subtype dimensionality reduction matrix as the training set. S1044, using the spatial subtype dimensionality reduction matrix as input data and spatial sites as samples, calculate the cell subtype prediction score for each spatial site, and take the cell subtype with the highest score as the cell subtype annotation for that spatial site. S1055, for all cell classes, annotate the cell subtypes of all spatial sites under each cell class one by one according to steps S1041 to S1044.