Mass spectrometer signal noise separation method, apparatus and device, and storage medium
By combining baseline correction and first-derivative localization of mass spectrometer signals with the isolated forest algorithm classification model, noise signals are automatically separated, solving the problem of relying on manual parameter settings in existing technologies and improving the analytical precision and accuracy of mass spectrometers.
Patent Information
- Application Number
- CN202511561574.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-02-10
AI Technical Summary
Existing mass spectrometer peak identification techniques rely on manual parameter settings, lack robustness, and are difficult to distinguish between low-frequency drift noise and high-frequency noise, resulting in low analytical precision and accuracy.
Baseline correction is performed based on the calibration window of the mass spectrometer. The first derivative is used to locate peak vertices and boundary points. Combined with a pre-trained classification model based on the isolation forest algorithm, noise signals are automatically separated.
Without requiring manual parameter settings, it improves the mass spectrometer's robustness to noise, enhances analytical precision and accuracy, and effectively removes noise signals.
Smart Images

Figure CN121502144A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of signal processing technology, and more specifically to noise separation methods, apparatus, equipment, and storage media for mass spectrometer signals. Background Technology
[0002] As a core tool in analytical chemistry, the analytical precision of a mass spectrometer is of paramount importance, and the identification of spectral peaks in the mass spectrometer signal is the core factor determining the analytical accuracy of the mass spectrometer. Currently, mainstream peak identification techniques include thresholding, derivative methods, and wavelet transform methods. However, these methods heavily rely on manual parameter settings, requiring repeated adjustments for different instruments and samples. Furthermore, they lack robustness to complex noise patterns and struggle to distinguish between low-frequency drift noise and high-frequency noise, significantly reducing the analytical precision and accuracy of the mass spectrometer. Summary of the Invention
[0003] This invention provides a method, apparatus, device, and storage medium for noise separation of mass spectrometer signals, in order to solve the problems that the peak identification of mass spectrometer signals relies on manual parameter settings and lacks robustness to noise, resulting in low analytical precision and accuracy of mass spectrometers.
[0004] In a first aspect, the present invention provides a noise separation method for mass spectrometer signals, the method comprising: Based on the calibration window corresponding to the mass spectrometer, baseline calibration is performed on the mass spectrometer signal to obtain the calibration signal; Based on the first derivative, the peak vertices and corresponding boundary points in the corrected signal are located to obtain candidate peak signals; The candidate peak signal is classified based on a pre-trained classification model, and the noise signal in the candidate peak signal is separated to obtain the output signal. The classification model is constructed based on the isolated forest algorithm.
[0005] In one optional implementation, baseline correction is performed on the mass spectrometer signal based on the correction window corresponding to the mass spectrometer to obtain a correction signal, including: Determine the calibration window based on the expected peak width of the mass spectrometer; For each mass spectrometer signal, the signal location is used as the center of the correction window. The minimum signal intensity covered by the correction window is counted to obtain the baseline intensity of the corresponding signal. The corrected signal is obtained by subtracting the signal strength from the corresponding baseline strength.
[0006] In one optional implementation, based on the first derivative, the peak vertices and corresponding boundary points in the corrected signal are located to obtain candidate peak signals, including: The peak is defined as the signal whose first derivative becomes zero during the trend of the first derivative changing from a positive to a negative value. Calculate the boundary threshold corresponding to the peak based on the signal strength of the signal within a preset range of the peak; Based on the boundary threshold corresponding to the peak, the boundary point corresponding to the peak is determined in the signal within a preset range of the peak. Signals located between boundary points are identified as candidate peak signals corresponding to peak vertices.
[0007] In one optional implementation, the candidate peak signal is classified based on a pre-trained classification model, and noise signals are separated from the candidate peak signal to obtain an output signal, including: The signals in the candidate peak signals are input into the classification model in sequence to obtain the anomaly scores of each signal in the candidate peak signals; Based on the anomaly scores, the signal type of each signal in the candidate peak signal is determined; The noise signal is removed from the candidate peak signal to obtain the output signal.
[0008] In one optional implementation, the signal type of each signal in the candidate peak signal is determined based on the anomaly score, including: If the abnormal score is greater than the preset score, the signal type is determined to be a real signal; If the abnormal score is less than the preset score, the signal type is determined to be a noise signal.
[0009] In one optional implementation, after locating the peak vertices and corresponding boundary points in the correction signal based on the first derivative to obtain candidate peak signals, the method further includes: Calculate the signal-to-noise ratio of each peak in the candidate peak signal; Remove the candidate peak signals corresponding to the peaks with a signal-to-noise ratio lower than the preset signal-to-noise ratio value from the candidate peak signals.
[0010] In one optional implementation, after classifying the candidate peak signals based on a pre-trained classification model and separating the noise signals from the candidate peak signals to obtain the output signal, the method further includes: Calculate the peak width range, peak shape fit, and local signal-to-noise ratio of the output signal; The peak width range, peak shape fit, and local signal-to-noise ratio are compared with the corresponding thresholds to verify the noise separation of the output signal.
[0011] In a second aspect, the present invention provides a noise separation device for mass spectrometer signals, the device comprising: The baseline correction module is used to perform baseline correction on the mass spectrometer signal based on the correction window corresponding to the mass spectrometer, and obtain the correction signal. The candidate peak localization module is used to locate the peak vertices and corresponding boundary points in the correction signal based on the first derivative, so as to obtain the candidate peak signal. The noise separation module is used to classify candidate peak signals based on a pre-trained classification model and separate noise signals from the candidate peak signals to obtain the output signal. The classification model is constructed based on the isolated forest algorithm.
[0012] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the noise separation method for mass spectrometer signals described in the first aspect or any corresponding embodiment thereof.
[0013] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the noise separation method for mass spectrometer signals according to the first aspect or any corresponding embodiment thereof.
[0014] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the noise separation method for mass spectrometer signals described in the first aspect or any corresponding embodiment thereof.
[0015] The noise separation method for mass spectrometer signals provided in this invention performs baseline correction on the mass spectrometer signal based on the correction window corresponding to the mass spectrometer, thereby obtaining a correction signal and eliminating baseline drift. Based on the first derivative, the peak vertices and corresponding boundary points in the correction signal are located to obtain candidate peak signals, thus performing preliminary noise separation on the correction signal. Based on a pre-trained classification model, the candidate peak signals are classified, and noise signals are separated from them to obtain an output signal. The classification model is then used to further screen for noise signals in the candidate peak signals, further removing noise. Therefore, without requiring manual parameter settings, noise removal is achieved through a combination of methods, improving the robustness of the mass spectrometer to noise and thus enhancing the analytical precision and accuracy of the mass spectrometer. Attached Figure Description
[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1This is a schematic flowchart of a first method for noise separation of mass spectrometer signals according to an embodiment of the present invention; Figure 2 This is a schematic flowchart of a second method for noise separation of mass spectrometer signals according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the third process of a noise separation method for mass spectrometer signals according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the fourth process of a noise separation method for mass spectrometer signals according to an embodiment of the present invention; Figure 5 This is a structural block diagram of a noise separation device for a mass spectrometer signal according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0020] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0021] As a core tool in analytical chemistry, the analytical precision of a mass spectrometer is paramount, and peak identification is the key factor determining its analytical accuracy. Currently, mainstream peak identification techniques include thresholding, derivative methods, and wavelet transform. Thresholding identifies peaks by fixing a signal-to-noise ratio (SNR) threshold; derivative methods locate peak boundaries using changes in the first or second derivative of the data; and wavelet transform identifies characteristic peaks through multi-scale analysis and continuous wavelet transforms. However, these methods heavily rely on manual parameter settings, such as SNR threshold and peak width, requiring repeated adjustments for different instruments and samples. Furthermore, they lack robustness to complex noise patterns, especially derivative methods, which are highly sensitive to noise. When the SNR is low, the identification error is significant, and it is difficult to distinguish between low-frequency drift noise and high-frequency noise, greatly reducing the analytical precision and accuracy of the mass spectrometer.
[0022] To address the aforementioned technical problems, this invention provides a noise separation method for mass spectrometer signals. Based on the calibration window corresponding to the mass spectrometer, baseline calibration is performed on the mass spectrometer signal to obtain a calibration signal. Based on the first derivative, the peak vertices and corresponding boundary points in the calibration signal are located to obtain candidate peak signals. Based on a pre-trained classification model, the candidate peak signals are classified, and noise signals are separated from the candidate peak signals to obtain an output signal. The classification model is constructed based on the isolated forest algorithm. This invention performs baseline correction on the mass spectrometer signal based on the calibration window corresponding to the mass spectrometer, obtaining a calibration signal to eliminate baseline drift. It then locates the peak vertices and corresponding boundary points in the calibration signal using the first derivative, obtaining candidate peak signals for preliminary noise separation. A pre-trained classification model is used to classify the candidate peak signals and separate noise signals from them to obtain the output signal. This classification model is then used to further screen for noise signals in the candidate peak signals, further removing noise. Thus, without requiring manual parameter settings, this invention improves the robustness of the mass spectrometer to noise by combining multiple methods, thereby enhancing the analytical precision and accuracy of the mass spectrometer.
[0023] According to an embodiment of the present invention, a method for noise separation of mass spectrometer signals is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0024] This embodiment provides a noise separation method for mass spectrometer signals, which can be used in mass spectrometers. Figure 1 This is a schematic flowchart of a first method for noise separation of mass spectrometer signals according to an embodiment of the present invention, as shown below. Figure 1 As shown, the process includes the following steps: Step S101: Based on the calibration window corresponding to the mass spectrometer, perform baseline calibration on the mass spectrometer signal to obtain the calibration signal.
[0025] In this embodiment of the invention, the calibration window is determined based on the analytical characteristics of the mass spectrometer itself, such as the expected peak width of the mass spectrometer, instead of using manually set parameters. This allows for adaptive baseline calibration based on the characteristics of the mass spectrometer, avoiding overcalibration and preserving low-abundance peaks in the mass spectrometer signal.
[0026] In this embodiment of the invention, based on a determined correction window, the correction window is slidable, and baseline correction is performed on the original signal of the mass spectrometer within the signal range covered by the correction window to eliminate baseline drift and obtain a corrected signal.
[0027] Step S102: Based on the first derivative, locate the peak vertices and corresponding boundary points in the correction signal to obtain candidate peak signals.
[0028] In this embodiment of the invention, the derivative method is used to identify peak vertices and peak boundaries to perform preliminary noise separation on the corrected signal after baseline correction. Specifically, the first derivative of each signal in the corrected signal is calculated, and the peak vertices and corresponding boundary points are located based on the changing trends of the first derivatives at each signal. At both the peak vertices and boundary points, the value of the first derivative is 0, but at the peak vertices, the trend changes from positive to negative, while at the boundary points, the trend changes from negative to positive. This pattern is used to identify and locate the peak vertices and corresponding boundary points in the corrected signal, thereby obtaining candidate peak signals.
[0029] Step S103: Classify the candidate peak signals based on the pre-trained classification model, separate the noise signals in the candidate peak signals, and obtain the output signal.
[0030] In this embodiment of the invention, a classification model is used to classify candidate peak signals, and noise separation is performed based on the classification results, thus performing a second noise separation. The classification model is constructed based on the isolated forest algorithm and contains multiple trained binary trees. Nodes in the binary trees are used to divide the signal into branches according to the relationship between the signal's feature data and the node's feature value. For example, signals with values smaller than the node's feature value are assigned to the left branch, and signals with values larger than the node's feature value are assigned to the right branch. The signal is input into each binary tree of the classification model, and each binary tree is divided downwards from its root node until the corresponding position of the signal in the binary tree is found, i.e., the signal's feature value is the same as the node's feature value, or the last level of the binary tree is reached. The query path length of the signal in each binary tree is obtained, and the classification model classifies the signal based on the query path length of the signal in each binary tree.
[0031] In this embodiment of the invention, each signal data in the candidate peak signal is input into the trained classification model to obtain the classification of each signal data, and the signal data classified as noise signals are separated and removed from the candidate peak signal to obtain the final output signal.
[0032] In one optional implementation, after obtaining the output signal, further noise separation verification is performed on the output signal to ensure that the obtained output signal has been filtered out of noise and meets the reliability requirements. Specifically, the peak width range, peak shape fit degree, and local signal-to-noise ratio of the output signal are calculated; the peak width range, peak shape fit degree, and local signal-to-noise ratio are compared with the corresponding thresholds to perform noise separation verification on the output signal.
[0033] The peak width range of the output signal can be calculated using the following formula (1): Formula (1) in, For the peak width range, This refers to the left half-height and width position. This refers to the right half-width position. The left half-width position is the first position where the signal strength in the direction to the left of the peak is half the signal strength at the peak peak. The right half-width position is the first position where the signal strength in the direction to the right of the peak is half the signal strength at the peak peak. The peak width range corresponds to a threshold including the minimum and maximum peak widths, meaning the peak width range must satisfy the following: The minimum and maximum peak width ranges are determined based on the physical range of the mass spectrometer's peak width.
[0034] The peak shape fit can be calculated using the following formula (2): Formula (2) in, The peak shape fit is... The actual signal strength, The signal fitting intensity, This is the average of the actual signal intensities of all signals in the output signal, where the signal fitting intensity is obtained based on a Gaussian fit to the output signal. The peak shape fit is used to verify whether the peak shape of the output signal conforms to a Gaussian distribution, thereby determining whether false positive peaks, such as overlapping peaks or noise superposition, have been removed. The threshold for the peak shape fit is... That is, the peak shape fit must meet the following requirements: This is to ensure that the peak shape conforms to a Gaussian distribution.
[0035] The local signal-to-noise ratio can be calculated using the following formula (3): Formula (3) in, For local signal-to-noise ratio, The signal strength at the peak. These are the 30% of signal data points with the lowest intensity within a local window. The local signal-to-noise ratio (SNR) is the median of the 30% of signal data points with the lowest intensity within the local window. It is used to verify that the peak intensity of the output signal is significantly higher than the local background noise, thus verifying whether noise has been removed. The threshold for the local SNR is... That is, the local signal-to-noise ratio must meet the following requirements: .
[0036] The noise separation method for mass spectrometer signals provided in this invention performs baseline correction on the mass spectrometer signal based on the correction window corresponding to the mass spectrometer, thereby obtaining a correction signal and eliminating baseline drift. Based on the first derivative, the peak vertices and corresponding boundary points in the correction signal are located to obtain candidate peak signals, thus performing preliminary noise separation on the correction signal. Based on a pre-trained classification model, the candidate peak signals are classified, and noise signals are separated from them to obtain an output signal. The classification model is then used to further screen for noise signals in the candidate peak signals, further removing noise. Therefore, without requiring manual parameter settings, noise removal is achieved through a combination of methods, improving the robustness of the mass spectrometer to noise and thus enhancing the analytical precision and accuracy of the mass spectrometer.
[0037] This embodiment provides a noise separation method for mass spectrometer signals, which can be used in mass spectrometers. Figure 2 This is a schematic diagram of a second process for noise separation of mass spectrometer signals according to an embodiment of the present invention, as shown below. Figure 2 As shown, the process includes the following steps: Step S201: Based on the calibration window corresponding to the mass spectrometer, perform baseline calibration on the mass spectrometer signal to obtain the calibration signal.
[0038] Specifically, step S201 includes: Step S2011: Determine the calibration window based on the expected peak width of the mass spectrometer.
[0039] In this embodiment of the invention, the expected peak width (half-width at half maximum) of the mass spectrometer in the current detection mode is obtained. The expected peak width is then multiplied by a set scaling factor to obtain the correction window size. For example, if the expected peak width of the mass spectrometer is 5 and the scaling factor is 2, then the correction window size is 10. During the calibration process, the correction window will cover the signal range corresponding to each correction window size to the left and right of the center signal point. That is, if the correction window size is... The actual signal range covered by the correction window is: .
[0040] Step S2012: For each mass spectrometer signal, take the signal position as the center of the correction window, count the minimum signal intensity covered by the correction window, and obtain the baseline intensity corresponding to the signal.
[0041] In this embodiment of the invention, baseline correction is performed for each signal in the mass spectrometer signal. Specifically, for each signal in the mass spectrometer signal, it is used as the center signal point of the correction window, and the minimum signal intensity within the signal range covered by the correction window is calculated. The baseline intensity corresponding to the signal is obtained, where, To adjust the window size, The signal being calibrated is the center signal point of the calibration window. To correct the signals within the signal range covered by the correction window.
[0042] Step S2013: Subtract the signal strength of the signal from the corresponding baseline strength to obtain the corrected signal.
[0043] In this embodiment of the invention, for each signal in the mass spectrometer signal, the signal intensity of the signal is subtracted from the baseline intensity calculated in the above steps to obtain the correction signal after eliminating baseline drift.
[0044] Step S202: Based on the first derivative, the peak vertices and corresponding boundary points in the corrected signal are located to obtain candidate peak signals. For details, please refer to [link to relevant documentation]. Figure 1 Step S102 of the illustrated embodiment will not be described again here.
[0045] Step S203: Based on the pre-trained classification model, classify the candidate peak signals and separate the noise signals from the candidate peak signals to obtain the output signal. For details, please refer to [link to relevant documentation]. Figure 1 Step S103 of the illustrated embodiment will not be described again here.
[0046] The noise separation method for mass spectrometer signals provided in this invention uses adaptive morphological filtering for baseline correction. On the one hand, it avoids the problem of overcorrection and excessive suppression of the baseline caused by polynomial fitting, which leads to the masking of low abundance peaks. On the other hand, it adaptively adjusts the correction window based on the expected peak width of the mass spectrometer, thereby avoiding the problems of a fixed window that is too large, causing the peak signal to be misjudged as the baseline, or a window that is too small, failing to effectively eliminate drift. Thus, it can strip away the true baseline and retain the complete signal of low abundance peaks.
[0047] This embodiment provides a noise separation method for mass spectrometer signals, which can be used in mass spectrometers. Figure 3 This is a schematic diagram of the third process of a noise separation method for mass spectrometer signals according to an embodiment of the present invention, as shown below. Figure 3 As shown, the process includes the following steps: Step S301: Based on the calibration window corresponding to the mass spectrometer, perform baseline calibration on the mass spectrometer signal to obtain the calibration signal. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0048] Step S302: Based on the first derivative, locate the peak vertices and corresponding boundary points in the correction signal to obtain candidate peak signals.
[0049] Specifically, step S302 includes: Step S3021: The peak value is determined as the signal corresponding to the first derivative being zero during the trend of the first derivative changing from a positive value to a negative value.
[0050] In this embodiment of the invention, the mathematical characteristic corresponding to the peak is that the signal strength rises to a peak and then falls. Correspondingly, the peak is the point where the derivative changes from positive to negative and crosses zero. Therefore, the signal corresponding to the point where the first derivative is zero during the trend of the first derivative changing from positive to negative in the correction signal is determined as the peak.
[0051] In one alternative implementation, the correction signal is smoothed by filtering before calculating the first derivative to reduce high-frequency noise interference and smooth the signal. Savitzky-Golay filtering can be used to filter the correction signal, smoothing noise while preserving the first and second derivative characteristics of the correction signal to the greatest extent possible, thus avoiding peak distortion caused by traditional moving average filtering.
[0052] Step S3022: Calculate the boundary threshold corresponding to the peak based on the signal strength of the signal within a preset range of the peak.
[0053] In this embodiment of the invention, a threshold method and local signal-to-noise ratio (SNR) are used to determine the boundary points corresponding to the peak apex. This verifies the authenticity and reliability of the detected candidate peaks while simultaneously locating the boundary points, i.e., determining whether the SNR is high enough to exclude noise spikes. Specifically, a local analysis window is constructed centered on the peak apex determined in the above steps. The signal range covered by this local analysis window is the preset range corresponding to the peak apex. The size of the local analysis window can be determined based on the expected peak width of the mass spectrometer, for example, it can be set to 2-3 times the expected peak width to ensure complete peak coverage. Within the constructed local analysis window, high-intensity signals near the identified peak apex are removed, and only low-intensity signals in the edge regions are retained as baseline noise. For example, the lowest 30% of data points within the window are retained. The boundary threshold is calculated based on the signal intensity of the baseline noise. For example, the mean of the baseline noise signal intensity can be used, or the mean square error of the baseline noise can be added to the mean, etc. Specific calculation methods are not limited here.
[0054] Step S3023: Based on the boundary threshold corresponding to the peak, determine the boundary point corresponding to the peak in the signal within the preset range of the peak.
[0055] In this embodiment of the invention, the boundary points corresponding to the peak include a left boundary point and a right boundary point. Based on the calculated boundary threshold, within a preset range of the peak, the signal is traversed to the left and right sides of the peak respectively, and the position where the signal intensity first decreases below the boundary threshold is found, which are the left and right boundary points corresponding to the peak.
[0056] Step S3024: The signals located between the boundary points are identified as candidate peak signals corresponding to the peak apex.
[0057] In this embodiment of the invention, for each peak vertex and its corresponding boundary point, all signals located between the boundary points are determined as candidate peak signals corresponding to that peak vertex.
[0058] In one optional implementation, after obtaining the candidate peak signal, the signal-to-noise ratio (SNR) of each peak in the candidate peak signal is calculated, wherein the SNR can be the global SNR, thereby eliminating falsely judged noise spikes based on the global SNR; and the candidate peak signal corresponding to the peak with an SNR lower than the preset SNR value is removed from the candidate peak signal.
[0059] Step S303: Based on the pre-trained classification model, classify the candidate peak signals and separate the noise signals from the candidate peak signals to obtain the output signal. For details, please refer to [link to relevant documentation]. Figure 1Step S103 of the illustrated embodiment will not be described again here.
[0060] The noise separation method for mass spectrometer signals provided in this invention locates peak vertices using the first derivative and determines the boundary points corresponding to each peak vertices by combining the threshold method and local signal-to-noise ratio. This method can identify and extract spurious peaks caused by noise while completely preserving the peak spectrum signal, thereby improving the accuracy of peak signal identification.
[0061] This embodiment provides a noise separation method for mass spectrometer signals, which can be used in mass spectrometers. Figure 4 This is a schematic flowchart of the fourth method for noise separation of mass spectrometer signals according to an embodiment of the present invention, as shown below. Figure 4 As shown, the process includes the following steps: Step S401: Based on the calibration window corresponding to the mass spectrometer, perform baseline calibration on the mass spectrometer signal to obtain the calibration signal. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0062] Step S402: Based on the first derivative, the peak vertices and corresponding boundary points in the corrected signal are located to obtain candidate peak signals. For details, please refer to [link to relevant documentation]. Figure 1 Step S102 of the illustrated embodiment will not be described again here.
[0063] Step S403: Classify the candidate peak signals based on the pre-trained classification model, separate the noise signals in the candidate peak signals, and obtain the output signal.
[0064] Specifically, step S403 includes: Step S4031: Input the signals in the candidate peak signals into the classification model in sequence to obtain the anomaly scores of each signal in the candidate peak signals.
[0065] In this embodiment of the invention, the candidate peak signals are sequentially input into the classification model. In the classification model, the signals are input into multiple binary trees, and the query path lengths in each binary tree are obtained. The average path length is obtained by averaging the query path lengths in each binary tree. The average path length is then compared and calculated with the preset standard path length in the classification model to obtain the anomaly score of the signal relative to the standard path length, thereby quantifying the degree of anomaly of the signal based on the standard path length. The preset standard path length in the classification model is obtained based on training samples during the training process of the classification model. The anomaly score of the signal can be calculated using the following formula (4): Formula (4) in, These are abnormal scores. This represents the average path length. The standard path length is denoted as 1. The closer the anomaly score is to 1, the greater the difference between the signal and the background noise, and the greater the probability that the signal is a true peak signal. The closer the anomaly score is to 0, the more similar the signal is to the background noise, and the greater the probability that the signal is background noise. Therefore, the signal can be classified based on its anomaly score.
[0066] Step S4032: Based on the anomaly score, determine the signal type of each signal in the candidate peak signal.
[0067] In this embodiment of the invention, the abnormal score of a signal is compared with a preset score to determine the signal type of each signal. If the abnormal score is greater than the preset score, the signal type is determined to be a real signal; if the abnormal score is less than the preset score, the signal type is determined to be a noise signal.
[0068] In an optional implementation, the candidate peak signal can be divided into multiple groups of candidate peaks according to the peak apex and the signal range of its corresponding candidate peak signal, and the feature parameters of each group of candidate peaks, such as peak intensity, retention time, peak width, etc., can be calculated separately. When training the classification model, training is performed on the features of a group of signals; that is, a group of signals is extracted, and a binary tree is randomly constructed using one of the features of that group of signals. This allows for the construction and training of binary trees for multiple feature parameters, resulting in a classification model that classifies signals based on feature parameters. When classifying signals, the feature parameters of each group of candidate peaks are input into the classification model to obtain the anomaly score corresponding to each feature parameter of each group of candidate peaks. Based on the anomaly scores corresponding to each feature parameter, the signal type of the candidate peak is determined. This enables high recognition capability for spectral peaks of different feature types, such as high-abundance peaks, low-abundance peaks, wide peaks, narrow peaks, etc., effectively preserving various types of spectral peaks.
[0069] Step S4033: Remove the noise signal from the candidate peak signal to obtain the output signal.
[0070] In this embodiment of the invention, signals identified as noise signals are removed from candidate peak signals, thereby further separating noise from the mass spectrometer signal to obtain the final output signal.
[0071] The noise separation method for mass spectrometer signals provided in this invention uses a classification model to classify candidate peak signals, thereby automatically and quickly identifying noise signals in the signal without the need for manual parameter setting. Furthermore, the classification model can adapt to different mass spectrometry types, distinguish the characteristic differences of different types of noise, and has good robustness to noise. At the same time, it can identify multiple types of spectral peak features, effectively retain various spectral peaks, and further improve the accuracy and precision of mass spectrometer peak identification.
[0072] This embodiment also provides a noise separation device for mass spectrometer signals, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0073] This embodiment provides a noise separation device for mass spectrometer signals, such as... Figure 5 As shown, it includes: The baseline correction module 501 is used to perform baseline correction on the mass spectrometer signal based on the correction window corresponding to the mass spectrometer to obtain a correction signal. The candidate peak localization module 502 is used to locate the peak vertices and corresponding boundary points in the correction signal based on the first derivative, so as to obtain the candidate peak signal. The noise separation module 503 is used to classify candidate peak signals based on a pre-trained classification model and separate noise signals from the candidate peak signals to obtain the output signal. The classification model is constructed based on the isolated forest algorithm.
[0074] In one optional implementation, the baseline correction module 501 includes: The calibration window determination unit is used to determine the calibration window based on the expected peak width of the mass spectrometer. The baseline intensity determination unit is used to calculate the minimum signal intensity covered by the correction window for each mass spectrometer signal, with the signal position as the center of the correction window, and obtain the baseline intensity corresponding to the signal. The correction signal determination unit is used to subtract the signal strength of the signal from the corresponding baseline strength to obtain the correction signal.
[0075] In one optional implementation, the candidate peak localization module 502 includes: The peak determination unit is used to determine the peak of the correction signal, specifically the signal whose first derivative is zero during the trend of the first derivative changing from a positive value to a negative value. The boundary threshold determination unit is used to calculate the boundary threshold corresponding to the peak based on the signal strength of the signal within a preset range of the peak. The boundary point determination unit is used to determine the boundary point corresponding to the peak in the signal within a preset range of the peak based on the boundary threshold corresponding to the peak. The candidate peak signal determination unit is used to determine the signals located between boundary points as candidate peak signals corresponding to the peak vertices.
[0076] In one optional implementation, the noise separation module 503 includes: The anomaly score determination unit is used to input the signals in the candidate peak signal into the classification model in sequence to obtain the anomaly score of each signal in the candidate peak signal; The signal type determination unit is used to determine the signal type of each signal in the candidate peak signal based on the anomaly score; The noise removal unit is used to remove noise signals from the candidate peak signals to obtain the output signal.
[0077] In one optional implementation, the signal type determination unit includes: The first signal type determination subunit is used to determine the signal type as a real signal if the abnormal score is greater than the preset score. The second signal type determination subunit is used to determine the signal type as a noise signal if the abnormal score is less than a preset score.
[0078] In one alternative embodiment, the device further includes: The signal-to-noise ratio (SNR) calculation module is used to calculate the SNR of each peak in the candidate peak signal. The candidate peak filtering module is used to remove candidate peak signals corresponding to peaks with a signal-to-noise ratio lower than a preset signal-to-noise ratio value from the candidate peak signals.
[0079] In one alternative embodiment, the device further includes: The parameter calculation module is used to calculate the peak width range, peak shape fit, and local signal-to-noise ratio of the output signal. The noise separation verification module is used to compare the peak width range, peak shape fitting degree, and local signal-to-noise ratio with the corresponding thresholds to perform noise separation verification on the output signal.
[0080] The noise separation device for mass spectrometer signals provided in this embodiment of the invention can execute the noise separation method for mass spectrometer signals provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.
[0081] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0082] The following is a detailed reference. Figure 6This diagram illustrates a suitable structural design for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) 602 or a program loaded from memory 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0083] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0084] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by the processor 601, it performs the functions defined in the noise separation method for mass spectrometer signals according to embodiments of the present invention.
[0085] Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0086] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded via a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the noise separation method for mass spectrometer signals shown in the above embodiments is implemented.
[0087] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0088] Although embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the present invention.
Claims
1. A method for noise separation of mass spectrometer signals, characterized in that, The method includes: Based on the calibration window corresponding to the mass spectrometer, baseline calibration is performed on the mass spectrometer signal to obtain the calibration signal; Based on the first derivative, the peak vertices and corresponding boundary points in the corrected signal are located to obtain candidate peak signals. The candidate peak signals are classified based on a pre-trained classification model, and noise signals in the candidate peak signals are separated to obtain the output signal. The classification model is constructed based on the isolated forest algorithm.
2. The method according to claim 1, characterized in that, The baseline correction of the mass spectrometer signal based on the correction window corresponding to the mass spectrometer is performed to obtain the correction signal, including: Determine the calibration window based on the expected peak width of the mass spectrometer; For each mass spectrometer signal, the signal location is used as the center of the correction window. The minimum signal intensity covered by the correction window is calculated to obtain the baseline intensity of the signal. The corrected signal is obtained by subtracting the signal strength from the corresponding baseline strength.
3. The method according to claim 1, characterized in that, The step of locating the peak vertices and corresponding boundary points in the corrected signal based on the first derivative to obtain candidate peak signals includes: The peak is defined as the signal whose first derivative is zero during the trend of the first derivative changing from a positive value to a negative value in the correction signal. Based on the signal strength of the signal within a preset range of the peak, calculate the boundary threshold corresponding to the peak; Based on the boundary threshold corresponding to the peak, the boundary point corresponding to the peak is determined in the signal within a preset range of the peak. The signals located between the boundary points are identified as candidate peak signals corresponding to the peak apex.
4. The method according to claim 1, characterized in that, The classification of the candidate peak signals based on the pre-trained classification model, and the separation of noise signals from the candidate peak signals to obtain the output signal, includes: The signals in the candidate peak signals are sequentially input into the classification model to obtain the anomaly score of each signal in the candidate peak signals; Based on the anomaly scores, the signal type of each signal in the candidate peak signals is determined; The noise signal is removed from the candidate peak signal to obtain the output signal.
5. The method according to claim 4, characterized in that, The step of determining the signal type of each signal in the candidate peak signal based on the anomaly score includes: If the abnormal score is greater than the preset score, the signal type is determined to be a real signal; If the abnormal score is less than the preset score, then the signal type is determined to be a noise signal.
6. The method according to claim 1, characterized in that, After locating the peak vertices and corresponding boundary points in the corrected signal based on the first derivative to obtain candidate peak signals, the method further includes: Calculate the signal-to-noise ratio of each peak in the candidate peak signal; Candidate peak signals corresponding to peaks with a signal-to-noise ratio lower than a preset signal-to-noise ratio value are removed from the candidate peak signals.
7. The method according to claim 1, characterized in that, After classifying the candidate peak signals based on the pre-trained classification model and separating the noise signals from the candidate peak signals to obtain the output signal, the method further includes: Calculate the peak width range, peak shape fit, and local signal-to-noise ratio of the output signal; The peak width range, peak shape fitting degree, and local signal-to-noise ratio are compared with the corresponding thresholds to verify the noise separation of the output signal.
8. A noise separation device for mass spectrometer signals, characterized in that, The device includes: The baseline correction module is used to perform baseline correction on the mass spectrometer signal based on the correction window corresponding to the mass spectrometer, and obtain the correction signal. The candidate peak localization module is used to locate the peak vertices and corresponding boundary points in the correction signal based on the first derivative, so as to obtain the candidate peak signal. The noise separation module is used to classify the candidate peak signal based on a pre-trained classification model and separate the noise signal in the candidate peak signal to obtain the output signal. The classification model is constructed based on the isolated forest algorithm.
9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the noise separation method for mass spectrometer signals according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the noise separation method for the mass spectrometer signal according to any one of claims 1 to 7.