Cancer single cell clustering method based on semantic perception contrast learning
By adopting a semantic perceptual contrast learning method in the clustering of cancer single-cell RNA sequencing data, the performance instability caused by high loss rates and noise in the data is solved, and more stable and accurate cell type recognition is achieved.
Patent Information
- Application Number
- CN202411502072.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-03-18
AI Technical Summary
Existing cancer single-cell RNA sequencing data clustering methods have unstable performance when processing high loss rate and noisy data, resulting in unsatisfactory clustering results.
Using a method based on semantic perception contrast learning, cells are randomly blocked through the dropout neural network layer to generate two data augmentation, and combined with automatic encoder, cell-cell graph construction, pseudo-tag graph generation, and dual contrast alignment modules, semantic information is extracted and clustered.
It significantly improves the stability and accuracy of the clustering of cancer single-cell RNA sequencing data, can more effectively capture the intrinsic characteristics of cells and the similarity between cells, and improves the ability to distinguish cell types.
Smart Images

Figure CN119649916A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of cancer single cell clustering, and in particular, relates to a cancer single cell clustering method based on semantic-aware contrastive learning. Background Art
[0002] In recent years, single-cell RNA sequencing (transcriptome sequencing technology) has been widely used in biological and medical research to explore biological processes by studying gene expression at the level of individual cells. This technology has revolutionized transcriptomics research and provided unprecedented insights into various biological phenomena, including embryonic development, drug discovery, and disease progression. A key task in single-cell RNA sequencing data analysis is the accurate identification of cell types. Unsupervised clustering provides an effective method for cell type identification by automatically discovering similarities and differences between cells.
[0003] A variety of clustering methods have been proposed for the analysis of cancer single-cell RNA sequencing data. A common strategy is to learn similarity measures between cell populations based on a dimensionality-reduced representation of the gene expression matrix. Subsequently, traditional clustering algorithms, such as k-means or hierarchical clustering, are applied to identify cell types. However, these dimensionality reduction methods can lead to the loss of important information because their effectiveness depends heavily on the underlying structure of the data. This can significantly affect the performance and scalability of clustering algorithms for cancer single-cell RNA sequencing data, leading to suboptimal results in downstream analyses.
[0004] In addition, deep neural networks have become a powerful learning paradigm for extracting discriminative representations for clustering and have been successfully applied to cancer single-cell clustering tasks. For example, the raw count data is mapped to a low-dimensional space using an autoencoder to reduce noise, the data distribution is reconstructed using a decoder, and clustering analysis parameters based on a negative binomial distribution are provided. However, these autoencoder-based algorithms mainly focus on the data itself, while ignoring the relationships between cells, resulting in insufficient effectiveness of the learned features. Specifically, for example, a cell-to-cell relationship graph is constructed by learning cell representations to capture the relationship information between cells, and a specific type of clustering autoencoder is used to discover information unique to each cell type. In addition, the model performance can be enhanced by incorporating cell-to-cell graphs encoded by graph neural networks to better capture the relationships between cells. However, graph neural networks transfer information between adjacent cells during feature learning without distinguishing noise edges, which may lead to a mixture of different cell types, thereby misleading clustering results. Although existing studies have demonstrated the effectiveness of integrating relationship information between cells in clustering tasks, current methods still face serious limitations, especially the problem of unstable clustering performance. This instability is usually due to the high loss rate and noise in the data, which makes them unable to fully capture the intrinsic characteristics of cells and accurately calculate the similarity between cells. These challenges ultimately hinder the construction of high-quality cell representations and cell-to-cell relationships, which in turn affects the effectiveness of clustering tasks. Summary of the invention
[0005] In view of the limitations of existing methods, a cancer single-cell clustering method based on semantic-aware contrastive learning is proposed. The dropout neural network layer is used, that is, two rounds of random dropout are performed on each cell to mask the expression values of certain genes, and then a small amount of Gaussian noise is added. Combined with high-expression gene screening, data enhancement, autoencoder, cell-cell graph construction, pseudo-label graph generation, and double contrast alignment modules, semantic information extraction and clustering of cancer single-cell data are achieved.
[0006] To achieve the above objectives, the present application provides a cancer single cell clustering method based on semantic-aware contrastive learning, which specifically includes:
[0007] S1: Screening highly expressed genes and randomly masking the gene expression of each cell to generate two enhancements of cell data;
[0008] S2: Extract semantic information from views using an autoencoder and train the encoder by minimizing the reconstruction loss;
[0009] S3: construct cell-cell maps and pseudo-label maps according to different views and distributions;
[0010] S4: A dual contrastive alignment module is applied to capture semantically invariant representations in augmentation by leveraging semantic information in the generated pseudo-label maps.
[0011] The step S1 randomly shields the gene expression of each cell, including:
[0012] Using the dropout neural network layer, two rounds of random dropout were performed on each cell;
[0013] Here, a weight of 0 is assigned to the randomly selected gene expression value.
[0014] S2: extracting semantic information from the view using an automatic encoder, including:
[0015] Order Z v =f(X v θ v )and Represent the encoding and decoding processes respectively;
[0016] Then the input X of the view v and output The reconstruction loss between is formulated as follows:
[0017]
[0018] Among them, θ v and is a network parameter.
[0019] The dual comparison and alignment module comprises:
[0020] Let the feature of the v-th view be expressed as Pseudo Labels
[0021] Then p v =Classify(Z v );
[0022] Compute the pseudo labels p for the two views m and p n The similarity matrix W between G ∈R N×N To construct a pseudo-label graph, it is expressed as:
[0023]
[0024] where Classify(·) is the classification head; τ is the threshold; W G The diagonal elements of represent the class probabilities of the same samples across views.
[0025] The S4 further comprises:
[0026] Construct a global cross-view feature map S G ∈R N×N , the formula is:
[0027]
[0028] where <·,·> represents the inner product; Z m and Z n It is the potential representation of views view1 and view2.
[0029] The S4 further comprises:
[0030] Align the global cross-view feature similarity map with the high-confidence pseudo-label map as follows:
[0031]
[0032] in, Used to encourage the same samples to be close in cross-view features; Used to force similar but different samples to belong to the same cluster.
[0033] The S4 further comprises:
[0034] Use the global view features to calibrate the local view features and construct the local feature map as follows:
[0035]
[0036] Where <·,·> represents the inner product;
[0037] Align the global view with each local view using the formula:
[0038]
[0039] The present invention realizes semantic information extraction and clustering of cancer single cell data by combining highly expressed gene screening, data enhancement, autoencoder, cell-cell graph construction, pseudo-label graph generation and double comparison alignment module, thereby improving the robustness and clustering effect of the model.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] The semantic-aware contrastive learning method proposed in the present invention can effectively capture the intrinsic characteristics of cells and significantly improve the stability of clustering results by addressing the high loss rate and noise problems existing in cancer single-cell RNA sequencing data.
[0042] By randomly masking the gene expression of each cell, generating two different data augmentations, and leveraging the semantic information in the generated pseudo-labels, this method is able to learn a semantically invariant representation of the data and improve the model's ability to discriminate cell types.
[0043] The method of the present invention can effectively learn biologically meaningful representations, more accurately identify cell types, and improve the accuracy and reliability of scRNA-seq data analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is a schematic diagram of a cancer single cell clustering method based on semantic-aware contrastive learning in one embodiment of the present application.
[0045] Figure 2 for Figure 1 Process diagram of the cancer single-cell clustering method based on semantic-aware contrastive learning described in .
[0046] Figure 3 This is the effect diagram of the cancer single-cell clustering method based on semantic-aware contrastive learning in this application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme will be clearly and completely described below in conjunction with the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] As attached Figure 1-2 As shown, in order to solve the above technical problems, the present application provides a cancer single cell clustering method based on semantic-aware contrast learning, which specifically includes:
[0049] S1: Screening highly expressed genes and randomly masking the gene expression of each cell to generate two enhancements of cell data;
[0050] S2: Extract semantic information from views using an autoencoder and train the encoder by minimizing the reconstruction loss;
[0051] S3: construct cell-cell maps and pseudo-label maps according to different views and distributions;
[0052] S4: A dual contrastive alignment module is applied to capture semantically invariant representations in augmentation by leveraging semantic information in the generated pseudo-label maps.
[0053] This application ensures that these enhancements share a consistent semantic structure by aligning the similarity graph with the high-confidence pseudo-label graph, maintaining the structural consistency of the inter-unit relationship and reliable class information, and ultimately achieving effective learning of semantically invariant unit representations. In addition, by randomly masking the gene expression of each cell, two different enhancements of cell data are generated, and the stability of features is ensured by constructing a reconstruction loss for feature training.
[0054] Preferably, in step S1, genes highly expressed in cells are screened, and two different enhanced views are generated by randomly masking gene expression, that is, randomly setting certain gene expression values to 0 or introducing noise. The two views will be used in the subsequent comparative learning process.
[0055] When screening out genes highly expressed in cells, it is preferred to calculate the average expression level of each gene in all cells, and select genes highly expressed in cells based on the average expression level, for example, select genes with average expression levels in the top 20%.
[0056] Preferably, the gene expression of each cell is randomly masked, and the masking ratio can be set according to actual data requirements, for example, 50% of the gene expression is masked.
[0057] In order to further fully explain the content of step S1, an example is given below:
[0058] #Assuming that data is a gene expression matrix of (cells x genes), we use the scanpy library to filter highly expressed genes to generate filtered data filtered_data, and then randomly drop neurons to generate two enhanced views x_1 and x_2:
[0059]
[0060]
[0061] Preferably, in this embodiment, the introduction of random noise can be achieved by: adding a small amount of Gaussian noise, thereby introducing a certain degree of uncertainty and diversity while retaining the original data characteristics, so as to better train the model's robustness to noise and changes. Specifically, a small amount of Gaussian noise (mean is 0, standard deviation is a small value, such as 0.01 or 0.05) is added to each gene expression value. Gaussian noise is added to the screened data matrix to generate two different enhanced views.
[0062] Finally, output the results:
[0063] print("Original data matrix shape:",data.shape);
[0064] print("Shape of the filtered data matrix:",filtered_data.shape);
[0065] print("Enhanced Vision Figure 1 shape: ",x_1.shape);
[0066] print("Enhanced Vision Figure 2 shape: ",x_2.shape).
[0067] This application calculates the average expression of genes and selects genes with higher expression to reduce noise and redundant information in the data. By randomly masking the filtered data, two different enhanced views are generated. These two views are used to train the model in the subsequent contrastive learning process to capture the semantic invariance of the data.
[0068] Preferably, randomly shielding the gene expression of each cell in step S1 comprises:
[0069] Using the dropout neural network layer, two rounds of random dropout were performed on each cell;
[0070] Here, a weight of 0 is assigned to the randomly selected gene expression value.
[0071] S2: extracting semantic information from the view using an automatic encoder, including:
[0072] Order Z v =f(X v θ v )and Represent the encoding and decoding processes respectively; the encoder compresses the input data into a latent space, and the decoder reconstructs the representation in the latent space back to the original data space. Use the enhanced views view1 and view2 generated by S1 as the input and output of the autoencoder, and train the model to minimize the reconstruction error. After the training is completed, the encoder is used to extract the latent representation of each view. Preferably, latent_view1 and latent_view2 are used as the latent representations of the two enhanced views. These latent representations will be used as semantic information in subsequent steps.
[0073] Preferably, before training the autoencoder, the input data is normalized to ensure that the expression values of different genes have the same scale.
[0074] The dual contrast alignment module uses the previously extracted latent representations to learn the similarities and differences between cells, and aligns the latent representations between the two enhanced views through contrastive learning, thereby improving the model's ability to understand cell types and states. Specifically, it includes:
[0075] Define contrastive loss function: Use contrastive loss function to measure the similarity of latent representations between two augmented views.
[0076] Take latent_view1 and latent_view2 as input, calculate the contrast loss, update the model parameters to minimize the contrast loss, and the reconstruction loss is formulated as follows:
[0077]
[0078] Among them, θ v and is the network parameter; X v is the input of the view; is the output of the view.
[0079] Let the feature of the v-th view be expressed as Pseudo Labels
[0080] Then p v =Classify(Z v );
[0081] Compute the pseudo labels p for the two views m and p n The similarity matrix W between G ∈R N×N To construct a pseudo-label graph, it is expressed as:
[0082]
[0083] where Classify(·) is the classification head; τ is the threshold; W G The diagonal elements of represent the class probabilities of the same samples across views. The output of the classification head is a vector of size num_classes, representing the probability of each category. m and p n These pseudo labels represent the probability distribution of each cell belonging to each category. By calculating the matrix multiplication of the two pseudo label matrices, the similarity matrix is obtained. The element s[i,j] in the similarity matrix s represents the visual Figure 1 The i-th cell and visual Figure 2The similarity between the jth cells in . By setting a threshold τ, a pseudo label graph G is constructed. Only when S[i,j] is greater than the threshold and i≠j, S[i,j] is assigned to otherwise In this embodiment, a pseudo-label graph is constructed to represent the similarities between cells. This graph structure will help in subsequent clustering or other analyses to better understand the structure and characteristics of cancer single-cell data.
[0084] The S4 further comprises:
[0085] Construct a global cross-view feature map S G ∈R N×N , using the inner product of the latent representations of the two views to construct a graph structure that represents the global similarity between cells, the formula is:
[0086]
[0087] where <·,·> represents the inner product; Z m and Z n It is the potential representation of views view1 and view2.
[0088] The S4 further comprises:
[0089] Align the global cross-view feature similarity map with the high-confidence pseudo-label map as follows:
[0090]
[0091] in, Used to encourage the same samples to be close in cross-view features; Used to force similar but different samples to belong to the same cluster.
[0092] The S4 further comprises:
[0093] Use the global view features to calibrate the local view features and construct the local feature map as follows:
[0094]
[0095] Where <·,·> represents the inner product;
[0096] Align the global view with each local view using the formula:
[0097]
[0098] like Figure 3As shown in the figure, the clustering diagram obtained after using t-SNE to cluster the four data sets of zeisel, Klein, humanESC_timeCourse and humanESC shows that the model has a good clustering effect on different data sets. It can be observed from the figure that data points of the same category (i.e. points with the same color) can be closely clustered together and form a clear cluster structure. This shows that the model can accurately capture the intrinsic structure of the data, achieve consistency and separation of categories, and provide reasonable clustering division for data of different categories.
[0099] In several embodiments provided in the present application, it is understood that each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved.
[0100] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0101] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of protection of the present application.
Claims
1. A cancer single cell clustering method based on semantic-aware contrastive learning, characterized in that: The following steps are involved: S1: Screen highly expressed genes and randomly mask the gene expression of each cell to generate two enhanced views of cell data, view1 and view2; S2: Extract semantic information from views using an autoencoder and train the encoder by minimizing the reconstruction loss; S3: construct cell-cell maps and pseudo-label maps based on different views; S4: A dual contrastive alignment module is applied to capture semantically invariant representations in augmentation by leveraging semantic information in the generated pseudo-label maps.
2. A cancer single cell clustering method based on semantic-aware contrastive learning according to claim 1, characterized in that: The step S1 randomly shields the gene expression of each cell, including: Using the dropout neural network layer, two rounds of random dropout were performed on each cell; Here, a weight of 0 is assigned to the randomly selected gene expression value.
3. The method for clustering cancer single cells based on semantic-aware contrastive learning according to claim 1, characterized in that: S2: extracting semantic information from the view using an automatic encoder, including: Order Z v =f(X v θ v )and Represent the encoding and decoding processes respectively; The encoder compresses the input data into a latent space, and the decoder reconstructs the representation in the latent space back to the original data space; the enhanced views view1 and view2 generated by S1 are used as the input and output of the autoencoder, and the model is trained to minimize the reconstruction error; after the training is completed, the encoder is used to extract the latent representation of each view.
4. The method for clustering cancer single cells based on semantic-aware contrastive learning according to claim 1, characterized in that: The dual comparison and alignment module comprises: The view input X v and output The reconstruction loss between is formulated as follows: Among them, θ v and is a network parameter.
5. The method for cancer single cell clustering based on semantic-aware contrastive learning according to claim 1, characterized in that: The dual comparison and alignment module comprises: Let the feature of the v-th view be expressed as Pseudo Labels Then p v =Classify(Z v ); Compute the pseudo labels p for the two views m and p n The similarity matrix W between G ∈R N×N To construct a pseudo-label graph, it is expressed as: where Classify(·) is the classification head; τ is the threshold; W G The diagonal elements of represent the class probabilities of the same samples across views.
6. The method for cancer single cell clustering based on semantic-aware contrastive learning according to claim 1, characterized in that: The S4 further comprises: Construct a global cross-view feature map S G ∈R N×N , the formula is: where <·,·> represents the inner product; Z m and Z m It is the potential representation of views view1 and view2.
7. The method for cancer single cell clustering based on semantic-aware contrastive learning according to claim 1, characterized in that: The S4 further comprises: Align the global cross-view feature similarity map with the high-confidence pseudo-label map as follows: in, Used to encourage the same samples to be close in cross-view features; Used to force similar but different samples to belong to the same cluster.
8. The method for cancer single cell clustering based on semantic-aware contrastive learning according to claim 6, characterized in that: The S4 further comprises: Use the global view features to calibrate the local view features and construct the local feature map as follows: Where <·,·> represents the inner product; Align the global view with each local view using the formula: Among them, S m is the local feature map of view1; S n It is the local feature map of view2.