Mass spectrum dimensionality reduction method for large mass spectrum library and application of mass spectrum dimensionality reduction method
By obtaining the precursor, ion peak and hash features on the mass spectrum, and dimensionality reduction processing is performed using the fully connected network, convolutional layer, maximum pooling layer and Transformer layer, the problem of insufficient similarity search efficiency and accuracy of mass spectrum in the prior art is solved, and fast and highly accurate mass spectrum retrieval is achieved.
Patent Information
- Application Number
- CN202411674056.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-21
AI Technical Summary
The prior art requires a large amount of computing resources when searching for mass spectra similarity, and searches based on the normalized dot product of the reference spectrum as a feature, making it difficult to improve the accuracy during search.
A mass spectrometer dimensionality reduction method for large mass spectrometer libraries is proposed. By obtaining precursor features, ion peak features and hash features, and using a fully connected network, convolutional layer, maximum pooling layer and Transformer layer for dimensionality reduction, the feature vector is finally reduced to 32 dimensions.
It realizes rapid similar spectrum retrieval in a large mass spectrum archive, improves the calculation speed of PTM/SAAV related knowledge discovery and the accuracy of spectrum search, and significantly shortens the spectrum search time.
Smart Images

Figure CN119622322A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence and proteomics, and specifically relates to a mass spectrum dimensionality reduction method for a large mass spectrum library and an application thereof. Background Art
[0002] In 2018, the ANN-SoLo tool was launched. ANN-SoLo uses an approximate nearest neighbor indexing ANN to select only a limited number of the most relevant in-library mass spectra for comparison with unknown query spectra, thereby speeding up the search for open modifications. At the same time, a feature hashing scheme for converting high-resolution mass spectra into low-dimensional vectors was proposed. The basic idea of this feature hashing scheme is to use a hash function to map fragment ion bins to a limited number of hash bins, thereby hashing sparse high-dimensional vectors into low-dimensional vectors, and the similarity between hash vectors can be used to approximate the similarity between the original high-dimensional vectors. An important consideration in choosing a hash function is that it must be unbiased in order to minimize the number of hash collisions, so they chose the MurmurHash3 algorithm, a popular non-cryptographic hash function that is essentially the same as a true random hash algorithm.
[0003] In 2022, Bittremieux et al. trained a deep neural network in a supervised manner to reduce the dimensionality of the spectra based on previous peptide-spectrum matching results. The network is called GLEAMS, and it embeds mass spectra into a low-dimensional space through supervised learning, in which mass spectra generated by the same peptide are close to each other. They also applied GLEAMS for large-scale mass spectra clustering to identify unidentified adjacent mass spectra from the same peptide, as well as to explore the "dark" proteome of mass spectra that have been repeatedly observed but never identified. GLEAMS uses convolutional neural networks to extract features, twin networks for model training, and Euclidean distance to calculate the cross-entropy loss function. This method effectively extracts features and embeds nearly 5,000-dimensional features into a 32-dimensional feature space. With the support of the FAISS storage index system, the embedded mapping of spectra is realized, which can quickly find similar spectra.
[0004] However, when searching for similar mass spectra in the prior art, for example, using the existing Gleams model and the Dleams model after optimizing the data, a large amount of computing resources is required. In addition, the prior art basically searches based on the normalized dot product of the reference spectrum as a feature, and the features are relatively simple when calculating the similarity, making it difficult to improve the accuracy of the search. Summary of the invention
[0005] In view of the problems existing in the prior art, in order to improve the efficiency and accuracy of mass spectra retrieval, the present invention proposes a mass spectra dimensionality reduction method for a large mass spectra library, which obtains precursor features, ion peak features and hash features from the mass spectra, and inputs the acquired features into the constructed embedder for dimensionality reduction processing. The dimensionality reduction processing includes the following steps:
[0006] The precursor features are processed using a fully connected network, and the ion peak features and hash features are processed using cascaded convolutional layers and maximum pooling layers respectively;
[0007] The processed features are concatenated and input into a fully connected layer;
[0008] The output features of the fully connected layer, the precursor features, the ion peak features, and the hash features are used as the input of the Transformer layer, and the Transformer layer processes them to obtain the initial feature vector;
[0009] The initial feature vector is concatenated with the mass-to-charge ratio feature of the mass spectrum to obtain the final feature vector after dimensionality reduction.
[0010] Furthermore, the acquisition of the precursor characteristics includes: Gray encoding the parent ion mass and mass-to-charge ratio of the mass spectrum, using one-hot encoding for the charge of the mass spectrum, and splicing the data obtained by Gray encoding and the data obtained by one-hot encoding together as the precursor characteristics.
[0011] Furthermore, the acquisition of the ion peak characteristics includes: normalizing and binning the ion peaks of the mass spectrum to obtain the ion peak characteristics.
[0012] Furthermore, the mass-to-charge ratio of the mass spectrum is mapped to a hash feature using the Murmurhash3 algorithm.
[0013] Furthermore, the Transformer layer processes features as follows:
[0014] After processing the output features of the fully connected layer through the linear layer, they are processed in turn using the multi-head attention mechanism, residual connection layer, and normalization layer;
[0015] After the processed features are concatenated with the precursor features, ion peak features, and hash features, they are mapped through a linear layer to obtain the features output by the Transformer layer.
[0016] Furthermore, the initial feature vector output by the Transformer layer is mapped into a 32-dimensional vector, and the mass-to-charge ratio feature of the one-dimensional mass spectrum is weighted with a weight of 0.125 and concatenated with the 32-dimensional vector to obtain a 33-dimensional vector.
[0017] Furthermore, the loss function used by the embedder during training is expressed as:
[0018]
[0019] Among them, L(W,label,E a ,E b ) represents the loss function of the embedder, W represents the weight vector in the embedder, and label represents the mass spectrum pair (E a ,E b ) label, when the mass spectrum is (E a ,E b ) is a similar mass spectrum, label = 1, when the mass spectrum is (E a ,E b ) is a dissimilar mass spectrum, label = 0; E a 、E b represent two mass spectra respectively; ||·||2 means finding the F2 norm.
[0020] The present invention also proposes an application of a mass spectrum dimensionality reduction method for a large mass spectrum library, wherein the embedder described in the method of the present invention is used to perform dimensionality reduction processing on the mass spectra in the database. When a user inputs a mass spectrum to be retrieved, the embedder is used to perform dimensionality reduction processing on the mass spectrum to be retrieved, and the top N mass spectra in the database with the smallest Euclidean distance to the mass spectrum to be retrieved after dimensionality reduction are pushed to the user.
[0021] The present invention uses a method of embedding spectrum data into low-dimensional space to realize rapid similar spectrum retrieval in a large mass spectrum archive, thereby improving the calculation speed of PTM / SAAV related knowledge discovery, increasing the speed of spectrum search, and greatly shortening the spectrum search time; in addition, the present invention uses the Transformer layer for feature fusion, which enhances the feature effect and improves the accuracy of the original model. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a flow chart of a mass spectrum dimensionality reduction method for a large mass spectrum library of the present invention;
[0023] Figure 2 It is a model structure diagram of a mass spectrum dimensionality reduction method for a large mass spectrum library of the present invention;
[0024] Figure 3 is a flow chart of the algorithm of Murmurhash3 according to an embodiment of the present invention;
[0025] Figure 4 is a design diagram of the Transformer layer of an embodiment of the present invention;
[0026] Figure 5It is a flow chart of the spectrum library retrieval method based on FAISS in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] The present invention proposes a mass spectrum dimensionality reduction method for a large mass spectrum library, which obtains precursor features, ion peak features and hash features from the mass spectrum, and inputs the obtained features into a constructed embedder for dimensionality reduction processing. The dimensionality reduction processing includes the following steps:
[0029] The precursor features are processed using a fully connected network, and the ion peak features and hash features are processed using cascaded convolutional layers and maximum pooling layers respectively;
[0030] The processed features are concatenated and input into a fully connected layer;
[0031] The output features of the fully connected layer, the precursor features, the ion peak features, and the hash features are used as the input of the Transformer layer, and the Transformer layer processes them to obtain the initial feature vector;
[0032] The initial feature vector is concatenated with the mass-to-charge ratio feature of the mass spectrum to obtain the final feature vector after dimensionality reduction.
[0033] Based on the DLEAMSE deep embedding model, the present invention uses the FAISS library efficient similarity search and clustering framework to improve the feature extraction method of the reference spectrum, and provides a mass spectrum dimensionality reduction model for large mass spectrum libraries, which effectively improves the timeliness of the algorithm and shortens the time for database clustering insertion.
[0034] like Figure 1 As shown in the figure, the DLEAMSE deep embedding model training structure is built based on the twin network. The twin network connects two identical models by sharing weights. The present invention applies the "twin" training structure to train the "spectral feature extraction model" (also called "spectral embedding model", Embedder). The construction idea of the training structure is as follows:
[0035] S1. Use the twin network to connect two identical embedders that share weights. Before using the embedder, the input spectrogram data is encoded into a long vector by the same encoder. The long vector is used as the direct input of the embedder. Subsequently, the long vector undergoes a series of convolution and pooling operations inside the embedder and then passes through the Transformer layer to be embedded into the new n-dimensional space. The real spectrogram is represented by an n-dimensional feature vector.
[0036] S2. The Euclidean distance between the spectrogram vectors obtained by Embedder is used to calculate the value of the contrast loss function. The contrast loss function achieves the goal of shortening the distance between the embedding points of similar spectrogram pairs by penalizing the "model weights that embed similar spectrogram pairs into distant points"; at the same time, it achieves the goal of pushing the distance between the embedding points of dissimilar spectrogram pairs farther by penalizing the "model weights that embed dissimilar spectrogram pairs into close points".
[0037] Specifically, the Embedder architecture diagram is as follows: Figure 1 As shown, the embedder includes two identical deep learning-based spectral embedding models that share weights, and the two spectral embedding models are connected using a twin neural network. The internal structure of the spectral embedding model includes a convolution layer and a maximum pooling layer. For precursor feature data with fewer eigenvalues, a simple fully connected network is used for feature extraction. For fragment ion data with more eigenvalues, hash features and feature strengths are used to extract features using operations such as convolution pooling. The three features of the above precursor features, hash features, and feature strengths are integrated and connected, processed as inputs to the fully connected layer network, and 32-dimensional spectral data is output. Finally, it is processed and transformed by the Embedder model and mapped to a new low-dimensional space to form a feature vector of incremental data after dimensionality reduction.
[0038] The Embedder embedder execution process is as follows:
[0039] 101. The precursor features, feature intensity and hash features in the spectrum data are input into two spectrum embedding models respectively, and a series of convolution and pooling operations are performed in the spectrum embedding model to obtain three new feature vectors.
[0040] 102. The three features are linearly connected and input into the Transformer layer. They are sequentially passed through the multi-head attention mechanism layer, the residual connection layer, and the normalization layer to obtain the fused extracted feature vector, which is then linearly connected with the original three features as the output.
[0041] 103. Embed the output feature vector into a new n-dimensional space (n is preferably 32 dimensions), and add a new one-dimensional mass-to-charge ratio data feature to obtain an embedded spectrum pair in which two spectrum embedding models are respectively embedded in the n-dimensional space.
[0042] 104. Calculate the Euclidean distance between the embedded spectrogram pairs, and calculate the loss function L according to the Euclidean distance and the label value. The calculation formula of the loss function L is as follows:
[0043]
[0044] Among them, L(W,label,E a ,E b ) represents the loss function of the embedder, W represents the weight vector in the embedder, and label represents the mass spectrum pair (E a ,E b ) label, when the mass spectrum is (E a ,E b ) is a similar mass spectrum, label = 1, when the mass spectrum is (E a ,E b ) is a dissimilar mass spectrum, label = 0; E a 、E b represent two mass spectra respectively; ||·||2 means finding the F2 norm.
[0045] Then, the write index method of faiss index is called to write the index to the 32-dimensional feature vector library of the spectral library, and the spectral library index file (.index) is constructed. Using the index search interface of faiss, the spectral feature vector to be searched and identified is searched for the spectral library index file. The search strategy is based on the k-nearest neighbor algorithm, that is, for each "queryspectral vector", the library spectral vector with the smallest Euclidean distance to the "queryspectral vector" is searched and used as the search and identification result. Finally, the original search and identification results are filtered and FDR (False Discovery Rate) quality control is performed. The original search and identification results are filtered through charge, parent ion mass and FDR quality control of the bait library strategy, as well as contaminant screening, to obtain the final peptide identification results.
[0046] In one embodiment, before the spectrum is input into the embedding model, the specific encoding method of the spectrum data is as follows. The three types of features of the spectrum data, namely, the parent ion feature, the ion peak binning feature and the hash feature of the mass-to-charge ratio data, are encoded, and the specific encoding scheme is designed as follows:
[0047] 201. Encode part or all of the mass, mass-to-charge ratio and charge information of the parent ion; use 27-bit Gray encoding for the mass and mass-to-charge ratio of the parent ion, and use a "one-hot" encoding with a length of 7 (representing charges 1+ to 7+, respectively) for the charge.
[0048] 202. Ion peaks are binned according to 0.02Th / bin or 1Th / bin. For ion peak features, the ion peak intensity is firstly square-root transformed and normalized, and then the ion peaks in the range of 50.5Th to 2500Th are binned, and the peak intensity of each bin is the sum of all the peak intensities in the bin.
[0049] 203. The mass-to-charge ratio data is mapped into a hash vector by using the Murmurhash3 algorithm, and then normalized, and the normalized denominator is the sum of all mass-to-charge ratio data.
[0050] On the one hand, mass-to-charge ratio data is the most important feature of mass spectrometry, because the core goal of mass analysis is to identify and analyze molecules by measuring the mass-to-charge ratio of substances. The mass-to-charge ratio can be used to identify molecules in the sample, especially peptides, proteins or other components. After the mass spectrometer electrically separates the molecules identified in the sample, it separates and detects them according to their mass-to-charge ratio. The accurate determination of the mass-to-charge ratio is the basis for identifying substances. The mass-to-charge ratio directly reflects the ratio of the mass to the charge of the ion. In most chromatographic experiments, sample molecules usually carry one or more charges (usually positive charges). The mass of the ion can be inferred from the mass-to-charge ratio data. This is critical for determining the molecules of the molecule, analyzing its structure, and performing compound characterization. On the other hand, the mass spectrum is usually composed of hundreds or even hundreds of mass-to-charge ratio-intensity pairs, and each mass spectrum can be regarded as a high-dimensional process. When calculating NDP, each mass spectrum needs to be compared and multiplied point by point with 500 reference spectra, and the amount of data processed is very large. This large-scale high-dimensional matrix multiplication will generate a lot of time. In order to improve the calculation efficiency of the model and save calculation time, this embodiment designs a new hash feature extraction method to replace the NDP feature of the reference spectrum in the original model, and adds a new one-dimensional mass-to-charge ratio data feature as the 33rd dimensional feature vector for rough division of positive and negative spectra.
[0051] The present invention maps the mass-to-charge ratio data of the mass spectrum into a 200-dimensional vector through the Murmurhash3 algorithm as a feature of the NDP that replaces the reference spectrum. MurmurHash3 is a non-encrypted hash function, originally proposed by Austin Appleby in 2008. It is often used to efficiently generate hash values, especially in scenarios where fast hashing is required and security requirements are not high. MurmurHash3 is the third version in the MurmurHash series and is also the most popular and commonly used one in the series. The advantages of MurmurHash3 are as follows:
[0052] 1. Suitable for scenarios that require high performance. Its implementation usually uses effective bit operations and numerical operations to ensure high efficiency when processing large amounts of data. This makes MurmurHash3 an ideal choice for processing large amounts of data, and can significantly improve the system's response speed and throughput;
[0053] 2. It provides a low collision rate, especially when the amount of data is only in the tens of millions, there is basically no need to worry about collisions. This is crucial for application scenarios that need to ensure data uniqueness or reduce hash conflicts. A low collision rate helps maintain the balance of the hash table, improve retrieval efficiency, and reduce performance degradation caused by collisions;
[0054] 3. Provides good randomness and distribution characteristics. After hashing, the hash values of different input data can be evenly distributed, reducing the possibility of hash conflicts. This is crucial for applications that require fast mapping of mass-to-charge ratio data. Good distribution helps ensure uniformity of data during storage and retrieval, improving the overall performance of the system.
[0055] Specifically, the calculation process of Murmurhash3 is:
[0056] 1. Define constants c1 and c2 for mixing and multiplication. r1 and r2 for the displacement of left shift operation. m and n are constants for mixing operation. Set the initial seed value to initialize the state of hash calculation. Different seed values will produce different hash results.
[0057] 2. Process the input mass-to-charge ratio data in groups of 4 bytes. If the last block is less than 4 bytes, a special processing method is used. Mix each 4-byte block to ensure that the high and low bits of the input data are evenly distributed to the output hash value. Usually involves bit operations, multiplication, XOR and other operations;
[0058] 3. For each 4-byte block, calculate its hash key k. The specific steps are as follows:
[0059] K=K*c1: multiply the current block by the constant c1.
[0060] K=K rot by r1: shift the result left by r1 bits (circular left shift).
[0061] K=K*c2:Multiply by the constant c2 again
[0062] Mix and rotate the calculated hash key k with the intermediate value h. The specific steps are as follows:
[0063] h=h^K: perform an XOR operation on the intermediate value h and the hash key K of the current block.
[0064] h=h rot by r2: shift the result left by r2 bits (circular left shift).
[0065] h=h*m+n: multiply by the constant m and add the constant n.
[0066] 4. If the length of the input byte array is not an integer multiple of 4, process the remaining part through a series of shift, multiplication and XOR operations to process the remaining bytes to ensure that the entire byte array is taken into account.
[0067] 5. XOR the intermediate value h with the length of the input data to increase the sensitivity of the hash value to the input length. A series of XOR, multiplication and shift operations are applied to perform the final mixing and compression of the hash value. These operations are designed to ensure that the output hash value is evenly distributed and has good properties.
[0068] 6. The final hash value is a 32-bit integer that can be used as a unique identifier or index value for the input data.
[0069] 7. The design of the two-level features is: take the mass-to-charge ratio data of each spectrum as the new first-level feature. After experimental testing, use a weight of 0.125 to add it to the 32-dimensional vector after dimensionality reduction, so that the original vector becomes a new 33-dimensional feature vector for rough division, which can ensure that dissimilar spectra are strictly distinguished. The mass-to-charge ratio data and the corresponding intensity are converted into hash vectors through the Murmurhash3 algorithm as new second-level features. The new feature vector is used to replace the normalized distance feature with 500 reference spectra in the Dleamse model for fine division, and measures the dot product distance between the new vectors generated after these feature values are embedded.
[0070] 8. In addition, the present invention provides a new feature fusion layer Transformer, which includes a multi-head attention mechanism layer, a residual connection layer, and a normalization layer. The multi-head attention mechanism accepts a feature vector concatenated from three feature vectors and extracts information from different angles. It is achieved by decomposing the input sequence into multiple subspaces and applying different attention mechanisms to each subspace. It captures information at different levels in the input sequence and enhances the model's ability to model long-distance dependencies. The residual layer enhances the stability of the model. It helps information flow directly to subsequent layers by adding a shortcut from input to output, thereby avoiding the common gradient vanishing problem in deep neural networks. The normalization layer is used to accelerate training and improve stability. It eliminates the scale difference between features by normalizing between different neurons within each sample. This normalization operation helps the gradient descent algorithm converge faster, while reducing internal covariate offsets and improving training stability. After processing by the Transformer layer, the accuracy of the model is greatly improved.
[0071] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A mass spectrum dimensionality reduction method for a large mass spectrum library, characterized in that: The precursor features, ion peak features and hash features are obtained from the mass spectrum, and the obtained features are input into the constructed embedder for dimensionality reduction. The dimensionality reduction process includes the following steps: The precursor features are processed using a fully connected network, and the ion peak features and hash features are processed using cascaded convolutional layers and maximum pooling layers respectively; The processed features are concatenated and input into a fully connected layer; The output features of the fully connected layer, the precursor features, the ion peak features, and the hash features are used as the input of the Transformer layer, and the Transformer layer processes them to obtain the initial feature vector; The initial feature vector is concatenated with the mass-to-charge ratio feature of the mass spectrum to obtain the final feature vector after dimensionality reduction.
2. A mass spectrum dimensionality reduction method for a large mass spectrum library according to claim 1, characterized in that: The acquisition of the precursor feature includes: Gray encoding the parent ion mass and mass-to-charge ratio of the mass spectrum, one-hot encoding the charge of the mass spectrum, and splicing the data obtained by Gray encoding and the data obtained by one-hot encoding together as the precursor feature.
3. The mass spectrum dimensionality reduction method for a large mass spectrum library according to claim 1, characterized in that: The acquisition of the ion peak features includes: normalizing and binning the ion peaks of the mass spectrum to obtain the ion peak features.
4. The mass spectrum dimensionality reduction method for a large mass spectrum library according to claim 1, characterized in that: The Murmurhash3 algorithm is used to map the mass-to-charge ratio of the mass spectrum into hash features.
5. The mass spectrum dimensionality reduction method for a large mass spectrum library according to claim 1, characterized in that: The Transformer layer processes features as follows: After processing the output features of the fully connected layer through the linear layer, they are processed in turn using the multi-head attention mechanism, residual connection layer, and normalization layer; After the processed features are concatenated with the precursor features, ion peak features, and hash features, they are mapped through a linear layer to obtain the features output by the Transformer layer.
6. The method for reducing the dimension of a mass spectrum for a large mass spectrum library according to claim 1, characterized in that: The initial feature vector output by the Transformer layer is mapped to a 32-dimensional vector. The mass-to-charge ratio feature of the one-dimensional mass spectrum is weighted with a weight of 0.125 and concatenated with the 32-dimensional vector to obtain a 33-dimensional vector.
7. The method for reducing the dimension of a mass spectrum for a large mass spectrum library according to claim 1, characterized in that: The loss function used by the embedder during training is expressed as: Among them, L(W,label,E a ,E b ) represents the loss function of the embedder, W represents the weight vector in the embedder, and label represents the mass spectrum pair (E a ,E b ) label, when the mass spectrum is (E a ,E b ) is a similar mass spectrum, label = 1, when the mass spectrum is (E a ,E b ) is a dissimilar mass spectrum, label = 0; E a 、E b represent two mass spectra respectively; ·2 means to find the F2 norm.
8. An application of a mass spectrum dimensionality reduction method for a large mass spectrum library, characterized in that: The embedder described in claim 1 is used to perform dimensionality reduction processing on the mass spectra in the database. When the user inputs the mass spectrum to be retrieved, the embedder is used to perform dimensionality reduction processing on the mass spectrum to be retrieved, and the top N mass spectra in the database with the smallest Euclidean distance to the mass spectrum to be retrieved after dimensionality reduction are pushed to the user.
Citation Information
Patent Citations
Isotope peak identification method and device based on mass spectrum imaging data and readable medium
CN117274639A
Natural molecule analysis method and system based on mass spectrum data
CN117423400A
Ion index-based protein tandem mass spectrum identification method
CN117711491A
Nanostructure-initiator mass spectrometry biometrics
US20140247115A1
Systems and methods for de novo peptide sequencing using deep learning and spectrum pairs
US20200326348A1