Single-cell rna sequencing data processing method, device, equipment and storage medium
By using an adversarial autoencoder model to reduce the dimensionality of single-cell RNA sequencing data, the problem of narrow applicability and low accuracy of existing methods is solved, achieving more efficient dimensionality reduction and feature extraction, which is suitable for precise analysis in digital healthcare platforms.
Patent Information
- Application Number
- CN202310633119.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-05-31
AI Technical Summary
Existing methods for dimensionality reduction of single-cell RNA sequencing data have narrow applicability, low accuracy, and poor processing effects, and cannot effectively extract biological information from single-cell RNA sequencing data.
Dimensionality reduction is achieved by employing an adversarial autoencoder model. By combining an autoencoder and a discriminator, an adversarial mechanism is introduced. The optimization objective is to minimize the combined error of adversarial loss error, mean square error, and structural similarity error, and to extract the feature vectors of the intermediate hidden layers for dimensionality reduction.
It improves the accuracy and reliability of dimensionality reduction results, has a wider range of applications, preserves the authenticity and validity of data, enhances the compression capability and generalization performance of the model, and is suitable for precise analysis on digital healthcare platforms.
Smart Images

Figure CN116580769B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of digital medicine, in particular to a single-cell RNA sequencing data processing method, device, equipment and storage medium. BACKGROUND
[0002] Single-cell RNA sequencing (scRNA-seq) technology is a method for observing gene expression at the single-cell level, which can better study different tissues and different types of cells in the tissues. With the development of single-cell RNA sequencing technology, the data obtained by single-cell RNA sequencing is becoming larger and larger. In the large data set obtained by sequencing, there are certain differences in the single-cell RNA sequences of different categories of cells, and it is necessary to cluster the single-cell RNA sequencing data before further studying the potential biological information in different categories of cells. In the detection data of the digital medical platform, the samples of single-cell RNA sequencing often contain tens of thousands of genes, resulting in a particularly high feature dimension of single-cell RNA sequencing data, and a large amount of redundant noise information in the gene sequencing data. If direct clustering is performed, sufficient time cost and computing power support are required. Therefore, it is necessary to extract the effective information of the single-cell RNA sequencing data and reduce the feature dimension before clustering analysis.
[0003] At present, there are many methods for reducing the dimension of single-cell RNA sequencing data. The classical principal component analysis (PCA) dimension reduction method converts the observation values to a latent space by defining the linear combination of the original data points with the continuous maximum variance (i.e. principal component), which is fast and simple, but the single-cell RNA sequencing data is essentially nonlinear, so it is not suitable for all data sets. The t-distributed Stochastic Neighbor Embedding (t-SNE) and Detrended Correspondence Analysis (DCA) dimension reduction methods have strict distribution assumptions for single-cell RNA sequencing data, which can be applied to sequencing data sets with no obvious cell heterogeneity, but the feature extraction of most single-cell RNA sequencing data is not ideal, often missing or deviating from the biological information of the original data, and the model generalization ability is not outstanding. Therefore, it is necessary to explore a single-cell RNA sequencing data dimension reduction method with higher accuracy and better effect. SUMMARY
[0004] Therefore, it is necessary to provide a single-cell RNA sequencing data processing method, device, equipment and storage medium to solve the problems of narrow applicability, low accuracy and poor processing effect of the existing single-cell RNA sequencing data dimension reduction method.
[0005] A single-cell RNA sequencing data processing method comprises:
[0006] obtain preprocessed sample data by preprocessing the sample sequencing data;
[0007] train a to-be-trained model using the preprocessed sample data to obtain an adversarial autoencoder model; the to-be-trained model comprises an autoencoder model and a discriminator; the autoencoder model comprises an encoder, an intermediate hidden layer and a decoder; the discriminator is used to adjust the distribution of output data of the autoencoder model;
[0008] input to-be-reduced sequencing data into the adversarial autoencoder model for dimensionality reduction, and extract a feature vector of the intermediate hidden layer to obtain low-dimensional sequencing data.
[0009] A single-cell RNA sequencing data processing device comprises:
[0010] A data preprocessing module is configured to obtain sample sequencing data, preprocess the sample sequencing data, and obtain preprocessed sample data.
[0011] A model training module is configured to train a to-be-trained model using the preprocessed sample data to obtain an adversarial autoencoder model; the to-be-trained model comprises an autoencoder model and a discriminator; the autoencoder model comprises an encoder, an intermediate hidden layer and a decoder; the discriminator is used to adjust the distribution of output data of the autoencoder model.
[0012] A data dimensionality reduction module is configured to input to-be-reduced sequencing data into the adversarial autoencoder model for dimensionality reduction, and extract a feature vector of the intermediate hidden layer to obtain low-dimensional sequencing data.
[0013] A computer device comprises a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, and the processor executes the computer readable instructions to implement the single-cell RNA sequencing data processing method.
[0014] One or more readable storage media storing computer readable instructions, which are executed by one or more processors to cause the one or more processors to perform the single-cell RNA sequencing data processing method.
[0015] The single-cell RNA sequencing data processing method, device, computer device and storage medium obtain sample sequencing data, preprocess the sample sequencing data to obtain preprocessed sample data, train a to-be-trained model using the preprocessed sample data to obtain an adversarial auto-encoder model, the to-be-trained model includes an auto-encoder model and a discriminator, the auto-encoder model includes an encoder, an intermediate hidden layer and a decoder, and the discriminator is used to adjust the distribution of output data of the auto-encoder model, and the to-be-reduced sequencing data is input into the adversarial auto-encoder model for dimension reduction, and a feature vector of the intermediate hidden layer is extracted to obtain low-dimensional sequencing data. The application provides an efficient and accurate dimension reduction processing method for feature mining and clustering analysis of single-cell RNA sequencing data. First, no distribution assumption is needed for cell expression of the sequencing data, the authenticity and effectiveness of the data are retained, and the application range is wider. Second, an adversarial mechanism is introduced in the dimension reduction task, and a comprehensive error based on adversarial loss error, mean square error and structural similarity error is minimized as an optimization target, the compression capability and generalization performance of the model are improved in multiple directions, the accuracy and reliability of the dimension reduction processing result are improved, and the data at the cell level is more accurately analyzed by the digital medical platform. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the application. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 is a flowchart of a single-cell RNA sequencing data processing method in an embodiment of the application;
[0018] Figure 2 is a structural diagram of an adversarial auto-encoder model in an embodiment of the application;
[0019] Figure 3 is a structural diagram of a single-cell RNA sequencing data processing device in an embodiment of the application;
[0020] Figure 4 is a schematic diagram of a computer device in an embodiment of the application. DETAILED DESCRIPTION
[0021] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0022] The single-cell RNA sequencing data processing method provided by the embodiments of the present application can be applied to sample detection and analysis business scenarios in the medical field, for example, single-cell RNA sequencing is applied to tumor cell heterogeneity research, discovery of new mutation sites, tumor cell clonal evolution mechanism and identification of related new biomarkers, etc. The single-cell RNA sequencing data processing method of the present embodiment improves the accuracy and reliability of the dimension reduction processing result, can fully extract the information expressed by the cells, obtain more abundant gene information, and make the identification resolution of the cell types higher, which helps to improve the analysis level of precision medical services.
[0023] In an embodiment, as shown in Figure 1 A single-cell RNA sequencing data processing method is provided, comprising the following steps S10-S30.
[0024] S10, obtaining sample sequencing data, preprocessing the sample sequencing data to obtain preprocessed sample data.
[0025] Understandably, the sample sequencing data refers to single-cell RNA sequencing data based on scRNA-seq data sets. The scRNA-seq technology provides a method for observing gene expression at the single-cell level, which can better study different tissues and different types of cells existing therein, and is widely used in many aspects of exploring heterogeneity, lineage path analysis and random gene expression research. Obtain scRNA-seq data sets from different species, different types, and different cell numbers as sample sequencing data, preprocess the sample sequencing data to remove error data and abnormal data, and obtain noise-free preprocessed sample data. The preprocessing includes removing blank cell data, maximum library data standardization and expression data standardization, and the preprocessed sample data is input into the model for training in the subsequent step.
[0026] S20, using the preprocessed sample data to train a to-be-trained model to obtain an adversarial autoencoder model; the to-be-trained model includes an autoencoder model and a discriminator; the autoencoder model includes an encoder, an intermediate hidden layer and a decoder; the discriminator is used to adjust the distribution of the output data of the autoencoder model.
[0027] Understandably, as shown in Figure 2As shown, the autoencoder model is composed of an encoder, an intermediate hidden layer and a decoder, a discriminator is added to the autoencoder model to generate an adversarial autoencoder model as a to-be-trained model. The autoencoder (AE) model is composed of an input layer, an intermediate hidden layer and an output layer, and has a symmetric structure. The number of nodes of the input layer is the same as that of the output layer, and the connection strength of the input layer and the intermediate hidden layer is symmetric. The encoder is used for mapping from the input layer to the intermediate hidden layer, and the decoder is used for mapping from the intermediate hidden layer to the output layer. The autoencoder model is trained iteratively in an unsupervised manner, and the high-dimensional input layer data is expressed by the low-dimensional intermediate hidden layer data, so as to realize dimension reduction of the data and minimize the reconstruction error of the output layer data and the input layer data. The autoencoder model is used as a generator, and a discriminator is added to generate a to-be-trained model. The to-be-trained model is trained using preprocessed sample data to obtain an adversarial autoencoder (AAE) model. The adversarial autoencoder model introduces the idea of adversarial training and optimization. The discriminator judges the real data of the sample and the data output by the generator, that is, the inference is completed by matching the aggregated posterior distribution of the generator with any prior distribution. The matching of the aggregated posterior and the prior can ensure that meaningful sample data is generated from any part of the prior space. In specific embodiments, the encoder, the decoder and the discriminator in the adversarial autoencoder model can be a 1, 2, 3 or 4 layer design of a fully connected neural network with 16, 32, 64, 128, 256, 512 or 1024 nodes.
[0028] S30, input the to-be-dimension-reduced sequencing data into the adversarial autoencoder model for dimension reduction, and extract the feature vector of the intermediate hidden layer to obtain low-dimensional sequencing data.
[0029] Understandably, the trained adversarial autoencoder model is used as a feature extraction model, and the trained adversarial autoencoder model includes an intermediate hidden layer. The dimension of the feature vector of the intermediate hidden layer is less than that of the input vector. The to-be-dimension-reduced sequencing data in the single-cell RNA sequencing data is obtained, the to-be-dimension-reduced sequencing data is input into the feature extraction model for dimension reduction, and the feature vector of the intermediate hidden layer is extracted by a forward propagation algorithm to obtain low-dimensional sequencing data. The low-dimensional sequencing data after dimension reduction can greatly contain biological information in the single-cell RNA sequencing data with a small number of genes, increase the effective representation of gene data, and reduce the time cost and computing power support required for subsequent clustering analysis.
[0030] The embodiment obtains single-cell RNA sequencing data as sample sequencing data, and provides an efficient and accurate dimension reduction processing method for feature mining and clustering analysis of single-cell RNA sequencing data. The sample sequencing data is preprocessed to obtain preprocessed sample data; the preprocessed sample data is used to train a to-be-trained model to obtain an adversarial autoencoder model; the to-be-trained model includes an autoencoder model and a discriminator; the autoencoder model includes an encoder, an intermediate hidden layer and a decoder; the discriminator is used to adjust the distribution of output data of the autoencoder model; and the to-be-reduced sequencing data is input into the adversarial autoencoder model for dimension reduction, and a feature vector of the intermediate hidden layer is extracted to obtain low-dimensional sequencing data. First, no distribution assumption is needed for the cell expression of single-cell RNA sequencing data, the authenticity and effectiveness of the data are retained, and the application range is wider; second, the mechanism of confrontation is introduced in the dimension reduction task, the “compression-decoding” ability of the autoencoder model is constrained by the discriminator, it is ensured that the input data and the output data are of the same distribution, and then the dimension reduction processing effect of the intermediate hidden layer is ensured; finally, based on the minimum comprehensive error of the adversarial loss error, the mean square error and the structural similarity error as the optimization target, the compression ability and the generalization performance of the adversarial autoencoder model are improved in multiple directions, the accuracy and the reliability of the dimension reduction processing result are improved, and it is beneficial to more accurate analysis of the data at the cell level by the digital medical platform.
[0031] Optionally, in step S10, that is, the obtaining of the sample sequencing data, the sample sequencing data is preprocessed to obtain preprocessed sample data, including:
[0032] S101, obtaining sample sequencing data, performing blank removal processing on the sample sequencing data to obtain first preprocessed data;
[0033] S102, performing maximum library normalization processing on the first preprocessed data to obtain second preprocessed data;
[0034] S103, performing expression normalization processing on the second preprocessed data to obtain the preprocessed sample data.
[0035] Understandably, the single-cell RNA sequencing data has a large amount of data, and the single-cell RNA sequencing data as sample sequencing data needs to be preprocessed to remove error data and abnormal data. In a specific embodiment, the data set of the sample sequencing data is wherein, X i =(x i1 , x i2 , x i3 ,..., x im ) represents the sequence data of the i-th cell, i = 1, 2, 3,..., n0, n0 represents the number of cells, m represents the number of genes, and x ijXi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m.
[0036] The blank cell data refers to the cell data without gene expression or with only a small number of gene expressions. The blank cell data cannot provide effective information and increases the time cost of model training. Therefore, the preprocessing needs to remove the blank cell data. For the sequence data of the ith cell, if the following judgment condition is met, it is removed:
[0037]
[0038] num1 represents the threshold value of the number of genes not expressed in the cell data, and is set to 10 by default; δ(x ij Xi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m.
[0039]
[0040] Xi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m.
[0041] The dataset of the sample sequencing data contains n0 pieces of cell data. The blank removal processing is performed on the sample sequencing data to obtain the first preprocessing data, and the dataset of the first preprocessing data contains n pieces of cell data.
[0042] In order to remove the influence of sequencing depth and gene length, the expression amount of the gene in the first preprocessing data is processed by maximum library size normalization (MLSN) to obtain the second preprocessing data. The maximum library size normalization processing is as follows:
[0043]
[0044] Xi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m. Xi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m. ij Xi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m. i· Xi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m.
[0045] In the dataset of single-cell RNA sequencing data, different species and different types of cell data often show high heterogeneity, which increases the difficulty of model training. The expression amount of the gene in the second preprocessing data is divided by the maximum expression amount to perform cell expression amount normalization to obtain the preprocessing sample data. The cell expression amount normalization processing is as follows:
[0046] Xi,j represents the expression amount of the jth gene on the ith cell, j = 1, 2, 3,..., m.
[0047] wherein, xi,j represents the expression amount x of the jth gene on the ith cell ij The results after maximum library normalization and cell expression normalization.
[0048] The preprocessing of the present embodiment can eliminate the noise influence of error data and abnormal data through blanking processing, and can reduce the problem of too large difference in expression amount of different genes through maximum library normalization and cell expression normalization, while weakening the strong features, the features with smaller values but characteristics are as much as possible to be shown, the influence of gene order of magnitude is removed, and the stability of subsequent model gradient update is improved.
[0049] Optionally, in step S10, i.e., the obtaining of the sample sequencing data, the sample sequencing data is preprocessed to obtain preprocessed sample data, and the preprocessing further includes:
[0050] S104, sampling processing is performed on the preprocessed sample data to obtain first amplified data;
[0051] S105, Gaussian noise adding processing is performed on the preprocessed sample data to obtain second amplified data;
[0052] S106, the preprocessed sample amplified data is generated according to the first amplified data and the second amplified data.
[0053] Understandably, the sample of single-cell RNA sequencing often contains tens of thousands of genes, and the sample sequencing data obtained by sequencing can provide sufficient cell data information to meet the training needs of the adversarial autoencoder model; in special cases, the sample obtained by single-cell RNA sequencing contains only a small amount of genes, and the sample sequencing data has only dozens or hundreds of data, which is difficult to meet the training needs of the adversarial autoencoder model. When the data amount of the preprocessed sample data is less than 1000, the preprocessed sample amplified data is obtained through data perturbation processing to meet the training needs of the adversarial autoencoder model, and the model is assisted to realize the mining of cell data information. The data perturbation processing includes sampling processing and Gaussian noise adding processing.
[0054] In a specific embodiment, the sampling processing refers to multiple times of sampling with replacement on the preprocessed sample data through Bootstrap sampling, and new cell data is generated by disturbing the correlation between genes to obtain first amplified data. The process of Bootstrap sampling is as follows: a data set D1={x ij |i=1, 2, 3,..., n; j=1, 2, 3,..., m}, wherein n represents the number of cells, m represents the number of genes, and x ijrepresents the expression amount of the jth gene expressed on the ith cell; the expression amount of the jth gene expressed in n cells of the pretreated sample data is respectively x 1j , x 2j , x 3j ,..., x nj , the expression amount data of the jth gene is equally-probabilistically sampled, and the sampling result is The sampling operation is repeated m times for m genes, and a new cell data is obtained. k After repeating the sampling K times, K is set as 10 by default 4 , and an amplified data is obtained. The amplified data contains K cell data.
[0055] In an embodiment, the Gaussian noise processing refers to randomly sampling 10% of the expression amount data of each cell sequence data, and adding random noise of one-dimensional standard normal distribution to obtain secondary amplified data. The process of adding Gaussian noise processing is as follows: obtaining the data set D1 of the pretreated sample data = {x ij |i = 1, 2, 3,..., n; j = 1, 2, 3,..., m}, wherein n represents the number of cells, m represents the number of genes, x ij represents the expression amount of the jth gene expressed on the ith cell; X i = (x i1 , x i2 , x i3 ,..., x im ) represents the sequence data of the ith cell, i = 1, 2, 3,..., n, and t genes are sampled for the ith cell sequence data, and Gaussian noise is added to the expression amount of the t s th gene of the ith cell. The Gaussian noise processing is repeated n times for n cells, and n new cell data are obtained as secondary amplified data. The Gaussian noise processing includes:
[0056]
[0057] , wherein represents the expression amount data of the t s th gene of the ith cell after adding Gaussian noise, represents the expression amount data of the t s th gene of the ith cell, represents Gaussian noise.
[0058] The primary expansion data contains K pieces of cell data, the secondary expansion data contains n pieces of cell data, and the pre-processed sample expansion data contains K+n pieces of cell data. When the data amount of the pre-processed sample data is less than 1000, after obtaining the pre-processed sample expansion data through the data perturbation processing, the method further comprises: inputting the pre-processed sample expansion data into the to-be-trained model to pre-train and obtain a pre-trained model; inputting the pre-processed sample data into the pre-trained model to perform formal training and obtain the adversarial auto-encoder model.
[0059] The embodiment fully considers the case that the sample data amount of single-cell RNA sequencing is small, realizes data expansion through sampling processing and adding Gaussian noise processing, so that the model has excellent fitting ability and generalization performance on the sample sequencing data set with fewer cells. Meanwhile, the pre-training method is used to improve the performance of the model. The pre-training is essentially a kind of transfer learning method. The pre-training is performed on the pre-processed sample expansion data with the same distribution as the sample sequencing data but with noise to shape the rudiment of the adversarial auto-encoder model, so that the adversarial auto-encoder model can be directly transferred from the distribution containing noise to the real distribution when the pre-processed sample data is inputted, and the training of the adversarial auto-encoder model is more effective.
[0060] Optionally, in step S20, the loss function for training the to-be-trained model comprises:
[0061]
[0062] Wherein, min represents minimization;
[0063] Loss represents the loss function of the adversarial auto-encoder model;
[0064] i represents the i-th output sequence;
[0065] n represents the number of output sequences;
[0066] L i represents the loss function of the i-th output sequence;
[0067] represents the adversarial loss function of the i-th output sequence;
[0068] β represents the weight of the adversarial loss function;
[0069] L S represents the structural similarity loss function of the output sequence;
[0070] represents the mean square error loss function of the i-th output sequence;
[0071] α represents the weight of the mean square error loss function;
[0072] γ represents the weight of the generator loss function.
[0073] Understandably, preprocessed sample data is used to train the model to be trained. The training objective is to minimize the sum of the loss function values of the output sequences of all preprocessed sample data, using the preprocessed sample data as input sequences, to obtain an adversarial autoencoder model. In a specific embodiment, the i-th cell sequence data (i = 1, 2, 3, ..., n) is obtained from the preprocessed sample data. After inputting the i-th cell sequence data into the model to be trained, the loss function value of the i-th output sequence includes the structural similarity loss and mean squared error of the autoencoder model, as well as the adversarial loss of the discriminator. The loss function of the i-th output sequence is expressed as:
[0074]
[0075] Where α∈(0,1) and β, γ>0, the weight values can be obtained through training.
[0076] L S The structural similarity loss function for the output sequence, which is the negative of the structural similarity, is expressed as follows:
[0077]
[0078] in, The structural similarity of the output sequences is represented by y, where y represents the input sequences. Represents the output sequence, μ y This represents the average of n input sequences. This represents the average of n output sequences. This represents the variance of y. express variance Represent y and The covariance, C1 and C2 are two constants that maintain stability.
[0079] The mean squared error of the i-th output sequence is expressed as follows:
[0080]
[0081] Where num(gene) represents the number of genes, and in this embodiment, the number of genes is m, j = 1, 2, 3, ..., m, y ij This represents the expression level of the j-th gene in the i-th input sequence. This represents the expression level of the j-th gene in the i-th output sequence.
[0082] The adversarial loss for the i-th output sequence is expressed as follows:
[0083]
[0084] wherein D represents a discriminator, y i represents the i-th input sequence, represents the i-th output sequence. According to the weighted calculation of the structural similarity loss, the mean square error and the adversarial loss, the loss function of the to-be-trained model is as follows:
[0085]
[0086] The embodiment considers the loss function of the to-be-trained model from multiple aspects. In the model training process, not only the adversarial loss and the mean square error in the reconstruction error aspect are concerned, but also an index measuring the structural similarity is introduced as the structural similarity loss to guarantee the similarity of the input sequence and the output sequence in structure. The optimization objective of minimizing the "adversarial loss + mean square error + structural similarity error" is integrated to improve the "compression-decoding" performance of the model from multiple aspects, so that the intermediate hidden layer can contain the feature information in the single-cell RNA sequencing data to the maximum extent while realizing dimension reduction.
[0087] Optionally, the preprocessed data includes training set data and test set data; in step S20, that is, the using the preprocessed sample data to train the to-be-trained model to obtain an adversarial autoencoder model includes:
[0088] S201, inputting the training set data into the to-be-trained model to perform discriminator training to obtain discriminator parameters;
[0089] S202, taking an autoencoder model as a generator, inputting the training set data into the to-be-trained model to perform generator training to obtain generator parameters;
[0090] S203, determining the adversarial autoencoder model according to the discriminator parameters and the generator parameters.
[0091] Understandably, before inputting the preprocessed data into the to-be-trained model, the preprocessed data needs to be divided into two parts according to a preset ratio to obtain training set data and test set data, the training set data is used for training the model, and the test set data is used for testing the trained model to ensure the accuracy of the trained model. The to-be-trained model includes an autoencoder model and a discriminator, the autoencoder model is used as a generator, the discriminator is used for adjusting the distribution of output data of the generator, and an adversarial autoencoder model is obtained. There are various ways when the training set data is input into the to-be-trained model for training and updating, among which, the batch gradient descent (batch gradient descent) calculates the loss function to update the gradient after traversing all the data, which leads to too complex calculation; the mini-batch gradient descent (mini-batch gradient descent) randomly selects a certain amount of data for training, and then calculates the loss function to update the gradient, which has less calculation and small training fluctuation. The embodiment of the present application preferably trains in the manner of mini-batch.
[0092] In a specific embodiment, a data set D = {X1, X2, X3,..., Xn} of preprocessed data is obtained. n , wherein X i represents sequence data of the i-th cell, i = 1, 2, 3,..., n, n represents the number of cells; the preprocessed data is randomly divided according to a ratio of 6:4, 60% of the preprocessed data is taken as training set data , and 40% of the preprocessed data is taken as test set data , wherein X i represents training set sequence data of the i-th cell, X' i represents test set sequence data of the i-th cell, n1+n2 = n; the to-be-trained model is initialized, the initial generator parameters are fixed, the training set data is input into the to-be-trained model for discriminator training, the discriminator parameters are obtained, so that the discriminator can distinguish between input sequence data and compressed-decoded output sequence data; the discriminator parameters are fixed, the training set data is input into the to-be-trained model for generator training, the generator parameters are obtained; the adversarial autoencoder model is determined according to the discriminator parameters and the generator parameters. When the adversarial autoencoder model has the compression-decoding capability, the distribution of the output sequence data will continuously approach or even coincide with the distribution of the input sequence data, that is, the discriminator cannot distinguish between the input sequence data and the output sequence data, the adversarial loss function value corresponding to the discriminator increases, and after taking the reciprocal, it decreases, so the negative value of the adversarial loss part in the comprehensive loss function ensures the optimization goal of minimizing the loss function.
[0093] The embodiment does not need to make a distribution assumption on the cell expression quantity of single-cell RNA sequencing data, has higher generalization performance and feature description capability; the auto-encoder model is used as the generator, the discriminator is added to introduce the idea of confrontation, the distribution of the input data and the output data is better described through the training of the generator and the discriminator, and the optimization objective of minimizing the loss function is ensured.
[0094] Optionally, in step S202, that is, the training set data is input into the to-be-trained model to perform generator training, and generator parameters are obtained, including:
[0095] S2021, fixing the discriminator parameters, inputting the training set data into the to-be-trained model to perform forward propagation training and calculation, and obtaining an adversarial loss function value;
[0096] S2022, fixing the discriminator parameters, performing back propagation training on the to-be-trained model according to the adversarial loss function value, and obtaining generator update parameters;
[0097] S2023, when the generator update parameters meet a preset training requirement, the generator update parameters are determined as the generator parameters.
[0098] Understandably, the forward propagation algorithm inputs the input sequence into the to-be-trained model, takes the output of the previous layer as the input of the next layer, and calculates the output of the next layer, until the output sequence is calculated. The back propagation algorithm is a short name of error back propagation, which is combined with an optimization method (such as gradient descent method) to train an artificial neural network model, and is used to update the weight value to minimize the loss function. In a specific embodiment, the discriminator parameters are fixed, the training set data is input into the to-be-trained model to perform forward propagation training and calculation, and an adversarial loss function value is obtained; the to-be-trained model is trained by back propagation according to the adversarial loss function value, the back propagation training adopts a stochastic gradient descent (SGD) mode, reads one data at a time, calculates the loss function to update the gradient, and iterates the parameters according to the running result to obtain generator update parameters, to complete one training; the training is repeated for multiple times, and when the generator update parameters meet a preset training requirement, the generator update parameters are determined as the generator parameters.
[0099] In the embodiment, the discriminator parameters are fixed to determine the generator parameters, the “compression-decoding” capability of the generator is constrained by the discriminator, the loss function is optimized through forward propagation and back propagation, the input data and the output data are ensured to be in the same distribution, and then the dimension reduction processing effect of the intermediate hidden layer is ensured.
[0100] Optionally, in step S2023, when the generator update parameter satisfies the preset training requirement, the generator update parameter is determined as the generator parameter, including:
[0101] S20231, when the adversarial loss function value meets the preset convergence condition, input the test set data into the to-be-trained model containing the generator update parameter, and calculate the test loss value of the test set data;
[0102] S20232, when the test loss value is in the preset loss value interval, the generator update parameter is determined as the generator parameter.
[0103] Understandably, after several times of training, when the adversarial loss function value meets the preset convergence condition, the test set data is input into the to-be-trained model containing the generator update parameter for a test, and the test loss value of the test set data is calculated; the training loss value is obtained, when the training loss value L train and the test loss value L test are in the preset loss value interval, that is, the training loss value and the test loss value meet the stop training condition, the generator update parameter is determined as the generator parameter, and the adversarial autoencoder model is returned. The stop training condition includes: the adversarial loss function value meets the preset convergence condition, the discriminator cannot well distinguish the input and output sequences, that is the training loss value L train and the test loss value L test are in the preset loss value interval, ε2 train < ε3, ε4 test < ε5, and the test error does not have a significant rebound fluctuation. Wherein, ε1, ε2, ε3, ε4 and ε5 are respectively corresponding to different loss function value thresholds, the setting of the threshold needs to be determined according to the actual expression amount of the single cell RNA sequencing data cell data set. For the cell data set with high expression amount, the loss of the model will be larger, and the corresponding threshold will be higher. For the cell data set with low or no expression, the loss of the model will be smaller, and the corresponding threshold will be lower.
[0104] In the embodiment, under the premise that the adversarial loss function value meets the preset convergence condition, by judging the training loss value and the test loss value, when the training loss value and the test loss value simultaneously meet the stop training condition, the model performance is greatly improved and the overfitting phenomenon does not appear.
[0105] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0106] In an embodiment, a single-cell RNA sequencing data processing device is provided, which corresponds to the single-cell RNA sequencing data processing method in the above embodiments. As shown in Figure 3 The single-cell RNA sequencing data processing device includes a data preprocessing module 10, a model training module 20, and a data dimension reduction module 30. The functions of each module are described in detail as follows:
[0107] The data preprocessing module 10 is configured to obtain sample sequencing data, preprocess the sample sequencing data, and obtain preprocessed sample data.
[0108] The model training module 20 is configured to train a to-be-trained model using the preprocessed sample data to obtain an adversarial autoencoder model. The to-be-trained model includes an autoencoder model and a discriminator. The autoencoder model includes an encoder, an intermediate hidden layer, and a decoder. The discriminator is configured to adjust the distribution of output data of the autoencoder model.
[0109] The data dimension reduction module 30 is configured to input to-be-dimension-reduced sequencing data into the adversarial autoencoder model for dimension reduction, and extract a feature vector of the intermediate hidden layer to obtain low-dimensional sequencing data.
[0110] Optionally, the data preprocessing module 10 includes:
[0111] The blank removal processing unit is configured to obtain sample sequencing data, perform blank removal processing on the sample sequencing data, and obtain primary preprocessed data.
[0112] The maximum library normalization processing unit is configured to perform maximum library normalization processing on the primary preprocessed data to obtain secondary preprocessed data.
[0113] The expression normalization processing unit is configured to perform expression normalization processing on the secondary preprocessed data to obtain the preprocessed sample data.
[0114] Optionally, the data preprocessing module 10 further includes:
[0115] The sampling processing unit is configured to perform sampling processing on the preprocessed sample data to obtain primary amplified data.
[0116] The Gaussian noise adding processing unit is configured to perform Gaussian noise adding processing on the preprocessed sample data to obtain secondary amplified data.
[0117] The preprocessed sample amplified data generation unit is configured to generate the preprocessed sample amplified data according to the primary amplified data and the secondary amplified data.
[0118] Optionally, the model training module 20 includes:
[0119] a loss function unit configured to train a loss function of the to-be-trained model, wherein the loss function comprises:
[0120]
[0121] wherein min represents minimization;
[0122] Loss represents a loss function of the adversarial auto-encoder model;
[0123] i represents an i-th output sequence;
[0124] n represents a number of output sequences;
[0125] L i represents a loss function of the i-th output sequence;
[0126] represents an adversarial loss function of the i-th output sequence;
[0127] β represents a weight of the adversarial loss function;
[0128] L S represents a structural similarity loss function of the output sequence;
[0129] represents a mean square error loss function of the i-th output sequence;
[0130] α represents a weight of the mean square error loss function;
[0131] γ represents a weight of the generator loss function.
[0132] Optionally, the model training module 20 comprises:
[0133] a discriminator training unit configured to input the training set data into the to-be-trained model to perform discriminator training, and obtain discriminator parameters;
[0134] a generator training unit configured to input the training set data into the to-be-trained model to perform generator training, and obtain generator parameters, wherein the auto-encoder model is used as a generator;
[0135] an adversarial auto-encoder model generation unit configured to determine the adversarial auto-encoder model according to the discriminator parameters and the generator parameters.
[0136] Optionally, the model training module 20 further comprises:
[0137] a forward propagation training unit configured to fix the discriminator parameters, input the training set data into the to-be-trained model to perform forward propagation training and calculation, and obtain an adversarial loss function value;
[0138] The back propagation training unit is configured to perform back propagation training on the to-be-trained model according to the adversarial loss function value, and obtain generator update parameters.
[0139] The generator parameter determination unit is configured to determine the generator update parameters as the generator parameters when the generator update parameters meet preset training requirements.
[0140] Optionally, the model training module 20 further comprises:
[0141] The test loss value calculation unit is configured to input the test set data into the to-be-trained model containing the generator update parameters, and calculate a test loss value of the test set data when the adversarial loss function value meets preset convergence conditions.
[0142] The test loss value judgment unit is configured to determine the generator update parameters as the generator parameters when the test loss value is in a preset loss value interval.
[0143] The specific limitations of the single-cell RNA sequencing data processing device can refer to the limitations of the single-cell RNA sequencing data processing method described above, which will not be repeated here. Each module in the single-cell RNA sequencing data processing device described above can be realized by software, hardware and their combinations in whole or in part. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in the form of software, so as to call and execute the operations corresponding to each module by the processor.
[0144] In one embodiment, a computer device is provided, which can be a server, and the internal structure diagram thereof can be as shown in Figure 4 The computer device comprises a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a readable storage medium and an internal memory. The readable storage medium stores an operating system, computer readable instructions and a database. The internal memory provides an environment for the operation of the operating system and the computer readable instructions in the readable storage medium. The database of the computer device is configured to store data related to the single-cell RNA sequencing data processing method. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer readable instructions are executed by the processor to implement a single-cell RNA sequencing data processing method. The readable storage medium provided in the embodiment comprises a non-volatile readable storage medium and a volatile readable storage medium.
[0145] In one embodiment, a computer device is provided, comprising a memory, a processor, and computer readable instructions stored on the memory and executable on the processor, wherein the processor implements the following steps when executing the computer readable instructions:
[0146] Obtaining sample sequencing data, preprocessing the sample sequencing data to obtain preprocessed sample data;
[0147] Training a to-be-trained model using the preprocessed sample data to obtain an adversarial autoencoder model; the to-be-trained model comprises an autoencoder model and a discriminator; the autoencoder model comprises an encoder, an intermediate hidden layer, and a decoder; the discriminator is used to adjust the distribution of output data of the autoencoder model;
[0148] Inputting to-be-reduced-dimension sequencing data into the adversarial autoencoder model to reduce the dimension, and extracting a feature vector of the intermediate hidden layer to obtain low-dimensional sequencing data.
[0149] In one embodiment, one or more computer readable storage media storing computer readable instructions are provided. The computer readable storage media provided by the embodiment includes non-volatile readable storage media and volatile readable storage media. The computer readable instructions are stored on the readable storage media, and when executed by one or more processors, the following steps are implemented:
[0150] Obtaining sample sequencing data, preprocessing the sample sequencing data to obtain preprocessed sample data;
[0151] Training a to-be-trained model using the preprocessed sample data to obtain an adversarial autoencoder model; the to-be-trained model comprises an autoencoder model and a discriminator; the autoencoder model comprises an encoder, an intermediate hidden layer, and a decoder; the discriminator is used to adjust the distribution of output data of the autoencoder model;
[0152] Inputting to-be-reduced-dimension sequencing data into the adversarial autoencoder model to reduce the dimension, and extracting a feature vector of the intermediate hidden layer to obtain low-dimensional sequencing data.
[0153] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing relevant hardware through computer readable instructions, and the computer readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer readable instructions are executed, the processes of the above-mentioned embodiments of the method can be included. Any reference to memory, storage, database or other medium used in each embodiment provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0154] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0155] The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not limit it; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for processing single-cell RNA sequencing data, characterized in that, The method comprises: obtaining sample sequencing data, preprocessing the sample sequencing data to obtain preprocessed sample data; training a to-be-trained model using the preprocessed sample data to obtain an adversarial autoencoder model; the to-be-trained model comprises an autoencoder model and a discriminator; the autoencoder model comprises an encoder, an intermediate hidden layer and a decoder; the discriminator is used to adjust the distribution of output data of the autoencoder model; the preprocessed sample data comprises training set data and test set data; inputting to-be-reduced sequencing data into the adversarial autoencoder model to reduce the dimension, and extracting a feature vector of the intermediate hidden layer to obtain low-dimensional sequencing data; wherein, the training of the to-be-trained model using the preprocessed sample data to obtain an adversarial autoencoder model comprises: inputting the training set data into the to-be-trained model for discriminator training to obtain discriminator parameters; inputting the training set data into the to-be-trained model for generator training to obtain generator parameters, with the autoencoder model as a generator; determining the adversarial autoencoder model according to the discriminator parameters and the generator parameters.
2. The single-cell RNA sequencing data processing method of claim 1, wherein, The method comprises: obtaining sample sequencing data, preprocessing the sample sequencing data to obtain preprocessed sample data; obtaining sample sequencing data, preprocessing the sample sequencing data to obtain preprocessed sample data; obtaining sample sequencing data, preprocessing the sample sequencing data to obtain preprocessed sample data; 3. The single-cell RNA sequencing data processing method of claim 1, wherein, The method further comprises: sampling the preprocessed sample data to obtain first amplified data; adding Gaussian noise to the preprocessed sample data to obtain second amplified data; generating the preprocessed sample data according to the first amplified data and the second amplified data.
4. The single-cell RNA sequencing data processing method of claim 1, wherein, The loss function for training the to-be-trained model comprises: wherein denotes minimization; denotes a loss function of the adversarial autoencoder model; represents the first output sequence; represents the number of output sequences; Indicates the first The loss function for each output sequence; represents the adversarial loss function for the th output sequence. represents a weight for the adversarial loss function; a structure similar loss function representing an output sequence; represents the mean squared error loss function for the th output sequence. denotes the weight of the mean square error loss function; denotes the weight of the generator loss function.
5. The single-cell RNA sequencing data processing method of claim 1, wherein, The generator training of the to-be-trained model using the training set data to obtain generator parameters comprises: fixing the discriminator parameters, inputting the training set data into the to-be-trained model for forward propagation training and calculation to obtain an adversarial loss function value; fixing the discriminator parameters, performing back propagation training on the to-be-trained model according to the adversarial loss function value to obtain generator update parameters; when the generator update parameters meet the preset training requirements, determining the generator update parameters as the generator parameters.
6. The single-cell RNA sequencing data processing method of claim 5, wherein, The determination of the generator update parameters as the generator parameters when the generator update parameters meet the preset training requirements comprises: when the adversarial loss function value meets the preset convergence condition, inputting the test set data into the to-be-trained model containing the generator update parameters and calculating a test loss value of the test set data; when the test loss value is in a preset loss value interval, determining the generator update parameters as the generator parameters.
7. A single-cell RNA sequencing data processing apparatus, comprising: The method comprises: The data preprocessing module is configured to obtain sample sequencing data, preprocess the sample sequencing data, and obtain preprocessed sample data. The model training module is configured to train a to-be-trained model using the preprocessed sample data, and obtain an adversarial autoencoder model. The to-be-trained model includes an autoencoder model and a discriminator. The autoencoder model includes an encoder, an intermediate hidden layer, and a decoder. The discriminator is configured to adjust the distribution of output data of the autoencoder model. The preprocessed sample data includes training set data and test set data. The data dimension reduction module is configured to input to-be-dimension-reduced sequencing data into the adversarial autoencoder model for dimension reduction, extract a feature vector of the intermediate hidden layer, and obtain low-dimensional sequencing data. The model training module includes: The discriminator training unit is configured to input the training set data into the to-be-trained model for discriminator training, and obtain discriminator parameters. The generator training unit is configured to use the autoencoder model as a generator, input the training set data into the to-be-trained model for generator training, and obtain generator parameters. The adversarial autoencoder model generation unit is configured to determine the adversarial autoencoder model according to the discriminator parameters and the generator parameters.
8. A computer device comprising a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, wherein, The processor executes the computer-readable instructions to implement the single-cell RNA sequencing data processing method of any one of claims 1 to 6.
9. A computer-readable storage medium having stored computer-readable instructions, wherein, The computer-readable instructions are executed by one or more processors to cause the one or more processors to perform the single-cell RNA sequencing data processing method of any one of claims 1 to 6.
Citation Information
Patent Citations
Single-cell sequencing data dimension reduction method fusing gene ontology and neural network
CN111564183A
Method and device for processing single-cell RNA sequencing data and electronic equipment
CN114038508A