Metabolomics data processing method, device, equipment and readable storage medium
By calculating the similarity distance difference between metabolomics data samples and generating normal distribution data for classification filling, combined with the weight of nearest neighbor samples to calculate predicted missing values, the traditional KNN interpolation method is ineffective in metabolomics data processing. problem, achieving more precise interpolation.
Patent Information
- Application Number
- CN202410634806.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-05-22
AI Technical Summary
The traditional KNN interpolation method ignores the distribution of the original sample data when dealing with missing metabolomics data, resulting in poor results and inability to accurately interpolate data.
Neighboring samples are selected by calculating the similarity distance difference between samples, and normal distribution data is generated to classify and fill missing values. The predicted missing values are calculated based on the weight of neighboring samples, and the process is looped until all missing positions are filled.
The distribution between data samples is considered, and the correlation between the sample to be interpolated and the neighboring samples is reflected through the weight, making the interpolation value more accurate.
Smart Images

Figure CN118212994B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a metabolomics data processing method, device, equipment and readable storage medium. Background Art
[0002] Metabolomics is a new discipline that conducts qualitative and quantitative analysis of all low-molecular-weight metabolites of an organism or cell during a specific physiological period. It reveals the metabolic state of an organism under different physiological or pathological conditions by analyzing and interpreting the metabolite spectra in biological samples. In mass spectrometry-based metabolomics data sets, missing values are ubiquitous. Usually, the types of missing values can be classified into three categories: Missing Completely At Random (MCAR), Missing At Random (MAR), and Missing Not At Random (MNAR). MAR is usually regarded as MCAR, and the same interpolation method is used to handle them.
[0003] Traditional KNN interpolation methods usually ignore the distribution of original sample data, so they are ineffective in dealing with missing metabolomics data and cannot accurately interpolate data. Summary of the invention
[0004] In order to solve the above technical problems, the embodiments of the present application provide a metabolomics data processing method, device, equipment and computer-readable storage medium.
[0005] In a first aspect, an embodiment of the present application provides a method for processing metabolomics data, the method comprising:
[0006] S1. Selecting original samples from the original data set in sequence as original target samples, and calculating the similarity distance difference between the original target samples and the original non-target samples in the original data set;
[0007] S2, selecting the neighbor samples and neighbor values of the original target sample according to the similarity distance difference;
[0008] S3, obtaining the missing position of the missing value in the original target sample, and generating a set of normally distributed data according to the metabolic values of all original samples at the missing position;
[0009] S4, classifying the missing values, selecting target values from the normally distributed data according to the classification results, and filling the missing positions of the original target samples with the target values;
[0010] S5, looping through steps S1-S4 until the missing positions of all original samples in the original data set are filled with target values, thereby obtaining a preprocessed data set;
[0011] S6, selecting preprocessed samples from the preprocessed data set in sequence as target samples to be interpolated, and calculating the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values;
[0012] S7, calculating the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight, and filling the missing position of the target sample to be interpolated with the predicted missing value;
[0013] S8. Execute steps S6-S7 in a loop until the missing positions of all preprocessed samples in the preprocessed data set are filled with predicted missing values to obtain an interpolated data set.
[0014] In one embodiment, the calculating the similarity distance difference between the original target sample and the original non-target sample in the original data set includes:
[0015] The similarity distance difference between the original target sample and the original non-target sample in the original data set is calculated according to formula (1), and the formula (1) is:
[0016] (1)
[0017] in, is the similarity distance difference between the original target sample and the original non-target sample, Representative The original target samples, Representative Original non-target samples, Representative The first Metabolic value, Representative The original non-target samples Metabolic value, The number of metabolic values for each original sample, Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? or 0 means missing. or A value of 1 indicates no missing data.
[0018] In one embodiment, selecting the neighboring samples and neighboring values of the original target sample according to the similarity distance difference includes:
[0019] Calculating a preset distance difference of the original target sample according to the similarity distance difference, and obtaining a maximum effective distance according to the preset distance difference;
[0020] If the similarity distance difference of the original non-target sample is less than or equal to the maximum effective distance, then the original non-target sample is the neighboring sample;
[0021] The number of the nearest neighbor samples is counted to obtain the nearest neighbor value.
[0022] In one embodiment, generating a set of normally distributed data according to the metabolic values of all original samples at the missing position comprises:
[0023] Obtaining the minimum metabolic value of all original samples at the missing position, and filling the missing position of the original target sample with the minimum metabolic value;
[0024] The metabolic values of all original samples at the missing positions are obtained to form a group of metabolic values, and the mean value and variance of the group of metabolic values are calculated to generate the normal distribution data.
[0025] In one embodiment, the classification result includes non-random missing and completely random missing, and selecting a target value from the normally distributed data according to the classification result includes:
[0026] If the metabolic value of the neighboring sample at the missing position is missing, it is the non-random missing, and data less than the minimum metabolic value is randomly selected from the set of normally distributed data as the target value;
[0027] If the metabolic value of the neighboring sample at the missing position is not missing, it is the completely random missing, and a value is randomly selected from the set of normally distributed data as the target value.
[0028] In one embodiment, the step of calculating the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values includes:
[0029] The weight of each neighbor sample is calculated according to formula (2), which is:
[0030] (2)
[0031] in, For the The first of the target samples to be interpolated The nearest neighbor samples are The weight of the nearest neighbor samples, is the nearest neighbor value, For the The target sample to be interpolated and the The similarity distance difference between neighbor samples is For the The target sample to be interpolated and the The similarity distance difference between the nearest neighbor samples.
[0032] In one embodiment, the step of calculating the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight includes:
[0033] The predicted missing value of the target sample to be interpolated is calculated according to formula (3), which is:
[0034] (3)
[0035] in, For the The first of the target samples to be interpolated Predict missing values, Represents the first The sample Metabolic value.
[0036] In a second aspect, an embodiment of the present application provides a metabolomics data processing device, the metabolomics data processing device comprising:
[0037] A first calculation module is used to select original samples from the original data set in sequence as original target samples, and calculate the similarity distance difference between the original target samples and the original non-target samples in the original data set;
[0038] A selection module, used for selecting a neighbor sample and a neighbor value of the original target sample according to the similarity distance difference;
[0039] A generating module, used for obtaining missing positions of missing values in the original target sample, and generating a set of normally distributed data according to the metabolic values of all original samples at the missing positions;
[0040] A first filling module is used to classify the missing values, select a target value from the normally distributed data according to the classification result, and fill the missing position of the original target sample with the target value;
[0041] A first loop module, used for looping the steps from the first calculation module to the first filling module until the missing positions of all original samples in the original data set are filled with target values to obtain a preprocessed data set;
[0042] A second calculation module is used to select preprocessed samples from the preprocessed data set in sequence as target samples to be interpolated, and calculate the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values;
[0043] A second filling module is used to calculate the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight, and fill the missing position of the target sample to be interpolated with the predicted missing value;
[0044] The second loop module is used to loop through the steps from the second calculation module to the second filling module until the missing positions of all preprocessed samples in the preprocessed data set are filled with predicted missing values to obtain an interpolated data set.
[0045] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the metabolomics data processing method provided in the first aspect is executed.
[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed on a processor, executes the metabolomics data processing method provided in the first aspect.
[0047] The metabolomics data processing method provided by the present application includes steps S1-S8, S1, selecting original samples from the original data set as original target samples in sequence, and calculating the similarity distance difference between the original target samples and the original non-target samples in the original data set; S2, selecting the neighbor samples and neighbor values of the original target samples according to the similarity distance difference; S3, obtaining the missing position of the missing value in the original target sample, and generating a set of normally distributed data according to the metabolic values of all original samples at the missing position; S4, classifying the missing values, selecting the target value from the normally distributed data according to the classification result, and filling the missing position of the original target sample with the target value; S5, looping through S1-S4 Steps are performed until the missing positions of all the original samples in the original data set are filled with the target values to obtain the preprocessed data set; S6, preprocessed samples are selected from the preprocessed data set in turn as the target samples to be interpolated, and the weight of each neighbor sample is calculated according to the target sample to be interpolated, the neighbor sample corresponding to the target sample to be interpolated, and the neighbor value; S7, according to each neighbor sample of the target sample to be interpolated and its corresponding weight, the predicted missing value of the target sample to be interpolated is calculated, and the predicted missing value is filled into the missing position of the target sample to be interpolated; S8, the steps of S6-S7 are executed repeatedly until the missing positions of all the preprocessed samples in the preprocessed data set are filled with the predicted missing values to obtain the interpolated data set. The present application obtains the neighbor samples through the similarity distance difference of the samples in the original data set, that is, the distribution between the original data samples is taken into account, and the correlation between the sample to be interpolated and the neighbor sample is reflected through the weight, so that the interpolated value is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.
[0049] Figure 1 A schematic diagram of a process of a metabolomics data processing method provided in an embodiment of the present application is shown;
[0050] Figure 2 Another schematic diagram of the process of the metabolomics data processing method provided in the embodiment of the present application is shown;
[0051] Figure 3 Another schematic diagram of the process of the metabolomics data processing method provided in the embodiment of the present application is shown;
[0052] Figure 4A schematic diagram of the structure of a metabolomics data processing device provided in an embodiment of the present application is shown.
[0053] Icons: 400 - metabolomics data processing device, 401 - first calculation module, 402 - selection module, 403 - generation module, 404 - first filling module, 405 - first circulation module, 406 - second calculation module, 407 - second filling module, 408 - second circulation module. DETAILED DESCRIPTION
[0054] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0055] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0056] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.
[0057] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0058] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0059] Example 1
[0060] The embodiment of the present application provides a method for processing metabolomics data. Metabolomics data covers a large amount of information on metabolites and has data characteristics of high dimensionality, diversity, and complexity. However, it is regulated by multiple factors, including environment, genetics, and physiological status. Therefore, there are often missing values in metabolomics data, which need to be interpolated before data analysis can be fully performed.
[0061] See also Figure 1 , the metabolomics data processing method includes steps S1-S8:
[0062] S1: Selecting original samples from the original data set in sequence as original target samples, and calculating similarity distance differences between the original target samples and original non-target samples in the original data set.
[0063] In this embodiment, each sample is selected from the original data set of metabolomics in turn, and each sample is used as the original target sample, and other samples in the original data set of metabolomics are used as original non-target samples. Specifically, the similarity distance difference between each original target sample and each original non-target sample is calculated one by one based on the Manhattan distance, and the multiple similarity distance differences are the similarities between the current original target sample and the remaining original non-target samples.
[0064] In one embodiment, the calculating the similarity distance difference between the original target sample and the original non-target sample in the original data set includes:
[0065] The similarity distance difference between the original target sample and the original non-target sample in the original data set is calculated according to formula (1), and the formula (1) is:
[0066] (1)
[0067] in, is the similarity distance difference between the original target sample and the original non-target sample, Representative The original target samples, Representative Original non-target samples, Representative The first Metabolic value, Representative The original non-target samples Metabolic value, The number of metabolic values for each original sample, Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? or 0 means missing. or A value of 1 indicates no missing data.
[0068] In this embodiment, each sample in the original data set includes The metabolic values are calculated by comparing the difference between each value in the original target sample and the original non-target sample, and the union of the missing values in the same position of the two samples, where 0 means missing The first Metabolism value is missing, 1 means The first The metabolic values are not missing. By obtaining the product of the union of the two sets and the difference, the Manhattan distance between the two original samples is finally obtained. The Manhattan distance is the similarity distance difference between the two original samples.
[0069] S2: Selecting neighbor samples and neighbor values of the original target sample according to the similarity distance difference.
[0070] In this embodiment, a preset distance difference of the original target sample is obtained according to the similarity distance difference, and the original non-target samples smaller than the preset distance difference are taken as neighbor samples, and the number of neighbor samples is counted as the neighbor value.
[0071] See also Figure 2 In one embodiment, selecting the neighboring samples and neighboring values of the original target sample according to the similarity distance difference includes steps S201-S203:
[0072] S201: Calculate a preset distance difference of the original target sample according to the similarity distance difference, and obtain a maximum effective distance according to the preset distance difference.
[0073] In this embodiment, the preset distance difference is obtained by using the similarity distance difference calculated in step S1 above, and the calculation method is as follows: ,in Indicates The preset distance difference of the original target samples, is the number of samples with missing data, Indicates The original target sample and the original non-target sample The maximum similarity distance difference is respectively The sum of all differences between the minimum similarity distance differences of the original target samples and the original non-target samples.
[0074] Furthermore, through the formula , the preset distance difference and the The minimum similarity distance difference of the original target samples Sum them up to get the maximum effective distance.
[0075] S202: If the similarity distance difference of the original non-target sample is less than or equal to the maximum effective distance, the original non-target sample is the neighboring sample.
[0076] In this embodiment, when the similarity distance difference of the original non-target sample is greater than the maximum effective distance, the original non-target sample is a non-neighbor sample. By setting the maximum effective distance, the non-neighbor samples far from the original target sample can be filtered out, thereby retaining the sample points with a closer distance as neighbor samples. This method enables each sample point to have its own neighbor samples, that is, for each sample point, the number of its nearest neighbors will change according to the density of the samples around it. This method of dynamically selecting neighbor samples can better adapt to the local density changes of different sample points, and improve the accuracy and robustness of the interpolation algorithm.
[0077] S203: Count the number of the neighbor samples to obtain the neighbor value.
[0078] In this embodiment, the number of neighbor samples corresponding to each target sample is counted to obtain the neighbor value , which is used for the subsequent calculation of missing values.
[0079] S3: Obtain the missing position of the missing value in the original target sample, and generate a set of normally distributed data according to the metabolic values of all original samples at the missing position.
[0080] In this embodiment, by locating the missing position of the missing value in the original target sample, the data of all original samples at the missing position can be obtained, that is, all original samples include the original target sample and the original non-target sample, and all original sample data at the missing position are processed by mean and variance to obtain a set of normally distributed data. Through this processing, data less than the current minimum value of the metabolite can be obtained from the normally distributed data, and when interpolation is performed through the KNN algorithm, the data distribution can be better restored.
[0081] See also Figure 3In one embodiment, the step of generating a set of normally distributed data according to the metabolic values of all original samples at the missing position comprises steps S301-S302:
[0082] S301: Obtain the minimum metabolic value of all original samples at the missing position, and fill the missing position of the original target sample with the minimum metabolic value.
[0083] In this embodiment, it is assumed that there is an original data set , where the behavioral metabolic values are listed as original samples. The original data set has 4 original samples, each of which contains 5 metabolic values. , first Perform logarithm operation. Since the metabolite may have a value of 0, add 1 to each value and then take the logarithm. The data after taking the logarithm is ,Will The missing values in are replaced with the minimum value of the metabolite value corresponding to the missing value position. For example, for the second metabolite, The value is replaced with the minimum value of 5.99 of the metabolite, that is, a set of data for all original samples at the missing position is obtained. .
[0084] S302: Obtaining the metabolic values of all original samples at the missing positions to form a group of metabolic values, calculating the mean value and variance of the group of metabolic values, and generating the normal distribution data.
[0085] In this embodiment, the calculation The mean and variance of the normal distribution data are simulated and generated according to the mean and variance, which is used to select metabolic values from the normal distribution data to fill in the missing positions and obtain the preprocessed data set.
[0086] S4: classify the missing values, select target values from the normally distributed data according to the classification results, and fill the missing positions of the original target samples with the target values.
[0087] In this embodiment, it is first necessary to determine whether the missing position of the original target sample is consistent with the missing position of the neighboring sample, classify the missing values according to the consistency of the missing position, and select the target value from the simulated normal distribution data according to the preset selection rules.
[0088] In one embodiment, the classification results include non-random missing and completely random missing, and the selecting a target value from the normally distributed data based on the classification results includes: if the metabolic value of the neighboring sample at the missing position is missing, it is the non-random missing, and data less than the minimum metabolic value is randomly selected from the set of normally distributed data as the target value; if the metabolic value of the neighboring sample at the missing position is not missing, it is the completely random missing, and a value is randomly selected from the set of normally distributed data as the target value.
[0089] In this embodiment, the categories of missing values include non-random missing and completely random missing. It is detected whether there is a missing value at the same position in the original non-target sample corresponding to the missing position in the original target sample. If there is a missing value at the same position, the missing value is determined to be a non-random missing category (missing due to being below the detection limit of the instrument). If there is no missing value at the same position, the missing value is determined to be a completely random missing category. Specifically, assuming that steps S202 and S203 obtain the best neighbor values of four samples, namely sample 1, sample 2, sample 3 and sample 4 are 2, 1, 2, 1 respectively, and the nearest neighbor samples of sample 1 are sample 2 and sample 3, the nearest neighbor sample of sample 2 is sample 3, the nearest neighbor samples of sample 3 are sample 2 and sample 4, and the nearest neighbor sample of sample 4 is sample 2. Since sample 2 is the nearest neighbor sample of sample 1, and the fourth metabolite of sample 1 and sample 2 is and If both are missing, then the missing value of sample 1 is considered is missing at random, and the fourth metabolite of sample 2 Also missing non-randomly. The second metabolite of sample 2 is missing, but the second metabolite of its neighbor sample 3 is not missing, then it is considered missing. Missing completely at random.
[0090] Furthermore, for non-random missing data, data less than the minimum value of the current metabolite are randomly selected from a set of normally distributed data to fill in the missing values. and missing values The missing values are randomly missing; the completely randomly missing data are filled by randomly selecting values from the normally distributed data, that is, the missing values and missing values It is a completely missing value. Finally, according to the classification results and selection rules, random missing values can be obtained. and ; Completely missing values and , get the preprocessed data set Through this processing, data less than the current minimum metabolic value can be obtained, and the data distribution can be better restored during KNN interpolation.
[0091] S5: looping through steps S1-S4 until the missing positions of all original samples in the original data set are filled with target values, thereby obtaining a preprocessed data set.
[0092] In this embodiment, by selecting the first target original sample from the original data set and determining its neighboring samples, the missing position of its missing value and whether the neighboring samples are missing at the same missing position are judged to obtain the type of missing value, and finally a value is selected from the normally distributed data to fill the missing position, and a sample in the original data set is selected as the target sample in a loop until the missing values of the samples in the original data set are filled, and finally the preprocessed data set is obtained.
[0093] S6: Selecting preprocessed samples from the preprocessed data set in sequence as target samples to be interpolated, and calculating the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values.
[0094] In this embodiment, preprocessed samples are selected from the preprocessed data set in sequence as samples to be interpolated, and the samples to be interpolated are effectively interpolated. The weights of their neighboring samples are allocated by the inverse distance weighting method. The inverse distance weighting is a common interpolation method in geographical analysis and has been widely used in various algorithms that require distance weight allocation. It should be noted that the neighboring samples and neighboring values corresponding to the target samples to be interpolated selected in sequence are completely consistent with the neighboring samples and neighboring values of the corresponding original target samples, and there is no need to recalculate the neighboring samples and neighboring values of the samples to be interpolated.
[0095] In one embodiment, the step of calculating the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values includes:
[0096] The weight of each neighbor sample is calculated according to formula (2), which is:
[0097] (2)
[0098] in, For the The first of the target samples to be interpolated The nearest neighbor samples are The weight of the nearest neighbor samples, is the nearest neighbor value, For the The target sample to be interpolated and the The similarity distance difference between neighbor samples is For the The target sample to be interpolated and the The similarity distance difference between the nearest neighbor samples.
[0099] In this embodiment, the neighboring samples closer to the target sample to be interpolated should have a greater influence, so the weight is obtained by normalizing the derivative of the similarity distance difference based on the inverse of the similarity distance difference between the target sample to be interpolated and the neighboring samples. , making sure that the sum of all weights is 1.
[0100] S7: Calculate the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight, and fill the missing position of the target sample to be interpolated with the predicted missing value.
[0101] In this embodiment, after determining the weight of the neighboring sample corresponding to the target sample to be interpolated, the missing value of the target sample to be interpolated at the missing position is predicted using the weight and the metabolite value of the neighboring sample at the missing position, and the predicted missing value is filled into the missing position of the sample to be interpolated. It should be noted that the missing position of the target sample to be interpolated is exactly the same as that of the original target sample.
[0102] In one embodiment, the step of calculating the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight includes:
[0103] The predicted missing value of the target sample to be interpolated is calculated according to formula (3), which is:
[0104] (3)
[0105] in, For the The first of the target samples to be interpolated Predict missing values, Represents the first The sample Metabolic value.
[0106] In this embodiment, a weight-adjusted predicted missing value is found for each missing value in the sample to be interpolated in the predicted data set, and the missing value in the original data is filled by the predicted value, so as to finally obtain a complete interpolated data set that is closer to the real data distribution. Assuming that the weight of the neighbor sample 2 of the target sample 1 to be interpolated is 0.74 and the weight of the neighbor sample 3 is 0.26, the calculation formula for the fourth metabolic value of the target sample 1 to be interpolated is: 0.74*4.72+5.43*0.26=4.9046, and the predicted missing value is 4.90.
[0107] S8: looping through steps S6-S7 until the missing positions of all preprocessed samples in the preprocessed data set are filled with predicted missing values, thereby obtaining an interpolated data set.
[0108] In this embodiment, preprocessed samples are selected from the preprocessed data set as samples to be interpolated in a cyclic manner, and predicted missing values are obtained by weighted summation of their neighboring samples at the exact positions, until the missing values of all samples to be interpolated in the preprocessed data set are calculated, and finally the final interpolated data set is obtained.
[0109] The metabolomics data processing method provided in this embodiment includes steps S1-S8, S1, selecting original samples from the original data set as original target samples in sequence, and calculating the similarity distance difference between the original target samples and the original non-target samples in the original data set; S2, selecting the neighbor samples and neighbor values of the original target samples according to the similarity distance difference; S3, obtaining the missing position of the missing value in the original target sample, and generating a group of normally distributed data according to the metabolic values of all original samples at the missing position; S4, classifying the missing values, selecting the target value from the normally distributed data according to the classification result, and filling the missing position of the original target sample with the target value; S5, looping through S1-S4 Steps are performed until the missing positions of all the original samples in the original data set are filled with the target values to obtain the preprocessed data set; S6, preprocessed samples are selected from the preprocessed data set in turn as the target samples to be interpolated, and the weight of each neighbor sample is calculated according to the target sample to be interpolated, the neighbor sample corresponding to the target sample to be interpolated, and the neighbor value; S7, according to each neighbor sample of the target sample to be interpolated and its corresponding weight, the predicted missing value of the target sample to be interpolated is calculated, and the predicted missing value is filled into the missing position of the target sample to be interpolated; S8, the steps of S6-S7 are executed repeatedly until the missing positions of all the preprocessed samples in the preprocessed data set are filled with the predicted missing values to obtain the interpolated data set. The present application obtains the neighbor samples through the similarity distance difference of the samples in the original data set, that is, the distribution between the original data samples is taken into account, and the correlation between the sample to be interpolated and the neighbor sample is reflected through the weight, so that the interpolated value is more accurate.
[0110] Example 2
[0111] In addition, an embodiment of the present application provides a metabolomics data processing device, which is applied to an electronic device.
[0112] like Figure 4 As shown, the metabolomics data processing device 400 includes:
[0113] A first calculation module 401 is used to select original samples from the original data set in sequence as original target samples, and calculate the similarity distance difference between the original target samples and the original non-target samples in the original data set;
[0114] A selection module 402 is used to select neighbor samples and neighbor values of the original target sample according to the similarity distance difference;
[0115] A generating module 403 is used to obtain the missing position of the missing value in the original target sample, and generate a set of normally distributed data according to the metabolic values of all original samples at the missing position;
[0116] A first filling module 404 is used to classify the missing values, select a target value from the normal distribution data according to the classification result, and fill the missing position of the original target sample with the target value;
[0117] A first loop module 405, configured to loop through the steps from the first calculation module 401 to the first filling module 404 until the missing positions of all original samples in the original data set are filled with target values, thereby obtaining a preprocessed data set;
[0118] A second calculation module 406 is used to select preprocessed samples from the preprocessed data set in sequence as target samples to be interpolated, and calculate the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values;
[0119] A second filling module 407 is used to calculate the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight, and fill the missing position of the target sample to be interpolated with the predicted missing value;
[0120] The second loop module 408 is used to loop through the steps from the second calculation module 406 to the second filling module 407 until the missing positions of all preprocessed samples in the preprocessed data set are filled with predicted missing values to obtain an interpolated data set.
[0121] Optionally, the first calculation module 401 is further used to calculate the similarity distance difference between the original target sample and the original non-target sample in the original data set according to formula (1), and the formula (1) is:
[0122] (1)
[0123] in, is the similarity distance difference between the original target sample and the original non-target sample, Representative The original target samples, Representative Original non-target samples, Representative The first Metabolic value, Representative The original non-target samples Metabolic value, The number of metabolic values for each original sample, Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? or 0 means missing. or A value of 1 indicates no missing data.
[0124] Optionally, the selection module 402 is also used to calculate the preset distance difference of the original target sample based on the similarity distance difference, and obtain the maximum effective distance based on the preset distance difference; if the similarity distance difference of the original non-target sample is less than or equal to the maximum effective distance, then the original non-target sample is the neighbor sample; count the number of the neighbor samples to obtain the neighbor value.
[0125] Optionally, the generating module 403 is further used to obtain the minimum metabolic value of all original samples at the missing position, and fill the missing position of the original target sample with the minimum metabolic value;
[0126] The metabolic values of all original samples at the missing positions are obtained to form a group of metabolic values, and the mean value and variance of the group of metabolic values are calculated to generate the normal distribution data.
[0127] The classification results include non-random missing and completely random missing. Optionally, the first filling module 404 is also used to determine that if the metabolic value of the neighboring sample at the missing position is missing, it is the non-random missing, and data less than the minimum metabolic value is randomly selected from the set of normally distributed data as the target value; if the metabolic value of the neighboring sample at the missing position is not missing, it is the completely random missing, and a value is randomly selected from the set of normally distributed data as the target value.
[0128] Optionally, the second calculation module 406 is further used to calculate the weight of each neighbor sample according to formula (2), and the formula (2) is:
[0129] (2)
[0130] in, For the The first of the target samples to be interpolated The nearest neighbor samples are The weight of the nearest neighbor samples, is the nearest neighbor value, For the The target sample to be interpolated and the The similarity distance difference between neighbor samples is For the The target sample to be interpolated and the The similarity distance difference between the nearest neighbor samples.
[0131] Optionally, the second filling module 407 is further used to calculate the predicted missing value of the target sample to be interpolated according to formula (3), and the formula (3) is:
[0132] (3)
[0133] in, For the The first of the target samples to be interpolated Predict missing values, Represents the first The sample Metabolic value.
[0134] The metabolomics data processing device 400 provided in this embodiment can implement the metabolomics data processing method provided in Example 1, and will not be described again to avoid repetition.
[0135] The metabolomics data processing device provided in this embodiment comprises the following steps: S1, selecting original samples from an original data set as original target samples in sequence, and calculating the similarity distance difference between the original target samples and the original non-target samples in the original data set; S2, selecting neighboring samples and neighboring values of the original target samples according to the similarity distance difference; S3, obtaining the missing position of the missing value in the original target sample, and generating a set of normally distributed data according to the metabolic values of all original samples at the missing position; S4, classifying the missing values, selecting target values from the normally distributed data according to the classification results, and filling the missing position of the original target sample with the target values; S5, looping through the steps S1-S4 until the missing position of the original target sample is reached. Until the missing positions of all the original samples in the original data set are filled with the target values, a preprocessed data set is obtained; S6, preprocessed samples are selected from the preprocessed data set in turn as the target samples to be interpolated, and the weight of each neighbor sample is calculated according to the target sample to be interpolated, the neighbor sample corresponding to the target sample to be interpolated, and the neighbor value; S7, according to each neighbor sample of the target sample to be interpolated and its corresponding weight, the predicted missing value of the target sample to be interpolated is calculated, and the predicted missing value is filled into the missing position of the target sample to be interpolated; S8, loop the steps of S6-S7 until the missing positions of all the preprocessed samples in the preprocessed data set are filled with the predicted missing values, and an interpolated data set is obtained. The present application obtains neighbor samples through the similarity distance difference of the samples in the original data set, that is, the distribution between the original data samples is taken into account, and the correlation between the sample to be interpolated and the neighbor sample is reflected through the weight, so that the interpolated value is more accurate.
[0136] Example 3
[0137] In addition, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the metabolomics data processing method provided in Example 1 is executed.
[0138] The electronic device provided in the embodiment of the present invention can execute the steps of the metabolomics data processing method provided in the above method embodiment 1, which will not be described again to avoid repetition.
[0139] Example 4
[0140] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the metabolomics data processing method provided in Example 1 is implemented.
[0141] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0142] The computer-readable storage medium provided in this embodiment can implement the metabolomics data processing method provided in Example 1, and will not be described again here to avoid repetition.
[0143] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0145] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A metabolomics data processing method, characterized in that: The method comprises: S1. Selecting original samples from the original data set in sequence as original target samples, and calculating the similarity distance difference between the original target samples and the original non-target samples in the original data set; S2, selecting the neighbor samples and neighbor values of the original target sample according to the similarity distance difference; S3, obtaining the missing position of the missing value in the original target sample, and generating a set of normally distributed data according to the metabolic values of all original samples at the missing position; S4, classifying the missing values, selecting target values from the normally distributed data according to the classification results, and filling the missing positions of the original target samples with the target values; S5, looping through steps S1-S4 until the missing positions of all original samples in the original data set are filled with target values, thereby obtaining a preprocessed data set; S6, selecting preprocessed samples from the preprocessed data set in sequence as target samples to be interpolated, and calculating the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values; S7, calculating the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight, and filling the missing position of the target sample to be interpolated with the predicted missing value; S8, looping through steps S6-S7 until the missing positions of all preprocessed samples in the preprocessed data set are filled with predicted missing values, thereby obtaining an interpolated data set; The calculating the similarity distance difference between the original target sample and the original non-target sample in the original data set includes: The similarity distance difference between the original target sample and the original non-target sample in the original data set is calculated according to formula (1), and the formula (1) is: (1) in, is the similarity distance difference between the original target sample and the original non-target sample, Representative The original target samples, Representative Original non-target samples, Representative The first Metabolic value, Representative The original non-target samples Metabolic value, The number of metabolic values for each original sample, Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? Representative The first Is a metabolic value missing? Representative The original non-target samples Is a metabolic value missing? or 0 means missing. or A value of 1 indicates no missing items; The selecting the neighboring samples and the neighboring values of the original target sample according to the similarity distance difference includes: Calculating a preset distance difference of the original target sample according to the similarity distance difference, and obtaining a maximum effective distance according to the preset distance difference; If the similarity distance difference of the original non-target sample is less than or equal to the maximum effective distance, then the original non-target sample is the neighboring sample; Counting the number of the nearest neighbor samples to obtain the nearest neighbor value; The calculating the preset distance difference of the original target sample according to the similarity distance difference includes: According to the formula Calculating a preset distance difference of the original target sample; in, Indicates The preset distance difference of the original target samples, is the number of original samples with missing values, Indicates The original target samples and the previous The maximum similarity distance difference between the original non-target samples and the The difference between the minimum similarity distance difference of the original target samples and all the original non-target samples; Acquiring the maximum effective distance according to the preset distance difference includes: According to the formula Calculating the maximum effective distance of the original target sample; in, Indicates The maximum effective distance of the original target samples, Indicates The minimum similarity distance difference between the original target samples and all the original non-target samples; The step of generating a set of normally distributed data according to the metabolic values of all original samples at the missing positions includes: Obtaining the minimum metabolic value of all original samples at the missing position, and filling the missing position of the original target sample with the minimum metabolic value; Obtaining the metabolic values of all original samples at the missing positions to form a group of metabolic values, calculating the mean value and variance of the group of metabolic values, and generating the normal distribution data; The classification result includes non-random missing and completely random missing, and selecting a target value from the normally distributed data according to the classification result includes: If the metabolic value of the neighboring sample at the missing position is missing, it is the non-random missing, and data less than the minimum metabolic value is randomly selected from the set of normally distributed data as the target value; If the metabolic value of the neighboring sample at the missing position is not missing, it is the completely random missing, and a value is randomly selected from the set of normally distributed data as the target value.
2. The method according to claim 1, characterized in that The step of calculating the weight of each neighbor sample according to the target sample to be interpolated, the neighbor samples corresponding to the target sample to be interpolated, and the neighbor values includes: The weight of each neighbor sample is calculated according to formula (2), which is: (2) in, For the The first of the target samples to be interpolated The nearest neighbor samples are The weight of the nearest neighbor samples, is the nearest neighbor value, For the The target sample to be interpolated and the The similarity distance difference between neighbor samples is For the The target sample to be interpolated and the The similarity distance difference between the nearest neighbor samples.
3. The method according to claim 1, characterized in that: The step of calculating the predicted missing value of the target sample to be interpolated according to each neighboring sample of the target sample to be interpolated and its corresponding weight includes: The predicted missing value of the target sample to be interpolated is calculated according to formula (3), which is: (3) in, For the The first of the target samples to be interpolated Predict missing values, Represents the first The sample Metabolic value.
4. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method for processing metabolomics data according to any one of claims 1 to 3 is executed.
5. A computer-readable storage medium, characterized in that: The device stores a computer program, which executes the metabolomics data processing method according to any one of claims 1 to 3 when the computer program is run on a processor.
