Method for inferring cell space composition
Through deep learning methods, combining scRNA-seq and spatial transcriptomic data, using semi-supervised graph attention neural networks and random projection forest technology, the limitations of existing methods in dealing with cell spatial composition are solved, and the accuracy of inference results is improved.
Patent Information
- Application Number
- CN202311180921.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-14
- Publication Date
- 2025-03-14
AI Technical Summary
The existing cell spatial composition inference method has limitations in dealing with the relationship between pseudo-ST data and real ST data, and it is difficult to fully capture the topological relationships and spatial correlations between cells, resulting in low accuracy of inference results.
A deep learning-based inference method for cell space composition is proposed. By obtaining matching scRNA-seq and spatial transcriptomics data sets, a deep neural network model is constructed, and the consistency and comparability of pseudo-ST data and ST data are enhanced by using technologies such as semi-supervised graph attention neural network (GAT) and random projection forest (RPForest), the consistency and comparability of pseudo-ST data and ST data are quantified, and the node relationship is performed and global spatial structure analysis is performed.
It improves the accuracy of inference of cell space composition, can better reduce the composition of cell type, is closer to the real situation, and shows stable performance and superior performance in both ordinary environment and pathological environment.
Smart Images

Figure BDA0004447352330000052 
Figure BDA0004447352330000054 
Figure BDA0004447352330000061
Abstract
Description
Technical Field
[0001] The present invention relates to a method for inferring cell space composition, and in particular to a method for inferring cell space composition based on deep learning, which belongs to the field of bioinformatics. Background Art
[0002] The rapid development of high-throughput single-cell sequencing technologies has enabled the study of cellular heterogeneity and gene expression specificity with unprecedented resolution. Advances in spatial transcriptomics (ST) have made it possible to measure gene expression while retaining spatial information, which provides great opportunities to study cellular heterogeneity, cell-cell communication, and interactions with each other in a spatial context. However, there is an inherent limitation in spatial transcriptomic analysis, namely that in most cases, each spot or head covers multiple cells. Even with high-resolution techniques, small parts of several cells can be included in the same spatial barcode region. Therefore, inferring the spatial composition of cells and identifying different cell types at each spot is a key task to understand the spatial context of pathology and physiology using spatially resolved transcriptomics.
[0003] In order to understand the distribution of cell types from spatial transcriptomics, the most common strategy is to combine it with single-cell RNA sequencing (scRNA-seq). The current mainstream method is mainly the deconvolution method, which aims to estimate the exact proportion of cell types at each spatial location by applying regression models, deep learning models, or by fitting probability distributions. Deep learning models usually combine multiple cells together to simulate the composition of real ST data. In this step, the gene expression values of multiple cells are often added as the gene expression of a single sequencing site (spot) to form pseudo ST data to simulate the composition of real ST data.
[0004] However, since the pseudo-ST data and real ST data composed of scRNA-seq are affected by different experimental and technical conditions, such as sequencing depth and batch effects, the inconsistency between the data affects the comparison and overall interpretation of the data. At the same time, the relationship between pseudo-ST data and real ST data is also important. Pseudo-ST data is synthetic data generated by mixing scRNA-seq data from the same tissue, aiming to simulate spatial transcriptomics (ST) data. The generation of pseudo-ST data is to provide a theoretically controllable dataset for evaluating and optimizing the performance of deconvolution methods. The goal of inferring the spatial composition of cells is to restore the cell type composition at different locations (spots) from the real ST data to gain a deeper understanding of the distribution and spatial structure of cell types in tissues. However, traditional simple graph methods have limitations in dealing with the relationship between pseudo-ST data and real ST data. These methods usually use simplified data representations and are difficult to fully capture richer information, such as topological relationships and spatial correlations between cells. Due to the importance of interactions and relative positions between cells in complex biological tissues, these factors play a key role in the identification of cell types and the analysis of spatial distribution, and the traditional simple graph methods used by these methods may not fully consider these key factors. Summary of the invention
[0005] In order to solve the problem that the existing cell spatial composition inference method simply utilizes the relationship between scRNA-seq data and ST data, resulting in low accuracy of the inference results, the present invention further proposes a cell spatial composition inference method.
[0006] It includes the following steps:
[0007] S1. Obtain scRNA-seq and spatial transcriptomics datasets of various tissues and organs. Each spot in spatial transcriptomics is generally composed of multiple single cells due to the sequencing accuracy. Therefore, single-cell resolution scRNA-seq data is the key to analyzing spatial transcriptomics data. At the same time, screen scRNA-seq and spatial transcriptomics datasets from the same tissue and organ. To deconvolve the spatial transcriptomics dataset using pseudo-ST data produced by scRNA-seq, the sources of the two datasets, i.e., the composition of cell types, need to match, so both need to come from the same tissue or organ.
[0008] S2. Obtain the gene expression matrix and metadata of scRNA-seq and ST datasets. The gene expression matrix is a data type obtained based on high-throughput sequencing or gene chip technology. It is used to describe the expression levels of each gene in cells or tissues under different conditions. It is a two-dimensional numerical matrix, in which rows represent genes and columns represent samples. The expression level of a gene in a certain sample is recorded at each element position. Metadata refers to information used to describe various attributes, characteristics and conditions of the research object, among which the single cell type of scRNA-seq is mainly required. Through these two types of information, we can analyze the gene expression of scRNA-seq and spatial transcriptomics, and then derive their relationship. The gene expression matrix of the two data is used to filter the gene expression matrix and extract significant features;
[0009] S3. The gene expression matrix of ST data is the spatial transcriptome sequencing data obtained by ST sequencing technology, which can be used to capture the gene expression of each spot covering a heterogeneous cell mixture. Therefore, the scRNA-seq dataset is used to simulate the cell mixture on each spot to construct synthetic ST data called "pseudo ST";
[0010] S4. In order to enhance the consistency and comparability between the pseudo-ST data and the ST data, the gene expression matrices of the two datasets were integrated into an overall expression matrix;
[0011] S5. The adjacency matrix can be used to represent the connection relationship between nodes in the graph, that is, whether the nodes are adjacent or connected. Random Projection Forest (RPForest), a high-dimensional data indexing algorithm based on random projection, is used to construct a random projection forest based on the feature matrix and perform k-nearest neighbor search (k-NN Search). Finally, a weighted adjacency matrix with a global spatial structure is obtained, which can quantitatively represent the relationship between each node.
[0012] S6. Build a deep neural network model. The deep neural network model adopts a semi-supervised graph attention neural network (GAT) and uses a multi-head attention mechanism to aggregate neighbor nodes. For each attention head, a neighbor node attention coefficient is generated, that is, the importance between a given node and its neighbor nodes. The outputs of these attention heads will be cascaded to form a new node representation vector. Each attention head includes a convolution layer, a weight restriction layer, a softmax layer, and a Dropout layer. The weight restriction layer refers to the multiplication of the attention coefficient obtained after convolution with the weighted adjacency matrix obtained in S4 to restrict the attention coefficient. Before the last attention layer, the outputs of all attention heads in each layer will be concatenated as the input of the next layer, and in the last layer, the outputs of the attention heads will be averaged as the output of the model.
[0013] Take a scRNA-seq sample and a ST sample from a certain tissue as sample S i , based on the sample S obtained from S2 i Gene expression matrix and metadata sample S i At the same time, according to S3, the feature matrix of multiple cell combinations is used as sample S i The feature matrix and cell type ratio matrix of the pseudo ST sample are obtained by S2 and S3. The feature matrix of the ST and pseudo ST combination obtained by S2 and S3 is input into S4 to obtain the weighted adjacency matrix of the global node using random projection forest. The combined feature matrix and weighted adjacency matrix are input into the deep neural network model for training, and the sample S is output. i The cell type ratio matrix and sample S i The cell type ratio matrix of the pseudo ST sample in the above formula is used to calculate the cross entropy as the loss until the upper limit of the number of iterations is met or the loss remains unchanged. After obtaining the trained model, the sample S is input i Sample S is available i The cell type ratio matrix of the ST data, i.e., the cellular spatial composition.
[0014] Furthermore, the specific process of S1 is:
[0015] We obtained two scRNA-seq samples of mouse healthy trachea and human colorectal cancer from public datasets, and used the gene expression matrix and metadata in the samples as the datasets of the samples to prepare benchmark data for subsequent comparison with other methods.
[0016] We obtained scRNA-seq samples and ST samples of mouse cerebral cortex, mouse cerebellum, human developing heart, and pancreatic ductal adenocarcinoma (PDAC) from public datasets, and used the gene expression matrix and metadata in the scRNA-seq samples and the gene expression matrix in the ST samples as datasets for each tissue to verify the usability of the method on real data.
[0017] To evaluate the inference performance under different conditions, pseudo ST datasets were generated from two scRNA-seq datasets: mouse trachea and human colorectal cancer. The mouse trachea dataset was from the Cell BLAST database (https: / / cblast.gao-lab.org / ), and the sequencing technologies were 10x and inDrop, respectively. The dataset names were Montoro_10x and Plasschaert, respectively. The colorectal cancer datasets were from scRNA sequencing of three Korean colorectal cancer patients (GSE132465) and scRNA sequencing of three Belgian colorectal cancer patients (GSE144735).
[0018] The Visium spatial transcriptome dataset of the mouse brain was downloaded from the 10X Genomics data repository (https: / / www.10xgenomics.com / cn / resources / datasets). The “Mouse Brain Serial Sections (Sagittal-Anterior)” sections contained 2695 spots and 32285 genes for GTAD analysis. For joint analysis, we selected the scRNA-seq data of the mouse primary visual cortex and anterolateral motor cortex from GSE115746. The gene expression matrix consisted of 23178 cells and 45768 genes.
[0019] The structure and complex cell type composition of the mouse cerebellum can naturally serve as a model tissue to evaluate the performance of cell type deconvolution. The Slide-seq V2 mouse cerebellum spatial transcriptome data comes from the previous study RCTD, which contains a total of 11,626 spots and 23,096 genes. The scRNA-seq comes from the DropViz database (http: / / dropviz.org / ), which consists of 15,609 cells and 24,387 genes. This study provides detailed cell type annotation information, with a total of 19 cell types.
[0020] The developing human heart data comes from an open database of a study (https: / / www.spatialresearch.org / resources-published-datasets / ). The study provided developing heart slices and analyzed them using ST technology. The scRNA-seq data consisted of 3777 cells and 15323 genes, with a total of 14 cell types. The ST data contained 3111 spots and 39739 genes. The genes in scRNA-seq were represented by ENSEMBLID, which did not match the gene names in the ST data. It was necessary to convert ENSEMBLID to the corresponding gene names first.
[0021] Tissues of diseases such as tumors show unique pathological cell structures. The data comes from GSE111672. Both scRNA-seq and ST data come from the published dataset GSE111672, which has a total of 20 cell types. scRNA-seq consists of 1926 cells and 19738 genes, and ST data contains 428 spots and 19738 genes.
[0022] Furthermore, the specific process of S2 is:
[0023] The S21, scRNA-seq, and ST datasets were imported into R to obtain the gene expression matrices of the two, and the cell type information of single cells was obtained from the metadata of scRNA-seq;
[0024] S22, based on the gene expression matrix of scRNA-seq and ST, the intersection of the two genes is obtained, and irrelevant genes are eliminated based on this, and the gene expression matrix is filtered;
[0025] S23. According to the gene expression matrix of scRNA-seq and the cell type of each cell obtained in the metadata, the total number of gene expression data was normalized, and the cells were clustered into different clusters using the Leiden clustering algorithm after PCA dimensionality reduction. The Wilcoxon rank sum test was used to perform differential expression analysis on the genes in each cell subpopulation, and the genes with the most differential and expression significance were calculated and screened. Then, the gene expression moments of the two data sets were filtered again for dimensionality reduction and denoising.
[0026] Furthermore, the specific process of S3 is as follows:
[0027] S31. Create a Seurat object using the filtered ST data and the matching metadata. Use the Seurat function Idents to extract the cell subset labels from the metadata and assign them to the identification attributes in the Seurat object.
[0028] S32, after inputting the Seurat object, the cell subpopulation label of the synthetic data to be generated, and the number of synthesized spots, the cell subpopulation label is processed first, and the punctuation marks and spaces in the label are replaced with dots;
[0029] S33. For each spot, randomly select 2 to 10 cells from the scRNA-seq data as the cell pool, calculate the weight of each cell in the selected cell pool, create a data set for the spot, which includes the weight information of each cell subset, and then generate synthetic gene expression data, merge these data into the pseudo ST data, and finally return the feature matrix of the synthetic pseudo ST data and the cell composition of the spot;
[0030] S34. Output the gene expression and cell type ratio matrix obtained by making pseudo ST data as a file and store it in csv format.
[0031] Furthermore, the specific process of S4 is:
[0032] S41. First, the data to be integrated are preprocessed and standardized to embed the cells in each dataset into a low-dimensional space, usually the result of principal component analysis (PCA), which will reduce the computational complexity and extract important cell features;
[0033] S42. For each data set, calculate the similarity score between each pair of spots. This is usually done by calculating cosine similarity or other similarity metrics. Similarity metrics are used to measure the similarity of expression patterns between spots. Between two data sets, select spot pairs with high similarity scores as anchor points. These spot pairs have similar expression patterns between different data sets. Associate the anchor points to determine which spots correspond between different data sets. This process is usually achieved by maximizing the similarity score. Finally, the anchor point information is saved.
[0034] S43. Use anchor information to align spots in different datasets and establish connections across datasets for integration. For each dataset, map feature features to the integration space, integrate them into an overall expression matrix and merge them together. Finally, integrate different datasets together to form an overall expression matrix.
[0035] Furthermore, the specific process of S5 is as follows:
[0036] S51, create an index array, which contains the index of the feature data, used to track the original order of the data during the tree construction process, build a random projection tree according to the feature matrix integrated in S4, and return the root node;
[0037] S52, obtaining an index list of all leaf nodes, for each leaf node, combining the points in the node in pairs to generate an edge list, which includes all edges between the points in the same leaf node, setting the weights of all edges in the edge list to 1, and then converting to an adjacency matrix;
[0038] S53, adding the adjacency matrix of each randomly projected tree to the overall adjacency matrix adj to integrate the results of all trees, averaging the results of all trees together in an average manner, and the result is used as the final weighted adjacency matrix.
[0039] Furthermore, the training process of the deep neural network model in S6 is specifically as follows:
[0040] First, the model inputs the weighted adjacency matrix obtained by S5 and the integrated dataset of S4. For each attention layer, given N node features, The feature dimension of each node is F, and the calculation of the attention coefficient can be expressed as:
[0041]
[0042] Among them, e ij represents the attention coefficient of node i relative to node j, and W are shared learnable parameters;
[0043] Then, in the weight constraint layer, the weight of the adjacency matrix calculated by S5 is multiplied by the attention coefficient to obtain the constrained attention coefficient v ij In order to better distribute the weights, in the softmax layer, the correlations calculated with all neighbors are uniformly normalized to obtain the normalized attention coefficient a ij It can be expressed as:
[0044]
[0045] By computing multiple attention heads in parallel, the information in the input sequence is fully captured. The outputs of all attention heads are concatenated in each layer as the input of the next layer or averaged in the last layer as the result output of the model:
[0046]
[0047] After the training is completed, the final output is The mask part is composed of the cell types inferred from the ST data and can be expressed as:
[0048]
[0049] in represents the proportion of cell types in the predicted pseudo-ST, Represents the cell type ratio of ST, that is, the cell space composition.
[0050] Beneficial effects:
[0051] The present invention obtains matching scRNA-seq and spatial transcriptomics datasets in a variety of tissues and organs. The intersection of the genes of scRNA-seq and ST is obtained through the gene expression matrix of scRNA-seq and ST, and irrelevant genes are eliminated based on this, and the gene expression matrix is filtered. Then, according to the cell type of each cell obtained in the gene expression matrix of scRNA-seq and metadata, the total number of gene expression data is normalized, and the cells are clustered into different clusters using the Leiden clustering algorithm after PCA dimensionality reduction. The genes in each cell subpopulation are differentially expressed by Wilcoxon rank sum test, and the genes with the most differences and expression significance are calculated and screened. Then the gene expression moments of the two data sets are filtered again for dimensionality reduction and denoising. The scRNA-seq data set is used to simulate the cell mixture on each spot. Select 2 to 8 cells from the scRNA-seq dataset, combine their gene expression profiles into the gene expression of pseudo-ST data, obtain the cell type of each cell through the metadata of scRNA-seq, calculate the cell type ratio within the spot according to the cell type of the combined cells in each spot in the pseudo-ST data, and output it in the form of a matrix. Output the gene expression and cell type ratio matrix obtained by making pseudo-ST data as a file and store it in csv format. The gene expression matrices of the pseudo ST data and ST data are preprocessed and standardized. The cells in each dataset are embedded into a low-dimensional space, which is usually the result of principal component analysis (PCA). For each dataset, the similarity score between each pair of spots is calculated. The similarity metric is used to measure the similarity of the expression patterns between spots. Between the two datasets, spot pairs with high similarity scores are selected as anchors. These spot pairs have similar expression patterns between different datasets. The anchors are associated to determine which spots correspond between different datasets. This process is usually achieved by maximizing the similarity score. Finally, the anchor information is saved. Using the anchor information, the spots in different datasets are aligned and connections across datasets are established for integration. For each dataset, the feature features are mapped to the integration space, integrated into an overall expression matrix and merged together. Finally, the different datasets are integrated together to form an overall expression matrix.Create an index array containing the index of the feature data to track the original order of the data during the tree construction process, build a random projection tree based on the feature matrix integrated by S4, return the root node, obtain the index list of all leaf nodes, for each leaf node, combine the points in the node two by two to generate an edge list, this list contains all the edges between the points in the same leaf node, set the weights of all edges in the edge list to 1, and then convert it to an adjacency matrix, add the adjacency matrix of each random projection tree to the overall adjacency matrix adj to integrate the results of all trees, and average the results of all trees together by averaging, and the result is used as the final weighted adjacency matrix. Build a deep learning model, using a scRNA-seq sample and an ST sample from a certain tissue as sample S. i , based on the sample S obtained from S2 i Gene expression matrix and metadata sample S i At the same time, according to S3, the feature matrix of multiple cell combinations is used as sample S i The feature matrix and cell type ratio matrix of the pseudo ST sample are obtained by S2 and S3. The feature matrix of the ST and pseudo ST combination obtained by S2 and S3 is input into S4 to obtain the weighted adjacency matrix of the global node using random projection forest. The combined feature matrix and weighted adjacency matrix are input into the deep neural network model for training, and the sample S is output. i The cell type ratio matrix and sample S i The cell type ratio matrix of the pseudo ST sample in the above formula is used to calculate the cross entropy as the loss until the upper limit of the number of iterations is met or the loss remains unchanged. After obtaining the trained model, the sample S is input i Sample S is available i The cell type ratio matrix of the ST data, i.e., the cellular spatial composition.
[0052] The present invention provides a method for inferring the spatial composition of cells. The matched scRNA-seq data are processed and integrated with the ST data. An adjacency matrix is constructed through a random projection forest. The cell composition in a spatial position (spot) is inferred using a deep neural network model. The composition results obtained have a high accuracy rate, providing a new, more accurate and comprehensive method for inferring the spatial composition of cells. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 is a flow chart of the present invention;
[0054] Figure 2 It is a schematic diagram of the process of the present invention;
[0055] Figure 3 This is a bar graph comparing other methods on human colorectal cancer data;
[0056] Figure 4 It is a bar graph comparing other methods on mouse trachea data;
[0057] Figure 5 This is a violin plot comparing other methods on human colorectal cancer data;
[0058] Figure 6 This is a violin plot comparing other methods on mouse trachea data;
[0059] Figure 7 This is the spatial distribution map of Granule cells in mouse cerebellum;
[0060] Figure 8 This is the spatial distribution map of Oligodendrocytes in mouse cerebellum;
[0061] Fig. 9 This is the spatial distribution map of Purkinje cells in mouse cerebellum;
[0062] Fig.10 This is the spatial distribution map of MLI2 cells in mouse cerebellum; DETAILED DESCRIPTION
[0063] Specific implementation method 1: Combination Figure 1-Figure 10 The present embodiment is described. The method for inferring the spatial composition of a cell described in the present embodiment comprises the following steps:
[0064] S1. Obtain scRNA-seq and spatial transcriptomics datasets of various tissues and organs. Since each spot in spatial transcriptomics is generally composed of multiple single cells due to sequencing accuracy, single-cell resolution scRNA-seq data is the key to analyzing spatial transcriptomics data. At the same time, screen scRNA-seq and spatial transcriptomics datasets from the same tissue and organ. To deconvolve the spatial transcriptomics dataset using pseudo-ST data produced by scRNA-seq, the sources of the two datasets, i.e., the composition of cell types, need to match, so both need to come from the same tissue or organ. The specific process is as follows:
[0065] We obtained two scRNA-seq samples of mouse healthy trachea and human colorectal cancer from public datasets, and used the gene expression matrix and metadata in the samples as the datasets of the samples to prepare benchmark data for subsequent comparison with other methods.
[0066] We obtained scRNA-seq samples and ST samples of mouse cerebral cortex, mouse cerebellum, human developing heart, and pancreatic ductal adenocarcinoma (PDAC) from public datasets, and used the gene expression matrix and metadata in the scRNA-seq samples and the gene expression matrix in the ST samples as datasets for each tissue to verify the usability of the method on real data.
[0067] To evaluate the inference performance under different conditions, pseudo ST datasets were generated from two scRNA-seq datasets: mouse trachea and human colorectal cancer. The mouse trachea dataset was from the Cell BLAST database (https: / / cblast.gao-lab.org / ), and the sequencing technologies were 10x and inDrop, respectively. The dataset names were Montoro_10x and Plasschaert, respectively. The colorectal cancer datasets were from scRNA sequencing of three Korean colorectal cancer patients (GSE132465) and scRNA sequencing of three Belgian colorectal cancer patients (GSE144735).
[0068] The Visium spatial transcriptome dataset of the mouse brain was downloaded from the 10X Genomics Data Repository (https: / / www.10xgenomics.com / cn / resources / datasets). The “Mouse Brain Serial Sections (Sagittal-Anterior)” sections contained 2695 spots and 32285 genes for GTAD analysis. For joint analysis, we selected the scRNA-seq data of the mouse primary visual cortex and anterolateral motor cortex from GSE115746. The gene expression matrix consisted of 23 178 cells and 45 768 genes;
[0069] The structure and complex cell type composition of the mouse cerebellum can naturally serve as a model tissue to evaluate the performance of cell type deconvolution. The Slide-seq V2 mouse cerebellum spatial transcriptome data comes from the previous study RCTD, which contains a total of 11,626 spots and 23,096 genes. The scRNA-seq comes from the DropViz database (http: / / dropviz.org / ), which consists of 15,609 cells and 24,387 genes. The study provides detailed cell type annotation information, with a total of 19 cell types.
[0070] The developing human heart data comes from an open database of a study (https: / / www.spatialresearch.org / resources-published-datasets / ). The study provided developing heart slices and analyzed them using ST technology. The scRNA-seq data consisted of 3777 cells and 15323 genes, with a total of 14 cell types. The ST data contained 3111 spots and 39739 genes. The genes in scRNA-seq were represented by ENSEMBLID, which did not match the gene names in the ST data. It was necessary to convert ENSEMBLID to the corresponding gene names first.
[0071] Tissues of diseases such as tumors show unique pathological cell structures. The data comes from GSE111672. Both scRNA-seq and ST data come from the published dataset GSE111672, which has 20 cell types. scRNA-seq consists of 1926 cells and 19738 genes, and ST data contains 428 spots and 19738 genes.
[0072] S2. Obtain the gene expression matrix and metadata of scRNA-seq and ST datasets. The gene expression matrix is a data type obtained based on high-throughput sequencing or gene chip technology. It is used to describe the expression level of each gene in cells or tissues under different conditions. It is a two-dimensional numerical matrix, in which rows represent genes and columns represent samples. The expression level of a gene in a certain sample is recorded at each element position. Metadata refers to information used to describe various attributes, characteristics and conditions of the research object, among which the single cell type of scRNA-seq is mainly required. Through these two types of information, we can analyze the gene expression of scRNA-seq and spatial transcriptomics, and then derive their relationship. The gene expression matrix of the two data is used to filter and extract significant features. The process is as follows:
[0073] The S21, scRNA-seq, and ST datasets were imported into R to obtain the gene expression matrices of the two. The cell type information of single cells was obtained from the metadata of scRNA-seq;
[0074] S22. Obtain the intersection of genes of scRNA-seq and ST based on the gene expression matrix of the two, and use this as a basis to eliminate irrelevant genes and filter the gene expression matrix of scRNA-seq and ST;
[0075] S23. According to the gene expression matrix of scRNA-seq and the cell type of each cell obtained in the metadata, the total number of gene expression data was normalized, and the cells were clustered into different clusters using the Leiden clustering algorithm after PCA dimensionality reduction. The genes in each cell subpopulation were differentially expressed by Wilcoxon rank sum test, and the top 30 most differential and expression-significant genes in each cell type were calculated and screened, and the list of gene names was output as a text document for storage. Then, the gene expression moments of the two data sets were filtered again based on the saved gene list for dimensionality reduction and denoising.
[0076] S3. The gene expression matrix of ST data is the spatial transcriptome sequencing data obtained by ST sequencing technology, which can be used to capture the gene expression of each spot covering a heterogeneous cell mixture. Therefore, the scRNA-seq dataset is used to simulate the cell mixture on each spot to construct synthetic ST data called "pseudo ST". The specific process is as follows:
[0077] S31. Create a Seurat object using the filtered ST data and the matching metadata. Use the Seurat function Idents to extract the cell subset labels from the metadata and assign them to the identification attributes in the Seurat object.
[0078] S32, after inputting the Seurat object, the cell subpopulation label of the synthetic data to be generated, and the number of synthesized spots, the cell subpopulation label is processed first, and the punctuation marks and spaces in the label are replaced with dots;
[0079] S33. For each spot, randomly select 2 to 10 cells from the scRNA-seq data as the cell pool, calculate the weight of each cell in the selected cell pool, create a dataset for the spot, which includes the weight information of each cell subset, and then generate synthetic gene expression data, merge these data into the pseudo ST data, and finally return the feature matrix of the synthetic pseudo ST data and the cell composition of the spot;
[0080] S34. Output the gene expression and cell type ratio matrix obtained by making pseudo ST data as a file and store it in csv format.
[0081] S4. In order to enhance the consistency and comparability between the pseudo-ST data and the ST data, the gene expression matrices of the two datasets were integrated into an overall expression matrix. This integration process was to better compare and understand the two datasets in subsequent analyses, thereby obtaining in-depth insights into cell types, gene expression, and transcriptional profiles. The specific process was as follows:
[0082] S41. First, the data to be integrated are preprocessed and standardized to embed the cells in each dataset into a low-dimensional space, usually the result of principal component analysis (PCA), which will reduce the computational complexity and extract important cell features;
[0083] S42. For each dataset, it is necessary to calculate the similarity score between each pair of spots. This is usually done by calculating cosine similarity or other similarity metrics to measure the similarity of the expression patterns between spots. The goal in the integration process is to select spot pairs with high similarity scores between the two datasets as anchor points. These spot pairs have similar expression patterns between different datasets. The process of selecting anchor points is usually achieved by maximizing the similarity score, and the anchor point information is saved for subsequent use.
[0084] S43. Use anchor information to align spots in different datasets and establish connections across datasets for integration. Map the features of each dataset to the integrated space. This integrated space can be seen as a unified coordinate system for representing spots in different datasets. These features are then integrated into an overall expression matrix and merged together. Finally, different datasets are integrated to form an overall expression matrix in which the information of different datasets is effectively fused for further analysis and research.
[0085] S5. The adjacency matrix can be used to represent the connection relationship between nodes in the graph, that is, whether the nodes are adjacent or connected. Random Projection Forest (RPForest), a high-dimensional data indexing algorithm based on random projection, is used to construct a random projection forest based on the feature matrix, and k-nearest neighbor search (k-NN Search) is performed. Finally, a weighted adjacency matrix with a global spatial structure is obtained, which can quantitatively represent the relationship between each node. The specific process is:
[0086] S51. First, in order to track the original order of the data throughout the process, an index array is created, which contains the index of the feature data. This index array will record the order of the feature data so that the original data can be traced back in subsequent analysis. Then, a random projection tree is constructed based on the feature matrix integrated in S4. This tree is a data structure used to segment and organize data, thereby achieving effective data integration.
[0087] S52. In the process of building the tree, obtain the index list of all leaf nodes. These leaf nodes are the terminal branches of the tree and contain a set of data points. For each leaf node, we combine the data points in it in pairs to generate an edge list. This edge list contains all the edges between the data points in the same leaf node. In this process, the weights of all edges are set to 1, indicating that there is a connection between them. Then, this edge list is converted into an adjacency matrix for subsequent calculation and integration;
[0088] S53. Next, the results of all random projection trees are integrated. First, the adjacency matrix of each tree is added to an overall adjacency matrix. This overall adjacency matrix is called adj. During the integration process, the results of all trees are averaged together using the average value. This means that for each element in the adjacency matrix, the average value of the elements at the corresponding position in all trees is calculated and used as the final weighted adjacency matrix. This final adjacency matrix contains the information of all integrated trees for subsequent data analysis and mining.
[0089] S6. Build a deep neural network model. The deep neural network model adopts a semi-supervised graph attention neural network (GAT) and uses a multi-head attention mechanism to aggregate neighbor nodes. For each attention head, a neighbor node attention coefficient is generated, that is, the importance between a given node and its neighbor nodes. The outputs of these attention heads will be cascaded to form a new node representation vector. Each attention head includes a convolution layer, a weight restriction layer, a softmax layer, and a Dropout layer. The weight restriction layer refers to the multiplication of the attention coefficient obtained after convolution with the weighted adjacency matrix obtained in S4 to restrict the attention coefficient. Before the last attention layer, the outputs of all attention heads in each layer will be concatenated as the input of the next layer, and in the last layer, the outputs of the attention heads will be averaged as the output of the model.
[0090] Take a scRNA-seq sample and a ST sample from a certain tissue as sample S i , based on the sample S obtained from S2 i Gene expression matrix and metadata sample S i At the same time, according to S3, the feature matrix of multiple cell combinations is used as sample S i The feature matrix and cell type ratio matrix of the pseudo ST sample are obtained by S2 and S3. The feature matrix of the ST and pseudo ST combination obtained by S2 and S3 is input into S4 to obtain the weighted adjacency matrix of the global node using random projection forest. The combined feature matrix and weighted adjacency matrix are input into the deep neural network model for training, and the sample S is output. i The cell type ratio matrix and sample S iThe cell type ratio matrix of the pseudo ST sample in the above formula is used to calculate the cross entropy as the loss until the upper limit of the number of iterations is met or the loss remains unchanged. After obtaining the trained model, the sample S is input i Sample S is available i The cell type ratio matrix of the ST data is the cell space composition. The specific process is as follows:
[0091] Deep neural network models such as Figure 2 First, the model inputs the weighted adjacency matrix obtained by S5 and the integrated dataset of S4. For each attention layer, given N node features, The feature dimension of each node is F, and the calculation of the attention coefficient can be expressed as:
[0092]
[0093] Among them, e ij represents the attention coefficient of node i relative to node j, and W are shared learnable parameters;
[0094] Then, in the weight constraint layer, the weight of the adjacency matrix calculated by S5 is multiplied by the attention coefficient to obtain the constrained attention coefficient v ij In order to better distribute the weights, in the softmax layer, the correlations calculated with all neighbors are uniformly normalized to obtain the normalized attention coefficient a ij It can be expressed as:
[0095]
[0096] By computing multiple attention heads in parallel, the information in the input sequence is fully captured. The outputs of all attention heads are concatenated in each layer as the input of the next layer or averaged in the last layer as the result output of the model:
[0097]
[0098] After the training is completed, the final output is The mask part is composed of the cell types inferred from the ST data and can be expressed as:
[0099]
[0100] in represents the proportion of cell types in the predicted pseudo-ST, Represents the cell type ratio of ST, that is, the cell space composition.
[0101] S7. Determine the tissue to be tested, obtain the corresponding scRNA-seq data and ST data, filter the gene expression matrix of scRNA-seq data and ST data according to the differentially expressed genes extracted by S2, make synthetic ST data called pseudo-ST according to S3 and obtain its cell type composition information, and obtain the integrated gene expression data through S4 according to the gene expression matrix of pseudo-ST and ST, and obtain the weighted adjacency matrix through S5, and the spatial relationship between the integrated nodes, take the feature matrix and the full adjacency matrix as data samples, and input the data samples into the deep neural network model of S6. After training, the cell type composition of each spot in the ST data, that is, the cell space composition, is obtained.
[0102] For the objective function, the model is trained using binary cross entropy loss, i.e.,
[0103]
[0104] Among them, Y i represents the i-th element in the true label Y, Represents the predicted label The meaning of this formula is: for each element, calculate the probability value of the true label (through the softmax function), and then take its negative logarithm as the loss value. Use the Adam optimizer to optimize the training loss. The Adam optimization algorithm is an extension of the stochastic gradient descent algorithm.
[0105] The present invention uses Jensen-Shannon distance (JSD), which is a distance metric that measures the similarity between two probability distributions. The value range of JSD is [0,1]. When the two probability distributions are exactly the same, the Jensen-Shannon distance is 0; when the two probability distributions are completely different and do not overlap, the Jensen-Shannon distance is 1. The smaller the JSD value, the higher the similarity between the two distributions, and therefore indicates that the accuracy of cross-point estimation of cell type composition is higher. The performance evaluation index is defined as follows:
[0106]
[0107] Where M is Y and The mean distribution, that is, M = 0.5*(P+Q), KL(P||M) represents the distribution The Kullback-Leibler divergence (KL divergence) to the distribution M.
[0108] Example
[0109] The recognition effect of the present invention is further described below with a group of specific experimental examples.
[0110] As described in S1, Slide-seq V2 ST data of mouse cerebellum were obtained from public databases. The ST data came from the previous study RCTD, which contained 11,626 spots and 23,096 genes. The scRNA-seq data came from the DropViz database (http: / / dropviz.org / ), which consisted of 15,609 cells and 24,387 genes. The study provided detailed cell type annotation information, with a total of 19 cell types.
[0111] As described in S2, the features of the scRNA-seq data and ST data of the mouse cerebellum space were extracted. Specifically, the data of the two were first filtered by the intersection of the genes in the scRNA-seq data and the ST data, and then the top 30 genes with significant differential expression between each cell type and the rest of the cell types were calculated based on the cell type information provided by the metadata of scRNA-seq. The set of genes extracted from all cell types was used as the features of the scRNA-seq data and ST data and the gene expression matrices of the two were filtered.
[0112] As described in S3, pseudo ST data of mouse cerebellum were prepared. Two to ten cells were randomly selected as cell pools from the filtered scRNA-seq data of mouse cerebellum, the weight of each cell in the selected cell pool was calculated, and a dataset of test spots was created, which included the weight information of each cell subset. Then synthetic gene expression data were generated, which were merged into the pseudo ST data, and finally the feature matrix of the synthetic pseudo ST data and the cell composition of the spot were returned.
[0113] As described in S4, after PCA dimensionality reduction of the gene expression matrices of pseudo-ST data and ST data of mouse cerebellum, for each dataset, the similarity score between each pair of spots is calculated by calculating cosine similarity or other similarity metrics, and the spot pairs with high similarity scores between the two datasets are selected as anchors. Using the anchor information, the spots in different datasets are aligned, and connections across datasets are established for integration. For each dataset, its features are mapped into the integration space, and then these features are integrated into an overall expression matrix and merged together. Finally, different datasets are integrated together to form an overall expression matrix, in which the information of different datasets is effectively fused for further analysis and research.
[0114] As described in S5, for the gene expression matrix after integrating the pseudo-ST data and ST data of mouse cerebellum, random projection forest (RPForest) was used to construct a random projection forest based on the feature matrix. Specifically, it refers to 10 random projection trees. The adjacency matrix of each tree is added to an overall adjacency matrix. During the integration process, the results of all trees are averaged together by the average value, which means that for each element in the adjacency matrix, the average value of the elements at the corresponding position in all trees is calculated and used as the final weighted adjacency matrix.
[0115] A deep neural network model for inferring the spatial composition of cells was constructed as described in S6.
[0116] Finally, scRNA-seq data and ST data from the same tissue were used in the present invention.
[0117] The mouse cerebellum data was trained with a deep neural network model to obtain the spatial composition of the tissue cells, specifically the cell type composition ratio of all cells in each spot in the ST data, such as Figure 7 , Figure 8 , Fig. 9 , Fig.10 As shown, through the spatial position information of ST data, the spatial mapping of the specified cell type can be obtained, and the color map on the right side of the figure represents the maximum and minimum values of the corresponding cell score. As shown in Table 1, by comparing the cell type hierarchical structure information of the mouse cerebellum provided by the research source of the data, the mouse cerebellar cortex is divided into three layers, the top is the molecular layer, the middle is the Purkinje layer, and the bottom is the Granular layer, which contains Granule Cells. Below the cortex is the White Matter rich in Oligodendrocytes and Astrocytes. The results inferred by the present invention are the same as those described in the study. The two molecular layer interneurons MLI1 and MLI2 of the Molecular layer are mapped to the top and outermost layers of the cerebellar cortex. Bergmann and Purkinje are co-localized in the same intermediate layer Purkinje layer, and Granule cells are co-localized in the sub-bottom Granule layer. Oligodendrocytes and Astrocytes are scattered below the Granular layer and are obviously enriched in the innermost part of the cerebellar slice. In summary, the present invention can accurately deconvolute the cell types of Slide-seq spatial transcriptome data and reconstruct the hierarchical structure of the mouse cerebellum.
[0118] Table 1 Cell type hierarchy of mouse cerebellum
[0119]
[0120] In order to evaluate the effectiveness and generalization ability of the present invention, it is demonstrated that the present invention improves the accuracy of inferring the spatial composition of cells by traditional methods. The present invention adopts the method of synthetic cell mixtures, combines scRNA-seq data from healthy mouse trachea and human colorectal cancer, and simulates spatial transcriptomics data under different conditions to evaluate the performance differences of different methods in normal control environments and pathological environments. To evaluate the performance of GTAD, we randomly or at a fixed cell type ratio from scRNA-seq data, and combine their transcriptome profiles to generate synthetic mixtures of known cell type composition. These synthetic mixtures serve as benchmarks to test the performance of GTAD in resolving cell types.
[0121] The present invention constructs a deep learning framework on the above benchmark test data set (all method steps of the present invention, such as Figure 1 ) were compared with existing methods, including the CellDART method, STRIDE method, DSTG method, RCTD method, and SPOTlight method. When evaluating the performance, we used JSD as an indicator to measure the similarity of two probability distributions. We calculated the average JSD value between the estimated cell type proportion and the actual proportion in each spot, and used a chord plot to display the JSD value distribution of the overall spot. The chord plot combines the box plot and kernel density estimation to more intuitively display the distribution shape and density of the data. Figure 3 , Figure 4 As shown in the figure, in each simulated data set, from the comparison of average values, the method of the present invention is superior to other methods in both data sets, and its JSD value is at least 2% lower than that of CellDART and STRIDE, which have better effects. Figure 5 , Figure 6 As shown in the figure, the Wilcoxon rank sum test (also known as the Mann-Whitney U test) is a non-parametric statistical method for independent samples, which is used to compare the properties of two groups of data. In the figure, **** represents the results of the present invention and other methods. The p value of the Wilcoxon rank sum test is less than 10 -4As shown in Table 2, by comparing the calculated statistical value with the critical value or p-value, we can judge that the results of the inference of the present invention are statistically significantly better than other methods. At the same time, when the chord diagram uses JSD as a metric, the width of the present invention is wider and lower than the two methods, which means that the difference between the estimated cell type ratio and the actual ratio at these points is small, that is, the model's prediction of the cell type deconvolution at these points is relatively accurate and reliable. Such results show that the present invention can better restore the composition of cell types, which is closer to the actual situation, and shows stable performance and superior performance in both normal and pathological environments. Taken together, the present invention has shown good performance and stability in these two different simulated data sets, providing a reliable tool for the accurate analysis of spatial transcriptomics data and effectively improving the accuracy of inferring cell composition.
[0122] Table 2 Wilcoxon rank sum test of the present invention and other methods on the benchmark test data set
[0123]
Claims
1. A method for inferring cell spatial composition, characterized in that: It includes the following steps: S1. Obtain scRNA-seq and spatial transcriptomics datasets of various tissues and organs. Each spot in spatial transcriptomics is generally composed of multiple single cells due to the sequencing accuracy. Therefore, single-cell resolution scRNA-seq data is the key to analyzing spatial transcriptomics data. At the same time, screen scRNA-seq and spatial transcriptomics datasets from the same tissue and organ. To deconvolve the spatial transcriptomics dataset using pseudo-ST data produced by scRNA-seq, the sources of the two datasets, i.e., the composition of cell types, need to match, so both need to come from the same tissue or organ. S2. Obtain the gene expression matrix and metadata of scRNA-seq and ST datasets. The gene expression matrix is a data type obtained based on high-throughput sequencing or gene chip technology. It is used to describe the expression levels of each gene in cells or tissues under different conditions. It is a two-dimensional numerical matrix, in which rows represent genes and columns represent samples. The expression level of a gene in a certain sample is recorded at each element position. Metadata refers to information used to describe various attributes, characteristics and conditions of the research object, among which the single cell type of scRNA-seq is mainly required. Through these two types of information, we can analyze the gene expression of scRNA-seq and spatial transcriptomics, and then derive their relationship. The gene expression matrix of the two data is used to filter the gene expression matrix and extract significant features; S3. The gene expression matrix of ST data is the spatial transcriptome sequencing data obtained by ST sequencing technology, which can be used to capture the gene expression of each spot covering a heterogeneous cell mixture. Therefore, the scRNA-seq dataset is used to simulate the cell mixture on each spot to construct synthetic ST data called "pseudo ST"; S4. In order to enhance the consistency and comparability between the pseudo-ST data and the ST data, the gene expression matrices of the two datasets were integrated into an overall expression matrix; S5. The adjacency matrix can be used to represent the connection relationship between nodes in the graph, that is, whether the nodes are adjacent or connected. Random Projection Forest (RPForest), a high-dimensional data indexing algorithm based on random projection, is used to construct a random projection forest based on the feature matrix and perform k-nearest neighbor search (k-NN Search). Finally, a weighted adjacency matrix with a global spatial structure is obtained, which can quantitatively represent the relationship between each node. S6. Build a deep neural network model. The deep neural network model adopts a semi-supervised graph attention neural network (GAT) and uses a multi-head attention mechanism to aggregate neighbor nodes. For each attention head, a neighbor node attention coefficient is generated, that is, the importance between a given node and its neighbor nodes. The outputs of these attention heads will be cascaded to form a new node representation vector. Each attention head includes a convolution layer, a weight restriction layer, a softmax layer, and a Dropout layer. The weight restriction layer refers to the multiplication of the attention coefficient obtained after convolution with the weighted adjacency matrix obtained in S4 to restrict the attention coefficient. Before the last attention layer, the outputs of all attention heads in each layer will be concatenated as the input of the next layer, and in the last layer, the outputs of the attention heads will be averaged as the output of the model. Take a scRNA-seq sample and a ST sample from a certain tissue as sample S i , based on the sample S obtained from S2 i Gene expression matrix and metadata sample S i The feature matrix of multiple cell combinations is used as sample S according to S3. i The feature matrix and cell type ratio matrix of the pseudo ST sample are obtained by S2 and S3. The feature matrix of the ST and pseudo ST combination obtained by S2 and S3 is input into S4 to obtain the weighted adjacency matrix of the global node using random projection forest. The combined feature matrix and weighted adjacency matrix are input into the deep neural network model for training, and the sample S is output. i The cell type ratio matrix and sample S i The cell type ratio matrix of the pseudo ST sample in the above formula is used to calculate the cross entropy as the loss until the upper limit of the number of iterations is met or the loss remains unchanged. After obtaining the trained model, the sample S is input i Sample S is available i The cell type ratio matrix of the ST data, i.e., the cellular spatial composition.
2. A method for inferring cell space composition according to claim 1, characterized in that: The specific process of S1 is as follows: Two scRNA-seq samples of mouse healthy trachea and human colorectal cancer were obtained from public datasets. The gene expression matrix and metadata in this paper are used as sample datasets to prepare benchmarks for subsequent comparisons with other methods. Test data; scRNA-seq samples and ST samples of mouse cerebral cortex, mouse cerebellum, human developing heart and pancreatic ductal adenocarcinoma (PDAC) were obtained from public datasets. The gene expression matrix and metadata in the scRNA-seq samples and the gene expression matrix in the ST samples were used as the datasets of each tissue to verify the availability of the method in real data. sex; In order to evaluate the inference performance under different conditions, pseudo ST datasets were generated from two scRNA-seq datasets: mouse trachea and human colorectal cancer. The mouse trachea dataset was obtained from the Cell BLAST database. (https: / / cblast.gao-lab.org / ), the sequencing technologies were 10x and inDrop, the datasets were named Montoro_10x and Plasschaert, and the colorectal cancer datasets were from scRNA of 3 Korean colorectal cancer patients. Sequencing GSE132465 and scRNA sequencing GSE144735 of three Belgian colorectal cancer patients; Visium spatial transcriptome dataset of mouse brain from 10X Genomics data repository (https: / / www.10xgenomics.com / cn / resources / datasets) download, "Mouse brain serial sections (sagittal - anterior)" slices contained 2695 spots and 32285 genes for GTAD analysis. For joint analysis, we selected scRNA-seq data of mouse primary visual cortex and anterolateral motor cortex from GSE115746, with a gene expression matrix consisting of 23 178 cells and 45 768 genes; The structure and complex cell type composition of the mouse cerebellum naturally serve as a model tissue to assess cell type responses. Convolution performance, Slide-seq V2 mouse cerebellum spatial transcriptome data comes from the previous study RCTD, containing a total of 11,626 spots and 23,096 genes, and scRNA-seq comes from the DropViz database (http: / / dropviz.org / ), consisting of 15,609 cells and 24,387 genes. This study provides detailed cell type annotation information, with a total of 19 cell types; Data on the developing human heart are available in an open database from a study (https: / / www.spatialresearch.org / resources-published-datasets / ), the study provided slices of developing hearts and analyzed them using ST technology. The scRNA-seq data consisted of 3777 cells and 15323 genes, with a total of 14 cell types. The ST data contained 3111 spots and 39739 genes. The genes in scRNA-seq were represented by ENSEMBLID, which did not match the gene names in the ST data. It was necessary to convert ENSEMBLID to the corresponding gene names first. Tissues of diseases such as tumors show unique pathological cell structures. The data comes from GSE111672. Both scRNA-seq and ST data come from the published dataset GSE111672, which has a total of 20 cell types. scRNA-seq consists of 1926 cells and 19738 genes, and ST data contains 428 spots and 19738 genes.
3. A method for inferring cell space composition according to claim 2, characterized in that: The specific process of S2 is: The S21, scRNA-seq, and ST datasets were imported into R to obtain the gene expression matrices of the two, and the cell type information of single cells was obtained from the metadata of scRNA-seq; S22, based on the gene expression matrix of scRNA-seq and ST, the intersection of the two genes is obtained, and irrelevant genes are eliminated based on this, and the gene expression matrix is filtered; S23. According to the gene expression matrix of scRNA-seq and the cell type of each cell obtained in the metadata, the total number of gene expression data was normalized, and the cells were clustered into different clusters using the Leiden clustering algorithm after PCA dimensionality reduction. The Wilcoxon rank sum test was used to perform differential expression analysis on the genes in each cell subpopulation, and the genes with the most differential and expression significance were calculated and screened. Then, the gene expression moments of the two data sets were filtered again for dimensionality reduction and denoising.
4. A method for inferring cell space composition according to claim 3, characterized in that: The specific process of S3 is as follows: S31. Create a Seurat object using the filtered ST data and the matching metadata. Use the Seurat function Idents to extract the cell subset labels from the metadata and assign them to the identification attributes in the Seurat object. S32, after inputting the Seurat object, the cell subpopulation label of the synthetic data to be generated, and the number of synthesized spots, the cell subpopulation label is processed first, and the punctuation marks and spaces in the label are replaced with dots; S33. For each spot, randomly select 2 to 10 cells from the scRNA-seq data as the cell pool, calculate the weight of each cell in the selected cell pool, create a data set for the spot, which includes the weight information of each cell subset, and then generate synthetic gene expression data, merge these data into the pseudo ST data, and finally return the feature matrix of the synthetic pseudo ST data and the cell composition of the spot; S34. Output the gene expression and cell type ratio matrix obtained by making pseudo ST data as a file and store it in csv format.
5. A method for inferring cell space composition according to claim 4, characterized in that: The specific process of S4 is as follows: S41. First, the data to be integrated are preprocessed and standardized to embed the cells in each dataset into a low-dimensional space, usually the result of principal component analysis (PCA), which will reduce the computational complexity and extract important cell features; S42. For each dataset, it is necessary to calculate the similarity score between each pair of spots. This is usually done by calculating cosine similarity or other similarity metrics to measure the similarity of the expression patterns between spots. The goal in the integration process is to select spot pairs with high similarity scores between the two datasets as anchor points. These spot pairs have similar expression patterns between different datasets. The process of selecting anchor points is usually achieved by maximizing the similarity score, and the anchor point information is saved for subsequent use. S43. Use anchor information to align spots in different datasets and establish connections across datasets for integration. Map the features of each dataset to the integrated space. This integrated space can be seen as a unified coordinate system for representing spots in different datasets. These features are then integrated into an overall expression matrix and merged together. Finally, different datasets are integrated to form an overall expression matrix in which the information of different datasets is effectively fused for further analysis and research.
6. A method for inferring cell space composition according to claim 5, characterized in that: The specific process of S5 is as follows: S51. First, in order to track the original order of the data throughout the process, an index array is created, which contains the index of the feature data. This index array will record the order of the feature data so that the original data can be traced back in subsequent analysis. Then, a random projection tree is constructed based on the feature matrix integrated in S4. This tree is a data structure used to segment and organize data, thereby achieving effective data integration. S52. In the process of building the tree, obtain the index list of all leaf nodes. These leaf nodes are the terminal branches of the tree and contain a set of data points. For each leaf node, we combine the data points in it in pairs to generate an edge list. This edge list contains all the edges between the data points in the same leaf node. In this process, the weights of all edges are set to 1, indicating that there is a connection between them. Then, this edge list is converted into an adjacency matrix for subsequent calculation and integration; S53. Next, the results of all random projection trees are integrated. First, the adjacency matrix of each tree is added to an overall adjacency matrix. This overall adjacency matrix is called adj. During the integration process, the results of all trees are averaged together using the average value. This means that for each element in the adjacency matrix, the average value of the elements at the corresponding position in all trees is calculated and used as the final weighted adjacency matrix. This final adjacency matrix contains the information of all integrated trees for subsequent data analysis and mining.
7. A method for inferring cell space composition according to claim 6, characterized in that: The training process of the deep neural network in S6 is as follows: First, the model inputs the weighted adjacency matrix obtained by S5 and the integrated dataset of S4. For each attention layer, given N node features, The feature dimension of each node is F, and the calculation of the attention coefficient can be expressed as: Among them, e ij represents the attention coefficient of node i relative to node j, and W are shared learnable parameters; Then, in the weight constraint layer, the weight of the adjacency matrix calculated by S5 is multiplied by the attention coefficient to obtain the constrained attention coefficient v ij In order to better distribute the weights, in the softmax layer, the correlations calculated with all neighbors are uniformly normalized to obtain the normalized attention coefficient a ij It can be expressed as: By computing multiple attention heads in parallel, the information in the input sequence is fully captured. The outputs of all attention heads are concatenated in each layer as the input of the next layer or averaged in the last layer as the result output of the model: After the training is completed, the final output is The mask part is composed of the cell types inferred from the ST data and can be expressed as: in represents the proportion of cell types in the predicted pseudo-ST, Indicates the cell type ratio of ST, that is, the cell space composition, and the final output sample S i The cell type ratio matrix of the ST data, i.e., the cellular spatial composition.
Citation Information
Cited By
Prediction method and prediction system for space transcriptomics, and storage medium
CN120727108A