A peak detection method, system and medium based on a clustering algorithm

By using a peak detection method based on clustering algorithms, the problems of peak shape variation and noise interference in narrow peak data processing are solved, achieving accurate peak start and end point identification and noise filtering, thus improving the accuracy and efficiency of data processing.

CN122332995APending Publication Date: 2026-07-03ANHUI WAYEE SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ANHUI WAYEE SCI & TECH CO LTD
Filing Date
2026-06-05
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing technologies suffer from severe peak shape variations, biased start and end point judgments, and insufficient resistance to high-frequency noise in narrow peak data processing. In particular, they are prone to over-segmentation or inability to distinguish neighboring peaks when identifying narrow peaks.

Method used

A peak detection method based on clustering algorithm is adopted. By setting the first derivative step size to 1, the maximum points are obtained, the maximum points with the difference of the horizontal coordinate less than the threshold are merged, the peak vertices are screened, the baseline distance is calculated, the candidate peaks are screened, and the peak height is used to cluster and filter noise peaks, and the baseline and start and end points are corrected.

Benefits of technology

It effectively filters noise, accurately analyzes the start and end points of peaks, improves the recognition accuracy of narrow peak data, overcomes the data distortion problem caused by filtering algorithms, and has a good filtering effect on high-frequency noise and slowly changing noise.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122332995A_ABST
    Figure CN122332995A_ABST
Patent Text Reader

Abstract

This invention discloses a peak detection method, system, and medium based on a clustering algorithm. The method includes: setting the step size of the first derivative to 1, calculating each maximum point of the acquired data; sequentially calculating the abscissa difference between two adjacent maximum points; if the abscissa difference is less than a distance threshold or multiple consecutive abscissa differences are less than the distance threshold, selecting the maximum ordinate value among the two or more maximum points less than the distance threshold as the merging point; using the merging point and two adjacent maximum points with an abscissa difference not less than the distance threshold as peak vertices; calculating the baseline distance of each peak based on the peak vertices, and selecting candidate peaks with a baseline distance less than a width threshold; clustering the candidate peaks by peak height to filter noise peaks; and correcting the peak baseline, peak start point, and peak end point based on the filtered data. The detection method proposed in this application is applicable to narrow peak data, effectively filters noise, and accurately analyzes the peak start and end point positions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of signal processing, and in particular to a peak detection method, system, and medium based on a clustering algorithm. Background Technology

[0002] In the field of analytical instruments, whether it is the chromatographic waveform output by gas chromatography (GC) or liquid chromatography (LC), or the waveform of mass spectrometry, absorption spectroscopy, or X-ray spectroscopy, peak identification is the core link in data processing, and its identification accuracy directly determines the reliability of the final qualitative and quantitative analysis results.

[0003] Narrow peaks (high and sharp with extremely small half-peak width) are a typical challenge in chromatographic data processing, commonly found in high-speed analyses such as ion chromatography, ultra-high performance liquid chromatography (UHPLC), and gas chromatography (GC). The core challenges lie in: sparse sampling points, difficulty in determining the signal-to-noise ratio, and excessive derivative response.

[0004] For data with narrow peaks, using conventional spectral detection methods may lead to the following problems: (1) When detecting chromatographic or mass spectrometric peaks using a first-order algorithm, if the filtering window is not reasonable, it will cause serious changes in peak shape, resulting in serious deviations in the start and end points, and two very close peaks will be judged as one. (2) Most existing first-order algorithms determine the start and end points of peaks by fluctuations, which can cause peaks to terminate prematurely or be extended too much, and have insufficient anti-interference ability against high-frequency noise.

[0005] Chinese patent CN107860845B discloses a method for automatically resolving overlapping peaks in GC-MS to accurately identify compounds. This patent combines automated peak extraction and clustering with the classic multivariate curve resolution-alternating least squares method to solve the problem of automated resolution of overlapping peaks. The patent proposes using the shape and retention time of EIC chromatographic peaks as similarity criteria to cluster EIC peaks belonging to the same compound together. This clustering process is suitable for conventional EIC peaks with relatively uniform density, stable peak width, and good inter-cluster separation. However, this clustering method may incorrectly cluster different time points within the same narrow peak (which should belong to one peak) into multiple subclasses (oversegmentation) or fail to distinguish adjacent but different narrow peaks. The technical problems and methods of this patent differ from those of this application.

[0006] Chinese patent application CN118587463A discloses a method and apparatus for clustering spectra, as well as a method and apparatus for baseline correction. This scheme clusters spectral peaks based on their position and width, improving the accuracy of the clustering results and simplifying the calculation. It proposes a technical solution for clustering overlapping spectral peaks, assuming they typically share similar characteristics. While the clustering process does not rely on a K-value or density threshold, it is highly sensitive to the quality of the full width at half maximum (FWHM) estimation and requires several pre-defined conditions for the clustered data (such as sufficient sampling points and symmetrical peak shapes). The technical means of this patent differ from those in this application.

[0007] Chinese patent application CN121239529A discloses a method, apparatus, processor, and computer-readable storage medium for highly adaptive peak detection in blind signal spectra. This patent decomposes the peak detection process into two organically combined stages: "preliminary detection of broad candidate peaks" and "adaptive intelligent screening based on machine learning clustering." This achieves high-precision, robust peak detection that automatically adapts to signal characteristics without requiring manual preset key thresholds. However, in the preliminary candidate peak detection of this patent, the fixed shielding window radius may lead to forced shielding of adjacent narrow peaks, resulting in missed detections, especially for narrow peak data processing. Furthermore, other valid peaks within the shielding window may be incorrectly eliminated. Additionally, the clustering method in this patent uses K-Means clustering (K=3) based on the intensity values ​​of candidate peaks with a fixed hierarchy, which may distort the results. The technical methods of this patent differ from those in this application. Summary of the Invention

[0008] To address the shortcomings of the prior art, this invention provides a peak detection method, system, and medium based on a clustering algorithm.

[0009] The technical solution adopted by this invention to solve its technical problem is as follows: A peak detection method based on clustering algorithm, suitable for data with narrow peaks, including: Set the step size of the first derivative to 1, and calculate each maximum point of the acquired data; the acquired data is one-dimensional. Calculate the difference in the x-coordinates of two adjacent maximum points in sequence; If the difference between the horizontal coordinates is less than the distance threshold or multiple consecutive differences between the horizontal coordinates are less than the distance threshold, the maximum value of the vertical coordinate will be used as the merging point among the two or more maximum points that are less than the distance threshold. The two adjacent maximum points with a merging point and a horizontal coordinate difference not less than the distance threshold are taken as peak vertices, such that the horizontal coordinate difference between any two adjacent peak vertices is not less than the distance threshold. Based on the peak apex, calculate the baseline distance of each peak and filter out candidate peaks whose baseline distance is less than the width threshold; Candidate peaks are clustered by peak height to filter out noise peaks; based on the filtered data, the peak baseline, peak start point, and peak end point are corrected.

[0010] Furthermore, it also includes: If the distance between the starting point or ending point of any candidate peak and its peak vertex is 1, and the starting point or ending point of the current peak coincides with that of an adjacent peak, then the current peak is merged into the adjacent peak, and the merged peak data is used as a candidate peak for clustering; if there is no overlap, then the current peak is a noise peak.

[0011] Furthermore, the baseline distance is: Calculate the minimum value of the data between every two adjacent extreme points in the peak, and use it as the peak start point and peak end point; use the difference in the x-coordinate between the current peak start point and peak end point as the baseline distance.

[0012] Furthermore, the clustering algorithm is DBSCAN.

[0013] Furthermore, candidate peaks are clustered based on peak height to filter out noise peaks, including: Set the minimum number of points and the neighborhood radius, and sort the peak heights of all currently filtered peaks in order of data size; Based on the sorting results, select each peak height data point in turn and calculate all points within its neighborhood radius; If the number of points in the neighborhood of any peak height data point is greater than or equal to the minimum number of points, then the peak height data point and all data points in its neighborhood form a cluster; if the number of points in the neighborhood is less than the minimum number of points, then it is a noise point.

[0014] Furthermore, candidate peaks are clustered by peak height to filter noise peaks, including: if the number of peaks in the clusters selected by clustering exceeds the number threshold, then the height threshold is set to 3 times the baseline noise to filter noise peaks.

[0015] Furthermore, this includes: calculating the height distance between each peak apex and its baseline, and using *a* times the maximum height distance as the neighborhood radius; where 0 <a<1。

[0016] Furthermore, the peak baseline is corrected, including: correcting the baseline of each peak individually, or correcting the baseline of the entire peak in the filtered data, so that the data of each peak are on the same side of the peak baseline.

[0017] Based on the same inventive concept, this application also proposes a peak detection system based on a clustering algorithm, comprising: The first-order processing module sets the step size of the first derivative to 1 and is used to calculate each maximum point of the acquired data; the acquired data is one-dimensional and has narrow peaks. The peak filtering module is used to calculate the difference in the x-coordinates of two adjacent maxima points in turn. If the difference in the x-coordinates is less than a distance threshold or multiple consecutive differences in the x-coordinates are less than the distance threshold, the maximum value of the y-coordinate is used as the merging point among the two or more maxima points that are less than the distance threshold. The two adjacent maxima points with the merged point and the difference in the x-coordinates not less than the distance threshold are used as peak vertices, so that the difference in the x-coordinates between any two adjacent peak vertices is not less than the distance threshold. Based on the peak vertices, the baseline distance of each peak is calculated, and candidate peaks with a baseline distance less than the width threshold are filtered out. The clustering module clusters candidate peaks based on their peak height to filter out noise peaks. The correction module corrects the peak baseline, peak start point, and peak end point based on the filtered data.

[0018] Based on the same inventive concept, this application also proposes a computer storage medium on which a computer program is stored, which, when executed by a processor, implements the method described above.

[0019] The beneficial effects of this invention are reflected in: The detection method proposed in this application is applicable to narrow peak data, effectively filters noise, and accurately analyzes the start and end points of peaks.

[0020] The peak detection method proposed in this application is suitable for narrow peak data. Compared with conventional filtering methods, it firstly overcomes the problem that filtering algorithms may cause data distortion; secondly, the method of this application can accurately analyze the start and end points of peaks without filtering or with a small filtering window, and it has good filtering effect on high-frequency noise; in addition, this application also makes up for the poor processing effect of filtering algorithms on slowly changing noise peaks.

[0021] In the peak detection method proposed in this application, the step size of the first derivative is set to 1, and the possible peaks in the data are judged point by point to avoid missed detection and inaccurate peak detection points. However, setting the step size to 1 also has the problem of noise misjudgment. Therefore, based on the first derivative, this application generates an improved first-order algorithm by merging the maximum points to filter the interference of high-frequency noise and obtain the preliminary screening results of peaks.

[0022] Based on the improved first-order algorithm, this application proposes a method for filtering noise peaks using a width threshold, addressing the impact of high-frequency noise peaks on the final detection results. Furthermore, the width threshold filtering process includes subsequent processing steps such as re-verification and multiple screenings to eliminate noise points and improve the efficiency of subsequent data processing.

[0023] Furthermore, the peak detection method proposed in this application also uses the width threshold and the peak start and end point to jointly determine "shoulder-like peaks", and determines whether the "shoulder-like peaks" are noise based on the overlap point between the "shoulder-like peaks" and adjacent peaks, which simplifies the noise processing process, solves the problem that the first derivative cannot identify similar data, and makes the peak detection results more accurate.

[0024] The peak detection method proposed in this application also considers removing slowly changing noise peaks. After noise filtering of the peak width, a density-based clustering algorithm is used to cluster the peak heights of the obtained candidate peaks to obtain accurate peak detection results.

[0025] The peak detection method proposed in this application, after undergoing first-order differentiation and noise filtering, corrects the baseline, start point, and end point of the peak in the finally obtained filtered data, and outputs accurate peak detection results. Attached Figure Description

[0026] Figure 1 This is a flowchart illustrating the peak detection method proposed in this application; Figure 2 This is a schematic diagram of the peak detection system in this application. Detailed Implementation

[0027] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0028] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other.

[0029] like Figure 1 As shown, this application proposes a peak detection method based on a clustering algorithm, which is suitable for data with narrow peaks, as detailed below: Set the step size of the first derivative to 1, and calculate each maximum point of the acquired data; the acquired data is one-dimensional. Calculate the difference in the x-coordinates of two adjacent maximum points in sequence; If the difference between the horizontal coordinates is less than the distance threshold or multiple consecutive differences between the horizontal coordinates are less than the distance threshold, the maximum value of the vertical coordinate will be used as the merging point among the two or more maximum points that are less than the distance threshold. The two adjacent maximum points with a merging point and a horizontal coordinate difference not less than the distance threshold are taken as peak vertices, such that the horizontal coordinate difference between any two adjacent peak vertices is not less than the distance threshold. Based on the peak apex, calculate the baseline distance of each peak and filter out candidate peaks whose baseline distance is less than the width threshold; Candidate peaks are clustered by peak height to filter out noise peaks; based on the filtered data, the peak baseline, peak start point, and peak end point are corrected.

[0030] The peak detection method proposed in this application, based on a first-order algorithm and taking into account the characteristics of narrow peak data, provides multiple filtering of noise peaks to obtain candidate peak data. It then uses peak height to implement a one-dimensional clustering algorithm to obtain accurate peak start and end points. The peak detection method proposed in this application does not involve complex calculations, is computationally simple and efficient, and is suitable for continuous online data streams.

[0031] The peak detection method proposed in this application does not consider the cases of shoulder peaks and negative peaks, as follows: Acquire the data to be processed (i.e., acquire the data). The acquired data has narrow peaks.

[0032] Narrow peaks (high and sharp with extremely small half-peak width) are a typical challenge in chromatographic data processing, commonly found in high-speed analysis scenarios such as ion chromatography, ultra-high performance liquid chromatography (UHPLC), and gas chromatography (GC).

[0033] Depending on the data source, the composition of the one-dimensional data varies, specifically in the index content of the horizontal axis.

[0034] The data objects processed in this application are one-dimensional data, including output time points and response values, with a one-to-one correspondence between time points and response values. Alternatively, the one-dimensional data can be wavelengths and response values, with a one-to-one correspondence between wavelengths and response values.

[0035] Because the data sources are different, the index content of the horizontal axis is different. It can be the mass-to-charge ratio or other content (such as time point, wavelength, etc.), but the value corresponding to the index is the response value (vertical axis).

[0036] The response value depends on the type of detector. For a UV detector, the ordinate is absorbance; for a mass spectrometer detector, the ordinate is ion abundance.

[0037] Preferably, it can also be a fluorescence detector, an electrochemical detector, or other detectors with different signal intensities.

[0038] If the data currently acquired is a data collection after data processing and splicing, the horizontal axis can also be a manually defined data index value to indicate the data order, without any other meaning, in order to facilitate subsequent data processing.

[0039] This application uses a first-order algorithm and noise filtering to determine the peaks in the acquired data.

[0040] Preferably, the step size of the first derivative is set to 1, and each maximum point of the acquired data is calculated. The acquired data is one-dimensional.

[0041] Calculate the difference in the x-coordinates of two adjacent maximum points in sequence; If the difference between the horizontal coordinates is less than the distance threshold or multiple consecutive differences between the horizontal coordinates are less than the distance threshold, the maximum value of the vertical coordinate will be used as the merging point among the two or more maximum points that are less than the distance threshold. The two adjacent maxima points with a difference in x-coordinates not less than the distance threshold are used as the apex points, so that the difference in x-coordinates between any two adjacent apex points is not less than the distance threshold.

[0042] The first derivative method is used to determine local maxima. Specifically, calculate the first derivative of two adjacent data points. If the product of the two derivatives is less than or equal to 0, and the derivative of the left data point is greater than or equal to 0 while the derivative of the right data point is less than 0, then the left data point is the local maximum. Here, "left" and "right" are relative concepts, indicating the order of the data.

[0043] Preferably, in this application, the abscissa difference between any maximum point and its two preceding and following maximum points is calculated to facilitate the determination of the range of maximum points less than the distance threshold, the screening of merged points, and the improvement of the efficiency and accuracy of peak selection.

[0044] This application sets the step size of the first derivative to 1, and judges the possible peaks in the data point by point to avoid missed detection and inaccurate peak detection points. However, setting the step size to 1 also has the problem of noise misjudgment. Therefore, this application filters the interference of high-frequency noise by merging the maximum points on the basis of the first derivative, and obtains the preliminary screening results of peaks.

[0045] Preferably, the distance threshold is determined based on the amount of data acquired and the distribution of the spectrum.

[0046] To avoid misjudging noise and spectral peaks, a minimum distance threshold can be set to perform one round of noise filtering. Then, based on the distribution of spectral peaks in the filtered data, it can be determined whether to perform another round of noise filtering and to determine the distance threshold to be used in the next round of filtering.

[0047] Preferably, to avoid missed detections, this application takes a first distance threshold of 3 as an example, filtering out two adjacent maxima points with a distance less than 3, using the maximum value of the two adjacent maxima points as the merging point, and the minimum value of the two adjacent maxima points as the noise point. The relationship between the distance of two adjacent maxima points and the first distance threshold is determined one by one, filtering out the merging points between two adjacent maxima points and the unmerged maxima points (the set of points formed by two adjacent maxima points with a horizontal coordinate difference not less than the first distance threshold). The merging point and the two adjacent maxima points with a horizontal coordinate difference not less than the distance threshold are used as peak vertices, ensuring that the horizontal coordinate difference between any two adjacent peak vertices is not less than the first distance threshold.

[0048] To ensure that the difference in the x-coordinates of any two adjacent peaks in the output filtering results is not less than the first distance threshold, a distance verification is performed using the first distance threshold. For several maximum points in the filtering results, two adjacent maximum points with a difference in x-coordinates less than the first distance threshold are filtered again. The maximum value of the two adjacent maximum points is taken as the merging point, and the minimum value is taken as the noise point.

[0049] Preferably, to ensure the accuracy of the merging point selection, in cases where multiple consecutive x-coordinate differences are less than the distance threshold, if there are five consecutive maximum points, where the x-coordinate difference between the first and second maximums is not less than the distance threshold, the x-coordinate difference between the second and third maximums is less than the distance threshold, the x-coordinate difference between the third and fourth maximums is less than the distance threshold, and the x-coordinate difference between the fourth and fifth maximums is not less than the distance threshold, then the second to fourth maximum points are considered extreme points less than the distance threshold.

[0050] Among the second to fourth maxima, the point with the highest ordinate is the merge point, and the remaining maxima are considered noise points.

[0051] The example shown here illustrates that the difference in the x-coordinates between any two pairs of three consecutive maxima is less than the distance threshold. In actual data processing, the number of consecutive maxima with values ​​less than the distance threshold can be any integer, such as 2 or more.

[0052] Preferably, distance verification can be omitted.

[0053] To reduce the computational load in subsequent data processing, the difference in the x-coordinates of two adjacent maxima in the filtering results can be determined again using a second distance threshold, ensuring that the difference in the x-coordinates of any two adjacent maxima in the second filtering results is not less than the second distance threshold. Preferably, the second distance threshold is greater than the first distance threshold.

[0054] Preferably, the second distance threshold filtering can be set after the first filtering, or after the distance verification, or the second distance threshold filtering can be omitted.

[0055] Based on the above process of filtering maxima, the peak is determined.

[0056] Based on the peak apex, calculate the baseline distance for each peak and filter out candidate peaks whose baseline distance is less than the width threshold.

[0057] Specifically, this includes: calculating the minimum value of the data between every two adjacent extreme points at the peak, which is used as the peak start point and peak end point; and using the difference in the x-coordinate between the current peak start point and peak end point as the baseline distance.

[0058] Filter the minimum point between any two adjacent peaks, and use this minimum point as both the endpoint of the previous peak and the starting point of the current peak. Calculate the baseline distance of the current peak based on the peak's starting and ending points.

[0059] Based on the above, the peak apex, peak start point, and peak end point have been obtained, thus yielding preliminary peak detection results. However, the preliminary detection results contain a large number of high-frequency noise peaks, requiring further noise filtering.

[0060] This application uses a width threshold as a filtering method for noise peaks. The width threshold is determined based on the amount of data acquired and the distribution of the spectrum.

[0061] This application sets a minimum width threshold of 5. This is because when the baseline distance is less than 5 data points, it implies that there must be a start or end point of the current peak, with only one data point between it and the peak's apex. This application treats such cases as noise.

[0062] Therefore, this application classifies data points with a baseline distance less than 5 as noise points. Preferably, other values ​​greater than 5 can also be set as minimum width thresholds based on the actual situation of the spectrum to exclude noise points.

[0063] Preferably, based on the minimum width threshold filtering, a new width threshold (the new width threshold is greater than the minimum width threshold) can be set for secondary filtering to eliminate noise points and improve the efficiency of subsequent data processing.

[0064] Preferably, the acquired data may also include "shoulder-like" data, which is then processed simultaneously using a width threshold. In this type of peak data, the clustering between the peak start point or peak end point and the peak apex is 1, and the baseline distance is not less than the width threshold.

[0065] Here, the width threshold is equivalent to the minimum width threshold (peak width of 5) mentioned above. Preferably, it can also be set to other values.

[0066] If the distance between the starting point or ending point of any candidate peak and its peak vertex is 1, and the starting point or ending point of the current peak coincides with that of an adjacent peak, then the current peak is merged into the adjacent peak, and the merged peak data is used as a candidate peak for clustering; if there is no overlap, then the current peak is a noise peak.

[0067] Preferably, the starting point or ending point of the current peak coincides with the peak of the adjacent peak. This may be due to the following situations: the starting point of the current peak coincides with the ending point of the adjacent peak; or, the ending point of the current peak coincides with the starting point of the adjacent peak.

[0068] This application uses a width threshold and the peak start and end points to jointly determine "shoulder-like peaks", and determines whether a "shoulder-like peak" is noise based on the overlap point between the "shoulder-like peak" and the adjacent peaks. This simplifies the noise processing process, solves the problem that the first derivative cannot identify similar data, and makes the peak detection results more accurate.

[0069] As mentioned above, the first derivative method, combined with noise filtering based on distance and peak width thresholds, can effectively remove high-frequency noise from the acquired data. However, there may still be slowly changing noise peaks in the spectral data, which may not be accurately determined during the aforementioned judgment process.

[0070] Therefore, after filtering noise by width threshold, this application uses a density-based clustering algorithm to cluster the peak heights of the obtained candidate peaks in order to eliminate slowly changing noise peaks and obtain accurate peak detection results.

[0071] Candidate peaks are clustered by peak height to filter out noise peaks; based on the filtered data, the peak baseline is corrected to obtain the corrected peak start and peak end points.

[0072] The peak height here refers to the distance between the current peak's apex and its baseline. The baseline is the line connecting the current peak's starting and ending points.

[0073] In this application, the clustering algorithm is DBSCAN.

[0074] Preferably, other density-based clustering algorithms can also be used.

[0075] The clustering process is as follows: Set the minimum number of points and the neighborhood radius, and sort the peak heights of all currently filtered peaks in order of data size; Based on the sorting results, select each peak height data point in turn and calculate all points within its neighborhood radius; If the number of points in the neighborhood of any peak height data point is greater than or equal to the minimum number of points, then the peak height data point and all data points in its neighborhood form a cluster; if the number of points in the neighborhood is less than the minimum number of points, then it is a noise point.

[0076] Since the data used for clustering in this application has already undergone multiple prior noise filtering processes, in order to simplify the calculation process and improve computational efficiency, this application proposes a one-dimensional clustering algorithm (DBSCAN1D) that uses only peak height as the clustering threshold. Essentially, it clusters and sorts candidate peak data based on peak height.

[0077] The specific process of the clustering algorithm is as follows: Given the minimum number of neighborhood points and the neighborhood radius, sort the peak heights of all currently filtered peaks in order of data size. Based on the sorting results, select each peak height data point in turn and calculate all points within its neighborhood radius (ε).

[0078] If the number of points in the neighborhood is greater than or equal to the minimum number of points (MinPts), then the point is marked as a core point, and a new cluster is created, that is, the point and all data points in its neighborhood form a cluster. If the number of points in the neighborhood is less than the minimum number of points, then it is a noise point.

[0079] Add all points within the neighborhood of the core point to the current cluster, and recursively check if these points are core points. If a point is a core point, continue adding unlabeled points within its neighborhood to the cluster until no new points can be added.

[0080] If the selected point is not a core point, it is marked as a noise point (if it is subsequently included in the neighborhood of other core points, it will be remarked as a boundary point and assigned to the corresponding cluster).

[0081] Repeat until all points are labeled as belonging to a cluster or as noise.

[0082] Preferably, in this application, the minimum number of points and the neighborhood radius of the clustering algorithm can be determined according to the data source or data processing requirements, or based on experience.

[0083] The first-order derivative and peak selection process is extremely sensitive to data fluctuations, resulting in a large number of noisy peaks in the candidate peak classification. In subsequent selection, peak height is used as the selection criterion, and a clustering algorithm is employed to further filter out the noise.

[0084] After the peak selection process described above, several candidate peaks are obtained. The peak height of each candidate peak is calculated, and the peak height data is sorted and clustered.

[0085] In this process, the height distance between each peak vertex and its baseline is calculated, and the neighborhood radius of the clustering algorithm is a times the maximum height distance. <a<1。

[0086] Alternatively, calculate the height distance between each peak apex and the baseline of that peak, and use the difference between the maximum and minimum height distances as the neighborhood radius of the clustering algorithm.

[0087] Alternatively, you can directly set the neighborhood radius based on experience.

[0088] Preferably, the minimum number of points can be set to 1, that is, 1 peak height data point represents 1 peak.

[0089] Alternatively, it can be set to other values ​​based on the current data distribution.

[0090] Preferably, the clustering process can be all the data of the candidate peak or a portion of the data.

[0091] If the amount of candidate peak data is large, after sorting the peak height data, select the data with smaller peak heights based on the sorting results (e.g., select 1 / 5, 1 / 4, etc. of the total candidate peak data). To ensure screening efficiency, the number of peak height data to be screened can be limited to 10 or more (or other numbers, such as 15, 20, etc.); otherwise, the selection range of candidate peaks can be further increased.

[0092] If only a portion of the candidate peak data is selected for clustering, the data with smaller peak height values ​​should be selected after sorting to ensure that the purpose of clustering and filtering out noise is achieved.

[0093] This application performs clustering based on the sorting results. The clustering process is simple, fast, and highly efficient.

[0094] Based on the above clustering process, multiple data clusters (clustering results) can be obtained. The data clusters are sorted in order according to the peak height: 0, 1, 2, ..., which correspond to the order of peak height from low to high.

[0095] Preferably, they can also be arranged in reverse order or in other ways.

[0096] Based on the peak height, determine the data cluster corresponding to the noise.

[0097] For example, the clustering result of data clusters with a sequence of 0 and 1 can be defined as noise, or other definitions can be used.

[0098] Preferably, if the peak height of each data cluster in the current data meets the actual requirements, the candidate peak data can be directly used as the filtered data.

[0099] Preferably, in the clustering results after removing noise, the peak data can be used to further remove noise and improve computational efficiency.

[0100] In the clusters selected by clustering, if the number of peaks exceeds the number threshold, then the height threshold is set to 3 times the baseline noise, and noise peaks are filtered out.

[0101] Preferably, the quantity threshold is determined based on actual needs.

[0102] Preferably, noise peaks can be removed without further removing them using a data threshold, and the data filtered by clustering can be used as the peak detection result.

[0103] After using a clustering algorithm to eliminate slowly changing noise data, filtered data was obtained. Based on this, the baseline, peak start point, and peak end point of the peaks can be further corrected to obtain accurate peak detection results.

[0104] Based on the filtered data, the peak baseline is corrected, and the corrected peak start and peak end points are obtained.

[0105] Specifically, this includes: correcting the baseline of each peak one by one, or correcting the baseline of the overall peaks in the filtered data so that the data of each peak are on the same side of the peak baseline.

[0106] The peak detection method proposed in this application is suitable for narrow peak data. Compared with conventional filtering methods, it firstly overcomes the problem that filtering algorithms may cause data distortion; secondly, the method of this application can accurately analyze the start and end points of peaks without filtering or with a small filtering window, and it has good filtering effect on high-frequency noise; in addition, this application also makes up for the poor processing effect of filtering algorithms on slowly changing noise peaks.

[0107] Based on the same inventive concept, this application also proposes a spectral peak detection system, comprising: The first-order processing module sets the step size of the first derivative to 1 and is used to calculate each maximum point of the acquired data; the acquired data is one-dimensional and has narrow peaks. The peak filtering module is used to calculate the difference in the x-coordinates of two adjacent maxima points in turn. If the difference in the x-coordinates is less than a distance threshold or multiple consecutive differences in the x-coordinates are less than the distance threshold, the maximum value of the y-coordinate is used as the merging point among the two or more maxima points that are less than the distance threshold. The two adjacent maxima points with the merged point and the difference in the x-coordinates not less than the distance threshold are used as peak vertices, so that the difference in the x-coordinates between any two adjacent peak vertices is not less than the distance threshold. Based on the peak vertices, the baseline distance of each peak is calculated, and candidate peaks with a baseline distance less than the width threshold are filtered out. The clustering module clusters candidate peaks based on their peak height to filter out noise peaks. The correction module corrects the peak baseline, peak start point, and peak end point based on the filtered data.

[0108] Based on the same inventive concept, this application also proposes a computer storage medium on which a computer program is stored, which, when executed by a processor, implements the method described above.

[0109] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

[0110] Apart from the technical features described in the specification, the other technical features are known to those skilled in the art. To highlight the innovative features of this invention, the other technical features will not be described in detail here.

Claims

1. A peak detection method based on clustering algorithm, characterized in that, Suitable for data with narrow peaks, including: Set the step size of the first derivative to 1, and calculate each maximum point of the acquired data; the acquired data is one-dimensional. Calculate the difference in the x-coordinates of two adjacent maximum points in sequence; If the difference between the horizontal coordinates is less than the distance threshold or multiple consecutive differences between the horizontal coordinates are less than the distance threshold, the maximum value of the vertical coordinate will be used as the merging point among the two or more maximum points that are less than the distance threshold. The two adjacent maximum points with a merging point and a horizontal coordinate difference not less than the distance threshold are taken as peak vertices, such that the horizontal coordinate difference between any two adjacent peak vertices is not less than the distance threshold. Based on the peak apex, calculate the baseline distance of each peak and filter out candidate peaks whose baseline distance is less than the width threshold; Candidate peaks are clustered by peak height to filter out noise peaks; based on the filtered data, the peak baseline, peak start point, and peak end point are corrected.

2. The peak detection method according to claim 1, characterized in that, Also includes: If the distance between the starting point or ending point of any candidate peak and its peak vertex is 1, and the starting point or ending point of the current peak coincides with that of an adjacent peak, then the current peak is merged into the adjacent peak, and the merged peak data is used as a candidate peak for clustering; if there is no overlap, then the current peak is a noise peak.

3. The peak detection method according to claim 1, characterized in that, Baseline distance is: Calculate the minimum value of the data between every two adjacent extreme points in the peak, and use it as the peak start point and peak end point; use the difference in the x-coordinate between the current peak start point and peak end point as the baseline distance.

4. The peak detection method according to claim 1, characterized in that, The clustering algorithm used is DBSCAN.

5. The peak detection method according to claim 1, characterized in that, Clustering candidate peaks by peak height to filter out noise peaks, including: Set the minimum number of points and the neighborhood radius, and sort the peak heights of all currently filtered peaks in order of data size; Based on the sorting results, select each peak height data point in turn and calculate all points within its neighborhood radius; If the number of points in the neighborhood of any peak height data point is greater than or equal to the minimum number of points, then the peak height data point and all data points in its neighborhood form a cluster; if the number of points in the neighborhood is less than the minimum number of points, then it is a noise point.

6. The peak detection method according to claim 5, characterized in that, Candidate peaks are clustered by peak height to filter noise peaks. This includes: if the number of peaks in the clusters selected by clustering exceeds the number threshold, then the height threshold is set to 3 times the baseline noise to filter noise peaks.

7. The peak detection method according to claim 5 or 6, characterized in that, include: Calculate the height distance between each peak apex and its baseline, and use *a* times the maximum height distance as the neighborhood radius; where 0 <a<1。 8. The peak detection method according to claim 5 or 6, characterized in that, Correcting peak baselines includes: correcting the baseline of each peak individually, or correcting the baseline of the entire peak in the filtered data, so that the data of each peak are on the same side of the peak baseline.

9. A peak detection system based on a clustering algorithm, characterized in that, The peak detection method applicable to any one of claims 1-8 includes: The first-order processing module sets the step size of the first derivative to 1 and is used to calculate each maximum point of the acquired data; the acquired data is one-dimensional and has narrow peaks. The peak filtering module is used to calculate the difference in the x-coordinates of two adjacent maxima points in turn. If the difference in the x-coordinates is less than a distance threshold or multiple consecutive differences in the x-coordinates are less than the distance threshold, the maximum value of the y-coordinate is used as the merging point among the two or more maxima points that are less than the distance threshold. The two adjacent maxima points with the merged point and the difference in the x-coordinates not less than the distance threshold are used as peak vertices, so that the difference in the x-coordinates between any two adjacent peak vertices is not less than the distance threshold. Based on the peak vertices, the baseline distance of each peak is calculated, and candidate peaks with a baseline distance less than the width threshold are filtered out. The clustering module clusters candidate peaks based on their peak height to filter out noise peaks. The correction module corrects the peak baseline, peak start point, and peak end point based on the filtered data.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the peak detection method as described in any one of claims 1-8.