Mass spectrum peak identification method and device, storage medium and computer equipment
By using parallel processing and dynamic threshold filtering of field-programmable gate arrays, the problem of balancing accuracy and efficiency in mass spectrometry peak identification methods in embedded mass spectrometers is solved, enabling real-time detection and adaptability to multiple scenarios, while reducing hardware costs and latency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN HYMSON LASER INTELLIGENT EQUIP CO LTD
- Filing Date
- 2026-03-03
- Publication Date
- 2026-07-21
AI Technical Summary
Existing mass spectrometry peak identification methods struggle to balance accuracy and efficiency in embedded mass spectrometers, failing to meet real-time detection needs. Furthermore, they are costly in terms of hardware, have low resource utilization, and cannot adapt to the complexity of different detection scenarios.
Mass spectrometry data is preprocessed using multiple parallel operation units based on field-programmable gate arrays to generate basic and dynamic thresholds. Valid data is then filtered through parallel detection units, and peak features are extracted in parallel to dynamically adjust the allocation of computing resources.
It significantly improves the accuracy and efficiency of mass spectrometry peak identification, reduces background noise interference, optimizes hardware resource utilization, meets the real-time detection requirements of embedded mass spectrometers, and adapts to the detection needs of multiple scenarios.
Smart Images

Figure CN122436422A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, storage medium and computer equipment for mass spectrometry peak identification. Background Technology
[0002] Mass spectrometers, as high-precision analytical instruments, are widely used in clinical testing, environmental monitoring, food safety, and other fields. Meanwhile, with the rapid development of embedded technology, portable and miniaturized mass spectrometers have become an important development direction in the industry, placing stringent requirements on the real-time performance, low power consumption, and low resource consumption of mass spectrometer data processing. During the qualitative and quantitative analysis of samples using mass spectrometry, to accurately obtain the mass-to-charge ratio and content information of each component in the sample, it is necessary to extract key features such as peak position (corresponding to mass-to-charge ratio), intensity, and peak width from the raw detected mass spectrometry data through mass spectrometry peak identification. This provides the core basis for subsequent qualitative and quantitative analysis of components, enabling accurate identification of sample components.
[0003] Currently, mainstream mass spectrometry peak identification methods in the industry mainly fall into two categories: one is CPU (Central Processing Unit)-based serial algorithms, such as wavelet transform, machine learning, and sliding window thresholding, which extract peak features through full data traversal and multi-level iteration; the other is schemes that attempt to port traditional algorithms to FPGAs (Field Programmable Gate Arrays), leveraging hardware parallel computing capabilities to improve peak identification processing speed. Furthermore, existing peak identification schemes commonly employ a globally unified single threshold generation logic and a fixed parallel architecture to complete the peak signal detection and feature extraction process.
[0004] However, existing technologies still have many limitations when adapting to the needs of embedded mass spectrometers: CPU-based serial algorithms have complex computational logic, and the processing latency for 1024-point mass spectrometry data typically exceeds 50ms, making it difficult to meet the core requirement of embedded mass spectrometers for real-time detection (generally requiring a latency of ≤10ms); the porting of traditional algorithms to FPGAs is mostly a simple code conversion without deep optimization for the FPGA parallel computing architecture. This either fails to fully utilize the advantages of FPGA's multiple computing units, resulting in limited acceleration, or relies on high-end FPGA chips, leading to high hardware costs that do not meet the cost control requirements of embedded devices; the global single threshold generation logic is rigid, relying only on global maximum or minimum values or variance to calculate the threshold, which cannot adapt to local differences in mass spectrometry data and has low yield. High-abundance peaks are easily masked by excessively high thresholds, leading to high false negative rates. Conversely, high-noise regions suffer from high false negative rates due to excessively low thresholds. Furthermore, threshold parameters are often fixed, making it difficult to dynamically adapt to different detection scenarios, such as clinical settings (low concentration, multiple interferences) and environmental settings (high noise, wide dynamic range). Fixed parallel architectures and pipeline depths cannot be dynamically adjusted based on real-time data volume. When data volume is low, resource utilization is insufficient (usually below 30%), resulting in resource waste. When data volume is high, resource bottlenecks cause a surge in processing latency. Additionally, due to the lack of enhancement and verification mechanisms for low-abundance peaks, existing methods struggle to balance the accuracy and efficiency of mass spectrometry peak identification. They also fail to consider hardware resource consumption and adaptability to multiple scenarios, making it difficult to meet the comprehensive requirements of embedded mass spectrometers for low cost, high adaptability, and high accuracy. Summary of the Invention
[0005] This application provides a method, apparatus, storage medium, and computer equipment for mass spectrometry peak identification, aiming to solve the problem that existing mass spectrometry peak identification methods struggle to balance accuracy and efficiency.
[0006] To solve the above-mentioned technical problems, the technical solution adopted in this application is to provide a mass spectrometry peak identification method. The mass spectrometry peak identification method includes: preprocessing mass spectrometry data based on multiple parallel operation units of a field-programmable gate array (FPGA); the preprocessing is used to enhance the intensity of low-abundance signals and suppress background noise; generating a basic threshold and a dynamic threshold based on the preprocessed mass spectrometry data; the basic threshold is used to determine the global background noise filtering range, and the dynamic threshold is used to determine the mass spectrometry peak screening range of a local data segment; filtering valid data from the preprocessed mass spectrometry data based on the basic threshold and the dynamic threshold; adjusting the number of parallel detection units activated by the FPGA based on the resource scheduling status of the FPGA, and determining multiple sub-tasks to be executed by each parallel detection unit; the multiple sub-tasks are used to detect potential peaks; splitting the valid data into multiple data to be detected according to the number of activated units, and assigning each data to be detected to different parallel detection units so that each parallel detection unit can execute the corresponding multiple sub-tasks to obtain potential peak data; and performing parallel peak feature extraction on the potential peak data based on the multiple operation cores of the FPGA to obtain the mass spectrometry peak identification result.
[0007] In some embodiments, the preprocessing includes noise filtering, baseline correction, data downsampling, and local peak signal enhancement; each of the parallel operation units interacts with data through the first-in-first-out buffer mechanism of the field-programmable gate array to execute each of the preprocessing steps in parallel. In some embodiments, the noise filtering process includes: performing median filtering on the mass spectrometry data based on a first preset configurable window; the baseline correction process includes: calculating the window mean based on a second preset configurable window, and correcting the baseline of the mass spectrometry data based on the window mean; the data downsampling process includes: performing decimal downsampling on the mass spectrometry data based on a preset downsampling rate; the local peak signal enhancement process includes: calculating the gradient mean of each data point in the mass spectrometry data and its adjacent data points; comparing the gradient mean with a preset gradient threshold to distinguish between low-abundance signal data points and background noise data points; numerically amplifying the low-abundance signal data points based on a preset amplification factor, and numerically reducing the background noise data points based on a preset attenuation factor.
[0008] In some embodiments, generating a base threshold and a dynamic threshold based on the preprocessed mass spectrometry data includes: performing global statistics on the preprocessed mass spectrometry data to obtain a global maximum and a global minimum; calculating the base threshold based on the global maximum and the global minimum, combined with a preset proportional coefficient; dividing the preprocessed mass spectrometry data into multiple data segments according to a preset number of points, and calculating the local variance of each data segment; calculating the dynamic adjustment coefficient of each data segment based on the ratio of the local variance of each data segment to the average variance of all data segments, combined with a preset weighting coefficient; and generating the dynamic threshold corresponding to each data segment based on the base threshold and the dynamic adjustment coefficient corresponding to each data segment.
[0009] In some embodiments, the formula for calculating the basic threshold is: ;in, This is the global maximum value. This is the global minimum value. The preset proportional coefficient is used; the formula for calculating the dynamic threshold is: ;in, For the first The dynamic threshold of each of the data segments, For the first The dynamic adjustment coefficient of each data segment; the formula for calculating the dynamic adjustment coefficient is: ;in, For the first The local variance of each of the data segments, The average variance of all the data segments, The preset weighting coefficient is referred to here.
[0010] In some embodiments, the resource scheduling state includes resource occupancy and input data volume; the multiple subtasks adopt a multi-level pipeline architecture and are configured according to the depth of each pipeline level; adjusting the number of parallel detection units enabled by the field-programmable gate array (FPGA) based on the resource scheduling state of the FPGA, and determining the multiple subtasks to be executed by each of the parallel detection units, includes: when the input data volume is lower than a first preset data volume threshold and the resource occupancy is lower than a first preset resource occupancy threshold, adjusting the number of enabled units to a first preset number, and determining the multiple subtasks to be executed based on a preset first-level pipeline depth; when the input data volume is between the first preset data volume threshold and a second preset data volume threshold, or the resource occupancy is between the first preset data volume threshold and a second preset data volume threshold, the resource scheduling state is adjusted to a first preset number, and the multiple subtasks to be executed are determined based on a preset first-level pipeline depth; when the input data volume is between the first preset data volume threshold and a second preset data volume threshold, or the resource occupancy is between the first preset data volume threshold and a second preset data volume threshold, the resource scheduling state is adjusted to a first preset number, and the resource scheduling state is lower than a first preset resource occupancy threshold, the resource scheduling state is adjusted to a first preset number, and the resource scheduling state is lower than a first preset resource occupancy threshold, the resource scheduling state is adjusted to a first preset number, and the resource scheduling state is lower than a second ... When the resource usage threshold is between the preset threshold and the second preset threshold, the number of tasks to be enabled is adjusted to the second preset threshold, and the multiple subtasks to be executed are determined based on the preset second-level pipeline depth. When the input data volume is higher than the second preset data volume threshold, or the resource usage rate is higher than the second preset resource usage threshold, the number of tasks to be enabled is adjusted to the third preset threshold, and the multiple subtasks to be executed are determined based on the preset third-level pipeline depth. The third preset threshold is greater than the second preset threshold, and the second preset threshold is greater than the first preset threshold. The preset third-level pipeline depth contains more types of subtasks than the preset second-level pipeline depth, and the preset second-level pipeline depth contains more types of subtasks than the preset first-level pipeline depth.
[0011] In some embodiments, the plurality of subtasks are selected from threshold comparison, edge judgment, peak confirmation, initial peak feature extraction and secondary confirmation of low abundance peaks; The plurality of subtasks corresponding to the preset first-level pipeline depth include the threshold comparison, the edge judgment, and the peak confirmation; the plurality of subtasks corresponding to the preset second-level pipeline depth include the threshold comparison, the edge judgment, the peak confirmation, and the initial peak feature extraction; the plurality of subtasks corresponding to the preset third-level pipeline depth include the threshold comparison, the edge judgment, the peak confirmation, the initial peak feature extraction, and the secondary confirmation of low-abundance peaks.
[0012] In some embodiments, the threshold comparison subtask is used to compare the value of the current data point in the data to be detected with the dynamic threshold corresponding to the position of the current data point. If the value of the current data point is greater than the dynamic threshold, the current data point is marked as a candidate signal point. The edge detection subtask is used to calculate the numerical gradient between adjacent candidate signal points, and based on the positive and negative changes of the numerical gradient and a preset threshold condition, determine the peak start position and peak end position of the candidate signal point sequence. The peak confirmation subtask is used to statistically analyze the peak start position and peak end position. The number of consecutive data points is determined. If the number is greater than the preset minimum peak width, the signal segment is confirmed as a potential peak. The initial peak feature extraction subtask is used to extract the peak data point index value and the corresponding peak amplitude of the potential peak, and temporarily store the peak data point index value and the peak amplitude as a coarse peak feature. The secondary confirmation subtask of low abundance peaks is used to obtain the dynamic threshold of the adjacent data segments of the data segment where the potential peak is located for potential peaks with amplitudes lower than a preset multiple dynamic threshold, and to verify the correlation between the dynamic threshold of the adjacent data segments and the dynamic threshold of the current segment. If the verification is successful, the potential peak is retained.
[0013] In some embodiments, the parallel peak feature extraction of the potential peak data based on the multiple computational cores of the field-programmable gate array to obtain mass spectrometry peak identification results includes: performing peak position feature extraction, peak intensity feature extraction, and peak width feature extraction in parallel on the potential peak data based on the multiple computational cores of the field-programmable gate array to obtain the peak position, peak intensity, and peak width of each potential peak; and performing data format conversion on the peak position, peak intensity, and peak width to adapt to a preset transmission interface.
[0014] In some embodiments, the peak position feature extraction includes: obtaining the clock cycle index corresponding to the vertex of the potential peak, and converting the clock cycle index into a mass-to-charge ratio value in combination with a preset time-of-flight-to-mass-charge ratio calibration coefficient, as the peak position; the peak intensity feature extraction includes: reading the fixed-point value of the vertex of the potential peak after preprocessing, as the peak intensity; the peak width feature extraction includes: calculating the half-height amplitude based on the peak intensity, determining the indices of the two data points whose values are closest to the half-height amplitude in the rising and falling edges of the potential peak, and calculating the difference between the two data point indices, as the peak width.
[0015] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a mass spectrometry peak identification device, the mass spectrometry peak identification device comprising: an analog-to-digital conversion module, a field-programmable gate array chip, a data transmission interface and an embedded main control unit; the field-programmable gate array chip integrates a logic module for executing the mass spectrometry peak identification method as described above.
[0016] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a storage medium storing program data, characterized in that the program data, when executed by a processor, implements the steps of the mass spectrometry peak identification method as described above.
[0017] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer device, which includes a processor and a memory connected to each other. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the mass spectrometry peak identification method described above.
[0018] The beneficial effects of this application are as follows: Unlike existing technologies, this application discloses a mass spectrometry peak identification method, apparatus, storage medium, and computer equipment. This application preprocesses mass spectrometry data using multiple parallel operating units based on a field-programmable gate array (FPGA), significantly improving data preprocessing speed by leveraging hardware parallelism. It also effectively reduces background noise interference while enhancing weak signal characteristics, significantly improving the signal-to-noise ratio. By generating basic and dynamic thresholds based on the preprocessed mass spectrometry data, and then filtering effective data from the preprocessed mass spectrometry data based on these thresholds, it adaptively adjusts the filtering criteria by combining global statistical characteristics and local fluctuation characteristics. This maintains high sensitivity to low-abundance peaks in low-noise regions while automatically raising the threshold in high-noise regions to suppress false detections, significantly improving the accuracy of identifying effective data in complex samples. Furthermore, by utilizing the resource allocation capabilities of the FPGA… The system adjusts the number of parallel detection units enabled by the field-programmable gate array (FPGA) under varying conditions, determines the multiple subtasks to be executed by each parallel detection unit, and splits the effective data into multiple data to be detected based on the number of enabled units. Each data to be detected is then assigned to a different parallel detection unit for parallel execution of the detection task. This allows for dynamic optimization of computing resource allocation based on real-time load, reducing power consumption under low load and automatically expanding computing power and adding verification mechanisms under high load, achieving the best balance between hardware resource utilization and detection efficiency. By using multiple processing cores based on the FPGA to extract potential peak features in parallel, mass spectrometry peak identification results are obtained, which can significantly reduce the processing latency of the feature calculation stage and meet the high real-time requirements of embedded devices for instant detection.
[0019] This application achieves dual optimization of peak identification accuracy and efficiency in mass spectrometry under a field-programmable gate array (FPGA) parallel computing architecture through the above-mentioned method. It can effectively avoid the problems of missed detection of low abundance peaks due to fixed thresholds and high latency due to serial computing in the prior art. It solves the technical problem that embedded mass spectrometers are difficult to balance high sensitivity and high real-time performance under resource-constrained conditions. It also balances hardware cost control and multi-scenario adaptability, which is conducive to improving the application performance of portable and real-time detection embedded mass spectrometers in complex scenarios such as clinical testing and environmental monitoring. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 This is a flowchart illustrating an embodiment of the mass spectrometry peak identification method provided in this application; Figure 2 This is a schematic diagram of an embodiment of the mass spectrometry peak identification device provided in this application.
[0021] Figure 3 This is a schematic diagram of the structure of an embodiment of the storage medium provided in this application; Figure 4 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application. Detailed Implementation
[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0023] The terms "first," "second," and "third" used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0024] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0025] This application provides a method for identifying mass spectrometry peaks, see reference. Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the mass spectrometry peak identification method provided in this application. The mass spectrometry peak identification method includes: Step 10: Based on multiple parallel operation units of field-programmable gate arrays, preprocess the mass spectrometry data; the preprocessing is used to enhance the intensity of low abundance signals and suppress background noise.
[0026] In this embodiment, the mass spectrometry data is acquired by a mass spectrometer and is a dataset reflecting the mass-to-charge ratio and relative abundance of ions in the sample (such as 100MHz sampling rate, 16-bit quantized integer raw data obtained after analog-to-digital conversion of the analog signal detected by the mass spectrometer detector). This data can be acquired in real-time or pre-acquired and provided for analysis. During the acquisition process, mass spectrometry data is affected by factors such as electronic thermal noise, power supply ripple interference, and detector nonlinear response, resulting in problems such as low signal-to-noise ratio, baseline drift, and weak signal distortion. This makes it difficult to distinguish weak effective signals from background noise, easily leading to missed or misjudged peak characteristics and affecting the accuracy of mass spectrometry peak identification.
[0027] In this embodiment, the impact of the aforementioned problems is mitigated through preprocessing to enhance the intensity of low-abundance signals and suppress background noise. Low-abundance signals refer to ion signals in mass spectrometry data that have relatively low abundance and are susceptible to noise interference. These signals typically correspond to trace components in the sample (such as drug metabolites or environmental micro-pollutants). However, due to their weak signal intensity, they are easily masked by background noise during conventional processing. Enhancing the intensity of low-abundance signals aims to improve the detection sensitivity of these weak signals, making them stand out from the background noise. The corresponding preprocessing methods may include signal decomposition and reconstruction, optimization of nonlinear filtering algorithms, and baseline correction. Background noise refers to random fluctuations in mass spectrometry data other than the effective signal. Its sources include thermal noise from instrument electronic components, power supply ripple, and interference signals such as environmental electromagnetic radiation. These interference signals can cause false positives (misclassifying noise as effective peaks) or distortion of effective peak characteristics. Suppressing background noise aims to reduce the interference of noise on the effective signal and improve the accuracy of mass spectrometry peak identification. The corresponding preprocessing methods may include frequency domain filtering, noise estimation and elimination, and noise pattern recognition and suppression. By enhancing the intensity of low-abundance signals and suppressing background noise, the signal-to-noise ratio of mass spectrometry data can be significantly improved, preventing weak feature signals from being submerged in background noise, thereby ensuring the accuracy of subsequent mass spectrometry peak identification.
[0028] In this embodiment, the preprocessing is specifically executed based on the parallel execution unit of a field-programmable gate array (FPGA). This parallel execution unit refers to a configurable computing array that utilizes the hardware parallelism of FPGAs to simultaneously perform preprocessing operations on multiple data blocks through a multi-channel parallel processing architecture. By performing parallel preprocessing of mass spectrometry data based on this parallel execution unit, multiple preprocessing subtasks such as noise filtering and baseline correction can be completed synchronously within a clock cycle, avoiding the accumulated latency caused by serial instruction execution in traditional CPU architectures. This hardware parallel acceleration mechanism effectively improves the speed of data preprocessing, enabling the processing of large amounts of mass spectrometry data in a short time, meeting the high real-time requirements of embedded devices for instant detection, and greatly improving the efficiency of mass spectrometry analysis.
[0029] Optionally, in some embodiments, the preprocessing includes noise filtering, baseline correction, data downsampling, and local peak signal enhancement; each parallel running unit interacts with data through the first-in-first-out buffer mechanism of the field-programmable gate array to execute each preprocessing step in parallel.
[0030] This optional embodiment specifically provides several preprocessing methods and their parallel execution mechanisms. Noise filtering aims to eliminate random noise components in the mass spectrometry data and improve data purity; specifically, it can employ time-domain filtering algorithms such as median filtering, Gaussian filtering, or moving average filtering. Baseline correction is used to correct baseline drift in the mass spectrometry data, ensuring accurate peak feature identification; specifically, it can employ baseline removal algorithms such as sliding window averaging, polynomial fitting, or spline interpolation. Data downsampling is used to reduce data volume while retaining key information, improving subsequent processing efficiency; specifically, it can employ data compression algorithms such as decimation downsampling, max pooling, or average pooling. Local peak signal enhancement is used to enhance the signal of low-abundance peaks, improving their detection sensitivity; specifically, it can employ signal enhancement algorithms such as gradient amplification, matched filtering, or wavelet transform.
[0031] In this optional embodiment, each parallel running unit realizes data interaction through the first-in-first-out (FIFO) caching mechanism of the field-programmable gate array (i.e., the processing result of the previous level processing unit is written into the FIFO cache, and the next level processing unit reads data from the FIFO cache for processing when it is ready). This can decouple the timing dependencies between processing modules, effectively eliminate the waiting time for data transmission between modules, thereby maximizing the utilization of the parallel computing resources of the field-programmable gate array and significantly reducing the overall processing latency.
[0032] Optionally, in some embodiments, the noise filtering process includes: performing median filtering on the mass spectrometry data based on a first preset configurable window; the baseline correction process includes: calculating the window mean based on a second preset configurable window, and correcting the baseline of the mass spectrometry data based on the window mean; the data downsampling process includes: performing decimation-based downsampling on the mass spectrometry data based on a preset downsampling rate; the local peak signal enhancement process includes: calculating the gradient mean between each data point and its adjacent data points in the mass spectrometry data; comparing the gradient mean with a preset gradient threshold to distinguish between low-abundance signal data points and background noise data points; numerically amplifying the low-abundance signal data points based on a preset amplification factor, and numerically reducing the background noise data points based on a preset attenuation factor.
[0033] In this optional embodiment, specific implementation steps for each processing method in the preprocessing are provided. Wherein: The noise filtering process specifically employs a median filtering algorithm, implemented by traversing the mass spectrometry data through a sliding window using a first preset configurable window. This first preset configurable window refers to a sliding window defined within the internal logic of the field-programmable gate array (FPGA) for selecting the range of data to be filtered. Its specific configuration can be based on operating parameters such as the noise concentration of the current mass spectrometry data, the proportion of impulse noise, or real-time requirements. For example, for 1024-point mass spectrometry data, it can typically be configured as a 3-point or 5-point window.
[0034] In the specific noise filtering process, the data points within the current window can be buffered using the shift registers inside the field-programmable gate array (FPGA), and a parallel comparator array can be deployed accordingly (e.g., 3 comparators for a 3-point window, 5 first-level comparators + 2 second-level comparators for a 5-point window) to synchronously compare all data within the window. Finally, the comparison results can be sorted, and the median value after sorting can be used as the filtered output, thereby filtering out impulse noise and random noise. This processing method can utilize the parallel characteristics of the FPGA to complete the filtering without consuming additional clock cycles for loop traversal, balancing filtering effect and real-time performance. Typically, the filtering delay can be controlled within 1 microsecond. Furthermore, since this logic does not involve complex iterations or state machine transitions, it can be implemented using combinational logic of the FPGA (i.e., the output depends only on the combinational operation of the basic logic gates of the current input), resulting in low hardware resource consumption.
[0035] The baseline correction process employs a lightweight sliding window averaging method, achieved through a combination of shift register buffering of window data, pipelined accumulator parallel accumulation, and fast division. The second preset configurable window refers to the sliding sampling interval used for real-time calculation of background baseline intensity. Its specific configuration can be based on operating parameters such as the resource constraints of the field-programmable gate array (FPGA), the baseline drift of the mass spectrometry data, or peak shape preservation requirements. For example, for 1024-point mass spectrometry data, it can typically be configured with 8 to 32 points.
[0036] In the specific baseline correction process, shift registers can be used to cache window data, and pipelined accumulators can be used to accumulate values within the window in parallel. When the window size is configured as a power of 2 (e.g., 8, 16, or 32), fast division can be achieved directly through binary right shift operations (e.g., dividing by 8, i.e., right shifting by 3 bits). Finally, a subtractor is used to subtract the calculated window mean from the original data, thus removing baseline drift in real time. This processing method avoids complex baseline fitting algorithms (e.g., polynomial fitting), and can be completed using only a simple combination of logic paths involving caching, accumulation, and bit operations. This significantly reduces hardware resource consumption and enables deterministic real-time processing latency (single-point baseline correction latency ≤ 1 clock cycle, e.g., 10ns). It avoids the iterative convergence latency problem of traditional fitting algorithms. At the same time, since it does not require calling the DSP multiplier resources of the field-programmable gate array, it can effectively reduce hardware resource utilization.
[0037] The data downsampling process employs decimation-based downsampling, controlled by a shift register configured according to the downsampling rate. The preset downsampling rate is a parameter used to determine the data extraction interval and control the sampling ratio. It can be configured based on factors such as the peak width characteristics of the mass spectrometry data, real-time requirements, or resource budget for subsequent processing. For example, for 1024-point mass spectrometry data, the downsampling rate is typically configured to 2-8 times to balance data accuracy and processing efficiency, avoiding the loss of key peak information due to an excessively high downsampling rate or the excessive data volume and increased processing latency due to an excessively low downsampling rate. During the downsampling process, the shift register performs shift operations according to the preset downsampling rate, outputting one data point every (N-1) sampling points (N being the downsampling rate), thus achieving uniform data extraction. This process requires no additional data computation logic; it can be implemented in hardware solely through shift register control, with negligible resource occupancy increases. Simultaneously, it significantly reduces the data volume processed by subsequent multi-level dynamic threshold generation and parallel peak detection modules, lowering overall processing latency.
[0038] The local peak signal enhancement processing specifically employs a gradient-based adaptive signal enhancement method, achieved through gradient calculation, threshold comparison, and amplitude adjustment. Adjacent data points refer to reference data points used for gradient calculation. Specifically, these can be any combination of one or more of the preceding, following, or terminating data points (e.g., one preceding and one following data point, totaling two data points, or two preceding and two following data points, totaling four data points). The selection window size for adjacent data points can be determined based on factors such as gradient calculation accuracy requirements, field-programmable gate array (FPGA) buffer resource limitations, or the smoothness of signal changes (e.g., four data points, two preceding and two following, can be configured when prioritizing calculation accuracy, while one preceding and one following data point, totaling two data points, can be configured when resources are limited or signal changes are gradual). The preset gradient threshold is the critical value for gradient amplitude used to distinguish low-abundance signal data points from background noise data points. Its specific value can be determined based on the overall signal-to-noise ratio of the mass spectrometry data, the expected intensity range of the low-abundance peak, or the detection scenario. The gradient threshold can be configured based on factors such as noise characteristics (e.g., a lower gradient threshold can be configured to improve the detection rate of low-abundance peaks when detecting low-concentration clinical samples, while a higher gradient threshold can be configured to suppress noise misjudgment when detecting high-noise environmental samples; typical configuration ranges are such that gradient absolute values less than 0.5 are considered background noise, and values greater than or equal to 0.5 are considered low-abundance signals); the preset amplification factor and preset attenuation factor are used to adjust the ratio of low-abundance signal data points to background noise data points, and can be configured according to the enhancement requirements of low-abundance signals, the degree of background noise suppression, or peak shape preservation requirements (e.g., when it is necessary to enhance low-abundance signals, the amplification factor can be configured to 1.2 to 2.0 times; when it is necessary to further suppress background noise, the attenuation factor can be configured to 0.8 times; when balancing peak shape preservation and signal-to-noise ratio improvement, the amplification factor is usually a combination of 1.5 times and the attenuation factor is 0.8 times).
[0039] In the specific gradient-based adaptive signal enhancement process, the gradient mean is calculated first. This involves using a field-programmable gate array (FPGA) shift register to cache the current data point and a preset number of neighboring data points. A subtractor is used to calculate the difference between the current data point and each neighboring data point, and the difference is accumulated and averaged to obtain the gradient mean. Next, a threshold comparison is performed, comparing the calculated gradient mean with a preset gradient threshold. If the absolute value of the gradient mean is greater than or equal to the preset gradient threshold, the current data point is marked as a low-abundance signal data point; otherwise, it is marked as a background noise data point. Finally, amplitude adjustment is performed, adjusting the value of the current data point based on the marking result. If it is a low-abundance signal data point, the value is multiplied by a preset amplification factor to amplify it; if it is a background noise data point, the value is multiplied by a preset attenuation factor to reduce it. The final output is the enhanced data point value. In this gradient-based adaptive signal enhancement process, the gradient calculation quantifies the signal change trend, which can effectively identify potential peak regions with local variation characteristics in mass spectrometry data; threshold comparison distinguishes effective signals from background noise, avoiding indiscriminate enhancement of the entire data; and amplitude adjustment amplifies low-abundance signals and suppresses background noise respectively, which can improve the signal-to-noise ratio difference between low-abundance peaks and background noise without changing the overall peak shape, providing higher quality input data for subsequent multi-level dynamic threshold screening.
[0040] This optional embodiment, through the detailed hardware logic implementation described above, can transform complex mathematical preprocessing algorithms into combinational logic at the level of basic logic gate circuits such as shifting, comparison, addition, subtraction, and bit operations. It fully utilizes the parallel computing characteristics of field-programmable gate arrays to achieve synchronous execution of each preprocessing subtask, avoiding the accumulated latency of traditional CPU serial processing. By replacing complex data caching logic with shift registers and iterative loop calculations with combinational logic, hardware resource consumption is significantly reduced. The processing latency can be controlled within 1 microsecond, meeting the real-time requirements of embedded mass spectrometers for instant detection.
[0041] Step 20: Based on the preprocessed mass spectrometry data, generate a basic threshold and a dynamic threshold; the basic threshold is used to determine the global background noise filtering range, and the dynamic threshold is used to determine the mass spectrometry peak screening range of local data segments.
[0042] Step 30: Based on the basic threshold and dynamic threshold, filter valid data from the preprocessed mass spectrometry data.
[0043] In this embodiment, after the aforementioned preprocessing, although the signal-to-noise ratio of the corresponding mass spectrometry data has been significantly improved through various preprocessing methods, the local noise intensity of different data segments still varies (for example, low-concentration samples in clinical testing scenarios may have multiple low-abundance peak regions, while high-concentration samples in environmental monitoring scenarios may contain large areas of high-noise interference regions). Therefore, in order to accurately identify the effective mass spectrometry peaks in each data segment, it is necessary to further distinguish between effective signals and invalid noise in the preprocessed mass spectrometry data and separate out the effective data (i.e., the set of data points whose signal intensity exceeds their corresponding local dynamic threshold and may be judged as potential peaks by subsequent processing).
[0044] In this embodiment, a dual threshold screening mechanism is provided, which determines the global background noise filtering range by setting a basic threshold and determines the mass spectrometry peak screening range of a local data segment by setting a dynamic threshold. The baseline threshold aims to determine the filtering boundary for global background noise. Specifically, it can be set based on factors such as the dynamic range of the mass spectrometry data, the signal-to-noise ratio level, or the required detection sensitivity (for example, for clinical samples with a wide dynamic range, the baseline threshold can be set close to the global minimum to retain more weak signals; while for environmental samples with high baseline noise, it can be set to the middle of the dynamic range to initially filter out most background fluctuations), thus constructing a preliminary screening benchmark suitable for the overall data. The dynamic threshold, on the other hand, aims to finely adjust the noise characteristics of different local data segments. Specifically, it can be set based on factors such as the local variance of the data segment, its noise correlation with adjacent data segments, or preset detection scenario parameters (for example, in high-noise data segments with large local variance, the dynamic threshold will be increased to suppress false detections; in low-noise data segments with small local variance, the dynamic threshold will be decreased to enhance sensitivity to low-abundance peaks), thereby adaptively matching the non-uniform characteristics of the mass-to-charge ratio dimension of the mass spectrometry data. In practical implementation, the basic threshold can be determined by the global minimum, maximum and quantile values of the mass spectrometry data after statistical preprocessing, or dynamically adjusted according to the needs of the detection scenario; while the dynamic threshold can be generated by calculating the mean, standard deviation or median absolute deviation of local data segments, and setting the threshold offset based on preset multiples or empirical values, and finally generating a screening threshold that matches the local noise level.
[0045] In this optional embodiment, after determining the basic threshold and the dynamic threshold, effective data can be filtered based on the dual-layer threshold using a synchronous parallel strategy or an asynchronous cascaded strategy to adapt to different hardware resources and real-time requirements. For example, the parallel computing characteristics of a field-programmable gate array (FPGA) can be utilized to send the preprocessed mass spectrometry data into two sets of comparison logic within the same clock cycle, comparing it simultaneously with the global basic threshold and the dynamic threshold corresponding to the current data segment. Subsequently, the two sets of comparison results are fused through a logical AND operation. Only when a data point simultaneously meets the global noise suppression requirement and the local peak significance requirement is it marked as a candidate signal point, thereby maximizing processing speed and achieving real-time filtering with extremely low latency. Alternatively, a two-stage pipeline filtering mechanism can be constructed. The first stage uses the basic threshold to perform a global preliminary screening of the full spectrum data, quickly removing background noise with an intensity significantly lower than the basic threshold, greatly reducing the amount of data processed subsequently. The second stage only performs a refined local comparison on the remaining data that has passed the preliminary screening, based on its data segment and the corresponding dynamic threshold, thereby confirming potential peaks and reducing the triggering frequency and power consumption of the dynamic threshold comparison logic. This dual-threshold-based screening method balances global noise suppression and local peak identification, and adapts to the resource constraints and real-time requirements of different hardware platforms through flexible parallel or cascade strategies. It effectively improves the accuracy and robustness of mass spectrometry peak detection, and can effectively separate effective signals from invalid noise in mass spectrometry data, providing a high-quality data foundation for subsequent accurate location and quantitative analysis of mass spectrometry peaks.
[0046] Optionally, in some embodiments, a base threshold and a dynamic threshold are generated based on the preprocessed mass spectrometry data, including: (1) Perform global statistics on the preprocessed mass spectrometry data to obtain the global maximum and global minimum values; (2) Calculate the basic threshold based on the global maximum and global minimum values, combined with the preset proportional coefficient; (3) Divide the preprocessed mass spectrometry data into multiple data segments according to the preset number of points, and calculate the local variance of each data segment; (4) Based on the ratio of the local variance of each data segment to the average variance of all data segments, and combined with the preset weighting coefficient, calculate the dynamic adjustment coefficient of each data segment. (5) Based on the basic threshold and the dynamic adjustment coefficient corresponding to each data segment, generate the dynamic threshold corresponding to each data segment.
[0047] In this optional embodiment, a method for efficiently generating basic and dynamic thresholds that combine global consistency and local adaptability is provided. In the specific generation process, the global maximum value (i.e., the highest amplitude among all data points) and the global minimum value (i.e., the lowest amplitude among all data points) of the preprocessed mass spectrometry data are first obtained to determine the overall dynamic range of the data. This global statistical method for obtaining the corresponding maximum and minimum values can be based on a parallel comparator array using a field-programmable gate array, pipelined sorting logic, or sliding window extreme value tracking, as long as it can accurately search for and lock the global maximum and minimum values in real time and in parallel during the data stream input process.
[0048] In this optional embodiment, the preset scaling factor is a configuration parameter used to map the base threshold to the offset of the overall dynamic range relative to the global minimum value. It determines the relative position of the background noise to be filtered within the overall dynamic range, thereby determining the global baseline for the background noise to be filtered. The minimum value plus the product of the dynamic range and this factor is then used as the base threshold to construct a preliminary screening benchmark applicable to the overall data and to roughly define the global background noise level. For example, in some embodiments, the preset scaling factor can be specifically selected within the range of 0.2-0.6 to avoid the base threshold being too low, resulting in ineffective background noise filtering, or too high, resulting in the misfiltering of effective low-abundance peaks, ensuring the rationality of the base threshold setting. Selecting a smaller scaling factor (e.g., close to 0.2) indicates that the detection scenario focuses more on low-abundance signals (e.g., low-concentration clinical samples), in which case the base threshold is lower, retaining more weak signals. Conversely, selecting a larger scaling factor (e.g., close to 0.6) indicates that the detection scenario has higher background noise (e.g., environmental monitoring samples), in which case the base threshold is higher, prioritizing the suppression of noise misjudgments. By flexibly configuring this preset ratio coefficient, the algorithm can adaptively adapt to the detection scenario requirements of different signal-to-noise ratios, so that the screening based on this basic threshold can maintain the best signal-to-noise ratio balance in different application scenarios.
[0049] In this optional embodiment, the preset number of points (e.g., 64 points) is the unit length used to divide the preprocessed mass spectrometry data into multiple data segments. The selection of the preset number of points needs to balance the accuracy of capturing local noise features with computational complexity, avoiding situations where excessively fine segmentation (e.g., 32 points) may lead to insufficient local variance statistics and susceptibility to random fluctuations, and situations where excessively coarse segmentation (e.g., 128 points) may mask the noise differences within the data segments and reduce the sensitivity of dynamic adjustment. By splitting the data according to the preset number of points (e.g., 64 points), the fluctuation characteristics of the full spectrum data can be refined to local regions, thereby accurately capturing the noise differences within different mass-to-charge ratio intervals. While ensuring the representativeness of local features, the computational load and resource consumption of the dynamic threshold generation module are controlled, and the random fluctuation intensity (i.e., noise level) of the signal segment is quantified, providing data support for subsequent fine-tuning of the dynamic threshold and avoiding the defect that a single global threshold cannot take into account both high-noise and low-signal areas.
[0050] In this optional embodiment, local variance is a statistic that measures the degree of fluctuation of data points around their mean within a single data segment, reflecting the noise intensity or the severity of signal changes in that data segment. Calculating the local variance of each data segment quantifies the local noise level in different mass-to-charge ratio intervals, providing a key basis for subsequently generating adaptive dynamic thresholds. The average variance of all data segments is the arithmetic mean of the local variances of all segments, serving as a normalized reference benchmark for the global noise level. Therefore, the ratio of local variance to average variance reflects the degree of deviation of the current data segment from the overall average noise level, providing a quantitative basis for determining whether the data segment belongs to a high-noise or low-noise region.
[0051] In this optional embodiment, the preset weighting coefficient is a configuration parameter used to convert the local noise characteristics of the data segment into the dynamic threshold adjustment range. Its value range can be set according to the noise distribution characteristics of the actual application scenario to adjust the influence weight of local variance on the dynamic threshold. For example, in some embodiments, the preset weighting coefficient can be specifically selected between 0.1 and 0.3 to control the fluctuation range of the dynamic adjustment coefficient (e.g., maintained between 0.8 and 1.5). Selecting a smaller weighting coefficient (e.g., close to 0.1) indicates a need to weaken the influence of local variance, preventing excessive threshold elevation due to individual noise points, suitable for low-noise clinical testing. Selecting a larger weighting coefficient (e.g., close to 0.3) indicates a need to strengthen the suppression of local variance, suitable for high-noise environmental monitoring. Based on the aforementioned introduction of the ratio of local variance to global average variance, the relative noise intensity can be weighted using this weighting coefficient, and combined with a base offset (e.g., 1) to obtain the dynamic adjustment coefficient for each data segment. This dynamic adjustment coefficient can automatically adjust the threshold ratio according to the local noise level. When the local noise is high, the coefficient increases, and when the local noise is low, the coefficient decreases, thus realizing the adaptive screening logic of "high threshold for high noise and low threshold for low noise". This enables the dynamic threshold to effectively suppress false detection in the strong noise area and sensitively capture low abundance peaks in the weak noise area.
[0052] This optional embodiment, by using the basic threshold generated by global statistics and the dynamic threshold generated by local variance correction, can replace traditional complex statistical algorithms (such as entropy calculation) with extremely low hardware resource consumption (only requiring comparators, adders, and multipliers). It achieves high sensitivity capture of low abundance peaks and effective suppression of high background noise, and is particularly suitable for embedded mass spectrometer systems with limited computing resources.
[0053] Optionally, in some embodiments, the formula for calculating the basic threshold is: ; in, This is the global maximum value. It is the global minimum value. This is a preset proportional coefficient; The formula for calculating the dynamic threshold is: ; in, For the first Dynamic threshold for each data segment For the first Dynamic adjustment coefficients for each data segment; The formula for calculating the dynamic adjustment coefficient is: ; in, For the first Local variance of each data segment The average variance of all data segments, These are preset weighting coefficients.
[0054] In this optional embodiment, specific calculation formulas for the aforementioned basic threshold, dynamic adjustment coefficient, and dynamic threshold are provided. The core of the basic threshold calculation formula lies in using the global maximum and minimum values to define the dynamic range of the data, and anchoring the basic threshold at a reasonable position within this dynamic range using a user-configurable scaling factor. This formula is simple and intuitive, involving only one subtraction and one multiplication operation, making it easy to implement quickly in a field-programmable gate array (FPGA) using combinational logic, providing a stable and adjustable baseline for the initial filtering of global background noise. The core of the dynamic adjustment coefficient calculation formula lies in introducing the ratio of local variance to global average variance to quantify the deviation of the current data segment from the overall average noise level, and using a preset weighting coefficient. The weight of this ratio on the final adjustment range ensures that the value range of the dynamic adjustment coefficient remains stable and balanced, avoiding over-adjustment of the threshold due to sudden changes in local noise. This formula transforms the complex evaluation of local noise characteristics into a division and a multiplication operation, and is also compatible with the fixed-point arithmetic unit of the field-programmable gate array. The core of the dynamic threshold calculation formula lies in combining the basic threshold and the dynamic adjustment coefficient, and generating a dynamic screening threshold that matches the local noise level through multiplication. This formula not only maintains the global consistency of the basic threshold, but also achieves local adaptation through the dynamic adjustment coefficient, ultimately forming a dual screening mechanism of "global coarse screening + local fine adjustment".
[0055] In this embodiment, the parameters in the above formula can be flexibly configured according to the noise distribution characteristics of the actual detection scenario. For example, in the detection of low-concentration clinical samples, the parameters can be appropriately reduced. Values are used to retain more weak signals while reducing... The value is used to weaken the influence of local variance and prevent excessive threshold raising due to individual noise points, thereby achieving accurate capture of low abundance peaks in low-noise environments; while in high-noise scenarios such as environmental monitoring, the value can be appropriately increased. The value is used to prioritize suppressing background noise while increasing... The value is used to enhance the suppression of local variance, ensuring that sensitivity to effective signals is maintained even in high-noise environments. This flexibility in parameter configuration allows the dual threshold mechanism to be widely adapted to detection requirements with different signal-to-noise ratios, significantly improving the versatility and practicality of the mass spectrometry peak identification algorithm. Furthermore, the above formulas all employ simple arithmetic operations, avoiding complex floating-point operations or iterative calculations, making them particularly suitable for implementation in resource-constrained embedded systems. This ensures real-time performance while effectively reducing hardware costs and power consumption. Through the above-formulated threshold generation logic, the complex adaptive threshold strategy can be transformed into basic logic operations such as parallel comparison and multiplication-accumulation operations that can be efficiently executed by a field-programmable gate array (FPGA). This achieves high-precision, adaptive peak selection while ensuring the algorithm's feasibility and efficiency on embedded hardware platforms.
[0056] Step 40: Based on the resource scheduling status of the field-programmable gate array (FPGA), adjust the number of parallel detection units enabled by the FPGA and determine the multiple sub-tasks that each parallel detection unit needs to execute; the multiple sub-tasks are used to detect potential peaks.
[0057] Step 50: Based on the number of activations, split the valid data into multiple data to be detected, and assign each data to be detected to a different parallel detection unit so that each parallel detection unit can execute multiple sub-tasks to obtain potential peak data.
[0058] In this embodiment, based on the valid data screened in the aforementioned steps, it is necessary to further efficiently and accurately detect the potential peaks contained therein (i.e., data segments whose signal intensity exceeds the local dynamic threshold and meets conditions such as continuity and minimum peak width, which may correspond to candidate signal regions of specific ion components in the sample). Considering that embedded mass spectrometers may face real-time changes in different data volumes (such as 512 points, 1024 points or more) and different noise scenarios (such as clinical low-concentration samples or environmental high-noise samples) in practical applications, if a fixed parallel computing architecture is adopted, it may cause hardware resources to be idle when the data volume is small, or cause a surge in processing latency and a decrease in accuracy due to resource bottlenecks when the data volume is large and the noise is complex.
[0059] In this embodiment, to avoid the aforementioned problems, a mechanism is specifically provided for dynamically adjusting the number of activated detection tasks and the configuration of executed subtasks based on the resource scheduling status of a field-programmable gate array (FPGA). Wherein: Resource scheduling status refers to the status information reflecting the current occupancy and remaining amount of available resources (such as logic units, storage resources, input / output resources, etc.) of the field-programmable gate array. This resource scheduling status can be obtained by sampling the utilization rate of logic units, Block RAM and DSP multipliers in real time through the resource monitoring unit integrated inside the field-programmable gate array, and combining it with the length information of the input data stream, etc. Parallel detection units refer to independent hardware processing modules configured from field-programmable gate array (FPGA) logic units to perform the core sub-task of peak detection. The number of active units is the total number of detection units currently in the active state participating in parallel peak detection. The selection range of this number can be set between 8 and 16 to balance hardware resource utilization and processing efficiency, and can effectively adapt to the resource budget of low-end and mid-range FPGA chips, avoiding the increase in processing latency due to too few parallel units, or the increase in resource contention and power consumption due to too many. The multiple subtasks that the parallel detection unit needs to execute refer to the time-dependent operation steps that constitute the complete peak detection process (such as threshold comparison, edge judgment, peak confirmation, initial peak feature extraction, and secondary confirmation of low-abundance peaks). The specific content can be dynamically added or removed according to the real-time working conditions, thereby forming a pipeline architecture of different depths. Specifically, there can be 3-5 subtasks to balance task execution efficiency and hardware resource consumption, meet the processing needs under different complexity and resource conditions, and avoid increasing the complexity of timing control due to overly fine task division, or decreasing processing efficiency due to overly coarse task division.
[0060] In this embodiment, during the dynamic scheduling process, when the resource scheduling status indicates that the available resources of the field-programmable gate array (FPGA) are relatively abundant, the number of parallel detection units can be appropriately increased, and more complex subtasks can be assigned to these units for execution. This fully utilizes hardware resources and improves data processing speed and the accuracy of potential peak detection. Conversely, when the resource scheduling status indicates that the available resources of the FPGA are relatively scarce, the number of parallel detection units can be reduced, and the subtasks to be executed by each parallel detection unit can be simplified. This avoids a surge in processing latency or a decrease in accuracy due to insufficient resources, ensuring that basic potential peak detection can still be completed under limited resource conditions. Through this strategy of dynamically optimizing the allocation of computing resources based on real-time status, the optimal balance between hardware resource utilization and detection efficiency is achieved, avoiding resource waste or performance bottlenecks caused by fixed architectures in existing technologies.
[0061] In this embodiment, after dynamically adjusting the number of parallel detection units and the subtask configuration, the parallel peak detection execution phase can begin. During execution, the selected valid data can be sequentially divided into multiple data blocks (i.e., data to be detected) based on the currently active number of parallel detection units. This division can be achieved by sorting the valid data by mass-to-load ratio and then evenly dividing it into the active number of blocks, ensuring that each data block contains approximately the same number of data points. Alternatively, a weighted allocation can be performed based on the current load or processing capacity of each parallel detection unit to achieve load balancing, preventing some units from being idle while others are overloaded, and maximizing overall processing efficiency. After the effective data is split, each data to be detected can be assigned to a different parallel detection unit (specifically through the internal bus of a field-programmable gate array or a crossbar switch, etc.). Each parallel detection unit will synchronously start and execute multiple corresponding sub-tasks based on its configured pipeline depth, such as threshold comparison, edge judgment, peak confirmation, etc., to perform independent and parallel peak detection on the assigned data blocks. After all parallel detection units have completed processing, the corresponding detection results can be obtained. These detection results record the data segment information that meets the corresponding threshold conditions and conforms to preset rules such as continuity and minimum peak width. These data segments are the potential peak information that may correspond to specific ion components in the sample.
[0062] This embodiment achieves load balancing and maximizes processing efficiency in the peak detection stage through the aforementioned dynamic resource scheduling and parallel detection mechanism. Specifically, by real-time monitoring of the field-programmable gate array's (FPGA) operation status through resource scheduling, parallel computing resources are dynamically configured, avoiding resource idleness in low-data-volume scenarios and preventing processing bottlenecks in high-data-volume or complex noise scenarios. By splitting effective data into multiple data blocks to be detected and allocating them to independent parallel detection units, multiple data segments can simultaneously undergo the peak detection pipeline. This transforms the originally serial traversal detection task into spatially parallel computation, significantly shortening the overall latency from data filtering to potential peak confirmation. This mechanism ensures that, under embedded resource constraints, the peak detection stage's latency can be stably controlled within 3 microseconds, providing a crucial guarantee for meeting the real-time detection requirement of an overall end-to-end latency ≤10 milliseconds.
[0063] Optionally, in some embodiments, the resource scheduling status includes resource utilization and input data volume; multiple subtasks adopt a multi-level pipeline architecture and are configured according to the depth of each pipeline level.
[0064] In this optional embodiment, the specific constituent indicators of resource scheduling status and their technical meanings are further refined. Resource utilization rate refers to the real-time percentage of resources used, including internal logic units (such as LUTs and FFs), storage resources (such as Block RAM), and dedicated computing units (such as DSP multipliers), reflecting the current level of hardware computing resource strain. Input data volume refers to the total number of mass spectrometry data points to be processed in the current batch (such as 512 points, 1024 points, etc.), reflecting the computational scale of the peak detection task. These two data points reflect the real-time processing load of the system, providing an accurate decision-making basis for dynamically adjusting the number of parallel detection units and subtask configurations.
[0065] This optional embodiment further details the implementation principles and advantages of multiple subtasks based on a multi-level pipeline architecture. The multi-level pipeline architecture refers to breaking down a complete peak detection task into multiple sub-steps (i.e., "levels") with a logical sequence but independent execution. Each step is implemented by a dedicated hardware logic unit. Different data points can proceed sequentially and overlap between different steps, much like products on a pipeline. Its depth refers to the number of levels it contains, such as 3, 4, or 5 levels. By combining the multi-level pipeline architecture with parallel detection units, each parallel unit uses the same pipeline steps to process its assigned data blocks. This microscopically improves the processing throughput of a single data block through task overlap and macroscopically expands the overall data processing bandwidth through multi-unit parallelism, thereby achieving a significant increase in detection efficiency at the hardware level.
[0066] Optionally, in some embodiments, based on the resource scheduling status of the field-programmable gate array (FPGA), the number of parallel detection units enabled by the FPGA is adjusted, and multiple sub-tasks to be executed by each parallel detection unit are determined, including: (1) When the amount of input data is lower than the first preset data amount threshold and the resource occupancy rate is lower than the first preset resource occupancy threshold, the number of activations will be adjusted to the first preset number, and multiple sub-tasks to be executed will be determined based on the preset first-level pipeline depth. (2) When the amount of input data is between the first preset data amount threshold and the second preset data amount threshold, or when the resource occupancy rate is between the first preset resource occupancy threshold and the second preset resource occupancy threshold, the number of activations will be adjusted to the second preset number, and multiple sub-tasks to be executed will be determined based on the preset second-level pipeline depth. (3) When the amount of input data is higher than the second preset data amount threshold, or the resource occupancy rate is higher than the second preset resource occupancy threshold, the number of activations will be adjusted to the third preset number, and multiple sub-tasks to be executed will be determined based on the preset third-level pipeline depth. Among them, the third preset quantity is greater than the second preset quantity, the second preset quantity is greater than the first preset quantity; the preset third level pipeline depth contains more types of subtasks than the preset second level pipeline depth, and the preset second level pipeline depth contains more types of subtasks than the preset first level pipeline depth.
[0067] In this optional embodiment, a specific and operable dynamic scheduling decision logic is provided. This logic maps continuous resource scheduling states (resource occupancy rate, input data volume) to discrete, preset hardware configuration combinations, thereby enabling efficient implementation in a field-programmable gate array (FPGA) through simple comparators and state machines. The first and second preset data volume thresholds can be flexibly set according to the actual mass spectrometry data scale and the processing capability of the FPGA. For example, the first preset data volume threshold can be set to 512 points and the second preset data volume threshold to 1024 points to cover common data volume ranges. The first and second preset resource occupancy thresholds can be determined proportionally based on the total resource volume of the FPGA's internal logic units, storage resources, and dedicated computing units, such as 30% and 50%, to accurately reflect the resource scarcity level.
[0068] In this optional embodiment: When the input data volume is lower than the first preset data volume threshold and the resource utilization rate is lower than the first preset resource utilization threshold, it indicates that the current data volume is small and the hardware resources are sufficient. At this time, the number of enabled functions is adjusted to the first preset number (e.g., 8) to avoid resource idleness. At the same time, based on the preset first-level pipeline depth (e.g., 3 levels), multiple sub-tasks to be executed (e.g., three sub-tasks: corresponding threshold comparison, edge judgment, and peak confirmation) are determined to reduce unnecessary computational overhead, improve the processing speed of a single data block, and reduce resource redundancy. When the amount of input data is between the first preset data amount threshold and the second preset data amount threshold, or when the resource utilization rate is between the first preset resource utilization threshold and the second preset resource utilization threshold, it indicates that the amount of data or resource utilization is at a medium level. At this time, the number of enabled functions will be adjusted to the second preset number (e.g., 12) to balance hardware resource utilization and processing efficiency. Based on the preset second-level pipeline depth (e.g., 4 levels), multiple sub-tasks to be executed will be determined (e.g., on the basis of the aforementioned three sub-tasks, a sub-task for initial extraction of peak features will be added) to improve detection accuracy. When the input data volume exceeds the second preset data volume threshold, or the resource utilization rate exceeds the second preset resource utilization threshold, it indicates a large data volume or high resource consumption. In this case, the number of devices activated is adjusted to the third preset number (e.g., 16) to fully utilize hardware resources, prevent processing bottlenecks, and determine multiple subtasks to be executed based on the preset third-level pipeline depth (e.g., level 5). (For example, adding a subtask for secondary confirmation of low-abundance peaks on top of the aforementioned four subtasks) to ensure accurate detection of potential peaks even in high-noise or complex data scenarios. Through this hierarchical dynamic scheduling strategy, the most suitable number of parallel detection units and subtask configuration can be automatically matched according to the real-time resource scheduling status, achieving the best balance between hardware resource utilization and detection efficiency, ensuring processing efficiency and accuracy, and preventing latency spikes.
[0069] This embodiment achieves precise and efficient matching between computing resources and real-time task requirements through the aforementioned tiered scheduling strategy based on explicit thresholds. It can automatically adjust the number of parallel detection units and subtask configurations based on different input data scales and resource usage, ensuring that peak detection tasks can be completed with optimal resource consumption under various operating conditions. This dynamic scheduling mechanism not only improves the utilization rate of hardware resources but also significantly enhances the system's adaptability and robustness, enabling it to flexibly handle detection needs in diverse scenarios, from low-concentration clinical samples to high-noise environmental samples. It should be understood that the aforementioned threshold range can be an open or closed interval, and can be set according to specific needs and the performance characteristics of the field-programmable gate array (FPGA). Any threshold range that reasonably reflects the data volume and resource usage status, and enables dynamic adjustment of the number of parallel detection units and subtask configurations accordingly, falls within the scope of this embodiment.
[0070] Optionally, in some embodiments, multiple subtasks are selected from threshold comparison, edge judgment, peak confirmation, initial peak feature extraction, and secondary confirmation of low abundance peaks; multiple subtasks corresponding to a preset first-level pipeline depth include threshold comparison, edge judgment, and peak confirmation; multiple subtasks corresponding to a preset second-level pipeline depth include threshold comparison, edge judgment, peak confirmation, and initial peak feature extraction; multiple subtasks corresponding to a preset third-level pipeline depth include threshold comparison, edge judgment, peak confirmation, initial peak feature extraction, and secondary confirmation of low abundance peaks.
[0071] In this optional embodiment, the subtask combinations corresponding to each pipeline depth in the multi-level pipeline architecture are specifically defined. The preset first-level pipeline depth corresponds to three basic subtasks: threshold comparison, edge detection, and peak confirmation. These three subtasks constitute the core and most fundamental part of the peak detection process, enabling rapid initial screening of potential peaks with low resource consumption and small data volume, ensuring processing efficiency. The preset second-level pipeline depth adds a peak feature extraction subtask to the first level. This subtask performs more in-depth feature analysis on the initially screened potential peaks, extracting key feature information such as peak width and peak height, which helps improve detection accuracy and is suitable for scenarios with moderate data volume or resource consumption. The preset third-level pipeline depth further adds a low-abundance peak secondary confirmation subtask. This subtask reconfirms potential peaks with low abundance that may be misjudged or missed, ensuring accurate detection of low-abundance peaks even in high-noise or complex data scenarios through stricter judgment criteria and more complex algorithms, suitable for situations with large data volume or high resource consumption. By clearly defining the combination of subtasks at each level of the pipeline, the dynamic scheduling mechanism can accurately select the appropriate combination of subtasks for execution based on the real-time resource scheduling status, further improving the system's flexibility and adaptability, and ensuring the efficient and accurate completion of peak detection tasks under different operating conditions.
[0072] Optionally, in some embodiments, the threshold comparison subtask is used to compare the value of the current data point in the data to be detected with the dynamic threshold corresponding to the position of the current data point. If the value of the current data point is greater than the dynamic threshold, the current data point is marked as a candidate signal point. The edge detection subtask is used to calculate the numerical gradient between adjacent candidate signal points. Based on the positive and negative changes of the numerical gradient and the preset threshold conditions, the peak start position and peak end position of the candidate signal point sequence are determined. The peak confirmation subtask is used to count the number of consecutive data points between the peak start position and the peak end position. If the number is greater than the preset minimum peak width points, the signal segment is confirmed as a potential peak. The subtask of initial peak feature extraction is used to extract the peak data point index value and the corresponding peak amplitude of the potential peak, and temporarily store the peak data point index value and peak amplitude as a rough peak feature; The subtask of secondary confirmation of low abundance peaks is used to obtain the dynamic threshold of the adjacent data segments of the data segment where the potential peak is located for potential peaks with amplitudes lower than a preset multiple of the dynamic threshold. The dynamic threshold of the adjacent data segments is used to verify the peak based on the correlation between the dynamic threshold of the adjacent data segments and the dynamic threshold of the current segment. If the verification is successful, the potential peak is retained.
[0073] In this optional embodiment, the specific functions and implementation logic of each subtask are described in detail. Among them: The threshold comparison subtask can be implemented using a parallel comparator array configured within a field-programmable gate array (FPGA). Specifically, each parallel detection unit receives the assigned data stream to be detected and, within each clock cycle, performs a parallel comparison between the value of the current data point (e.g., a 16-bit fixed-point number) and the dynamic threshold pre-loaded into the dynamic threshold register corresponding to the data segment to which the data point belongs. If the current data point value is greater than the dynamic threshold, a level signal (e.g., a high-level pulse signal) is generated, and the index of that data point (e.g., a counter value) is marked as a candidate signal point and stored in the candidate signal point buffer queue. This process is completed within a single clock cycle, without the need for loop traversal, achieving real-time filtering at the data stream level.
[0074] The edge detection subtask can be implemented using gradient calculation logic and a state machine within a field-programmable gate array (FPGA). Specifically, this task sequentially reads consecutive candidate signal points from the aforementioned candidate signal point buffer queue and calculates the numerical gradient between adjacent candidate signal points (i.e., the difference between the value of the next point and the value of the previous point). Based on the positive or negative change of the gradient value, combined with preset threshold conditions (e.g., requiring the current point value to be greater than a dynamic threshold when the gradient changes from negative to positive, and requiring continuous gradient changes to satisfy preset monotonicity requirements), the starting position of the peak (the inflection point where the gradient changes from negative to positive) and the ending position of the peak (the inflection point where the gradient changes from positive to negative) are accurately determined. This logic, controlled by a finite state machine, can effectively distinguish between genuine peak signals and isolated high points caused by noise fluctuations.
[0075] The peak confirmation subtask can be implemented using a counter and comparison logic. Specifically, after the edge detection subtask determines the start and end positions of the peak, this task counts the number of consecutive data points (i.e., peak width points) between the peak start and end positions. This number is compared with a preset minimum peak width point count (e.g., configurable to 3 points, corresponding to the minimum resolvable peak width of the mass spectrometer). If the counted number of consecutive data points is greater than or equal to the preset minimum peak width point count, the signal segment is confirmed as a valid potential peak, and a peak confirmation signal is generated. Simultaneously, the peak's start and end indices are packaged and output to the subsequent processing unit. If the count is less than the preset minimum peak width point count, it is considered noise interference and discarded.
[0076] The initial peak feature extraction subtask is implemented through extreme value search logic and register temporary storage. Specifically, for each confirmed potential peak, this task reads all data point values between its start and end positions. A pipelined comparator chain tracks and locks the maximum value and its corresponding data point index within the data segment in real time. When processing reaches the end position of the peak, this maximum value is determined as the peak amplitude, and its index is determined as the peak data point index. Subsequently, this pair of "peak index - peak amplitude" is used as a coarse peak feature and temporarily stored in the field-programmable gate array register or FIFO buffer for more accurate calculations in subsequent parallel peak feature extraction steps, or as a preliminary result for rapid output.
[0077] The secondary confirmation subtask for low-abundance peaks is implemented through threshold correlation verification logic between adjacent data segments. Specifically, this task targets potential peaks whose peak amplitude is lower than a preset multiple (e.g., 1.5 times) the dynamic threshold of the current data segment (i.e., peak value < 1.5 × 1.5 times ... Enhanced verification was performed on the low-abundance peak. During verification, the data segment containing the potential peak (the first...) was synchronously read. Dynamic threshold of segment , and its preceding section (the first) (Paragraph) and the next paragraph (the first paragraph) Dynamic threshold of segment and Then, calculate. and , and The absolute value of the difference. If both differences are less than or equal to a preset correlation tolerance (e.g., 0.2 times the base threshold). If the threshold correlation between adjacent data segments is strong, it indicates that the noise level in that region is stable, and the current low-abundance peak is highly likely to be a true signal, thus it is retained. If any difference exceeds this tolerance, it is determined to be a false peak caused by a sudden change in local noise and is removed. This process is completed in parallel through combinational logic, with extremely low latency, effectively improving the accuracy of low-abundance peak identification while suppressing false detections.
[0078] This optional embodiment constructs a layered, depth-adjustable pipelined detection mechanism through the aforementioned refined sub-task logic. Threshold comparison, edge detection, and peak confirmation constitute the basic detection capabilities, enabling rapid response in low-load scenarios. Initial peak feature extraction reduces subsequent computational pressure through parallel processing. Secondary confirmation of low-abundance peaks utilizes the spatial correlation of local thresholds, solving the problem in traditional algorithms where weak signals are easily masked by noise or misjudged, significantly improving the algorithm's robustness and accuracy in complex detection environments. Each sub-task is designed as synthesizable combinational logic or simple sequential logic using a field-programmable gate array (FPGA), allowing seamless integration into a multi-level pipeline architecture. It can be dynamically enabled or disabled based on resource scheduling status, thus achieving an optimal balance between hardware resource utilization and real-time processing while ensuring peak detection accuracy.
[0079] Step 60: Based on the multi-core operation of the field-programmable gate array, perform parallel peak feature extraction on the potential peak data to obtain the mass spectrometry peak identification results.
[0080] In this embodiment, after screening and confirming potential peaks through the aforementioned steps, it is necessary to further quantify the core features of each potential peak to generate structured identification results that can be used for subsequent qualitative and quantitative analysis. Mass spectrometry peak identification results typically include key parameters such as peak position (corresponding to mass-to-charge ratio), peak intensity (corresponding to ion abundance), and peak width (reflecting ion energy distribution). Traditional methods serially calculate these features on the CPU, and the computational delay increases linearly with the number of peaks, making it difficult to meet the real-time requirements of embedded systems.
[0081] In this embodiment, parallel feature extraction of potential peak data is achieved through multiple computational cores of a field-programmable gate array (FPGA). Multiple computational cores refer to multiple hardware computing units (such as multiple DSP slices or parallel arrays of arithmetic logic units) within the FPGA chip that can independently perform arithmetic logic operations. By assigning different feature calculation tasks for different potential peaks or different features of the same peak to different computational cores for synchronous execution, the originally serial feature calculation process can be transformed into spatially parallel computation, thereby greatly reducing the total time spent on feature extraction. In specific implementation, the scheduling logic first distributes the potential peak data (including the start and end positions of each peak and peak index, etc.) to each computational core. Each computational core then performs feature extraction tasks in parallel based on the peak data it receives, such as mass-to-charge ratio conversion, intensity reading, and full width at half maximum (FWHM) calculation. After all computational cores have completed their calculations, the summed peak feature data constitutes the final mass spectrometry peak identification result.
[0082] This embodiment, through its hardware multi-core-based parallel feature extraction mechanism, ensures that even with a large number of peaks, the latency of the feature calculation stage can be strictly controlled at the microsecond level, thus meeting the requirements of high real-time mass spectrometry analysis. Simultaneously, because each computational core operates independently without interference, this mechanism also possesses extremely high stability and reliability, effectively avoiding overall computational interruptions or result errors due to single-point failures. Furthermore, the multi-core architecture of the field-programmable gate array supports dynamic reconfiguration, allowing for flexible adjustment of the number and configuration of computational cores according to actual detection needs, further enhancing the system's adaptability and flexibility.
[0083] Optionally, in some embodiments, parallel peak feature extraction is performed on potential peak data based on multiple computational cores of a field-programmable gate array (FPGA) to obtain mass spectrometry peak identification results, including: (1) Based on the multi-core operation of field-programmable gate array, peak position feature extraction, peak intensity feature extraction and peak width feature extraction are performed in parallel on the potential peak data to obtain the peak position, peak intensity and peak width of each potential peak; (2) Convert the data format of peak position, peak intensity and peak width to adapt to the preset transmission interface.
[0084] In this optional embodiment, two core sub-steps for parallel peak feature extraction are specifically detailed. In the first sub-step, the parallel computing capabilities of the multi-core FPGA are utilized to split and parallelize the calculation tasks for the three features: peak position, peak intensity, and peak width. For example, the first set of cores can be configured to convert the peak's clock index into a mass-to-charge ratio (peak position), the second set can read and output the peak intensity value, and the third set can calculate the peak's half-width at half-maximum (peak width). Each set of cores can simultaneously process different potential peaks or perform synchronous calculations on different features of the same batch of potential peaks, thereby significantly improving the throughput of feature extraction. In the second sub-step, considering that the data interface format requirements between different modules in the embedded system (such as the FPGA and the main controller) may differ, the extracted raw feature data needs to be format-converted to adapt to a preset transmission interface capable of data interaction with the main controller module or other external devices. For example, the fixed-point numbers used in internal calculations are converted to the integer or floating-point format required by the interface standard and encapsulated according to a preset data packet structure. This conversion process can also be completed in parallel by a dedicated format conversion logic unit, ensuring that the feature data can be transmitted quickly and stably to subsequent processing units or external devices in a low-latency, high-efficiency manner, and through preset transmission interfaces such as SPI (Serial Peripheral Interface) or PCIe (Parallel Peripheral Component Interconnect Express).
[0085] This optional embodiment, through this refined design, decomposes the parallel peak feature extraction process into two closely linked sub-steps: feature calculation and data format conversion. This fully leverages the parallel computing advantages of the multi-core field-programmable gate array (FPGA) while ensuring data interaction compatibility through dedicated format conversion logic. It can ensure that all peak features are accurately quantified and standardized within extremely low latency (typically ≤2 microseconds), providing a structured and directly usable data foundation for subsequent qualitative and quantitative analysis.
[0086] Optionally, in some embodiments, peak position feature extraction includes: obtaining the clock cycle index corresponding to the vertex of the potential peak, and combining it with a preset time-of-flight-mass-charge ratio calibration coefficient to convert the clock cycle index into a mass-charge ratio value as the peak position; Peak intensity feature extraction includes: reading the fixed-point value of the vertex of the potential peak after preprocessing, as the peak intensity; Peak width feature extraction includes: calculating the half-height amplitude based on peak intensity, determining the indices of the two data points whose values are closest to the half-height amplitude at the rising and falling edges of the potential peak, and calculating the difference between the two data point indices as the peak width.
[0087] In this optional embodiment, the specific extraction methods for the three core peak features are described in detail. Among them: The key to peak position feature extraction lies in mass-to-charge ratio (MTR) conversion. Specifically, in time-of-flight mass spectrometry (TOF-MS), there is a definite mathematical relationship between the MTR of an ion and its arrival time at the detector (corresponding to the sampling clock cycle index). During extraction, the precise clock cycle index value corresponding to the peak apex can be obtained from the potential peak data (this index is synchronously recorded by a high-speed counter during data acquisition). Then, using the multipliers and adders of a field-programmable gate array (FPGA), this index value is substituted into a preset time-of-flight-MTR calibration formula for calculation, directly outputting the MTR value as the peak position feature. The calibration coefficient can be pre-determined using a standard sample (such as perfluorotributylamine) during the system calibration stage and stored in the configuration register. The calibration method is as follows: import the standard sample into the mass spectrometer, record the counter value corresponding to the standard peak, and substitute it into the known standard peak MTR to calculate the value.
[0088] Peak intensity feature extraction is relatively straightforward. Since the preprocessed data has been converted to a fixed-point format (such as standard 16-bit vertex data) and the amplitude information of the peak has been preserved, it is only necessary to read the fixed-point value of the point from the data cache according to the index of the peak vertex. This value directly reflects the relative abundance of ions and can be used as the peak intensity output.
[0089] Peak width feature extraction typically uses the full width at half maximum (FWHM) as a metric. The extraction process involves two stages: calculation and search. First, half the peak intensity is calculated as the FWHM amplitude. Then, a search is performed from the peak's beginning towards the apex to find the first data point index with a value greater than or equal to the FWHM amplitude (left half-peak). Next, a search is performed from the peak's apex towards the peak's end to find the first data point index with a value less than or equal to the FWHM amplitude (right half-peak). Finally, the difference between the left and right half-peak indices is calculated and multiplied by the sampling interval to obtain the peak width value in units of time. This search process can be rapidly implemented using the parallel comparison logic of a field-programmable gate array (FPGA). The extraction logic for all three features is designed as deterministic, parallelizable hardware operations, ensuring both efficiency and accuracy in feature extraction.
[0090] Optionally, in some embodiments, the formula for converting clock cycles to mass-to-charge ratio values is: ;in, The preset time-to-mass-to-charge ratio calibration coefficient is determined in advance by a standard sample (such as perfluorotributylamine) during the system calibration phase and stored in the configuration register of the field-programmable gate array; This is the counter value, i.e., the precise clock cycle index corresponding to the potential peak. The AD sampling rate is the sampling frequency of the analog-to-digital conversion module in the mass spectrometer, typically 100 MHz. This formula directly maps time information to the mass-to-charge ratio, utilizing the physical principle that the mass-to-charge ratio of ions in a time-of-flight mass spectrometer is proportional to the square of their arrival time at the detector, through pre-calibrated coefficients. It achieves fast and accurate conversion, avoids complex floating-point operations such as square root, significantly reduces hardware resource consumption and improves calculation speed.
[0091] This application achieves deep collaborative optimization of algorithm logic and field-programmable gate array (FPGA) hardware architecture through the various embodiments and optional embodiments of the aforementioned mass spectrometry peak identification method. Specifically, a parallel preprocessing mechanism enhances low-abundance signals and suppresses background noise, providing a high signal-to-noise ratio data foundation for subsequent processing; a multi-level dynamic threshold generation mechanism adaptively matches the local noise characteristics of the mass spectrometry data, significantly improving the detection rate of low-abundance peaks and effectively suppressing false detections in high-noise regions; a dynamic resource scheduling mechanism achieves precise matching between computing resources and real-time data load, optimizing hardware resource utilization while ensuring processing efficiency; and a pipelined parallel peak detection and feature extraction mechanism significantly shortens the end-to-end processing latency from data input to result output. Through this overall solution, this application effectively solves the core technical challenges in the prior art, such as the difficulty in balancing accuracy and efficiency in mass spectrometry peak identification, insufficient utilization of hardware resources, and difficulty in adapting to multiple detection scenarios. It provides an efficient peak identification solution for embedded mass spectrometers that combines high real-time performance, high accuracy, and low resource consumption.
[0092] When the above-described method of this application is implemented in a hardware device with low to mid-range performance (its structure can be referred to in the mass spectrometry peak identification device 70 described later, specifically using a Xilinx Artix-7 35T as the field-programmable gate array chip for implementing the mass spectrometry peak identification method, an ADI AD9226 as the analog-to-digital converter module, a PCIe 2.0 interface as the data transmission interface, and an NXP i.MX6 processor as the embedded main control unit), it achieves excellent performance indicators such as a low abundance peak detection rate of ≥92%, an overall detection accuracy of ≥95%, a false negative rate of ≤3%, and a false positive rate of ≤2%, which is significantly better than the existing serial peak identification method based on the central processing unit (the low abundance peak detection rate of the existing method is usually lower than 75%, and the false negative rate and false positive rate are usually higher than 8%, and the false negative rate of low abundance peaks in the high noise region is as high as 20%). Compared to existing methods, this application reduces end-to-end processing latency from typically over 50ms to less than 10ms, meeting the stringent requirements of embedded point-of-care testing. Simultaneously, the logic resource utilization of the field-programmable gate array (FPGA) chip can be stably maintained within a reasonable range of 45%-60%, effectively adapting to the cost constraints of mid-to-low-end chips and avoiding cost increases due to reliance on high-end hardware. This performance meets the stringent requirements of standards such as the ISO 13485 medical device quality management system for the accuracy, stability, and real-time performance of clinical testing data, which is beneficial for improving the application performance of portable, point-of-care embedded mass spectrometers in complex scenarios such as clinical testing and environmental monitoring.
[0093] See Figure 2 , Figure 2 This is a schematic diagram of an embodiment of the mass spectrometry peak identification device provided in this application. The mass spectrometry peak identification device 70 includes: an analog-to-digital conversion module 71, a field-programmable gate array (FPGA) chip 72, a data transmission interface 73, and an embedded main control unit 74; the FPGA chip 72 is integrated for executing... Figure 1 The logical module of the mass spectrometry peak identification method described.
[0094] In this embodiment, the analog-to-digital converter module 71 is an electronic module used to convert analog signals into digital signals. It receives analog voltage or current signals reflecting the mass-to-charge ratio and relative abundance of ions detected by the mass spectrometer detector, and digitizes the corresponding analog signals according to a preset sampling frequency and quantization precision. This provides digital data that can be processed by a field-programmable gate array (FPGA) chip for the logical execution of the corresponding mass spectrometry peak identification method. The core function of the analog-to-digital converter module 71 is to realize the signal conversion from the analog domain to the digital domain. Its conversion accuracy and sampling rate directly affect the signal-to-noise ratio and resolution of subsequent digital signal processing. Therefore, the analog-to-digital converter module 71 typically uses high-resolution, high-sampling-rate analog-to-digital conversion devices to ensure the quality of mass spectrometry data acquisition.
[0095] In some optional embodiments, the analog-to-digital converter (ADC) 71 can be selected as an ADC with 12-bit or higher resolution and a sampling rate reaching the megahertz level (such as Analog Devices' AD9226 chip). Such devices can effectively capture subtle changes in the mass spectrometry signal while ensuring high-precision conversion, providing a rich and accurate data foundation for subsequent processing. They can interface with the receiving module of the field-programmable gate array (FPGA) chip 72, and their sampling rate and quantization accuracy can be flexibly adjusted through register programming to adapt to the needs of different detection scenarios. This ensures that the mass spectrometer meets the requirements of high-resolution, high-sampling-rate signal acquisition, avoiding the loss of low-abundance peak information due to quantization errors. The specific ADC selection can be determined based on factors such as the detector type, signal bandwidth, and power consumption budget of the mass spectrometer. The selection in this embodiment is for illustrative purposes only and does not constitute a limitation on the scope of protection of this application.
[0096] In this embodiment, the field-programmable gate array (FPGA) chip 72 refers to a reconfigurable digital integrated circuit chip programmed and configured using a hardware description language. Internally, it integrates logic modules capable of implementing the aforementioned mass spectrometry peak identification method of this application (such as a parallel operation unit for performing preprocessing operations like noise filtering, baseline correction, data downsampling, and local peak signal enhancement; a two-layer threshold generation module for generating basic and dynamic thresholds; a resource scheduling module for dynamically adjusting the number of parallel detection units and pipeline depth according to resource scheduling status; a parallel detection unit for performing subtasks like threshold comparison, edge detection, peak confirmation, initial peak feature extraction, and secondary confirmation of low-abundance peaks; and a multi-core feature extraction unit for parallel extraction of peak position, peak intensity, peak width, etc.). Through its inherent hardware parallel computing characteristics, the FPGA chip 72 can simultaneously execute calculations on multiple data points within a single clock cycle, significantly improving the processing speed of mass spectrometry peak identification and meeting the real-time requirements of embedded mass spectrometers for instantaneous detection.
[0097] In some optional embodiments, the field-programmable gate array (FPGA) chip 72 can be selected from low- to mid-range FPGA chips with fewer than 50k logic cells and less than 3Mb Block RAM (such as the Xilinx Artix series or Intel Cyclone series, e.g., Xilinx Artix-7 35T) to reduce hardware costs and meet the real-time processing requirements of small- to medium-sized mass spectrometers. For scenarios with higher performance requirements, FPGA chips with more logic cells and larger Block RAM can also be selected; this application does not impose specific limitations on this. Simultaneously, the FPGA chip 72 needs to implement a first-in-first-out (FIFO) buffer mechanism for data buffering and timing decoupling between various preprocessing subtasks and pipeline stages. The FIFO buffer can be implemented through the block memory resources within the FPGA chip, and the buffer depth can be set from 256 points to 1024 points according to the data throughput requirements, such as 1024×16bit, to adapt to the one-time buffering requirements of 1024 points of mass spectrometry data. The specific selection of field-programmable gate array (FPGA) chips can be determined based on the resource constraints, power consumption budget, and cost control requirements of the actual application. The selection in this embodiment is only for illustrative purposes and does not constitute a limitation on the scope of protection of this application.
[0098] In this embodiment, the data transmission interface 73 is a data communication channel connecting the field-programmable gate array (FPGA) chip 72 and the embedded main control unit 74. Its main function is to transmit the peak identification results (including peak position, peak intensity, peak width, and other characteristic data) processed by the FPGA chip 72 to the embedded main control unit 74 for subsequent qualitative and quantitative analysis or display output. The data transmission interface 73 needs to have high bandwidth and low latency data transmission capabilities to ensure that the peak identification results can be transmitted to the embedded main control unit 74 in real time, avoiding the impact of data transmission bottlenecks on the overall system response speed. This data transmission interface 73 can be a general interface using the same data transmission protocol that is shared by both the FPGA chip 72 and the embedded main control unit 74, or it can be a dedicated interface chip or module that is set between the two and can perform data format conversion and protocol adaptation.
[0099] In some optional embodiments, the data transmission interface 73 may be selected from one or more standard interfaces such as Serial Peripheral Interface (SPI), High-Speed Serial Computer Expansion Bus (PCIe), or Universal Serial Bus Interface (USB). The data transmission interface 73 has a transmission bandwidth of not less than 1Gbps and a peak identification end-to-end delay of not more than 10ms, ensuring that the peak identification result is transmitted to the embedded main control unit 74 in real time, avoiding the impact of data transmission bottlenecks on the overall system response speed. The specific selection of the data transmission interface can be determined based on the data volume of the peak identification result, the transmission frequency, and system cost requirements. The selection in this embodiment is for illustrative purposes only and does not constitute a limitation on the scope of protection of this application.
[0100] In this embodiment, the embedded main control unit 74 is the control center of the entire mass spectrometry peak identification device 70. It is responsible for coordinating the working timing of each module, configuring various parameters of the mass spectrometry peak identification method, receiving and processing the peak identification results sent by the data transmission interface 73, and communicating with the host computer or other external devices. The embedded main control unit 74 typically uses an ARM architecture embedded processor, which has abundant interface resources and flexible software programming capabilities, and can meet the needs of the mass spectrometer control system for multi-task scheduling and real-time response.
[0101] In some optional embodiments, the embedded master control unit 74 can be selected from a low-power, high-performance embedded processor (such as NXP's i.MX6 series). This embedded master control unit 74 needs to efficiently execute complex mass spectrometry data processing algorithms, and typically requires at least 1GB of random access memory and more than 8GB of embedded memory to ensure data caching and program execution space during multi-task parallel processing. Simultaneously, through multi-level interrupt management and low-power mode design, overall power consumption can be reduced while ensuring system real-time performance, ensuring smooth operation of the mass spectrometry peak identification algorithm and subsequent data processing tasks. The embedded processor needs to have a multi-channel serial communication interface (such as an SPI interface or PCIe interface corresponding to the data transmission interface 73) to interact with the field-programmable gate array chip 72 and the host computer; furthermore, the embedded master control unit can also support network communication functions such as Ethernet or Wi-Fi to achieve remote data transmission and system monitoring. Furthermore, a real-time operating system can run on the embedded main control unit 74, enabling functions such as parameter configuration, task scheduling, result display, and communication with a host computer through software programs. The parameter configuration function allows users to set operating parameters such as sampling rate, dynamic threshold, and pipeline depth via host computer software. The task scheduling function coordinates the timing relationship between mass spectrometry data acquisition, peak identification processing, and result transmission. The result display function presents the peak identification results to the user in graphical or tabular form. The communication with the host computer supports exporting the peak identification results to an external computer for further analysis. The specific embedded processor selection can be determined based on factors such as system performance requirements, power consumption budget, and software development resources. The selection in this embodiment is for illustrative purposes only and does not constitute a limitation on the scope of protection of this application.
[0102] In some optional embodiments, the mass spectrometry peak identification device 70 may further include a power supply module that provides stable power to each functional module. This power supply module can convert the externally input DC voltage (such as 12V or 24V) into the operating voltage required by each module (such as 3.3V, 1.8V, 1.2V, etc.), and provide overvoltage protection, overcurrent protection, and voltage ripple suppression functions to ensure that each module operates reliably in a stable power supply environment. The specific component selection of the power management module can be determined based on factors such as the power consumption requirements, input voltage range, and electromagnetic compatibility requirements of each module.
[0103] The specific selections described in the above optional embodiments are only for illustrative purposes to illustrate feasible implementation methods of the device embodiments of this application, and do not limit this application to using the specific type of device described above. Any mass spectrometry peak identification device 70 that uses a device with corresponding functional characteristics to implement the mass spectrometry peak identification method of this application can be understood to fall within the protection scope of this application. Since the embodiments of the device part correspond to the embodiments of the above method, the description of the mass spectrometry peak identification device 70 provided by the embodiments of this invention should refer to the above method embodiments. The embodiments of this invention will not be repeated here, but they have the same beneficial effects as the above-described mass spectrometry peak identification method.
[0104] See Figure 3 , Figure 3 This is a schematic diagram of an embodiment of the storage medium provided in this application.
[0105] The storage medium 80 stores program data 81, which, when executed by the processor, implements, as follows: Figure 1 The described method for identifying mass spectrometry peaks.
[0106] The program data 81 is stored in a storage medium 80 and includes several instructions for causing a network device (such as a router, personal computer, or server) or processor to execute all or part of the steps of the methods described in the various embodiments of this application.
[0107] Optionally, the storage medium 80 can be any medium capable of storing program data 81, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), disk, or optical disc.
[0108] See Figure 4 , Figure 4 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application.
[0109] The computer device 90 includes a processor 92 and a memory 91 interconnected. The memory 91 stores a computer program, and when the processor 92 executes the computer program, it implements, for example, Figure 1 The mass spectrometry peak identification method described herein. The memory 91 may include the storage medium 80, or it may be another separately developed memory.
[0110] Unlike existing technologies, this application discloses a mass spectrometry peak identification method, apparatus, storage medium, and computer device. By preprocessing mass spectrometry data using multiple parallel operating units based on a field-programmable gate array (FPGA), the preprocessing speed can be significantly improved by leveraging hardware parallelism. This also effectively reduces background noise interference while enhancing weak signal characteristics, significantly improving the signal-to-noise ratio. Based on the preprocessed mass spectrometry data, basic and dynamic thresholds are generated. Based on these thresholds, valid data is screened from the preprocessed mass spectrometry data. The screening criteria can be adaptively adjusted by combining global statistical characteristics and local fluctuation characteristics, thus maintaining high sensitivity to low-abundance peaks in low-noise regions while automatically raising the threshold in high-noise regions to suppress false detections, significantly improving the accuracy of identifying valid data in complex samples. Furthermore, by utilizing resource scheduling based on the FPGA… The system adjusts the number of parallel detection units enabled by the field-programmable gate array (FPGA), determines the multiple subtasks to be executed by each parallel detection unit, and splits the effective data into multiple data to be detected according to the number of enabled units. Each data to be detected is then assigned to a different parallel detection unit to execute the detection task in parallel. This allows for dynamic optimization of the allocation strategy of computing resources based on the real-time load, reducing power consumption under low load and automatically expanding computing power and adding verification mechanisms under high load, achieving the best balance between hardware resource utilization and detection efficiency. By using multiple computing cores based on the FPGA to perform parallel peak feature extraction on potential peak data, mass spectrometry peak identification results are obtained, which can significantly reduce the processing latency of the feature calculation stage and meet the high real-time requirements of embedded devices for instant detection.
[0111] This application achieves dual optimization of peak identification accuracy and efficiency in mass spectrometry under a field-programmable gate array (FPGA) parallel computing architecture through the above-mentioned method. It can effectively avoid the problems of missed detection of low abundance peaks due to fixed thresholds and high latency due to serial computing in the prior art. It solves the technical problem that embedded mass spectrometers are difficult to balance high sensitivity and high real-time performance under resource-constrained conditions. It also balances hardware cost control and multi-scenario adaptability, which is conducive to improving the application performance of portable and real-time detection embedded mass spectrometers in complex scenarios such as clinical testing and environmental monitoring.
[0112] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments, storage medium embodiments, and computer device embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0113] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for identifying mass spectrometry peaks, characterized in that, include: Mass spectrometry data is preprocessed using multiple parallel operation units based on field-programmable gate arrays. The preprocessing is used to enhance the intensity of low-abundance signals and suppress background noise; Based on the preprocessed mass spectrometry data, a basic threshold and a dynamic threshold are generated; The basic threshold is used to determine the global background noise filtering range, and the dynamic threshold is used to determine the mass spectrometry peak screening range of local data segments. Based on the basic threshold and the dynamic threshold, valid data are selected from the preprocessed mass spectrometry data; Based on the resource scheduling status of the field-programmable gate array (FPGA), the number of parallel detection units enabled by the FPGA is adjusted, and the multiple sub-tasks to be executed by each parallel detection unit are determined. The multiple subtasks are used to detect potential peaks; According to the number of activations, the effective data is split into multiple data to be detected, and each data to be detected is assigned to a different parallel detection unit so that each parallel detection unit can execute the corresponding multiple sub-tasks to obtain potential peak data. Based on the multiple computational cores of the field-programmable gate array, parallel peak feature extraction is performed on the potential peak data to obtain mass spectrometry peak identification results.
2. The mass spectrometry peak identification method according to claim 1, characterized in that, The preprocessing includes noise filtering, baseline correction, data downsampling, and local peak signal enhancement. Each of the parallel operation units interacts with data through the first-in-first-out buffer mechanism of the field-programmable gate array to execute each of the preprocessing steps in parallel.
3. The mass spectrometry peak identification method according to claim 1, characterized in that, The generation of a base threshold and a dynamic threshold based on the preprocessed mass spectrometry data includes: Global statistics are performed on the preprocessed mass spectrometry data to obtain the global maximum and global minimum values; Based on the global maximum value and the global minimum value, and in conjunction with a preset proportional coefficient, the basic threshold is calculated; The preprocessed mass spectrometry data is divided into multiple data segments according to a preset number of points, and the local variance of each data segment is calculated. Based on the ratio of the local variance of each data segment to the average variance of all data segments, and in conjunction with a preset weighting coefficient, the dynamic adjustment coefficient of each data segment is calculated. Based on the basic threshold and the dynamic adjustment coefficient corresponding to each data segment, the dynamic threshold corresponding to each data segment is generated.
4. The mass spectrometry peak identification method according to claim 3, characterized in that, The formula for calculating the basic threshold is: ; in, This is the global maximum value. This is the global minimum value. The preset proportional coefficient; The formula for calculating the dynamic threshold is: ; in, For the first The dynamic threshold of each of the data segments, For the first The dynamic adjustment coefficient of each of the data segments; The formula for calculating the dynamic adjustment coefficient is as follows: ; in, For the first The local variance of each of the data segments, The average variance of all the data segments, The preset weighting coefficient is referred to here.
5. The mass spectrometry peak identification method according to claim 1, characterized in that, The resource scheduling status includes resource utilization and input data volume; the multiple subtasks adopt a multi-level pipeline architecture and are configured according to the depth of each pipeline level; Based on the resource scheduling status of the field-programmable gate array (FPGA), the number of parallel detection units activated by the FPGA is adjusted, and multiple sub-tasks to be executed by each parallel detection unit are determined, including: When the amount of input data is lower than the first preset data amount threshold and the resource utilization rate is lower than the first preset resource utilization threshold, the number of activations is adjusted to the first preset number, and the multiple sub-tasks to be executed are determined based on the preset first-level pipeline depth. When the amount of input data is between the first preset data amount threshold and the second preset data amount threshold, or when the resource utilization rate is between the first preset resource utilization threshold and the second preset resource utilization threshold, the number of activations is adjusted to the second preset number, and the multiple sub-tasks to be executed are determined based on the preset second-level pipeline depth. When the amount of input data is higher than the second preset data amount threshold, or the resource occupancy rate is higher than the second preset resource occupancy threshold, the number of activations is adjusted to the third preset number, and the multiple sub-tasks to be executed are determined based on the preset third-level pipeline depth. Wherein, the third preset quantity is greater than the second preset quantity, and the second preset quantity is greater than the first preset quantity; the preset third-level pipeline depth includes more types of subtasks than the preset second-level pipeline depth, and the preset second-level pipeline depth includes more types of subtasks than the preset first-level pipeline depth.
6. The mass spectrometry peak identification method according to claim 5, characterized in that, The multiple subtasks are selected from threshold comparison, edge judgment, peak confirmation, initial peak feature extraction, and secondary confirmation of low abundance peaks. The multiple subtasks corresponding to the preset first-level pipeline depth include the threshold comparison, the edge judgment, and the peak confirmation; The multiple subtasks corresponding to the preset second-level pipeline depth include the threshold comparison, the edge judgment, the peak confirmation, and the initial extraction of peak features; The multiple subtasks corresponding to the preset third-level pipeline depth include the threshold comparison, the edge judgment, the peak confirmation, the initial extraction of peak features, and the secondary confirmation of low-abundance peaks.
7. The mass spectrometry peak identification method according to claim 1, characterized in that, The multi-core operation based on the field-programmable gate array (FPGA) performs parallel peak feature extraction on the potential peak data to obtain mass spectrometry peak identification results, including: Based on the multiple processing cores of the field-programmable gate array, peak position feature extraction, peak intensity feature extraction and peak width feature extraction are performed in parallel on the potential peak data to obtain the peak position, peak intensity and peak width of each potential peak; The peak position, peak intensity, and peak width are converted into data formats to adapt to a preset transmission interface.
8. A mass spectrometry peak identification device, characterized in that, The mass spectrometry peak identification device includes: an analog-to-digital conversion module, a field-programmable gate array chip, a data transmission interface, and an embedded main control unit; The field-programmable gate array chip integrates a logic module for performing the mass spectrometry peak identification method as described in any one of claims 1 to 7.
9. A storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, it implements the steps of the mass spectrometry peak identification method as described in any one of claims 1 to 7.
10. A computer device, characterized in that, It includes an interconnected processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the steps of the mass spectrometry peak identification method as described in any one of claims 1 to 7.