A method and system for mass spectrum image visualization and self-supervised spectral library matching

CN122570490APending Publication Date: 2026-08-14SHANGHAI DEV CENT OF COMP SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-17
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]相关技术中质谱谱库匹配的方案,依旧存在不足:相关技术中的质谱谱库匹配方案,通常需要针对单次扫描谱图、组分级质谱图、包含保留时间演化信息的连续运行信号以及具有共洗脱或共碎裂特征的混合碎片信号分别设计预处理流程与匹配算法

Benefits of technology

本申请提供了一种基于质谱图图像化与自监督的谱库匹配方法及系统,通过将不同来源的数据统一映射为图像化张量,并利用条件向量封装实验元数据,无需针对不同数据类型切换流程或手动分类,系统可自动适配,提升了方法通用性与易用性;通过引入证据单元生成器(EUG),并利用合成混合谱图数据进行监督,能够以数据驱动的方式,从复杂的运行级混合信号中识别并分离出代表单一组分的证据单元,降低了对复杂人工解卷积规则和参数调优的依赖,提升了对低丰度组分的识别能力与整体鲁棒性;通过采用深度特征编码器,在处理质谱图像时,能聚焦于有效信号区域,并保持精细分辨率,提升了计算效率与资源利用率;通过构建融合了条件向量的检索嵌入向量,并执行分层检索与条件自适应重排序,确保了在各种实际场景下的高检索精度与容错能力;通过基于检索结果自动构建结构化证据链生成解析报告,提升了分析结果的可信度与可接受度,为人工复核提供了清晰依据。此外,本申请还增强了系统的鲁棒性与容错能力:基于“条件可得即用/否则自动降级”的策略,确保系统在元数据缺失(如无 RT、无前体)的情况下仍能提供基线水平的鉴定结果,避免了传统软件因参数缺失而报错的问题。提升了细粒度匹配与不完整证据下的鉴定能力:通过以证据单元作为索引粒度对谱图进行“基元化”表征,将同一化合物分解为多个可聚合的证据单元嵌入向量,使系统能够在碎片缺失、共洗脱干扰或跨平台偏移的情况下仍通过跨证据单元聚合实现稳健检索与解释。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122570490A_ABST
    Figure CN122570490A_ABST
Patent Text Reader

Abstract

This application discloses a method and system for spectral library matching based on mass spectrum image visualization and self-supervised analysis, relating to the technical field of mass spectrometry image computation and analysis. The method includes: acquiring multi-morphological mass spectrometry data containing spectral-level input and / or runtime input; parsing and extracting conditional vectors from the multi-morphological mass spectrometry data; discretizing and intensity normalizing the multi-morphological mass spectrometry data to obtain an image-based tensor; implicitly deconvolving the image-based tensor using an evidence unit generator to generate multi-scale evidence units; mapping the evidence units to retrieval embedding vectors through deep feature encoder fusion; performing conditional adaptive retrieval and re-ranking in a mass spectrometry vector library to obtain a ranking result of candidate compounds containing matching evidence; constructing a structured evidence chain based on the candidate compound ranking result; and generating an analysis report based on the structured evidence chain. This application can improve the efficiency of the spectral library matching process and the reliability of the analysis results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of mass spectrometry image computation and analysis, and in particular to a method and system for mass spectrum image visualization and self-supervised spectral library matching. Background Technology

[0002] Mass spectrometry (MS) library matching is a core step in the identification of unknown compounds. With the widespread application of technologies such as gas chromatography-mass spectrometry (GC-MS), liquid chromatography-tandem mass spectrometry (LC-MS / MS), and data-independent acquisition (DIA), mass spectrometry data exhibits characteristics of multi-form, high dimensionality, high noise, and high mixing.

[0003] Current mass spectrometry library matching schemes still have shortcomings: These schemes typically require separate preprocessing procedures and matching algorithms for single-scan spectra, component-level mass spectra, continuous operation signals containing retention time evolution information, and mixed fragment signals with co-elution or co-fragmentation characteristics. These different data types can originate from gas chromatography-mass spectrometry, liquid chromatography-tandem mass spectrometry, and their various acquisition modes. The lack of a unified characterization framework for different data organization formats in existing methods leads to system complexity, cumbersome operation, and insufficient cross-platform compatibility. When dealing with mixed data or co-eluted mixed signals in complex samples, they heavily rely on deconvolution algorithms (such as nonnegative matrix factorization) based on human experience and complex parameter tuning, exhibiting poor robustness to low-abundance components and nonlinear chromatographic drift, and low automation. When general-purpose deep learning models (such as CNN and Transformer) are directly applied to mass spectrometry data, their unique physical properties are overlooked: First, anisotropy, meaning that the mass-to-charge ratio (m / z) dimension requires sub-Dalton resolution to distinguish fine structures, while the retention time (RT) dimension is relatively coarse. In chromatographic-mass spectrometry data, the m / z dimension typically requires high resolution / high quality accuracy to distinguish fine structures of near-mass ions and isotopes. In contrast, the resolvability of the RT dimension is mainly limited by chromatographic peak width and system drift, often exhibiting soft constraints on a second-scale scale and requiring alignment correction. Second, extreme sparsity, with a very low proportion of effective signal, leading to a significant waste of computation in the background region. The lack of high-quality mixed-spectrum annotation data means that the performance of deep learning models is highly dependent on the annotation data. However, in real-world experiments, obtaining the precise "ground truth" of each component in a mixed spectra is extremely difficult and costly. Existing methods often rely on limited libraries of pure standards for supervised training, resulting in insufficient generalization and evidence separation capabilities when faced with real, complex mixed matrix interference. "Black box" matching lacks interpretability and a closed-loop chain of evidence. Existing AI spectral library matching typically outputs a similarity score or classification probability directly, lacking the logical deduction process found in expert human analysis. In scenarios such as forensic identification and clinical diagnosis, where the reliability of results is extremely important, users find it difficult to determine which key fragments, isotopic evidence, or retention time consistency are used to arrive at high-scoring matches, nor can they know the reasons for excluding other candidates, making AI results difficult to audit and accept.

[0004] In summary, there is an urgent need for a deep learning framework driven by mass spectrometry physical priors (such as sparsity and anisotropy) to achieve unified image representation of data from the spectral level to the operational level, obtain robust implicit deconvolution capabilities through synthetic data supervision, and ultimately achieve transparent and interpretable intelligent identification by combining with a large language model. This invention is proposed based on the above-mentioned needs. Summary of the Invention

[0005] The purpose of this application is to provide a method and system for spectral library matching based on mass spectrum visualization and self-supervised analysis, which can improve the efficiency of the spectral library matching process and the reliability of the analysis results.

[0006] To achieve the above objectives, this application provides the following solution: In a first aspect, this application provides a spectral library matching method based on mass spectrum visualization and self-supervised learning, comprising: acquiring multimorphic mass spectrometry data containing spectral-level input and / or runtime-level input; parsing and extracting condition vectors from the multimorphic mass spectrometry data to obtain condition vectors, wherein the condition vectors contain masks representing missing conditions; discretizing and intensity normalizing the multimorphic mass spectrometry data to obtain a visualized tensor; implicitly deconvolving the visualized tensor using an evidence unit generator to generate multi-scale evidence units; wherein the multi-scale evidence units include at least component-level evidence units and / or substructure-level evidence units, wherein the component-level evidence units are used to characterize a single potential chemical component, and the substructure-level evidence units are used to characterize diagnostic fragments, isotope peak clusters, feature neutral loss, and substructure or functional group-related fragmentation patterns; and fusing the evidence units using a deep feature encoder. Based on the evidence unit and the conditional vector, the evidence unit is mapped to a retrieval embedding vector. A two-stage strategy is used to train the evidence unit generator and the deep feature encoder: the first stage uses unlabeled data to perform a masked autoencoder task for pre-training; the second stage constructs a synthetic mixed spectrum dataset, using at least one of the following as supervision targets: pure spectrum corresponding to each component in the synthetic sample, true values ​​of component positions, substructure or fragment annotations, diagnostic ion tags, isotope peak cluster tags, or neutral loss tags, to jointly optimize the evidence unit generation capability and the representation capability of the deep feature encoder; based on the retrieval embedding vector and the conditional vector, conditional adaptive retrieval and re-ranking are performed in the mass spectrometry vector library to obtain the candidate compound ranking results containing matching evidence; a structured evidence chain is constructed based on the candidate compound ranking results, and an analytical report is generated based on the structured evidence chain.

[0007] Secondly, this application provides a spectral library matching system based on mass spectrometry visualization and self-supervised learning. The system includes: a data input and preprocessing module for acquiring multi-morphological mass spectrometry data and generating conditional vectors and visualization tensors; an implicit deconvolution module with an embedded evidence unit generator for generating multi-scale evidence units from the visualization tensors; the multi-scale evidence units include at least component-level evidence units and / or substructure-level evidence units, wherein the component-level evidence units characterize a single potential chemical component, and the substructure-level evidence units characterize diagnostic fragmentation, isotope peak clusters, feature neutrality loss, and substructure or functional group-related fragmentation patterns; a feature encoding module with an embedded deep feature encoder for fusing the evidence units with conditional vectors and mapping them to retrieval embedding vectors; and a stage. The training module is used to train the evidence unit generator and the deep feature encoder according to a two-stage strategy: the first stage uses unlabeled data to perform a masked autoencoder task for pre-training; the second stage constructs a synthetic mixed spectrum dataset, using at least one of the following as supervision targets: the pure spectrum corresponding to each component in the synthetic sample, the true value of the component position, the substructure or fragment annotation, the diagnostic ion label, the isotope peak cluster label, or the neutral loss label, to jointly optimize the evidence unit generation capability and the representation capability of the deep feature encoder; the intelligent retrieval and ranking module is used to perform conditional adaptive retrieval and re-ranking based on the retrieval embedding vector and the condition vector; the analytical report generation module is used to construct a structured evidence chain based on the candidate compound ranking results and generate an analytical report based on the structured evidence chain.

[0008] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a method and system for spectral library matching based on mass spectrum visualization and self-supervised learning. By uniformly mapping data from different sources into visualized tensors and encapsulating experimental metadata using conditional vectors, the system can automatically adapt to different data types without requiring process switching or manual classification, thus improving the method's versatility and ease of use. By introducing an evidence unit generator (EUG) and using synthetic mixed spectral data for supervision, it can identify and separate evidence units representing single components from complex runtime mixed signals in a data-driven manner, reducing reliance on complex manual deconvolution rules and parameter tuning, and improving the ability to identify low-abundance components and overall robustness. By employing a deep feature encoder, it can focus on the effective signal region while maintaining fine resolution when processing mass spectrometry images, improving computational efficiency and resource utilization. By constructing a retrieval embedding vector that integrates conditional vectors and performing hierarchical retrieval and conditional adaptive reordering, it ensures high retrieval accuracy and fault tolerance in various practical scenarios. By automatically constructing a structured evidence chain based on the retrieval results to generate an analytical report, it improves the credibility and acceptability of the analysis results and provides a clear basis for manual review. Furthermore, this application enhances the system's robustness and fault tolerance: based on a "use when conditions are available / automatically degrade otherwise" strategy, it ensures that the system can still provide baseline-level identification results even when metadata is missing (e.g., no RT, no precursor), avoiding the error problems caused by missing parameters in traditional software. It also improves the identification capabilities under fine-grained matching and incomplete evidence: by using evidence units as the index granularity to "primalize" the spectrum, the same compound is decomposed into multiple aggregateable evidence unit embedding vectors, enabling the system to achieve robust retrieval and interpretation through cross-evidence unit aggregation even with fragmentation, co-elution interference, or cross-platform offset. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments 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.

[0010] Figure 1 This is a flowchart of the spectral library matching method based on mass spectrum visualization and self-supervised analysis in the embodiments of this application.

[0011] Figure 2 This is a flowchart of the spectral library matching method based on mass spectrum visualization and self-supervised analysis in the embodiments of this application.

[0012] Figure 3 This is a schematic diagram illustrating the image representation and modal adaptation of multi-mode mass spectrometry data in the embodiments of this application.

[0013] Figure 4 This is a schematic diagram of the implicit deconvolution principle based on the evidence unit generator in the embodiments of this application.

[0014] Figure 5 This is a schematic diagram of the depth feature encoder structure in an embodiment of this application.

[0015] Figure 6 This is a schematic diagram of the two-stage training strategy in the embodiments of this application.

[0016] Figure 7 This is a schematic diagram of the adaptive vector retrieval and reordering logic in an embodiment of this application.

[0017] Figure 8 This is a schematic diagram illustrating the construction of a structured chain of evidence and the parsing of a generative report in an embodiment of this application. Detailed Implementation

[0018] 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 some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0020] like Figure 1 As shown, this application provides a method for spectral library matching based on mass spectrum imaging and self-supervised analysis. The method includes the following steps: S110. Acquire multimorphic mass spectrometry data containing spectral-level input and / or runtime input, and parse and extract the multimorphic mass spectrometry data to obtain a condition vector, which contains a mask representing the absence of conditions.

[0021] S120. Discretize and normalize the intensity of the multimorphic mass spectrometry data to obtain an image tensor.

[0022] S130. The image tensor is implicitly deconvolved using an evidence unit generator to generate multi-scale evidence units. The multi-scale evidence units include at least component-level evidence units and / or substructure-level evidence units, wherein the component-level evidence units are used to characterize a single potential chemical component, and the substructure-level evidence units are used to characterize diagnostic fragments, isotope peak clusters, feature neutral loss, and substructure or functional group-related fragmentation patterns.

[0023] S140. The evidence unit and the conditional vector are fused by a deep feature encoder, and the evidence unit is mapped to the retrieval embedding vector.

[0024] S150. The evidence unit generator and deep feature encoder are trained using a two-stage strategy: In the first stage, a masked autoencoder task is performed using unlabeled data for pre-training; in the second stage, a synthetic mixed spectrum dataset is constructed, and at least one of the following is used as the supervision target: the pure spectrum corresponding to each component in the synthetic sample, the true value of the component position, the substructure or fragment annotation, the diagnostic ion label, the isotope peak cluster label or the neutral loss label, to jointly optimize the evidence unit generation capability and the representation capability of the deep feature encoder.

[0025] S160. Based on the retrieval embedding vector and conditional vector, perform conditional adaptive retrieval and reordering in the mass spectrometry vector library to obtain the ranking results of candidate compounds containing matching evidence.

[0026] S170. Construct a structured chain of evidence based on the candidate compound ranking results, and generate an analysis report based on the structured chain of evidence.

[0027] This application provides a spectral library matching method based on mass spectrum visualization and self-supervised analysis. By uniformly mapping data from different sources into visualized tensors and encapsulating experimental metadata using conditional vectors, the method eliminates the need for switching processes or manual classification for different data types, allowing for automatic adaptation and improving its versatility and ease of use. By introducing an evidence unit generator (EUG) and using synthetic mixed spectral data for supervision, it can identify and separate evidence units representing single components from complex runtime mixed signals in a data-driven manner. This reduces reliance on complex manual deconvolution rules and parameter tuning, improving the ability to identify low-abundance components and overall robustness. Employing a deep feature encoder, it can focus on the effective signal region while maintaining fine resolution when processing mass spectrometry images, improving computational efficiency and resource utilization. By constructing a retrieval embedding vector that integrates conditional vectors and performing hierarchical retrieval and conditional adaptive reordering, it ensures high retrieval accuracy and fault tolerance in various practical scenarios. By automatically constructing a structured evidence chain based on the retrieval results to generate an analytical report, it improves the credibility and acceptability of the analysis results, providing a clear basis for manual review.

[0028] For example, such as Figure 2As shown, multi-form mass spectrometry data includes spectral-level input and operational-level input. The spectral-level input includes a one-dimensional mass spectrometry signal without a continuous retention time evolution dimension, which includes at least one of the following: a full-scan fingerprint spectrum of gas chromatography-mass spectrometry, a fractional mass spectrum, or a single secondary spectrum or a fractional secondary spectrum obtained from liquid chromatography-tandem mass spectrometry. The operational-level input includes a two-dimensional mass spectrometry signal with a retention time evolution dimension, which includes at least one of the following: a retention time-ion mass-to-charge ratio signal formed by continuous acquisition along the retention time during gas chromatography-mass spectrometry operation, or a retention time-fragment ion mass-to-charge ratio signal formed by continuous acquisition or associated tissues along the retention time during liquid chromatography-tandem mass spectrometry operation. Both the spectral-level input and the operational-level input include experimental metadata associated with the signal data, which includes discrete metadata and continuous metadata. For liquid chromatography-tandem mass spectrometry data, both data-dependent and data-independent acquisition modes can provide spectral-level input and / or operational-level input; the acquisition mode does not constitute a limitation on the above-mentioned input organization form.

[0029] In step S110 above, multi-morphological mass spectrometry data to be analyzed is acquired through a unified interface. This data includes both spectral-level inputs (such as single mass spectra) and operational-level inputs (such as chromatography-mass spectrometry data containing retention time series). The experimental metadata accompanying the data is automatically parsed, including but not limited to ionization mode, acquisition mode, precursor ion information, collision energy, and retention time, and this information is encoded into a unified condition vector. This vector is specifically designed with a mask representing missing information, used to intelligently determine whether to enable specific conditions for constraint in subsequent processes.

[0030] Specifically, the conditional vector is obtained by analyzing and extracting the multimorphic mass spectrometry data, including: Discrete and continuous metadata are extracted from the experimental metadata. The discrete metadata is encoded into a dense vector, and the continuous metadata is standardized. A conditional random missing data simulation mechanism is introduced to randomly mask some metadata information during the encoding process (i.e., ...). Figure 2 The missing mask is used to form a robust conditional vector.

[0031] Specifically, in the process of constructing condition vectors, discrete conditions (including ionization mode, polarity, acquisition mode, instrument series, etc.) are mapped into dense vectors through a learnable embedding layer (i.e., Figure 2 Discrete-condition embedding). For continuous conditions (including resolution, collision energy, isolation window width, retention time / exponent, precursor information—m / z and charge, etc.), normalization is performed (i.e., Figure 2(Continuous conditional standardization). After concatenating the above features, the final conditional vector is obtained through projection. In addition, this method introduces a conditional dropout mechanism, which randomly masks some conditional components during training, forcing the model to learn robust representations that do not depend on complete metadata.

[0032] In step S120, as Figure 3 As shown, all input data are mapped to a unified two-dimensional space consisting of the retention time (RT) dimension and the mass-to-charge ratio (m / z) dimension, forming an image-based tensor. For the mass-to-charge ratio axis, a high-resolution discretization strategy (such as adaptive binning) is used for digitization. For the intensity determined by the RT and m / z coordinates, logarithmic normalization is performed to compress the dynamic range. For one-dimensional spectral inputs that originally lacked the RT dimension, dimensionality expansion is achieved through copy broadcasting or a learnable modal adapter (i.e.,...). Figure 2 The spectral level input is extended in two dimensions, giving it the same two-dimensional data structure as the runtime level input, thereby achieving a unified representation across data formats.

[0033] The m / z axis range is set to the configurable mass range supported by the system. For gas chromatography-mass spectrometry (GC-MS) and routine small molecule metabolomics analysis, a range of 50-1000 Da is preferred. For lipidomics or peptide analysis scenarios using liquid chromatography-mass spectrometry (LC-MS), the range is preferably extended to 50-2000 Da.

[0034] In this embodiment, high-resolution discretization is used to resolve the conflict between accuracy and memory usage. To control the input tensor dimension while preserving the fine structure of high-resolution mass spectrometry (HRMS), the system abandons a single fixed binning method, and the discretization strategy preferably adopts one of the following two: Strategy 1 uses fine-grained fixed binning, setting the minimum precision unit Δm = 0.01 Da. In this case, the feature dimension corresponding to a range of 1000 Da is... Order of magnitude. Although this precision (10 mDa) is below the instrument's limit resolution (0.1 mDa), it is sufficient to maintain the spatial structural separability of isotope peaks (spacing ~1.0 Da) and key fragment fingerprints, representing the optimal balance for deep learning representations.

[0035] Strategy two is adaptive nonlinear binning, which employs a non-uniform grid mapping method: ultra-high resolution (e.g., Δm = 0.001 Da) is used in low-mass regions with dense ions (e.g., <500 Da) or in localized areas where signals are detected; coarse resolution is used in background regions without signals or in high-mass regions. This hashing method losslessly compresses the physical precision of 4 decimal places into a fixed-length input vector.

[0036] For mass spectrometry signals with extremely large dynamic range (spanning 10), 2 -10 7 Based on the characteristics of [the application], this application uses a logarithmic transformation formula for normalization, as shown below: .

[0037] in, Scaling factor (preferably 10) 4 ), This is the result of normalization. The above processing method aims to improve the visibility of low-abundance fragment peaks while suppressing the excessive dominance of high-abundance base peaks, ultimately forming a normalized image tensor. .

[0038] It should be noted that for spectral input, the additional dimensions obtained by dimensional expansion are used to adapt to the unified two-dimensional model input structure, and do not indicate that the spectral input has actual measured continuous retention time evolution information; in the subsequent conditional fusion and result interpretation process, the constraints related to the actual retention time are only enabled when the corresponding retention time information is available.

[0039] In step S130, the evidence unit generator in this application can generate multi-scale evidence units of different granularities according to the training objective, slot type, or output head type. Specifically, the evidence units may include component-level evidence units and substructure-level evidence units. Component-level evidence units are used to characterize local regions, soft mask layers, or component slots corresponding to a single potential chemical component in a mixed signal; substructure-level evidence units are used to characterize diagnostic fragments, isotope peak clusters, feature neutral loss, substructure or functional group-related fragmentation patterns. Both can be output from different slots, different prediction heads, or different attention masks of the same evidence unit generator. It should be noted that the evidence unit generator in this application can also implicitly deconvolve the image tensor to generate evidence units representing a single component. Specifically, this includes identifying and separating the local representation or characteristic representation corresponding to a single chemical component from the image tensor as evidence units.

[0040] The identification and separation process is achieved through at least one of the following methods: A region of interest bounding box with confidence is generated on the feature map to locate the effective components; the image tensor is decomposed into multiple weighted superimposed component layers through a learnable soft masking mechanism, wherein the soft mask is generated through an iterative attention mechanism; as a cold start or failure safety mechanism, local signals are intercepted according to a preset retention time window and mass-to-charge ratio bandwidth.

[0041] like Figure 4As shown, this application employs an Evidence Unit Generator (EUG) for implicit deconvolution of mixed spectra, inputting an image-based tensor into the EUG. This generator is a deep learning module whose core function is to automatically identify and separate local feature regions corresponding to a single chemical component from mixed spectral signals that may contain multiple co-eluted components, in a data-driven manner. This achieves implicit deconvolution of the mixed spectrum, automatically downgrading to global or sliding window mode for spectral inputs or low-confidence regions, and outputting a standardized sequence of evidence units. The sequence includes multiple evidence units, with each evidence unit-level vector representing one of the evidence units. This process achieves implicit deconvolution without requiring a pre-defined peak shape model. For spectral inputs that are already of a single component, the generator can automatically adapt to a global processing mode. Specifically, when using the input tensor X, which contains signals mixed with multiple co-eluted components, this embodiment employs a slot attention approach. The system initializes k learnable slots, each representing a potential compound component, and competes for energy distribution in the input feature map through an iterative attention mechanism. The process of attention calculation is as follows: in, Indicates the component tank index, Indicates the index of the image pixels.

[0042] Then output k soft masks with the same size as the input. Each component tank generates an independent unit of evidence. (Dot product). For example, an additivity reconstruction constraint is imposed during training, as follows: .

[0043] This constraint forces the network to mix signals. Each pixel in the model is "assigned" to one or more of the most likely component slots, thereby achieving intelligent separation of mixed overlapping peaks (i.e. implicit deconvolution) without relying on a fixed peak shape model.

[0044] Furthermore, during the training process of the evidence unit generator, to ensure that multiple evidence units can completely cover the input signal and avoid different component slots learning repetitive representations, this embodiment introduces an evidence unit generation loss function. The loss function includes at least reconstruction consistency loss, component slot difference loss, and mask sparsity constraint loss, and its overall form is as follows: .

[0045] = .

[0046] = .

[0047] = .

[0048] in, This represents the reconstruction consistency loss, used to constrain the summation of multiple evidence units to approximately reconstruct the input image tensor; This represents the loss due to the difference between component cells, which is used to reduce the redundant response between different component cells and encourage different component cells to focus on different local signal regions. The mask sparsity constraint loss is used to make each evidence unit focus on a limited effective signal region and reduce the interference of the background region on the evidence unit. Through the above loss function, the evidence unit generator can achieve separation and localization of different potential components while maintaining the reconfigurability of the input signal.

[0049] In some embodiments, an evidence unit generator (RPN-EUG) based on a Region Proposal Network (RPN) is employed. Borrowing from object detection approaches, instead of performing complex decomposition of the entire image, the network directly predicts several "bounding boxes" on the feature map that may contain a chemical component. This is achieved by predicting bounding boxes for multiple regions of interest (ROIs) on the feature map. Based on its confidence level, potential components are directly selected. , This indicates the start and end positions of the bounding box within the time dimension. This indicates the center position and feature span of the bounding box in the mass-to-charge ratio dimension.

[0050] In other embodiments, the component slot can also be extended to multiple types of evidence slots, including at least a component slot and a substructure slot; the component slot is used to capture chemical component-level signals, and the substructure slot is used to capture diagnostic fragments, isotope clusters, neutral loss, or functional group-related fragmentation patterns.

[0051] In step S140, the evidence unit and conditional vector are fused through a deep feature encoder, and the evidence unit is mapped to a retrieval embedding vector. This includes: fusing the conditional vector as modulation information with the evidence unit; processing the fused features using a neural network with anisotropic receptive fields and sparse activation characteristics, and outputting a fixed-dimensional vector as the retrieval embedding vector (i.e., Figure 2 Z1, Z2, Z3...Z kThe anisotropic receptive field manifests as differentiated information aggregation in the mass-to-charge ratio (m / z) and retention time (RT) dimensions during the encoding process. In this embodiment, a specially designed deep feature encoder is used to fuse and encode each evidence unit with its corresponding conditional vector. This encoder employs an asymmetric downsampling strategy, maintaining high resolution in the m / z direction at the shallow layers of the network to capture fine fragments and isotopic patterns, while compressing the retention time (RT) dimension. As the network deepens, the receptive field in the RT dimension is gradually expanded to understand chromatographic behavior. Through this structure, each evidence unit is ultimately mapped to a fixed-length retrieval embedding vector, which simultaneously contains the mass spectrometric fingerprint of the substance and experimental context information.

[0052] The deep feature encoder preferably employs an improved MS-SwinUNet structure, which is specifically designed for the physical characteristics of mass spectrometry images. Specifically: Anisotropic feature aggregation (i.e. Figure 2 In the anisotropic encoding phase, the shallow layers of the network employ a small retention time (RT) window and a high-resolution mass-to-charge ratio (m / z) window to divide the image into patches, allowing the model to focus its attention on capturing fine isotopic distributions and fragment ion features. As the network deepens, asymmetric downsampling is used to preferentially compress features and expand the receptive field in the RT dimension, while maintaining high resolution in the m / z dimension. Ultimately, the deep network can form a global temporal understanding covering the entire chromatographic peak while maintaining the mass spectrometric fingerprint resolution that distinguishes adjacent ions.

[0053] To address the sparsity issue of extremely high background coverage in mass spectrometry images, the encoder supports a sparse tensor input processing mode. Specifically, during image block segmentation, the system constructs a non-zero activation index based on local signal intensity, generating feature tokens only for image blocks containing valid signals and performing subsequent calculations. For large background areas, a computational bypass strategy is used to skip them directly, making the overall computational complexity proportional to the number of valid ions in the input spectrum, thereby significantly improving processing efficiency. Considering that background coverage in mass spectrometry images exceeds 95%, dynamic pruning is introduced in this embodiment to avoid invalid calculations. like Figure 5 As shown, in the stage of dividing the image into patches, the sum of the absolute intensities of all pixels within each image patch is calculated as the signal energy E=Σ|I|. A dynamic threshold τ is set, and only image patches with energy E>τ are retained to generate feature tokens, which are then used in subsequent model calculation processes.

[0054] Location information preservation: To prevent the loss of spatial structure information after pruning, the system will retrieve and add the corresponding absolute position code for the preserved image patch based on its coordinates (RT, m / z) in the original image.

[0055] Window computation bypass: In the moving window self-attention module with sparse tensor input, the system checks whether the current window contains any valid tokens. For "empty windows" that do not contain any valid tokens, the complex matrix multiplication operations inside are skipped directly, thus achieving a significant acceleration in inference.

[0056] The specific parameters for asymmetric downsampling are as follows: In stages 1-2 of the network (shallow layers), a downsampling kernel with a stride of (m / z:1, RT:2) is used. This means a 2x compression in the width (RT) direction to begin aggregating temporal information, while maintaining the original resolution in the height (m / z) direction to preserve the fine mass spectrometry fingerprint. In stages 3-4 of the network (deep layers), a downsampling kernel with a stride of (m / z:2, RT:4) is used. At this stage, the RT dimension is significantly compressed to obtain a global view covering the entire chromatographic peak, while the m / z dimension is moderately abstracted, transforming it from a specific mass-to-charge ratio value into a high-level semantic feature.

[0057] In step S150, as Figure 6 As shown, a two-stage strategy is employed to train the evidence unit generator and the deep feature encoder. Specifically, the method in this application further includes: training the evidence unit generator and the deep feature encoder, the training process including: using unlabeled mass spectrometry data to perform mask autoencoder and spectral contrast learning tasks, wherein the mask autoencoder adopts a non-uniform mask sampling strategy based on signal saliency; and performing supervised training using a synthetic mixed spectrum dataset, wherein the synthetic mixed spectrum is generated by superimposing pure spectra and simulating matrix effects and nonlinear responses, so that the output embedding vector has the property of homogeneous aggregation and heterogeneous separation. The pure spectra (and / or the ground truth values ​​of their component positions, such as ROI bounding boxes or soft masks) corresponding to each component in the synthetic sample are used as the supervision target to jointly optimize the evidence unit generation capability and the representation capability of the deep feature encoder.

[0058] Specifically, the training of the Evidence Unit Generator (EUG) and the deep feature encoder preferably adopts the following two-stage strategy: Phase 1: Self-Supervised Pre-training. Using unlabeled mass spectrometry data, the Masked Autoencoder (MAE) loss and the spectral contrastive learning loss are jointly optimized. In the MAE task, the model needs to reconstruct the masked fragment peaks and isotopic patterns from the remaining image patches after random masking, thereby learning the internal structure of the mass spectrometry data. In the contrastive learning task, views obtained from the same original spectrum after data augmentation such as random noise injection and intensity jitter are used as positive sample pairs, and spectra of different compounds are used as negative sample pairs. The contrastive loss function is used to bring positive samples closer together and push negative samples apart, thereby enhancing the model's robustness to fluctuations in experimental conditions.

[0059] In addition to general masking autoencoders, the following specialized self-supervised tasks designed for the physical properties of mass spectrometry data can be introduced to enhance the model's physical perception capabilities: Task A: Signal-Saliency Autoencoder (MAE): To force the model to learn key chemical signals rather than the background, non-uniform masking is employed. Specifically, the system determines whether to mask each image patch based on its signal energy E, with a probability of P_mask∝log(E). This means that high-signal regions ("peaks") are more likely to be masked, forcing the model to reconstruct the masked main peak based on the surrounding chemical context (isotope profiles, fragment associations), thereby learning deeper mass spectrometry patterns. A dynamic weight matrix is ​​introduced when calculating the reconstruction error (MSE Loss). High-weighted losses are calculated only for non-zero pixels, while reconstruction errors with zero background values ​​are given very low weights or are masked out. The loss calculation method is as follows: .

[0060] in, This represents the mask autoencoding loss. i Indicates pixel index, Indicates the mask area. and These represent the actual value and the predicted value, respectively. This represents the dynamic weights. The above strategy ensures that the direction of gradient descent is always dominated by the recovered chemical signal, rather than by the fitted background.

[0061] Task B: Isotope Pattern Reconstruction: This task involves selectively masking regions at the high mass end of a mass spectrum (typically containing isotope peaks such as M+1 and M+2), requiring the model to predict the distribution pattern of the masked isotope peaks based solely on information from the main peak (M) at the low mass end. This task is directly related to the elemental composition of compounds, driving the model to learn strict stoichiometric rules.

[0062] Task C: Precursor-Fragment Consistency: The system constructs negative samples, pairing an MS2 fragment spectrum with a randomly erroneous precursor ion information (precursor m / z). The model is trained to determine whether the "precursor-fragment" pair matches, thereby internalizing the generation relationship between precursors and feature fragments under different fragmentation patterns.

[0063] Task D: Spectral Comparison Learning (Robustness): Treat the same spectrum after intensity jittering or random noise injection as a positive sample pair, and treat the spectra of different compounds as negative sample pairs. Improve the robustness of the model to fluctuations in experimental conditions through contrastive loss.

[0064] Second stage: Synthetic supervised fine-tuning (deconvolution capability specialization): This phase aims to train the EUG model's signal separation capability in complex contexts using precisely labeled synthetic data and to address the distribution discrepancy between simulated and real data (Sim2Real Gap).

[0065] 1. Construction of high-fidelity synthetic data (nonlinear physics simulation).

[0066] To overcome the limitation of traditional linear superposition methods in reflecting true chromatographic behavior, this embodiment employs a nonlinear physical synthesis strategy to construct the training set: Matrix effect simulation: When components are extracted from a pure standard library and superimposed, a random ion suppression factor is introduced. It acts on low-abundance components, simulating the charge-competitive inhibition of low-abundance ions by high-abundance co-elutants.

[0067] Nonlinear response simulation: An intensity-dependent response decay function (Sigmoid or Log-linear) is introduced to simulate the nonlinear saturation effect of the detector at extremely high concentrations.

[0068] Real background injection: Instead of simple Gaussian white noise, chemical background noise extracted from real blank biological samples (BlankMatrix) is injected into the synthesized spectrum.

[0069] Through the above steps, the generated synthetic hybrid spectrum closely approximates the physical properties of real biological samples, enabling the model to learn the ability to resist matrix interference during the pre-training stage.

[0070] 2. Domain Adaptation: Despite the high fidelity of the synthesized data, the system supports an optional domain consistency calibration step to further eliminate residual distribution differences. In engineering implementation, a direct fine-tuning strategy is preferred, as follows: Freeze the underlying general feature extraction parameters of the feature encoder; use a small number of unlabeled or weakly labeled real experiments to collect mixed spectra as target domain data; update only the high-level parameters of the EUG generator and the prediction head with a small learning rate (e.g., 1e-5).

[0071] This strategy enables a smooth transfer of models from the "synthetic domain" to the "real experimental domain" at low cost without the need to build complex adversarial networks (GANs).

[0072] Supervised training (metric learning): The constructed high-fidelity synthetic mixture spectrum is input into Slot-EUG, which is required to output a certain value under the conditions of matrix interference and nonlinear response. Each component's embedding vector is consistent with the embedding vector of the original pure standard (Canonical Ground Truth). A hard mining mechanism is constructed using Triplet Loss or Circle Loss: it brings together "distorted views of the same compound under different matrix backgrounds" and pushes away "interferences with similar structures but different retention times," thereby forcing the model to learn robust feature representations that are invariant to matrix effects and nonlinear responses.

[0073] In step S160, based on the retrieval embedding vector and the conditional vector, a conditional adaptive retrieval and re-ranking are performed in the mass spectrometry vector library to obtain a ranking result of candidate compounds containing matching evidence, specifically including: Based on the ionization mode and polarity in the condition vector, a corresponding subset is selected from the mass spectrometry vector library. Within the subset, when the precursor ion mass-to-charge ratio or data-independent acquisition isolation window information is available in the condition vector, this information is used as the center to filter within a preset mass tolerance range, constrain the search space, and perform an approximate nearest neighbor search to obtain an initial candidate set.

[0074] Based on the availability of each metadata component in the condition vector, the overall ranking score of the initial candidate set is dynamically calculated. The overall ranking score is a weighted combination of vector similarity and one or more metadata conformity evidences, including retention time bias and collision energy matching degree. The candidate compound ranking result is an ordered list, where each candidate entry contains at least a compound identifier, an overall ranking score, and key evidence items in its composition.

[0075] For example, such as Figure 7 As shown, in an embodiment that uses a data-independent acquisition mode to obtain runtime input, the following specific scenario illustrates the entire process from retrieval to report generation: Conditional adaptive retrieval and sorting: Based on the conditional index, the spectral conditional vector indicates ESI+, the precursor m / z is 301.035, and the retention time (RT) is 10.5 min.

[0076] First-level filtering: Based on the ionization method of the condition vector, only the sub-database is searched in the vector database, eliminating half of the irrelevant data.

[0077] The second constraint is to retrieve only entries in the sub-database whose predecessor m / z is within a certain tolerance range (e.g., within 301.035±0.005).

[0078] Third-level recall: Within this range, the HNSW algorithm is used for Approximate Nearest Neighbor (ANN) search (i.e., Figure 2 (ANN search) yielded the top 100 candidates.

[0079] Fourth-level reordering: Calculate the deviation ΔRT between the theoretical RT and the measured value at 10.5 min for each candidate, and calculate the final score with reference to the energy matching of the CE. The calculation method is as follows: .

[0080] in, This represents the overall score. , Indicates weight, Represents vector similarity, The weighting function represents the bias; if the RT condition is missing, then β = 0.

[0081] Based on the above method, even if the vectors of isomers have extremely high similarity, the one with smaller RT deviation will be placed in the first position. If the user does not provide RT, β will automatically be reduced to zero, degenerating into a pure vector sort.

[0082] In step S170, generating an analysis report based on the structured evidence chain includes: serializing the structured evidence chain into a machine-readable text format, injecting it as a context constraint into a large language model, and driving the large language model to generate a structured analysis report containing the confidence level of the identification conclusion, candidate difference analysis, and inference of the lysis mechanism based on the context constraint.

[0083] Before generating the analytical report, this method also includes a structured chain of evidence and isotope consistency verification process. The following key indicators are automatically extracted to construct a JSON-formatted evidence set: Vector similarity: deep semantic matching score; Key fragment matching list: specific m / z matching points; Isotope consistency: The system calculates the theoretical isotope distribution based on candidate chemical formulas (e.g., M+1 abundance should be 1.1% × C atoms) and compares it with the measured M+1 peak intensity. If the deviation is too large (e.g., the measured value is much higher than the theoretical value), it is marked as "potential co-elution" or "elemental composition mismatch" as strong evidence to exclude false positives.

[0084] For example, the process of generating the parsing report described above includes: Multi-source evidence aggregation: The system automatically extracts multi-dimensional evidence from the retrieval and re-ranking process to construct a structured evidence set, mainly including: Deep semantic evidence comes from the embedding vector similarity scores of the encoder. For example, the cosine similarity score between the Rank1 candidate (quercetin) and the query spectrogram's embedding vector is 0.945 (this data is only an example to illustrate the method and does not represent any real meaning, the same below). The similarity score of the Rank2 candidate (isorhamnetin) is 0.892.

[0085] Qualitative constraint evidence includes precursor ion mass deviation (unit: ppm) and DIA isolation window hit status. For example, the precursor ion mass deviation of Rank 1 is 1.2 ppm and that of Rank 2 is 1.5 ppm, both within the instrument tolerance range, and both hit the preset 25 Da DIA isolation window.

[0086] Quantitative physical evidence includes retention time (RT) deviations and collision energy (CE) matching. For example, the measured retention time (RT) of Rank 1 deviates from the reference value in the standard library by 0.15 min. The RT deviation of Rank 2 is 1.80 min. Furthermore, both are confirmed to have been acquired at a collision energy (CE) of 35 eV, meeting the matching criteria.

[0087] Fine-grained spectral matching evidence includes library explanatory annotations aligned with hit evidence units (EUs) and spectral matching evidence: EU_01 aligned library annotations include the diagnostic ion m / z 151.003 (substructure / functional group hint: flavonoid skeleton-related fragmentation feature) and a feature neutral loss hint (example); EU_02 aligned library annotations include isotope peak cluster pattern consistency hints (example). The list of key fragment ion m / z matches and the Pearson correlation coefficient between measured and theoretical isotope distributions are also included. For example, Rank 1 matches the feature fragments m / z 301.035 and 151.003. Rank 2 is missing the key fragment m / z 151.003. In isotope consistency verification, the Pearson correlation coefficient between the isotope abundance distribution of Rank 1 and the theoretical value is 0.98, significantly better than Rank 2's 0.85.

[0088] Context building and prompting engineering: The structured evidence set described above is serialized into a machine-readable format such as JSON or Markdown, serving as an immutable "Fact Context," also known as the contextual constraints mentioned earlier. This contextual context is then injected into the input prompt of the Large Language Model (LLM). The prompt contains strict instructions such as "Generate a report based solely on the provided factual context; fabricated data is prohibited," requiring the model to generate answers based only on the provided factual context.

[0089] like Figure 8 As shown, the large language model performs reasoning based on factual context, generating a parsing report with the following logical structure: Identification Conclusion: Based on evidence including vector similarity and RT bias, a "high / medium / low" confidence rating is output. Difference Analysis: By comparing the top two candidates, specific evidence of their distinguishing characteristics in key fragment matching or RT consistency is identified. Mechanistic Explanation: Based on the list of matched fragment ions, possible fragmentation pathways of the compound are inferred and described.

[0090] The following is an example of a parsing report containing all the items: (1) Identification conclusion: Best match result: Quercetin. Confidence rating: High.

[0091] Based on comprehensive analysis, the candidate exhibits excellent performance in two key dimensions: deep semantic similarity (cross-EU aggregation score of 0.945, with EU_01 / EU_02 contributing 0.62 / 0.38 respectively) and physical retention time (deviation of 0.15 min), and shows a high degree of isotopic pattern agreement (correlation coefficient of 0.98). Furthermore, the EU_01-aligned spectral library annotation suggests the presence of a diagnostic ion at m / z 151.003, providing support for flavonoid skeleton-related fragmentation characteristics.

[0092] (2) Candidate difference analysis (Rank1 vs Rank2): Although the Rank2 candidate (Isorhamnetin) performed reasonably well in terms of parent ion mass deviation (1.5 ppm), it had a significant disadvantage in key physical properties: Retention time (RT) evidence: Quercetin had an RT deviation of only 0.15 min, while Isorhamnetin had a deviation as high as 1.80 min, indicating that the latter's chromatographic behavior did not match the measured signal.

[0093] Isotopic evidence: The correlation coefficient of isotopic distribution of quercetin (0.98) is significantly higher than that of isorhamnetin (0.85), indicating that the elemental composition of quercetin is more consistent with the measured data.

[0094] (3) Explanation of the fragmentation mechanism: According to the fragment matching list, the key fragment m / z 151.003 was detected in the measured spectrum. This fragment is a typical reverse Diels-Alder (RDA) fragmentation product of quercetin. The Rank2 candidate lacks this key fragment, resulting in a decrease in its confidence level. In summary, based on the accurate matching of retention times and the completeness of characteristic fragments, quercetin was determined to be the correct result.

[0095] Through the above embodiments, this invention can transform complex multidimensional mass spectrometry parameters into natural language reports that are easy for researchers to read. It not only provides identification conclusions but also offers logical explanations based on physical (RT) and chemical evidence (fragmentation), significantly improving the interpretability and reliability of mass spectrometry analysis results. Those skilled in the art should understand that the compound names, specific values ​​(such as ppm, RT deviation), and JSON field definitions in the above embodiments are merely examples and do not constitute a limitation on the scope of protection of this invention. In practical applications, relevant parameters can be adjusted according to the specific type of mass spectrometer and experimental conditions.

[0096] This application also provides a spectral library matching system based on mass spectrum visualization and self-supervised analysis. The system includes: a data input and preprocessing module, an implicit deconvolution module, a feature encoding module, an intelligent retrieval and sorting module, and a parsing report generation module.

[0097] The data input and preprocessing module is used to acquire multimorphic mass spectrometry data and generate conditional vectors and image-based tensors; the implicit deconvolution module embeds an evidence unit generator to generate evidence units from the image-based tensors; the feature encoding module embeds a deep feature encoder to fuse the evidence units with the conditional vectors and map them into retrieval embedding vectors; the intelligent retrieval and ranking module is used to perform conditional adaptive retrieval and re-ranking based on the retrieval embedding vectors and conditional vectors; and the analysis report generation module is used to construct a structured evidence chain based on the ranking results of the candidate compounds and generate an analysis report based on the structured evidence chain.

[0098] This application provides a method and system for spectral library matching based on mass spectrum visualization and self-supervised analysis. By mapping data from different sources into visualized tensors and encapsulating experimental metadata using conditional vectors, the system can automatically adapt to different data types without requiring process switching or manual classification, thus improving its versatility and ease of use. By introducing an evidence unit generator (EUG) and using synthetic mixed spectral data for supervision, it can identify and separate evidence units representing single components from complex runtime mixed signals in a data-driven manner, reducing reliance on complex manual deconvolution rules and parameter tuning, and improving the ability to identify low-abundance components and overall robustness. By employing a deep feature encoder, it can focus on the effective signal region while maintaining fine resolution when processing mass spectrometry images, improving computational efficiency and resource utilization. By constructing a retrieval embedding vector that integrates conditional vectors and performing hierarchical retrieval and conditional adaptive reordering, it ensures high retrieval accuracy and fault tolerance in various practical scenarios. By automatically constructing a structured evidence chain based on the retrieval results to generate an analytical report, it improves the credibility and acceptability of the analysis results and provides a clear basis for manual review.

[0099] Furthermore, this application enhances the system's robustness and fault tolerance: based on a "use when conditions are available / automatically degrade otherwise" strategy, it ensures that the system can still provide baseline-level identification results even when metadata is missing (e.g., no RT, no precursor), avoiding the error problems caused by missing parameters in traditional software. It also improves the identification capabilities under fine-grained matching and incomplete evidence: by using evidence units as the index granularity to "primalize" the spectrum, the same compound is decomposed into multiple aggregateable evidence unit embedding vectors, enabling the system to achieve robust retrieval and interpretation through cross-evidence unit aggregation even with fragmentation, co-elution interference, or cross-platform offset.

[0100] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0101] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0102] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0103] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0104] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0105] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

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

[0107] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for spectral library matching based on mass spectrum imaging and self-supervised learning, characterized in that, The method for mass spectrum image visualization and self-supervised spectral library matching includes: Acquire multimorphic mass spectrometry data containing spectral-level input and / or runtime-level input, and parse and extract condition vectors based on the multimorphic mass spectrometry data to obtain condition vectors, wherein the condition vectors contain masks representing missing conditions; The multimorphic mass spectrometry data are discretized and intensity normalized to obtain an image tensor; The image tensor is implicitly deconvolved by the evidence unit generator to generate multi-scale evidence units; the multi-scale evidence units include at least component-level evidence units and / or substructure-level evidence units, wherein the component-level evidence units are used to characterize a single potential chemical component, and the substructure-level evidence units are used to characterize diagnostic fragments, isotope peak clusters, feature neutral loss, substructure or functional group-related fragmentation patterns. The evidence unit and the condition vector are fused by a deep feature encoder, and the evidence unit is mapped to a retrieval embedding vector. The evidence unit generator and deep feature encoder are trained using a two-stage strategy: the first stage uses unlabeled data to perform a masked autoencoder task for pre-training; the second stage constructs a synthetic mixed spectrum dataset, using at least one of the following as supervision targets: the pure spectrum corresponding to each component in the synthetic sample, the true value of the component position, the substructure or fragment annotation, the diagnostic ion label, the isotope peak cluster label or the neutral loss label, to jointly optimize the evidence unit generation capability and the representation capability of the deep feature encoder. Based on the retrieval embedding vector and the conditional vector, a conditional adaptive retrieval and reordering are performed in the mass spectrometry vector library to obtain a ranking result of candidate compounds containing matching evidence; A structured chain of evidence is constructed based on the ranking results of the candidate compounds, and an analysis report is generated based on the structured chain of evidence.

2. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 1, characterized in that, The multimorphic mass spectrometry data are discretized and intensity normalized to obtain an image-based tensor, including: The multimorphic mass spectrometry data is mapped to a two-dimensional coordinate system consisting of retention time and mass-to-charge ratio dimensions. The mass-to-charge ratio axis is discretized for resolution, and the original intensity values ​​are dynamically compressed to form a standardized two-dimensional numerical matrix as the image tensor. Specifically, for the spectral level input, dimensional expansion is used to give the spectral level input the same two-dimensional structure as the runtime input, so as to achieve a unified representation of multi-morphological data.

3. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 1, characterized in that, The imaged tensor is implicitly deconvolved using an evidence unit generator to generate multi-scale evidence units, including: identifying and separating local signal regions, soft mask layers, or characteristic representations corresponding to a single potential chemical component from the imaged tensor as component-level evidence units; and / or identifying and separating local signal patterns, local peak cluster patterns, or characteristic representations corresponding to diagnostic fragments, isotope peak clusters, feature neutral loss, substructure or functional group-related fragmentation patterns from the imaged tensor as substructure-level evidence units; wherein the identification and separation process is implemented through at least one of the following methods: Generate bounding boxes of regions of interest with confidence scores on the feature map to locate effective components; The image tensor is decomposed into multiple weighted superimposed component layers through a learnable soft masking mechanism, wherein the soft mask is generated through an iterative attention mechanism. As a cold start or failure safety mechanism, local signals are intercepted according to a preset retention time window and mass-to-charge ratio bandwidth.

4. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 1, characterized in that, The step of fusing the evidence unit and the conditional vector through a deep feature encoder and mapping the evidence unit to a retrieval embedding vector includes: The condition vector is used as modulation information and fused with the evidence unit; The fused features are processed using a neural network with anisotropic receptive field and sparse activation characteristics, and a fixed-dimensional vector is output as the retrieval embedding vector; wherein, the anisotropic receptive field is manifested in the differentiated information aggregation of mass-to-charge ratio dimension and retention time dimension during the encoding process. The method further includes: when constructing the mass spectrometry vector database, pooling and / or attention convergence aggregation of the retrieval embedding vectors of multiple evidence units corresponding to the same database entry to obtain material-level aggregated embeddings, and storing the material-level aggregated embeddings together with the evidence unit-level retrieval embedding vectors for retrieval, reordering and / or result summarization.

5. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 1, characterized in that, The process of training the evidence unit generator and the deep feature encoder includes: Using unlabeled mass spectrometry data, a mask autoencoding and spectrum comparison learning task is performed, wherein the mask autoencoding adopts a non-uniform mask sampling strategy based on signal saliency; the spectrum comparison learning will bring different enhanced views of the same original mass spectrometry data closer together and push the spectra of different compounds within the same batch further apart. Supervised training is performed using a synthetic mixed spectrum dataset, which is generated by superimposing pure spectra and simulating matrix effects and nonlinear responses, so that the output embedding vector has the property of homogeneous aggregation and heterogeneous separation. The second stage also includes semi-supervised domain adaptation.

6. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 1, characterized in that, The spectral-level input includes a one-dimensional mass spectrometry signal that does not include the dimension of continuous retention time evolution, and it includes at least one of the following: a full-scan fingerprint spectrum of gas chromatography-mass spectrometry, a fractional mass spectrometry spectrum, or a single secondary spectrum or a fractional secondary spectrum obtained by liquid chromatography-tandem mass spectrometry. The operational-level input includes a two-dimensional mass spectrometry signal that includes the dimension of retention time evolution, and it includes at least one of the following: a retention time-ion mass-to-charge ratio signal formed by continuous acquisition along the retention time during gas chromatography-mass spectrometry operation, or a retention time-fragment ion mass-to-charge ratio signal formed by continuous acquisition along the retention time or associated tissues during liquid chromatography-tandem mass spectrometry operation. Both the spectral-level input and the operational-level input are associated with available experimental metadata, which includes discrete metadata and / or continuous metadata. When some information in the experimental metadata is missing, it is characterized by a mask in the conditional vector. For liquid chromatography-tandem mass spectrometry data, both data-dependent acquisition modes and data-independent acquisition modes can provide spectral-level input and / or operational-level input, and the acquisition mode does not constitute a limitation on the above-mentioned input organization form.

7. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 6, characterized in that, The conditional vector is obtained by analyzing and extracting the multimorphic mass spectrometry data, including: Extract the discrete metadata and continuous metadata from the experimental metadata; The discrete metadata is encoded into a dense vector, and the continuous metadata is standardized. A conditional random missing information simulation mechanism is introduced to randomly mask part of the metadata information during the encoding process, so as to form the conditional vector with robustness.

8. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 1, characterized in that, Conditional adaptive retrieval and reordering are performed in the mass spectrometry vector library, including: Based on the ionization mode and polarity in the condition vector, a corresponding subset is selected from the mass spectrometry vector library. Within the subset, when the condition vector contains accurate precursor ion mass-to-charge ratio information, candidate entries are filtered according to the accurate precursor ion mass-to-charge ratio and a preset mass tolerance. When the condition vector contains precursor ion isolation range information, candidate entries whose precursor ion mass-to-charge ratio falls within the precursor ion isolation range are retained according to the precursor ion isolation range and a boundary mass tolerance. An approximate nearest neighbor search is performed on the filtered candidate entries to obtain an initial candidate set. Based on the availability of each metadata component in the condition vector, the comprehensive ranking score of the initial candidate set is dynamically calculated. The comprehensive ranking score is a weighted combination of vector similarity and one or more metadata conformity evidences, including retention time deviation and collision energy matching degree. The candidate compound ranking result is an ordered list, wherein each candidate entry contains at least a compound identifier, the overall ranking score, and key evidence items in its composition.

9. The method for spectral library matching based on mass spectrum imaging and self-supervised analysis according to claim 1, characterized in that, The process of generating an analytical report based on a structured chain of evidence includes: serializing the structured chain of evidence into a machine-readable text format, injecting it as a context constraint into a large language model, and driving the large language model to generate a structured analytical report containing the confidence level of the identification conclusion, candidate difference analysis, and inference of the lysis mechanism based on the context constraint.

10. A spectral library matching system based on mass spectrum imaging and self-supervised analysis, characterized in that, The system includes: The data input and preprocessing module is used to acquire multimorphic mass spectrometry data and generate conditional vectors and image-based tensors. An implicit deconvolution module with an embedded evidence unit generator is used to generate multi-scale evidence units from an image tensor; the multi-scale evidence units include at least component-level evidence units and / or substructure-level evidence units, wherein the component-level evidence units are used to characterize a single potential chemical component, and the substructure-level evidence units are used to characterize diagnostic fragments, isotope peak clusters, feature neutral loss, substructure or functional group-related fragmentation patterns; The feature encoding module, which embeds a deep feature encoder, is used to fuse the evidence unit condition vector and map it into a retrieval embedding vector. The phased training module is used to train the evidence unit generator and the deep feature encoder according to a two-stage strategy: the first stage uses unlabeled data to perform a masked autoencoder task for pre-training; the second stage constructs a synthetic mixed spectrum dataset, using at least one of the following as supervision targets: the pure spectrum corresponding to each component in the synthetic sample, the true value of the component position, the substructure or fragment annotation, the diagnostic ion label, the isotope peak cluster label or the neutral loss label, to jointly optimize the evidence unit generation capability and the representation capability of the deep feature encoder. The intelligent retrieval and sorting module is used to perform conditional adaptive retrieval and re-sorting based on the retrieval embedding vector and condition vector. The analysis report generation module is used to construct a structured evidence chain based on the candidate compound ranking results, and generate an analysis report based on the structured evidence chain.