A method and system for predicting metabolite structures based on the BERT Siamese neural network model
By using mass spectrometry data processing based on the BERT twin neural network model, the problem of analyzing high-dimensional sparse metabolomics data has been solved, enabling efficient and accurate identification of metabolite structures and improving the efficiency of drug development.
Patent Information
- Application Number
- CN202510136075.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-07
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2045-02-07
AI Technical Summary
Existing technologies struggle to effectively process high-dimensional and sparse metabolomics data, resulting in poor metabolite structure resolution. Furthermore, existing methods are computationally inefficient on large-scale datasets, making it difficult to meet the need for rapid identification of a large number of unknown metabolite structures.
A BERT-based twin neural network model was adopted. Through preprocessing of mass spectrometry data and structural similarity calculation, a bidirectional sub-network was built and trained. The BERT network was used to extract features of mass spectrometry data and calculate mass spectrometry similarity and structural similarity to achieve efficient identification of metabolite structures.
It improves the accuracy and computational efficiency of metabolite structure prediction, enabling the screening of a large number of compounds in a short time, reducing computational resource consumption, and supporting the rapid progress in fields such as drug development.
Smart Images

Figure CN120015180B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of metabolite detection in metabolomics, specifically involving a method and system for predicting metabolite structure based on the BERT Siamese neural network model, and is a study of a deep learning model for mass spectrometry data processing and detection of metabolites. Background Technology
[0002] Metabolomics aims to systematically analyze metabolites in organisms and explore their roles in physiological, pathological, and environmental changes. With the development of high-throughput technologies such as mass spectrometry (MS) and nuclear magnetic resonance (NMR), the scale of metabolomics data has increased dramatically, exhibiting characteristics of high dimensionality, complexity, and heterogeneity. How to effectively extract valuable information from it has become a research challenge.
[0003] Existing methods for predicting metabolite structures have many limitations. Traditional methods based on statistical analysis and dimensionality reduction techniques (such as principal component analysis and t-SNE) struggle to handle the high-dimensional sparsity of metabolomics data and cannot accurately capture key features, resulting in poor resolution of metabolite structures. For example, when analyzing metabolomics data from complex biological samples, these methods may lose important structural information and fail to accurately distinguish between structurally similar metabolites.
[0004] Machine learning-based methods, such as Support Vector Machines (SVM), Random Forests, and K-Nearest Neighbors (KNN), while improving predictive capabilities to some extent, still have limitations when dealing with noise and nonlinear relationships in metabolomics data. They struggle to fully explore the complex connections between mass spectrometry data and metabolite structures, and their prediction accuracy and stability need improvement. In practical applications, these methods are susceptible to fluctuations in data quality, leading to biased prediction results.
[0005] Furthermore, existing prediction methods are computationally inefficient on large-scale metabolomics datasets, making it difficult to meet the need for rapid identification of numerous unknown metabolite structures. For example, in drug development, rapid screening of a large number of potential active metabolites is required, and the efficiency of existing methods limits the research and development process. Therefore, developing a more efficient and accurate method for predicting metabolite structures is urgently needed.
[0006] This invention proposes a method and system for predicting metabolite structures based on a BERT Siamese neural network model. The aim is to achieve efficient pattern recognition, anomaly detection, and feature extraction by introducing a BERT Siamese neural network model and leveraging the similarity relationships in metabolomics data. This method can help researchers more accurately identify potential patterns in metabolomics data, improve data interpretability and predictive capabilities, and provide more reliable technical support for in-depth analysis and application of metabolomics. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for predicting metabolite structures based on the BERT twin neural network model. It provides an effective solution to the problems of sparse and high-dimensional mass spectrometry data, and has been tested on actual data with good results.
[0008] This invention is achieved as follows: The first objective of this invention is to provide a method for predicting metabolite structures based on a BERT Siamese neural network model, the method comprising:
[0009] Step S1: Obtain the mass spectrometry data and SMILES molecular codes of the compounds; preprocess the mass spectrometry data and convert the SMILES molecular codes into fixed-length molecular fingerprints; simultaneously calculate the structural similarity between molecular fingerprints.
[0010] The preprocessed mass spectrometry data is used as a dataset, with the structural similarity between molecular fingerprints serving as labels.
[0011] Step S2: Build a BERT-based Siamese neural network model and train it using the dataset;
[0012] The BERT-based Siamese neural network model includes two parallel sub-networks;
[0013] The inputs to the two subnetworks are preprocessed mass spectrometry data of different compounds, and the outputs are the first mass spectrometry data information features and the second mass spectrometry data information features, respectively.
[0014] The mass spectrometry similarity is calculated by combining the first and second mass spectrometry data information features output from the two sub-networks.
[0015] Step S3: Use the trained BERT-based twin neural network model to identify the structure of metabolites.
[0016] Preferably, in step S1, all mass spectrometry data are preprocessed and set as one-dimensional array information of the same length, with mass-to-charge ratio as index and intensity information normalized to the range of 0-1.
[0017] Preferably, the structural similarity calculation in step S1 is as follows:
[0018]
[0019] in and , , represent the intensity of the i-th peak in the mass spectra of the two compounds, respectively, where n is the peak number.
[0020] Preferably, in step S2, each sub-network includes multiple network units connected in series, and each network unit includes a BERT network and a feedforward network connected in series.
[0021] Preferably, the mass spectrometry similarity calculation in step S2 is as follows:
[0022]
[0023] in and , , represent the intensity of the i-th peak in the mass spectra of the two compounds, respectively, where n is the peak number.
[0024] Preferably, the loss function of the BERT Siamese neural network model during training in step S2 is as follows:
[0025]
[0026] Loss = mean(L )
[0027] Where Loss represents the mean squared error loss. The average loss between mass spectrometry similarity and structural similarity is represented by this value. , These represent the predicted mass spectrometry similarity and the actual structural similarity, respectively; T represents transpose.
[0028] Continue training the network using the Adam algorithm until the model achieves loss convergence or reaches the maximum number of iterations.
[0029] Preferably, step S3 specifically involves:
[0030] 3-1 After preprocessing, the mass spectrometry data of the unknown metabolites to be identified are used to construct mass spectrometry pairs with the mass spectrometry data of known compounds; the constructed mass spectrometry pairs are then input into two subnetworks of a trained BERT-based Siamese neural network to predict mass spectrometry similarity.
[0031] 3-2 Find analogs from known compounds based on the molecular formula or relative molecular mass of unknown metabolites, and calculate the structural similarity between these analogs and known compounds;
[0032] Based on mass spectrometry similarity and structural similarity, the substance most similar to the unknown metabolite was identified.
[0033] A second objective of this invention is to provide a metabolite structure prediction system, comprising:
[0034] The mass spectrometry similarity calculation module is responsible for constructing mass spectrometry pairs between the preprocessed mass spectrometry data of the unknown metabolites to be identified and the mass spectrometry data of known compounds; the constructed mass spectrometry pairs are then input into two sub-networks of a trained BERT-based Siamese neural network to perform mass spectrometry similarity prediction.
[0035] The structural similarity calculation module is responsible for finding analogs from known compounds based on the molecular formula or relative molecular mass of unknown metabolites, and calculating the structural similarity between these analogs and known compounds.
[0036] The metabolite structure prediction module is responsible for identifying the substance most similar to the unknown metabolite based on mass spectrometry similarity and structural similarity.
[0037] A third object of the present invention is to provide a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computer, the computer performs the method described thereon.
[0038] A fourth object of the present invention is to provide a computing device, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method described herein.
[0039] The present invention has the following beneficial effects:
[0040] 1. Compared with traditional methods for calculating spectral similarity (such as cosine similarity and modified cosine similarity) and traditional machine learning methods (such as SVM, random forest, and KNN), this invention applies a deep learning method that can better extract data features when dealing with large amounts of high-dimensional and sparse data, thereby improving the accuracy of similarity calculation.
[0041] 2. When processing metabolomics data, this invention uses the BERT network to mine the potential semantic information of mass spectrometry data through a bidirectional self-attention mechanism, capture long-distance dependencies, and thus improve the accuracy of mass spectrometry similarity calculation, providing a more reliable basis for subsequent metabolite structure identification.
[0042] 3. The metabolite structure identification model based on BERT Siamese neural network proposed in this invention introduces BERT network to improve the feature extraction capability of the network, better calculate the similarity between mass spectra and reduce the spatiotemporal complexity.
[0043] 4. The BERT Siamese neural network model of this invention incorporates the BERT network, significantly enhancing the network's feature extraction capabilities. The BERT network can efficiently encode mass spectrometry data, extract key peak information, and reduce unnecessary computational steps. Compared with other complex models, this model effectively reduces temporal and spatial complexity while maintaining prediction accuracy. In drug development, when screening a large number of compounds, it can complete metabolite structure analysis in a shorter time, saving computational resources and accelerating the development process. Attached Figure Description
[0044] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is the BERT network model structure provided in the embodiments of the present invention.
[0046] Figure 2 This is the main structure of the BERT-based Siamese neural network model provided in the embodiments of the present invention.
[0047] Figure 3 This is an application process for metabolite structure identification based on the BERT Siamese neural network model provided in this embodiment of the invention. Detailed Implementation
[0048] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0049] like Figure 1 As shown in the figure, an embodiment of the present invention provides a method for predicting metabolite structures based on a BERT Siamese neural network model, comprising:
[0050] Step S1: Obtain the mass spectrometry data and molecular identifier SMILES molecular code of the compound;
[0051] The dataset used in this invention is a mass spectrometry dataset of metabolite reactant and product pairs from the KEGG molecular database.
[0052] All mass spectrometry data were preprocessed and formatted as one-dimensional arrays of equal length, with mass-to-charge ratio (m / z) as the index, and intensity information normalized to the range of 0-1; details are as follows:
[0053] Mass spectrometry data are typically represented as The mass-to-charge ratio in the mass spectrometry data The relative intensity of the peak .
[0054] All mass spectrometry data Convert to standard format ,
[0055] The mass-to-charge ratio is defined as follows:
[0056]
[0057] Set the mass-to-charge ratio step size to 1, and the relative peak intensity corresponding to each mass-to-charge ratio is:
[0058]
[0059] Normalize the relative peak intensity:
[0060]
[0061] The SMILES molecular code is converted into a fixed-length molecular fingerprint. SMILES is a chemical identifier for a chemical substance molecule. Using the Rdkit library in Python, SMILES is converted into a molecular fingerprint, which is a fixed-length binary code representing the molecular structure information of the chemical substance.
[0062] Simultaneously calculate the structural similarity between molecular fingerprints;
[0063] The preprocessed mass spectrometry data was used as the dataset, with the structural similarity between molecular fingerprints serving as labels; the structural similarity was calculated as follows:
[0064]
[0065] and These are the intensities at the i-th peak in the two mass spectra, respectively.
[0066] n is the number of peaks involved in the calculation (usually peak pairs with the same mass-to-charge ratio).
[0067] Step S2: Build a BERT-based Siamese neural network model and train it using the dataset;
[0068] The BERT-based Siamese neural network model has two input ports and one output port. Each input is mass spectrometry data, and the output is the mass spectrometry similarity between the two input mass spectrometry data, i.e., the cosine similarity between the data.
[0069] See appendix Figure 2 The BERT-based Siamese neural network model includes two parallel sub-networks;
[0070] Each sub-network consists of multiple cascaded network units, and each network unit consists of a cascaded BERT network and a feedforward network.
[0071] The inputs to the two sub-networks are preprocessed mass spectrometry data of different compounds. The original mass spectrometry data is encoded by the BERT network to extract key peak information from the mass spectrometry data. Then, the data is decoded by the feedforward network. Finally, both sub-networks obtain a one-dimensional vector containing mass spectrometry information features, which are the first mass spectrometry data information features and the second mass spectrometry data information features, respectively.
[0072] See appendix Figure 1The BERT network includes an input embedding layer, six unit structures, each of which includes a multi-head attention mechanism, a first Add & Norm layer, a Feed Forward layer, a second Add & Norm layer, and introduces residual connections.
[0073] The mass spectrometry similarity is calculated by combining the first and second mass spectrometry data information features output from the two sub-networks.
[0074] The mass spectrometry similarity is calculated as follows:
[0075]
[0076] and These are the intensities at the i-th peak in the two mass spectra, respectively.
[0077] n is the number of peaks involved in the calculation (usually peak pairs with the same mass-to-charge ratio).
[0078] The similarity of mass spectrometry data output by the network is compared with the structural similarity between molecules represented by the input data. This comparison is used for model training and optimization, enabling the model to learn the correlation between mass spectrometry similarity and molecular structural similarity, and ultimately for the identification of metabolite structures.
[0079] The loss function for the BERT Siamese neural network model during training is as follows:
[0080]
[0081] Loss = mean(L )
[0082] Where Loss represents the mean squared error loss. The average loss between mass spectrometry similarity and structural similarity is represented by this value. , These represent the predicted mass spectrometry similarity and the actual structural similarity, respectively; T represents transpose.
[0083] Continue training the network using the Adam algorithm until the model reaches loss convergence or reaches the maximum number of iterations.
[0084] Step (3), see appendix Figure 3 Metabolite structures were identified using a trained BERT-based Siamese neural network model; specifically:
[0085] 3-1 After preprocessing, the mass spectrometry data of the unknown metabolites to be identified are used to construct mass spectrometry pairs with the mass spectrometry data of known compounds. The constructed mass spectrometry pairs are then input into two subnetworks of a pre-trained BERT-based Siamese neural network to predict mass spectrometry similarity.
[0086] 3-2 Find analogs from known compounds based on the molecular formula or relative molecular mass of unknown metabolites, and calculate the structural similarity between these analogs and known compounds;
[0087] Based on mass spectrometry similarity and structural similarity, the substance most similar to the unknown metabolite was identified.
[0088] The higher the similarity between mass spectrometry and structural similarity, the better.
[0089] The following is an explanation of the effectiveness of this invention:
[0090] 1. Selection of dataset
[0091] The metabolite structure identification model based on BERT Siamese neural network proposed in this invention was evaluated on a test dataset to verify the model's identification accuracy.
[0092] The evaluation and validation metric used in this invention is the Top-K validation metric:
[0093]
[0094] Top-K accuracy is a common evaluation metric that indicates whether the model includes the true label in the top K predicted items.
[0095] 2. Model Validation Results
[0096] The test dataset contains 747 metabolite molecules. The validation was performed on this dataset, and the experimental results are as follows.
[0097] Table 1. Prediction results of the model of this invention on real datasets.
[0098] Top1 Top 3 Top 5 Top 10 This invention model 52.95% 73.91% 83.07% 90.68%
[0099] The table above verifies that the proposed metabolite structure identification model achieves a high identification accuracy on real datasets. Therefore, this model further proves that the metabolite structure identification model based on BERT Siamese neural network is reliable for the task of identifying the molecular structure of metabolites.
[0100] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for predicting metabolite structures based on a BERT Siamese neural network model, characterized in that, The method includes: Step S1: Obtain the mass spectrometry data and SMILES molecular codes of the compounds; preprocess the mass spectrometry data and convert the SMILES molecular codes into fixed-length molecular fingerprints; simultaneously calculate the structural similarity between molecular fingerprints. The preprocessed mass spectrometry data is used as a dataset, with the structural similarity between molecular fingerprints serving as labels. Step S2: Build a BERT-based Siamese neural network model and train it using the dataset; The BERT-based Siamese neural network model includes two parallel sub-networks; The inputs to the two subnetworks are preprocessed mass spectrometry data of different compounds, and the outputs are the first mass spectrometry data information features and the second mass spectrometry data information features, respectively. The mass spectrometry similarity is calculated by combining the first and second mass spectrometry data information features output from the two sub-networks. Step S3: Identify metabolite structures using the trained BERT-based twin neural network model; The loss function for the BERT Siamese neural network model during training in step S2 is as follows: ; ; Where Loss represents the mean squared error loss. The average loss between mass spectrometry similarity and structural similarity is represented by this value. These represent the predicted mass spectrometry similarity and the actual structural similarity, respectively; T represents transpose. Continue training the network using the Adam algorithm until the model reaches loss convergence or reaches the maximum number of iterations. Step S3 is as follows: 3-1 After preprocessing, the mass spectrometry data of the unknown metabolites to be identified are used to construct mass spectrometry pairs with the mass spectrometry data of known compounds; the constructed mass spectrometry pairs are then input into two subnetworks of a trained BERT-based Siamese neural network to predict mass spectrometry similarity. 3-2 Find analogs from known compounds based on the molecular formula or relative molecular mass of unknown metabolites, and calculate the structural similarity between these analogs and the known compounds; Based on mass spectrometry similarity and structural similarity, the substance most similar to the unknown metabolite was identified.
2. The method according to claim 1, characterized in that, In step S1, all mass spectrometry data are preprocessed and set as one-dimensional arrays of the same length, with the mass-to-charge ratio as the index and the intensity information normalized to the range of 0-1.
3. The method according to claim 1, characterized in that, In step S2, each sub-network includes multiple network units connected in series, and each network unit includes a BERT network and a feedforward network connected in series.
4. The method according to claim 1, characterized in that, The mass spectrometry similarity calculation in step S2 is as follows: ; and , , represent the intensity of the i-th peak in the mass spectra of the two compounds, respectively, where n is the peak number.
5. A metabolite structure prediction system based on the method of any one of claims 1-4, characterized in that... include: The mass spectrometry similarity calculation module is responsible for constructing mass spectrometry pairs between the preprocessed mass spectrometry data of the unknown metabolites to be identified and the mass spectrometry data of known compounds. The constructed mass spectrometry pairs are input into two subnetworks of a pre-trained BERT-based Siamese neural network to predict mass spectrometry similarity. The structural similarity calculation module is responsible for finding analogs from known compounds based on the molecular formula or relative molecular mass of unknown metabolites, and calculating the structural similarity between these analogs and known compounds. The metabolite structure prediction module is responsible for identifying the substance most similar to the unknown metabolite based on mass spectrometry similarity and structural similarity.
6. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computer, the computer performs the method according to any one of claims 1-4.
7. A computing device, comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-4.
Citation Information
Patent Citations
Metabolite recognition system based on molecular fingerprint prediction and application method thereof
CN112735532A
Drug small molecule property prediction method, device and equipment based on self-supervised learning
CN113707235A