A method for batch effect correction of metabolomics data based on generative adversarial network

By constructing a batch correction method for metabolomics data based on generative adversarial networks, the batch effect problem caused by multi-center experiments and instrument fluctuations was solved, achieving accurate correction and quality improvement of metabolomics data, and supporting biomarker discovery and drug development.

CN121281627BActive Publication Date: 2026-03-31DALIAN CHEM DATA SOLUTION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing batch correction methods for metabolomics data are insufficient to effectively eliminate complex nonlinear batch effects caused by differences in multicenter experiments and fluctuations in instrument performance, resulting in data bias and incomparability across batches, especially in multi-omics integrated studies where data accuracy and reliability are inadequate.

Method used

We employ a generative adversarial network (GAN)-based approach, constructing an attention mechanism neural network model, a GAN model, and a time series model for deep joint training. By combining gradient collaborative updates and time-dynamic guidance, we optimize model parameters and correct metabolomics data.

Benefits of technology

By deeply mining data features, accurately correcting batch effects, improving data quality, and enhancing the comparability of data from different batches, reliable data support can be provided for biomarker discovery, disease diagnosis, and drug development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121281627B_ABST
    Figure CN121281627B_ABST
Patent Text Reader

Abstract

The application provides a method for correcting batch effect of metabolomics data based on a generative adversarial network, relates to the cross technical field of bioinformatics and analytical chemistry, and comprises the following steps: generating a metabolomics data training set and a metabolomics data test set; constructing a neural network model based on an attention mechanism; constructing a generative adversarial network model; constructing a time series according to the metabolomics data training set, and constructing a time series model based on the time series; performing deep joint training on the constructed neural network model, generative adversarial network model and time series model; obtaining corrected metabolomics data; and performing quality evaluation on the corrected metabolomics data. The technical problem of complex nonlinear batch effect being difficult to effectively eliminate due to factors such as differences between multi-center experiments and fluctuations in instrument performance, thereby causing metabolomics data deviation and cross-batch incompatibility, is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the interdisciplinary fields of bioinformatics and analytical chemistry, and in particular to a batch effect correction method for metabolomics data based on generative adversarial networks. Background Technology

[0002] In the cutting-edge field of intersection between life sciences and chemical analysis, metabolomics, as an emerging research direction, is gradually changing our understanding of chemical processes within organisms. With the rise of precision medicine and personalized treatment, metabolomics aims to precisely analyze the dynamic changes of small-molecule metabolites in organisms, which is crucial for understanding the mechanisms of disease development, optimizing drug treatment effects, and assessing the impact of environmental factors on human health. In the current era of rapid advancements in high-throughput analytical technologies, metabolomics, with its high-sensitivity and high-resolution detection methods, offers unprecedented opportunities for in-depth exploration of biomolecular mechanisms.

[0003] Currently, liquid chromatography-mass spectrometry (LC-MS) and gas chromatography-mass spectrometry (GC-MS) techniques dominate metabolomics research. These techniques can detect hundreds or even thousands of metabolites in a single analysis, providing researchers with a wealth of data resources. However, in practical research, these data face significant challenges. Large-scale metabolomics studies typically involve multiple research centers, different operators, and multiple instruments. Even when following standard operating procedures, batch effects can occur due to differences in instrument brands and models between laboratories, subtle variations in experimental consumables, and natural fluctuations in instrument performance over the analysis period. This batch effect stems not only from the instruments themselves but is also related to various factors in the sample processing, such as individual physiological differences at sample collection, environmental changes during sample transportation, and variations in sample storage time. These intertwined factors significantly increase the complexity and uncertainty of metabolomics data.

[0004] Researchers have explored various strategies to address batch effects in metabolomics data. Internal standard-based calibration techniques were once a common choice. However, due to the vast diversity of metabolites in organisms and their highly varied chemical properties, finding a universal internal standard is nearly impossible. Furthermore, internal standards are susceptible to various interferences in complex sample matrices, severely impacting the stability and representativeness of their signals and leading to significant biases in the calibration results.

[0005] Sample scalar correction methods attempt to correct for batch effects by adjusting the peak intensities of metabolites across the entire sample. However, this method ignores the specificity of changes in different metabolites across different batches, treating all metabolites the same, which may mask important biological differences, leading to biased data analysis results that fail to accurately reflect the true changes in metabolites.

[0006] While regression methods based on quality control (QC) samples are widely used, they also have significant limitations. Linear regression, due to the limitations of its linear assumptions, cannot effectively capture the nonlinear characteristics of signal drift when dealing with complex metabolomics data. Locally weighted regression with scatter smoothing (LOESS), although capable of handling nonlinear problems to some extent, relies on fitting local data. With limited data or complex signal drift, it is prone to overfitting local noise, leading to decreased model generalization ability. Support vector regression (SVR) has certain advantages in handling nonlinear data, but traditional SVR methods rely on a single kernel function, making it difficult to fully adapt to the diversity and complexity of metabolomics data, failing to fully extract potential information from the data, and affecting the accuracy of batch calibration.

[0007] With the rapid development of artificial intelligence and machine learning technologies, some advanced algorithms have been gradually introduced into the field of metabolomics, such as autoencoders and generative adversarial networks (GANs) in deep learning. However, these methods face problems in practical applications, such as complex model training, high computational resource requirements, and unstable results. When learning data features, autoencoders may lose some key information; when generating data, GANs have difficulty guaranteeing the quality and stability of the generated data, and the training process is prone to dilemmas such as pattern collapse.

[0008] Faced with these challenges, existing batch correction methods for metabolomics data are insufficient to meet research needs. Especially with the trend towards multi-omics integrated research, metabolomics data requires correlation analysis with genomics, transcriptomics, and proteomics data, placing higher demands on data accuracy and reliability. Therefore, developing a novel batch correction method for metabolomics data that can effectively overcome the limitations of existing methods is of great significance for promoting the in-depth development of metabolomics research and realizing the translation from basic research to clinical applications. Summary of the Invention

[0009] This disclosure provides a batch effect correction method for metabolomics data based on generative adversarial networks, which solves the technical problem in the prior art that it is difficult to effectively eliminate complex nonlinear batch effects caused by factors such as differences in multi-center experiments and fluctuations in instrument performance, thereby causing bias and incomparability of metabolomics data across batches.

[0010] According to a first aspect of this disclosure, a batch effect correction method for metabolomics data based on generative adversarial networks is provided, comprising:

[0011] Collect samples, collect metabolomics data, preprocess the metabolomics data, divide the preprocessed metabolomics data into batches, and generate a metabolomics data training set and a metabolomics data test set. The preprocessing includes data standardization and missing value handling.

[0012] A neural network model based on the attention mechanism is constructed. The neural network model includes an input layer, an attention mechanism layer, a hidden layer, and an output layer. The input layer is used to input metabolomics data, the attention mechanism layer is used to obtain weighted feature representations, the hidden layer is used for nonlinear feature extraction, and the output layer is used to output the predicted batch effect.

[0013] A generative adversarial network (GAN) model is constructed, which includes a generator and a discriminator. The generator is used to generate supplementary data similar to the metabolomics data, and the discriminator is used to determine whether the input data is real metabolomics data or supplementary data generated by the generator.

[0014] Time series data are constructed from the metabolomics training set, and a time series model is built based on the time series data.

[0015] Under a unified training framework, the constructed neural network model, generative adversarial network model, and time series model are subjected to deep joint training. The model parameters are optimized through gradient collaborative update and time dynamic guidance.

[0016] Input data from the metabolomics test set into the deeply jointly trained model to obtain the corrected metabolomics data.

[0017] Principal component analysis, cluster analysis, and statistical tests were used to assess the quality of the corrected metabolomics data.

[0018] One or more technical solutions provided in this disclosure have at least the following technical effects or advantages: collecting samples, acquiring metabolomics data, preprocessing the metabolomics data, dividing the preprocessed metabolomics data into batches, generating a metabolomics data training set and a metabolomics data test set, wherein the preprocessing includes data standardization and missing value handling; constructing a neural network model based on an attention mechanism, the neural network model including an input layer, an attention mechanism layer, a hidden layer, and an output layer, wherein the input layer is used to input metabolomics data, the attention mechanism layer is used to obtain weighted feature representations, the hidden layer is used for nonlinear feature extraction, and the output layer is used to output the predicted batch effects; constructing a generative adversarial network model, the generative adversarial network model including... The system comprises a generator and a discriminator. The generator produces supplementary data similar to the metabolomics data, while the discriminator determines whether the input data is genuine metabolomics data or supplementary data generated by the generator. A time series dataset is constructed from the metabolomics training set, and a time series model is built based on this dataset. Under a unified training framework, the constructed neural network model, generative adversarial network model, and time series model are deeply co-trained, and model parameters are optimized through gradient collaborative updates and time-dynamic guidance. Data from the metabolomics test set is input into the deeply co-trained model to obtain corrected metabolomics data. Principal component analysis, cluster analysis, and statistical tests are used to assess the quality of the corrected metabolomics data. This system addresses the technical problem in existing technologies where complex nonlinear batch effects caused by multi-center experimental differences and instrument performance fluctuations are difficult to effectively eliminate, leading to data bias and cross-batch incomparability in metabolomics. It achieves the technical effects of deeply mining data features, accurately correcting batch effects, improving data quality, enhancing the comparability of data from different batches, providing reliable data support for metabolomics research, and contributing to the development of fields such as biomarker discovery, disease diagnosis, and drug development.

[0019] The above description is merely an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0021] Figure 1A flowchart illustrating a batch effect correction method for metabolomics data based on generative adversarial networks, provided in an embodiment of this application;

[0022] Figure 2 This is a specific embodiment showing the RT~m / z plot of peak table data after peak extraction;

[0023] Figure 3 Heatmaps of QC control samples and actual samples after batch calibration;

[0024] Figure 4 This is a graph showing the PCA multivariate correction analysis results of the peak table data after batch correction.

[0025] Figure 5 This is a graph showing the PLS-DA score results of the peak table data after batch correction. Detailed Implementation

[0026] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0027] Example 1: This disclosure provides a batch effect correction method for metabolomics data based on generative adversarial networks, which is referred to below. Figure 1 The methods include:

[0028] S1: Collect samples, collect metabolomics data, preprocess the metabolomics data, divide the preprocessed metabolomics data into batches, and generate a metabolomics data training set and a metabolomics data test set. The preprocessing includes data standardization and missing value handling.

[0029] Specifically, the first step is sample collection and processing. Metabolomics research involves a wide variety of sample types, including human blood, urine, tissue samples, and cell and tissue extracts from animals and plants. Specific processing methods are used for different samples: For human blood samples, collection must be under strict aseptic conditions. After collection, the samples are rapidly centrifuged at 4°C and 3000 rpm for 10-15 minutes to separate serum or plasma, which is then aliquoted and stored at -80°C to prevent metabolite degradation or alteration. For animal and plant tissue samples, they are ground into powder using liquid nitrogen at low temperatures, then a specific ratio of extraction solution (e.g., methanol:water = 3:1) is added. Ultrasonic disruption is used to fully release the metabolites, followed by centrifugation at 12000 rpm for 20 minutes in a low-temperature high-speed centrifuge. The supernatant is then collected for later use. Taking a serum metabolomics study of diabetic patients and healthy individuals as an example, a number of age- and sex-matched diabetic patients and healthy volunteers were recruited. Five mL of venous blood was collected from each participant in the morning on an empty stomach. Immediately after collection, the blood samples were placed in blood collection tubes containing an anticoagulant (such as EDTA). The samples were centrifuged at 3000 rpm for 15 minutes at 4°C to separate the serum, which was then transferred to sterile cryovials, aliquoted 1 mL into each tube. All serum samples were stored at -80°C to avoid repeated freeze-thaw cycles until metabolomics analysis was performed.

[0030] Subsequently, the samples were analyzed using liquid chromatography-mass spectrometry (LC-MS) and gas chromatography-mass spectrometry (GC-MS), and metabolomics data were acquired using high-resolution mass spectrometry. The LC-MS used a C18 reversed-phase column (100-150 mm length, 2.1 mm inner diameter, 3-5 μm particle size) to ensure effective separation of metabolites. Mobile phase A was an aqueous solution containing 0.1% formic acid, and mobile phase B was an acetonitrile solution containing 0.1% formic acid. The flow rate was set to 0.25-0.3 mL / min, the column temperature was maintained at 30-35℃, and the mass spectrometry scan range was set to m / z 50-1500. Data acquisition was performed in positive ion mode. Gas chromatography-mass spectrometry (GC-MS) was performed using an HP-5MS capillary column (30m long, 0.25mm inner diameter, 0.25μm film thickness). The initial temperature was 40℃ for 2 minutes, then increased to 300℃ at a rate of 10℃ / min and held for 5 minutes. Full scan mode was used for mass spectrometry, with the scan range determined according to the research objectives. Throughout the data acquisition process, samples were injected in a random order, and one quality control (QC) sample was inserted every 10 samples analyzed. The QC sample was prepared from a mixture of serum samples to ensure the stability of the monitoring instrument and the repeatability of the analysis process. Finally, the above process yielded structurally complete and stable metabolomics data, providing fundamental data support for subsequent batch effect correction and model training.

[0031] Next, standardized preprocessing operations were performed on the acquired metabolomics data, including data standardization and missing value handling. Since the raw mass spectrometry data in metabolomics often exhibit diverse formats, specialized software (such as MExplorer Ultimate) was first used to convert them to a unified mzXML or mzML format to ensure the compatibility and stability of subsequent processing. After format standardization, median standardization was performed on the metabolite peak intensity data to make the data comparable across different samples. Regarding missing value handling, the missing rate for each metabolite was first calculated, and different imputation strategies were determined accordingly. If the missing rate was below 10%, the K-Nearest Neighbors (KNN) algorithm was used for data imputation. In this method, the five nearest neighbors most similar to the target sample were selected by calculating the Euclidean distance between samples, and the average content of their corresponding metabolites was used as the estimated missing value, thus preserving the local structural features of the data. When the missing rate was between 10% and 30%, a machine learning-based random forest algorithm was introduced to complete the imputation. This method first performs feature engineering on the data to construct a feature set containing information such as metabolite mass-to-charge ratio and retention time. This feature set is then used to train a random forest model. The trained model is then used to predict missing values, ensuring higher accuracy in modeling correlations between variables during the imputation process. Metabolites with a missing rate exceeding 30% are removed after comprehensively considering their biological significance to avoid model bias caused by high missing rates. After preprocessing, peak table data after metabolite peak extraction is obtained, along with corresponding two-dimensional distribution plots of retention time-mass-to-charge ratio (RT–m / z) and heatmaps of quality control (QC) samples and actual samples, as shown below. Figure 2-3 As shown,

[0032] Finally, the metabolomics data, after being standardized in format, median standardized, and missing value processed to form a well-structured and stable dataset, was divided into batches based on time and batch labels. This ensured that systematic differences between batches were clearly identified and effectively recognized during subsequent model training. Based on the batch labels, each batch of data was further divided into a metabolomics training set and a metabolomics test set, with a data ratio of 7:3. The metabolomics training set was used to build and train the model, while the metabolomics test set was used to evaluate model performance and predict and correct batch effects. The model parameters that performed best on the metabolomics test set were ultimately selected as the final parameters, ensuring the reliability of the correction method.

[0033] S2: Construct a neural network model based on the attention mechanism. The neural network model includes an input layer, an attention mechanism layer, a hidden layer, and an output layer. The input layer is used to input metabolomics data, the attention mechanism layer is used to obtain weighted feature representations, the hidden layer is used for nonlinear feature extraction, and the output layer is used to output the predicted batch effects.

[0034] Furthermore, step S2 also includes:

[0035] Build a neural network model architecture and set the number of nodes in the input layer, hidden layer and output layer according to the feature dimensions of metabolomics data;

[0036] The data from the metabolomics training set is input into the neural network model, and the attention weights of each feature in the metabolomics data are obtained through the attention mechanism layer. The specific calculation formula is as follows:

[0037] ;

[0038] in, This represents the attention weight of the i-th feature. This represents the attention score after scaling the i-th feature. Let represent the attention score after scaling the j-th feature, n represent the total number of features, the denominator is a normalization factor, and exp is an exponential function;

[0039] Weighted feature representations are obtained based on attention weights using a weighted summation method.

[0040] The weighted feature representation is input into the hidden layer of the model, and nonlinear feature extraction is performed to obtain the deep feature representation;

[0041] The output layer generates predicted batch effects based on deep feature representations.

[0042] Specifically, the neural network model based on the attention mechanism is constructed by first building the model architecture. The model presents a complete mapping structure from input to output, including an input layer, an attention mechanism layer, two hidden layers, and an output layer. The number of nodes in the input layer is set according to the feature dimensions of the preprocessed metabolomics data. When the data has n features, the number of nodes in the input layer is n. The hidden layers adopt a multilayer perceptron structure, with the first hidden layer having 2n nodes and the second hidden layer having n nodes. The ReLU activation function is used for both layers to enhance the non-linear expressive power of the model. The number of nodes in the output layer is the same as that in the input layer, and it is used to output the processed metabolomics data. In the specific implementation, the neural network model is built using the Python TensorFlow framework. Assuming that the data has 500 features, the number of nodes in the input layer is 500, the number of nodes in the first hidden layer is 1000, and the number of nodes in the second hidden layer is 500. The ReLU activation function is used for both layers. The number of nodes in the output layer is the same as that in the input layer, which is 500.

[0043] In the model structure, the attention mechanism layer serves as the core functional module, used to extract key features with batch discrimination capabilities from the input data X. The input data X is preprocessed metabolomics data from the training set, including several feature values ​​for each sample, representing the abundance of each metabolite in the sample. The input data X first undergoes three different linear transformations to generate a query vector Q, a key vector K, and a value vector V. The calculation of these three vectors is achieved using a learnable weight matrix, specifically expressed as: Q = W Q X, K=W K X, V=W V X, where W Q W K W V This is a learnable weight matrix that matches the input dimension. In a specific implementation, for example, when the feature dimension is 500, the three weight matrices can be initialized as random 500×500 matrices. Then, the attention score matrix S is obtained by calculating the dot product of the query vector Q and the key vector K, with the calculation form: S = Q K T K T This represents the transpose of the key vector K. To avoid gradient instability caused by the dot product increasing in dimension, the attention score matrix is ​​divided by the scaling factor sqrt(d). k ) is scaled, where d k Let K be the dimension of the key vector, which is 500 in the example above. Then, the scaled attention score matrix is ​​normalized by applying the Softmax function to obtain the attention weight matrix A, which is expressed as: A = Softmax(S / sqrt(d...) k This attention weight matrix characterizes the correlation weights between input features. It's important to note that the scalar form of the Softmax function can be written as: ,in, This represents the attention weight of the i-th feature. This represents the attention score after scaling the i-th feature. Let A represent the attention score after scaling the j-th feature, n represent the total number of features, the denominator acts as a normalization factor to transform all weights into a probability distribution, and exp is an exponential function that ensures the result of Softmax is a probability distribution. This scalar form is essentially the same as the previous functional form, both obtaining attention weights through Softmax. However, one obtains the weights at a single feature level, while the other obtains the weights in matrix form, involving the overall weights of Q over all K. This explanation is only for illustrating the computational principle. Finally, the value vector V is weighted and summed according to the attention weight matrix A to obtain the weighted feature representation Z after the attention mechanism, expressed as Z: Z = A V. Through the above calculation process, the attention mechanism can highlight key metabolite features related to batch differences, while suppressing noise features unrelated to batch effects, thereby improving the feature extraction capability of subsequent models.

[0044] The weighted feature representation output from the attention mechanism layer is then fed into subsequent hidden layers for further nonlinear feature extraction. The hidden layers combine and map the attention output features using activation functions to uncover complex interactions between metabolites. In this model design, the calculation results from the hidden layers do not directly correspond to the fully corrected batch effect data, but rather further generate deep feature representations that can be used for batch effect estimation and correction calculations. The final output layer generates predicted batch effects with the same dimension as the input based on these deep feature representations, thus characterizing the correction direction or magnitude of each feature in the model, providing a basis for subsequent batch effect correction calculations.

[0045] S3: Construct a generative adversarial network model, which includes a generator and a discriminator. The generator is used to generate supplementary data similar to the metabolomics data, and the discriminator is used to determine whether the input data is real metabolomics data or supplementary data generated by the generator.

[0046] Furthermore, step S3 also includes:

[0047] The parameters of the generator in the generative adversarial network model are defined, including the generator's network structure type, number of hidden layer nodes, type of hidden layer activation function, number of output layer nodes, type of output layer activation function, and the form of the generator's loss function. The generator's loss function is defined as follows:

[0048] ;

[0049] in, Represents the loss function of the generator. Let z represent the expectation of the random noise vector. Let G(z) represent the noise distribution, G(z) represent the supplementary data generated by the generator, and D(G(z)) represent the discrimination result of the discriminator on the supplementary data generated by the generator.

[0050] The parameters of the discriminator in the generative adversarial network model are set, including the discriminator's network structure type, number of hidden layer nodes, type of hidden layer activation function, number of output layer nodes, type of output activation function, and the form of the discriminator's loss function, wherein the form of the discriminator's loss function is defined as follows:

[0051] ;

[0052] in, This represents the loss function of the discriminator. pdata(x) represents the expectation of the real metabolomics data, pdata(x) represents the distribution of the real metabolomics data, D(x) represents the discrimination result of the discriminator on the real metabolomics data, and D(G(z)) represents the discrimination result of the discriminator on the supplementary data generated by the generator.

[0053] A generative adversarial network model was trained using a metabolomics training set, and the model parameters were optimized based on the Adam optimizer and backpropagation algorithm.

[0054] Specifically, after constructing the neural network model, a generative adversarial network (GAN) model was further built based on the TensorFlow framework to generate supplementary data with similar characteristics to the metabolomics data, thus assisting in the correction of batch effects. The GAN consists of two sub-modules: a generator and a discriminator. The generator is responsible for generating supplementary data that is as realistic as possible, while the discriminator is used to determine whether the input data is real metabolomics data or supplementary data generated by the generator.

[0055] The generator is designed using a multilayer perceptron architecture. The input consists of deep feature representations processed by an attention mechanism and a 100-dimensional random noise vector z. The generator contains three hidden layers with 512, 256, and 128 nodes respectively, all using the ReLU activation function. The output layer has the same number of nodes as the feature dimension of the metabolomics data, and uses the Tanh activation function to ensure that the generated supplementary data is within a reasonable range. The loss function of the generator is defined as:

[0056] ;

[0057] in, Represents the loss function of the generator. Let represent the expectation of a random noise vector z according to its distribution. Let G(z) represent the noise distribution, G(z) represent the supplementary data generated by the generator, and D(G(z)) represent the discriminator's judgment result on the supplementary data generated by the generator. The generator deceives the discriminator by minimizing this loss function to make the generated data as close as possible to the real data.

[0058] Design a discriminator. The discriminator is used to distinguish between real and real input data, which can be real metabolomics data or supplementary data generated by a generator. The discriminator also uses a multilayer perceptron structure, containing three hidden layers with 128, 256, and 512 nodes respectively, using the ReLU activation function. The output layer is a single node, using the Sigmoid function to output the discrimination result, with a value between 0 and 1, where 0 represents the probability of the data being generated data and 1 represents the probability of it being real data. The loss function of the discriminator is defined as:

[0059] ;

[0060] in, This represents the loss function of the discriminator. Let pdata(x) represent the expected distribution of real metabolomics data according to the actual data distribution, D(x) represent the discrimination result of the discriminator on the real metabolomics data, and D(G(z)) represent the discrimination result of the discriminator on the supplementary data generated by the generator. The discriminator improves its ability to distinguish between real data and generated data by minimizing this loss function.

[0061] In the adversarial training process, the generator and discriminator are trained alternately. First, a batch of real metabolomics data and corresponding random noise are randomly sampled from the metabolomics training set. The deep feature representation processed by the attention mechanism and the random noise are input into the generator to generate supplementary data. Then, the generated supplementary data and the real metabolomics data are input into the discriminator to calculate the discrimination result. Based on the discrimination result, the loss functions of the generator and discriminator are calculated, and the parameters of the generator and discriminator are updated respectively. Training optimization uses the Adam optimizer with a learning rate of 0.0001, β1=0.5, and β2=0.999. The parameters are continuously adjusted through the backpropagation algorithm, making the data generated by the generator increasingly closer to the real data, while simultaneously improving the discriminator's discrimination ability.

[0062] S4: Construct time series data based on the metabolomics training set, and build a time series model based on the time series data;

[0063] Furthermore, step S4 also includes:

[0064] Using the time labels in the metabolomics training set as the x-axis and the peak intensity of metabolites as the y-axis, the measured values ​​of each metabolite at different time points are arranged in chronological order to form a time series.

[0065] The time series is tested for stationarity. If the series is non-stationary, the trend or variance changes are eliminated through differencing.

[0066] Based on time series data, the autoregressive order, moving average order, and differencing order are determined using the autocorrelation function and partial autocorrelation function. A time series model is then constructed by combining this with an autoregressive integral moving average model. The specific expression is as follows:

[0067] ;

[0068] in, This represents the estimated batch effect at time t. and q and i are the autoregressive coefficient and moving average coefficient, respectively; p and q are the autoregressive order and moving average order, respectively; and i and j are the index values. White noise at time t;

[0069] The parameters of the time series model are estimated and adjusted using the maximum likelihood estimation method.

[0070] Based on the trained time series model, the batch effect at future time points is predicted.

[0071] Specifically, time-series analysis is further performed on the batch effects of metabolomics data to capture the dynamic changes of batch effects over time. First, a training set of metabolomics data is acquired, and the analysis time sequence of samples is determined based on time labels. Time-series data is then constructed for each metabolite. With analysis time as the x-axis and metabolite peak intensity as the y-axis, the measured values ​​of each metabolite at different time points are arranged chronologically to form a metabolite time series. For example, in a long-term metabolomics study, samples are collected at regular intervals, and the peak intensities of a particular metabolite in each collected sample are arranged sequentially to construct the time series for that metabolite. This time series can reflect the changing trend of the batch effect of the metabolite at different experimental time points.

[0072] After constructing the time series data, a stationarity test is performed. If the series exhibits non-stationary characteristics, trend or variance variations are eliminated through differencing to meet the stationarity requirement. If the series is stationary, this step is skipped, and the next step is performed directly. Subsequently, the parameters of the time series model are determined using the autocorrelation function (ACF) and partial autocorrelation function (PACF), including the autoregressive order p, the moving average order q, and the differencing order d. The time series model is constructed using an autoregressive integral moving average model to describe the variation of batch effects over time. The specific expression of the model is as follows:

[0073] ;

[0074] in, This represents the estimated batch effect value at time t, indicating the strength of the batch effect in the metabolomics data at time point t. Represents the batch effect from previous moments. These are autoregressive coefficients used to measure the strength of the linear influence of past values ​​on the current value. These coefficients need to be automatically obtained through maximum likelihood estimation during model training. These are the moving average coefficients, used to describe the random disturbances over the previous j steps. current batch effect estimate The influence of this coefficient is also automatically determined during training through maximum likelihood estimation. The white noise term represents random disturbances at time t that cannot be explained by the trend or model. p is the autoregressive order, which determines how much of the past data the model references. The value q is obtained from previous calculations. It is the moving average order, which determines how many past noise terms the model references. i and j are index values ​​used for iterative summation. In addition, although the difference order d is not explicitly shown in the model, this value needs to be defined. Its function is to transform non-stationary time series into stationary series. It is also obtained from previous calculations.

[0075] During the time series model training phase, the parameters of the ARIMA model are estimated using maximum likelihood estimation and continuously adjusted to ensure the model accurately fits the time series data of batch effects and captures their dynamic trends. Based on the trained time series model, batch effects at future time points can be predicted, thus providing dynamic reference information for batch effect correction of subsequent metabolomics data.

[0076] S5: Under a unified training framework, perform deep joint training on the constructed neural network model, generative adversarial network model, and time series model, and optimize model parameters through gradient collaborative update and time dynamic guidance.

[0077] Furthermore, step S5 also includes:

[0078] The data from the metabolomics training set are input into the neural network model to extract deep feature representations and the loss function of the neural network;

[0079] Input deep feature representations and random noise vectors into the generator of the generative adversarial network model to generate supplementary data;

[0080] Input real metabolomics data and supplementary data generated by the generator into the metabolomics training set into the discriminator for discrimination, and obtain the loss functions of the generator and discriminator based on the discrimination results;

[0081] Combining the three types of loss functions, the gradients are calculated using the backpropagation algorithm, and the parameters of the corresponding models are updated independently. The basic form of gradient calculation using the backpropagation algorithm is as follows:

[0082] ;

[0083] in, Let L represent the gradient of the loss function L with respect to the model parameters w, and m represent the number of samples. This indicates the loss function's effect on the predicted value. gradient, Indicates predicted value The gradient with respect to the model parameter w.

[0084] Specifically, after constructing the neural network model, generative adversarial network model, and time series model, the metabolomics data training set is further input into the overall model framework for deep joint training. The core mechanism of this process is based on the backpropagation algorithm, which iteratively optimizes the model parameters to improve the model's ability to predict and correct batch effects.

[0085] In the initial training phase, preprocessed metabolomics data is input into an attention-based neural network model to extract deep feature representations and predicted batch effects. The batch effects are compared with estimates from a time-series model to independently obtain the neural network model's own loss function. This loss measures the accuracy of the neural network's batch effect estimation. The deep feature representations, along with a random noise vector, are input into the generator of a generative adversarial network (GAN) model to generate supplementary data. Then, both the real data and the generated supplementary data are simultaneously input into a discriminator for discrimination. The loss functions of the generator and discriminator are calculated based on the discrimination results.

[0086] After the loss function is calculated, the gradients of three types of parameters are updated using the backpropagation algorithm: those of the neural network model, the generator, and the discriminator. The basic form of gradient calculation using the backpropagation algorithm is as follows:

[0087] ;

[0088] in, Let represent the gradient of the loss function L with respect to the model parameters w, m represent the number of samples, and i be the index value. This indicates the loss function's effect on the predicted value. The gradient measures the impact of changes in output on changes in loss. Indicates predicted value The gradient of the model parameters w describes how changes in the model parameters w will affect the output. It is important to clarify that the loss function in this calculation formula is divided into three categories: the loss function of the neural network, the loss function of the generator, and the loss function of the discriminator. These are used to adjust the parameters of the neural network model, the generator, and the discriminator, respectively.

[0089] Specifically, the loss function L represents the error metric between the model output and the true target, used to measure the model's prediction quality. In this joint training framework, L is not a single value, but a unified representation of three types of losses: neural network loss, generator loss, and discriminator loss. The model parameters w are the target for backpropagation updates. Since this method involves three types of models, w essentially encompasses the weights and biases of the neural network model, the parameters of the generator, and the parameters of the discriminator. Predicted values This represents the model's predicted output for the i-th sample. It also has three different meanings, depending on which type of model it belongs to, when optimizing neural network models. This represents the predicted batch effect when optimizing the generator. This represents the output of the discriminator after the data generated by the generator passes through it. When optimizing the discriminator... This represents the probability that the discriminator distinguishes between the real data and the supplementary data. m is the number of samples, referring to the number of samples contained in a batch during training. It is not the sample size of the metabolomics training set, nor the original measurement number of a batch, but rather the number of data in a small batch that participates in gradient calculation each time parameters are updated. For example, if the metabolomics training set involves 5120 data points, the batch size can be set to 32, so the value of m is 32.

[0090] By repeatedly performing forward propagation, loss calculation, and backpropagation, the neural network model can extract batch effect-related features more accurately, while the generator can generate supplementary data that more closely approximates the true distribution, and the discriminator can achieve higher discrimination accuracy in distinguishing between real data and generated data.

[0091] During joint training, the dynamic trend of batch effect provided by the time series model is introduced as external guidance information into the training process of the neural network model and the generative adversarial network model to guide the model's direction selection during gradient update. For example, the batch effect change predicted by the time series model is input as an additional feature into the attention mechanism neural network model, enabling the model to identify and utilize the temporal dynamics of batch effect during parameter update. At the same time, the predicted batch effect trend is used to constrain the generation process of the generative adversarial network, guiding the generator to more accurately reproduce the changing characteristics of batch effect at different time stages when simulating data, thereby improving the overall model's correction effect on time-dependent batch bias.

[0092] The model training uses the Adam optimizer for parameter updates, with an initial learning rate set to 0.0001. During training, a learning rate decay strategy is employed, reducing the learning rate to 0.9 every 50 training epochs to ensure rapid convergence in the early stages and a more stable parameter update process in later stages. Simultaneously, to prevent overfitting, Dropout layers are added between hidden layers with a probability of 0.2 to improve the model's generalization ability to unseen data.

[0093] Finally, through the above joint optimization strategy, the attention mechanism neural network model, generator, and discriminator achieve synergistic convergence within the unified framework of backpropagation, thereby enabling the overall model system to more accurately identify, model, and correct batch effects in metabolomics data.

[0094] S6: Input data from the metabolomics test set into the deeply jointly trained model to obtain the corrected metabolomics data;

[0095] Furthermore, step S6 also includes:

[0096] Data from the metabolomics test set were input into a deeply jointly trained neural network model and a generative adversarial network model to obtain batch effects and supplementary data.

[0097] By combining time series models to correct for batch effects, the corrected metabolomics data are obtained. The specific optimization formula is as follows:

[0098] ;

[0099] Where X represents the original metabolomics data, B represents the predicted batch effect, G represents the generated supplementary data, and T represents the batch estimate predicted by the time series model.

[0100] Specifically, a deeply jointly trained model is used to predict and correct batch effects. The metabolomics test set is input into a trained attention-based neural network model to predict batch effects in the data. Then, the predicted batch effects are corrected based on supplementary data generated by a generative adversarial network and the prediction results of the time series model. The specific correction method is as follows: assuming the original metabolomics data is X, the predicted batch effect is B, the generated supplementary data is G, and the batch estimate predicted by the time series model is T, then the corrected metabolomics data X' = X - B + G + T. This method effectively eliminates the influence of batch effects, yielding the corrected metabolomics data.

[0101] Specifically, all variables in the formula represent the peak intensity of metabolites in the same dimension and can be directly added or subtracted. Parameter X is the raw data containing the true signal and batch bias. "-B" represents removing the static systematic batch effect identified by the neural network, "+G" represents using a generator to supplement data and fill in the sparse areas of the data after removing the bias, and "+T" represents dynamically correcting the batch drift across time through a time series model. Finally, through the logic of "stripping-completion-correction", the corrected metabolomics data containing only the true biological signal is obtained, which perfectly matches the core logic of the patented technology solution.

[0102] S7: Principal component analysis and cluster analysis were used to assess the quality of the corrected metabolomics data.

[0103] Specifically, after data correction and optimization, a comprehensive evaluation of the corrected metabolomics data is required using multiple assessment metrics to determine the effectiveness of batch effect suppression and the improvement in data quality. Principal component analysis (PCA) is used to project the corrected data into a two-dimensional or three-dimensional space to observe the distribution of different batches of data, such as... Figure 4 As shown. If batch effects are effectively corrected, data points from different batches should be mixed, rather than clustered according to batch. Using clustering analysis algorithms (such as K-Means clustering), calculate the silhouette coefficient, Calinski-Harabasz index, and other indicators of the corrected data to evaluate the clustering effect; better clustering indicates stronger data comparability. Perform differential metabolite analysis using statistical tests (such as t-tests and ANOVA), using a p-value less than 0.05 and a fold change greater than 2 or less than 0.5 as thresholds to screen differential metabolites between different groups in the corrected data. If the corrected data accurately reflects biological differences, the screened differential metabolites should be consistent with the research objectives and biological background. Compare the results before and after data correction, such as... Figure 5 As shown.

[0104] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0105] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for batch effect correction of metabolomics data based on a generative adversarial network, characterized in that, The method comprises: Collecting samples, collecting metabolomics data, preprocessing metabolomics data, dividing preprocessed metabolomics data according to batches, generating metabolomics data training set and metabolomics data test set, the preprocessing includes data standardization processing and missing value processing; A neural network model based on attention mechanism is constructed, the neural network model comprises an input layer, an attention mechanism layer, a hidden layer and an output layer, wherein the input layer is used for inputting metabolomics data, the attention mechanism layer is used for obtaining weighted feature representation, the hidden layer is used for nonlinear feature extraction, and the output layer is used for outputting predicted batch effect; A generative adversarial network model is constructed, the generative adversarial network model comprises a generator and a discriminator, wherein the generator is used for generating supplementary data similar to the metabolomics data, and the discriminator is used for judging whether the input data is real metabolomics data or supplementary data generated by the generator; A time series is constructed according to the metabolomics data training set, and a time series model is constructed based on the time series; In a unified training framework, the constructed neural network model, generative adversarial network model and time series model are jointly trained in depth, the model parameters are optimized through gradient cooperative updating and time dynamic guidance, wherein the optimization of the model parameters further comprises: The data in the metabolomics data training set is input into the neural network model, and the deep feature representation and the loss function of the neural network are extracted; The deep feature representation and the random noise vector are input into the generator of the generative adversarial network model to generate supplementary data; The real metabolomics data in the metabolomics data training set and the supplementary data generated by the generator are input into the discriminator for discrimination, and the loss function of the generator and the discriminator is obtained according to the discrimination result; Combined with the three types of loss functions, the gradients are calculated through the back propagation algorithm respectively, and the parameters of the corresponding model are updated independently, wherein the basic form of the back propagation algorithm for calculating the gradient is: ; wherein, denotes the gradient of the loss function L with respect to the model parameters w, m denotes the number of samples, denotes the gradient of the loss function with respect to the predicted value , denotes the gradient of the predicted value with respect to the model parameters w; The data in the metabolomics data test set is input into the model after depth joint training, and the corrected metabolomics data is obtained, wherein the corrected metabolomics data further comprises: The data in the metabolomics data test set is input into the depth joint trained neural network model and the generative adversarial network model to obtain the batch effect and the supplementary data; The batch effect is corrected by combining the time series model to obtain the corrected metabolomics data, and the specific optimization formula is: ; Wherein, X represents the original metabolomics data, B represents the predicted batch effect, G represents the generated supplementary data, and T represents the batch estimation value predicted by the time series model; The quality of the corrected metabolomics data is evaluated by principal component analysis, cluster analysis method and statistical test method.

2. The method of claim 1, wherein the method is based on a generative adversarial network. The neural network model based on attention mechanism comprises: The neural network model architecture is built, the node number of the input layer, the hidden layer and the output layer is set according to the feature dimension of the metabolomics data; The data in the metabolomics data training set is input into the neural network model, the attention weights of each feature in the metabolomics data are obtained through the attention mechanism layer, and the specific calculation formula is: ; wherein, denotes the attention weight of the i-th feature, denotes the scaled attention score of the i-th feature, denotes the scaled attention score of the j-th feature, n denotes the total number of features, the denominator acts as a normalization factor, and exp is the exponential function; The weighted feature representation is obtained based on the attention weight through a weighted sum method; The input weighted feature representation is input to a hidden layer of the model to perform nonlinear feature extraction and obtain a deep feature representation; The output layer generates a predicted batch effect according to the deep feature representation.

3. The method of claim 1, wherein the method is based on a generative adversarial network. The generative adversarial network model is constructed, including: Parameters of the generator in the generative adversarial network model are set, including a network structure type of the generator, a number of hidden layer nodes, a type of hidden layer activation function, a number of output layer nodes, a type of output layer activation function, and a loss function form of the generator, wherein the loss function form of the generator is defined as: ; wherein, a loss function of the generator, denotes an expectation over a random noise vector z, denotes a distribution of the noise, G(z) denotes the complementary data generated by the generator, and D(G(z)) denotes a discrimination result of the discriminator on the complementary data generated by the generator; Parameters of the discriminator in the generative adversarial network model are set, including a network structure type of the discriminator, a number of hidden layer nodes, a type of hidden layer activation function, a number of output layer nodes, a type of output activation function, and a loss function form of the discriminator, wherein the loss function form of the discriminator is defined as: ; wherein, represents a loss function of the discriminator, represents an expectation of the real metabolomics data, pdata(x) represents a distribution of the real metabolomics data, D(x) represents a discrimination result of the real metabolomics data by the discriminator, and D(G(z)) represents a discrimination result of the supplementary data generated by the generator by the discriminator; The generative adversarial network model is trained by using a metabolomics data training set, and model parameters are optimized based on an Adam optimizer and a back propagation algorithm.

4. The method of claim 1, wherein the method is based on a generative adversarial network. A time series is constructed according to the metabolomics data training set, and a time series model is constructed based on the time series, including: Taking a time label in the metabolomics data training set as an abscissa and a metabolite peak intensity as an ordinate, arranging the measured values of each metabolite at different time points in time order to form a time series; Stationarity test is performed on the time series, and if the sequence is non-stationary, a trend or variance change is eliminated through a difference operation; Based on the time series, autocorrelation function and partial autocorrelation function are used to determine an autoregressive order, a moving average order and a difference order, and a time series model is constructed by combining an autoregressive integrated moving average model, and a specific expression is: ; wherein, represents a batch effect estimate at time t, and are an autoregressive coefficient and a moving average coefficient, respectively, p and q are an autoregressive order and a moving average order, respectively, i, j are index values, represents white noise at time t; The parameters of the time series model are estimated by a maximum likelihood estimation method to adjust the model parameters; The batch effect at a future time point is predicted based on the trained time series model.

Citation Information

Patent Citations

  • Single cell data batch effect correction method based on generative adversarial network

    CN116825186A

  • Metabonomics data batch effect correction method based on deep learning

    CN120260672A