An enzyme function prediction method based on deep contrast learning
By generating joint feature representations of enzymes and substrates through deep contrastive learning and optimizing the contrastive learning encoder, the problems of single feature information and insufficient prediction accuracy in enzyme function prediction are solved, and more accurate prediction of enzyme catalytic function is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NORTHWEST A & F UNIV
- Filing Date
- 2026-04-21
- Publication Date
- 2026-07-14
Smart Images

Figure CN122090963B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of enzyme function prediction technology, and in particular to an enzyme function prediction method based on deep contrastive learning. Background Technology
[0002] Enzyme function prediction is an important research direction in the field of bioinformatics. Its core is to determine the catalytic function category of enzymes by analyzing relevant data, providing technical support for fields such as biocatalysis and drug development. Currently, conventional enzyme function prediction methods mainly rely on amino acid sequence homology alignment or feature extraction from the enzyme's amino acid sequence alone, followed by prediction using traditional machine learning models. While some methods incorporate substrate molecular structure data, they only perform simple feature encoding, failing to achieve an effective correlation between enzyme and substrate-related features.
[0003] In conventional technical solutions, prediction methods based solely on amino acid sequences cannot fully reflect the interaction between enzymes and substrates, resulting in limited feature information and difficulty in capturing key factors influencing enzyme catalytic function. Methods that simply combine substrate features cannot effectively integrate the core association features between enzymes and substrates, nor can they accurately reflect the spatial characteristics of enzyme-substrate binding sites and the electron transfer patterns of catalytic active centers. Furthermore, conventional prediction models lack targeted sample mining and parameter optimization mechanisms, making it difficult to accurately distinguish differences between different enzyme-substrate pairs, leading to insufficient model prediction accuracy and failing to meet practical application requirements. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing an enzyme function prediction method based on deep contrastive learning.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: an enzyme function prediction method based on deep contrastive learning, comprising:
[0006] Acquire the amino acid sequence data of the target enzyme and the corresponding molecular structure data of the reaction substrate, perform sequence embedding encoding processing on the amino acid sequence data, and generate the sequence feature vector of the target enzyme;
[0007] The molecular structure data of the reaction substrate are subjected to graph structure modeling to generate the molecular graph feature vector of the reaction substrate.
[0008] The sequence feature vector and the molecular graph feature vector are subjected to cross-modal feature fusion processing to generate a joint feature representation of the target enzyme and substrate. The joint feature representation includes the spatial complementarity features of the enzyme-substrate binding site and the electron transfer features of the catalytic active center.
[0009] The pre-trained contrastive learning encoder is invoked to perform contrastive sample mining processing on the joint feature representation to generate a set of positive and negative sample pairs, which includes anchor samples of similar enzyme-substrate pairs and negative samples of differential enzyme-substrate pairs.
[0010] A contrastive loss function is constructed based on the set of positive and negative sample pairs, and the parameters of the contrastive learning encoder are updated through the backpropagation algorithm to generate an optimized contrastive learning encoder.
[0011] The amino acid sequence data of the target enzyme and the molecular structure data of the reaction substrate are input into the optimized contrastive learning encoder, which outputs the predicted catalytic function category of the target enzyme.
[0012] As a further aspect of the present invention, the amino acid sequence data is subjected to sequence embedding encoding processing to generate the sequence feature vector of the target enzyme, including:
[0013] The amino acid sequence data includes sequence length, residue composition, and distribution of conserved sites;
[0014] The sequence feature vector includes local residue interaction features and global sequence evolution features;
[0015] The molecular graph feature vector includes atomic node features and chemical bond edge features;
[0016] The amino acid sequence data is converted into a one-hot coding matrix, the dimension of which is determined by the total number of amino acid types and the length of the target enzyme sequence.
[0017] The one-hot encoding matrix is input into the first convolutional layer of the convolutional neural network to extract the local residue interaction features of the target enzyme. The kernel size of the first convolutional layer is set to adapt to the length of short-range residue interactions.
[0018] The local residue interaction features are input into the hidden layer of the recurrent neural network to capture the global sequence evolution features of the target enzyme. The hidden state dimension of the recurrent neural network is set to a capacity that adapts to long-distance sequence dependencies.
[0019] The global sequence evolution features are input into the attention mechanism layer, the attention weights at different residue positions are calculated, and the global sequence evolution features are weighted and summed according to the attention weights to generate the sequence feature vector.
[0020] The dimension of the sequence feature vector is mapped to the same embedding space dimension as the molecular graph feature vector in order to perform subsequent cross-modal feature fusion processing.
[0021] As a further aspect of the present invention, graph structure modeling is performed on the molecular structure data of the reaction substrate to generate a molecular graph feature vector of the reaction substrate, including:
[0022] The molecular structure data of the reaction substrate includes functional group type, spatial configuration, and electron cloud density distribution;
[0023] The atomic node information and chemical bond edge information in the molecular structure data of the reaction substrate are analyzed to construct the molecular graph data structure of the reaction substrate. The node attributes of the molecular graph data structure include atomic number, electronegativity and spatial coordinates, and the edge attributes include chemical bond type and bond length.
[0024] The molecular graph data structure is input into the first graph convolutional layer of the graph convolutional neural network, and the features of the neighboring nodes of the atomic nodes are aggregated to generate an atomic embedding vector containing the local environment of the functional groups.
[0025] The atom embedding vector is input into the hidden layer of a multilayer perceptron to extract the spatial configuration features and electron cloud density distribution features of the reaction substrate. The activation function of the hidden layer of the multilayer perceptron is set to adapt to the type of nonlinear chemical properties.
[0026] The spatial configuration features and electron cloud density distribution features are input to the readout layer, and global pooling is performed on all atom embedding vectors to generate the molecular graph feature vector.
[0027] The dimension of the molecular graph feature vector is mapped to the same embedding space dimension as the sequence feature vector in order to perform subsequent cross-modal feature fusion processing.
[0028] As a further aspect of the present invention, the sequence feature vector and the molecular graph feature vector are subjected to cross-modal feature fusion processing to generate a joint feature representation of the target enzyme and substrate, including:
[0029] The sequence feature vector and the molecular graph feature vector are concatenated to form an initial joint feature vector, the dimension of which is the sum of the dimensions of the two input vectors;
[0030] The initial joint feature vector is input into the query matrix and key value matrix of the cross-attention mechanism. The query matrix is initialized by the sequence feature vector, and the key value matrix is initialized by the molecular graph feature vector.
[0031] An attention weight matrix is generated by calculating the similarity score between the query matrix and each key value matrix. The attention weight matrix reflects the correlation strength between enzyme sequence features and substrate molecule features.
[0032] The molecular graph feature vector is weighted and summed according to the attention weight matrix to generate a substrate attention-enhanced feature vector.
[0033] The sequence feature vector is added to the substrate attention enhancement feature vector, and then normalized to generate the joint feature representation, wherein the dimension of the joint feature representation is consistent with the dimension of the input sequence feature vector.
[0034] As a further aspect of the present invention, the step of invoking a pre-trained contrastive learning encoder to perform contrastive sample mining processing on the joint feature representation to generate a set of positive and negative sample pairs includes:
[0035] Retrieve from bioinformatics databases a set of candidate enzyme sequences that are homologous to the target enzyme, and a set of candidate substrates that have similar structures to the reaction substrate;
[0036] Each candidate enzyme in the candidate enzyme sequence set is combined with the reaction substrate to generate a candidate enzyme-substrate pair, and the cosine similarity between the joint feature representation of the candidate enzyme and the joint feature representation of the target enzyme is calculated.
[0037] Candidate enzyme-substrate pairs whose joint feature representation cosine similarity with the target enzyme is greater than a preset threshold are marked as anchor samples, forming the positive sample subset of the positive and negative sample pair set;
[0038] Candidate enzyme-substrate pairs whose cosine similarity to the joint feature representation of the target enzyme is less than a preset threshold are marked as differential samples. Samples with different catalytic function categories from the differential samples are selected to form the negative sample subset of the positive and negative sample pair set.
[0039] The anchor sample is paired with the sample selected from the difference sample to generate the set of positive and negative sample pairs containing the anchor sample, positive sample, and negative sample.
[0040] As a further aspect of the present invention, a contrastive loss function is constructed based on the set of positive and negative sample pairs, and the parameters of the contrastive learning encoder are updated using a backpropagation algorithm, including:
[0041] For each anchor sample in the set of positive and negative sample pairs, calculate its comparison similarity score with the corresponding positive sample and its comparison similarity score with the corresponding negative sample.
[0042] Based on the contrast similarity scores, a contrast loss function in the form of InfoNCE is constructed. The objective of the contrast loss function is to maximize the similarity score between the anchor sample and the positive sample, while minimizing the similarity score between the anchor sample and the negative sample.
[0043] The gradient of the contrastive loss function with respect to the parameters of the contrastive learning encoder is calculated, and the gradient reflects the direction of the influence of parameter updates on the value of the loss function.
[0044] Based on the magnitude and direction of the gradient, the parameters of the contrastive learning encoder are updated using an adaptive moment estimation optimizer, wherein the learning rate of the adaptive moment estimation optimizer is set to a mode that decays with the number of training steps.
[0045] Repeat the steps from calculating the contrastive similarity score to updating the parameters. When the numerical fluctuation of the contrastive loss function on the validation set is less than the preset convergence threshold and no longer shows a continuous downward trend in multiple training iterations, it is determined to be converged, training is stopped and the optimized contrastive learning encoder is saved.
[0046] As a further aspect of the present invention, the global sequence evolution features are input into the attention mechanism layer to calculate the attention weights at different residue positions, including:
[0047] The global sequence evolution features are input into the linear transformation module of the attention mechanism layer to obtain the query vector, key vector, and value vector.
[0048] Calculate the dot product between the query vector and the key vector to obtain the attention score matrix;
[0049] The attention score matrix is scaled and then converted into a probability distribution using a normalization function to obtain the attention weight matrix for different residue positions;
[0050] The attention weight matrix and the value vector are weighted and summed to generate context-aware sequence features;
[0051] The context-aware sequence features are input into a feedforward neural network for nonlinear transformation to generate weighted sequence context features;
[0052] The weighted sequence context features are subjected to residual connection and normalization to finally generate the sequence feature vector.
[0053] As a further aspect of the present invention, a contrastive loss function in the form of InfoNCE is constructed based on the contrastive similarity score, including:
[0054] The similarity score between each anchor sample and its corresponding positive sample is converted into a probability value using an exponential function to obtain the probability value of the anchor-positive sample pair.
[0055] The similarity score between each anchor sample and its corresponding negative sample is converted into a probability value using an exponential function, resulting in a series of probability values for anchor-negative sample pairs.
[0056] Calculate the sum of the probability values of the anchor point-positive sample pair and the probability values of the anchor point-negative sample pair;
[0057] Divide the probability value of the anchor point-positive sample pair by the sum of probabilities to obtain the normalized similarity of each anchor point-positive sample pair;
[0058] Take the negative logarithm of the normalized similarity of all anchor-positive sample pairs within the batch to obtain the negative log-likelihood value of each sample pair;
[0059] The average of the negative log-likelihood values for all sample pairs is taken as the final output of the contrastive loss function in the form of InfoNCE.
[0060] As a further aspect of the present invention, the gradient of the contrastive loss function with respect to the parameters of the contrastive learning encoder is calculated, including:
[0061] The gradient of the joint feature representation is obtained by calculating the partial derivative of the contrastive loss function with respect to the joint feature representation output by the contrastive learning encoder.
[0062] Based on the gradient of the joint feature representation, the partial derivative of the contrastive loss function with respect to the parameters of the cross-attention mechanism module in the cross-modal feature fusion processing step is calculated using the chain rule.
[0063] Continuing to use the chain rule of differentiation, based on the gradient of the joint feature representation, calculate the partial derivative of the contrastive loss function with respect to the parameters of the hidden layer of the recurrent neural network in the sequence embedding encoding process, and calculate the partial derivative of the contrastive loss function with respect to the parameters of the first graph convolutional layer of the graph convolutional neural network in the graph structure modeling process;
[0064] The partial derivatives of the calculated parameters of the cross-attention mechanism module, the hidden layer parameters of the recurrent neural network, and the first graph convolutional layer parameters of the graph convolutional neural network are summarized to obtain the complete gradient of the contrastive loss function with respect to the parameters of the contrastive learning encoder.
[0065] The complete gradient is used as the basis for guiding the adaptive moment estimation optimizer to update its parameters.
[0066] As a further aspect of the present invention, it also includes a step of introducing data augmentation processing during the contrastive learning training process:
[0067] A random residue masking operation is applied to the amino acid sequence data of the target enzyme to replace some residues in the sequence with unknown residue symbols, thereby generating enhanced enzyme sequence data;
[0068] Random bond length perturbation was applied to the molecular structure data of the reaction substrate. While maintaining the chemical rationality of the molecular structure, the bond lengths of some chemical bonds were slightly adjusted to generate enhanced substrate structure data.
[0069] The enhanced enzyme sequence data and enhanced substrate structure data were subjected to sequence embedding encoding and graph structure modeling processing, respectively, to generate enhanced sequence feature vectors and enhanced molecular graph feature vectors.
[0070] The enhanced sequence feature vector and the enhanced molecular graph feature vector are subjected to cross-modal feature fusion processing to generate an enhanced joint feature representation;
[0071] The enhanced joint feature representation and the original joint feature representation are used as positive sample pairs and input into the contrastive learning encoder for contrastive learning to enhance the feature robustness of the contrastive learning encoder.
[0072] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0073] The amino acid sequence feature vector obtained by sequence embedding encoding of the target enzyme is fused with the molecular graph feature vector obtained by graph structure modeling of the reaction substrate through cross-modal feature fusion processing. This generates a joint feature representation that includes spatial complementarity features of enzyme-substrate binding sites and electron transfer features of catalytic active centers. This cross-modal fusion method overcomes the limitations of conventional techniques that extract single features of enzymes or substrates separately. It can simultaneously capture the sequence characteristics of enzymes, the molecular structural characteristics of substrates, and the key interaction features between the two. This compensates for the incompleteness of single feature information, making the feature representation more closely reflect the actual impact mechanism of enzyme catalytic function, and allowing subsequent prediction processes to be carried out based on more comprehensive and core feature information.
[0074] A pre-trained contrastive learning encoder is invoked to perform contrastive sample mining on the joint feature representation, generating a set of positive and negative sample pairs containing anchor samples of similar enzyme-substrate pairs and negative samples of differential enzyme-substrate pairs. A contrastive loss function is constructed based on this set of positive and negative sample pairs, and the parameters of the contrastive learning encoder are updated using the backpropagation algorithm, thus optimizing the encoder. This sample mining and parameter optimization method solves the problems of lack of specificity in sample mining and inaccurate parameter optimization in conventional contrastive learning. It enables the contrastive learning encoder to more clearly identify the similarities and differences between different enzyme-substrate pairs. The optimized encoder can more accurately parse the core information in the joint features, reduce the interference of irrelevant features, and improve the stability and accuracy of enzyme catalytic function category prediction. Attached Figure Description
[0075] Figure 1 This is a flowchart of an enzyme function prediction method based on deep contrastive learning as described in this invention.
[0076] Figure 2 A flowchart for sequence embedding encoding processing;
[0077] Figure 3 A flowchart for modeling molecular diagram structures;
[0078] Figure 4 This is a graph showing the changes in normalized similarity and loss value as a function of the number of negative samples.
[0079] Figure 5 This is a diagram showing the effect of residue mask ratio on feature stability. Detailed Implementation
[0080] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0081] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0082] See Figure 1The process involves acquiring the amino acid sequence data of the target enzyme and its corresponding substrate molecular structure data. Sequence embedding encoding is performed on the amino acid sequence data, transforming it into a sequence feature vector containing local residue interactions and global sequence evolution information. Graph structure modeling is then applied to the substrate molecular structure data, converting it into a molecular graph feature vector containing atomic nodes and chemical bond edges. Cross-modal feature fusion is performed between the sequence feature vector and the molecular graph feature vector. This fusion uses an attention mechanism to capture the association between the enzyme and substrate, generating a joint feature representation that simultaneously includes spatial complementarity features of enzyme-substrate binding sites and electron transfer features of catalytic active centers. A pre-trained contrastive learning encoder is then used to perform contrastive sample mining on this joint feature representation, retrieving and constructing a set of positive and negative sample pairs containing similar and different pairs from a bioinformatics database. Based on this set, a contrastive loss function is constructed, and the parameters of the contrastive learning encoder are updated using a backpropagation algorithm, resulting in an optimized contrastive learning encoder. The amino acid sequence data of the target enzyme and the molecular structure data of the substrate are then input into this optimized contrastive learning encoder, which outputs a predicted catalytic function category for the target enzyme.
[0083] In one embodiment of the present invention, the obtained amino acid sequence data of the target enzyme includes sequence length, residue composition, and conserved site distribution information. The processing objective is to generate a sequence feature vector containing local residue interaction characteristics and global sequence evolution characteristics. See also... Figure 2 The amino acid sequence data is converted into a one-hot encoding matrix. The dimension of the one-hot encoding matrix is determined by the total number of twenty standard amino acid types and the actual length of the target enzyme sequence. For example, for a sequence of length 300, the dimension of the one-hot encoding matrix is 300 multiplied by 20. The generated one-hot encoding matrix is input into the first convolutional layer of a convolutional neural network. The kernel size of the first convolutional layer is set to adapt to the length of short-range residue interactions, such as 3, 5, or 7, to scan and extract patterns between adjacent residues in the sequence, thereby generating local residue interaction features of the target enzyme. These local residue interaction features are then input into the hidden layer of a recurrent neural network. The hidden state dimension of the recurrent neural network is set to adapt to the capacity of long-range sequence dependencies, such as 256 or 512 dimensions. The hidden layer units process local features according to the sequence order, capturing contextual dependency information across the entire sequence to form the global sequence evolution features of the target enzyme.
[0084] The obtained global sequence evolution features are input into the attention mechanism layer to calculate the importance weights of different residue positions. In the attention mechanism layer, the global sequence evolution features are mapped to a query vector, a key vector, and a value vector through three independent linear transformation layers. The dot product between the query vector and the key vector is calculated to generate an attention score matrix reflecting the strength of associations between all residue positions. This attention score matrix is scaled by a scaling factor equal to the square root of the key vector dimension, and then a normalized exponential function is used to convert the scaled scores into a probability distribution, thus obtaining the attention weight matrix for different residue positions. The value vectors are then weighted and summed using this attention weight matrix. The attention weight matrix determines the contribution of each residue position's feature during aggregation, thereby generating a context-aware sequence feature that reinforces key residue information related to enzyme function. This context-aware sequence feature is then input into a feedforward neural network for nonlinear transformation. The feedforward neural network contains at least one hidden layer and uses a nonlinear activation function to generate a weighted sequence context feature. A residual connection operation is performed on the weighted sequence context features, adding them to the input of the attention mechanism layer, i.e., the global sequence evolution features. The result is then normalized to generate the sequence feature vector. The dimension of the sequence feature vector is mapped through a linear projection layer to the same embedding space dimension as the subsequent molecular map feature vector, for example, to 128 dimensions, to facilitate subsequent cross-modal feature fusion processing. The weight values in the attention weight matrix can be calculated using the following formula:
[0085]
[0086] in: Indicates position Query for location Attention weights of the keys It is the first in the query vector matrix The vector corresponding to each position It is the th in the key vector matrix The vector corresponding to each position It is the dimension of the key vector. It is the total length of the sequence, and the normalized exponential function ensures that the sum of all weights is 1.
[0087] In one embodiment of the present invention, the acquired reaction substrate molecular structure data includes information on functional group type, spatial configuration, and electron cloud density distribution. The molecular structure data is stored in a standardized format, such as a SMILES string or an SDF file. See also Figure 3This method analyzes atomic node and chemical bond information from molecular structure data. Atomic node information includes the atomic number, electronegativity, and three-dimensional spatial coordinates of each atom. Chemical bond information includes the bonded atom pairs, bond type, and bond length. Based on the analyzed information, a molecular graph data structure for the reaction substrate is constructed. This molecular graph data structure is represented in the form of an adjacency list or adjacency matrix. Each node in the graph corresponds to an atom, and the node attribute vector contains the atomic number, electronegativity, and spatial coordinates. Each edge in the graph corresponds to a chemical bond, and the edge attribute vector contains the bond type and bond length.
[0088] In specific implementation, the constructed molecular graph data structure is input into the first graph convolutional layer of a graph convolutional neural network. The first graph convolutional layer operates on each atomic node, aggregating the feature information of its one-hop neighbor nodes. The aggregation process employs summation or averaging operations. The aggregation function integrates the attributes of the central atomic node itself with the attributes of all its connected neighboring atomic nodes, generating atomic embedding vectors containing information about the local environment of functional groups. It can be understood that the graph convolutional neural network can contain multiple layers, each expanding the receptive field of the atomic nodes to capture a wider range of molecular substructure information. These atomic embedding vectors are then input into the hidden layer of a multilayer perceptron. The activation function of the multilayer perceptron's hidden layer is set to adapt to the type of nonlinear chemical properties, such as using a rectified linear unit or a hyperbolic tangent function. The hidden layer performs a nonlinear transformation on the atomic embedding vectors to extract the spatial configuration features and electron cloud density distribution features of the reaction substrate. In some embodiments, the spatial configuration features can reflect the three-dimensional shape of the molecule, and the electron cloud density distribution features can reflect the reactive sites.
[0089] In practice, the extracted spatial configuration features and electron cloud density distribution features are input into a readout layer. The readout layer performs global pooling on the feature vectors of all atoms. Global pooling can be either global average pooling or global max pooling. Global average pooling calculates the element-wise average of all atomic feature vectors, while global max pooling takes the maximum value of each atomic feature vector along each feature dimension. The pooling operation generates a fixed-length vector as the molecular graph feature vector. The dimension of the molecular graph feature vector is mapped to the same embedding space dimension as the sequence feature vector through a linear projection layer, for example, to 128 dimensions. In cross-modal feature fusion processing, the generated sequence feature vector and molecular graph feature vector are concatenated along their feature dimensions to generate an initial joint feature vector. The dimension of the initial joint feature vector is equal to the sum of the dimensions of the sequence feature vector and the molecular graph feature vector, for example, 256 dimensions. It can be understood that the concatenation operation preserves all the original information from both modalities.
[0090] In some embodiments, an initial joint feature vector is input into a cross-attention mechanism. The query matrix in the cross-attention mechanism is initialized by a linear transformation of the sequence feature vectors, and the key-value matrix is initialized by another linear transformation of the molecular graph feature vectors. Attention weights are generated by calculating the similarity between the query matrix and each key vector in the key-value matrix, using a dot product approach. The attention weights reflect the association strength between each feature unit in the enzyme sequence and each feature unit in the substrate molecule; the association strength determines the contribution ratio of the substrate features during fusion. The similarity score in the cross-attention mechanism can be expressed by the following formula:
[0091]
[0092] in: Represents the first feature in the sequence The first unit in the substrate characteristics The unnormalized similarity score of each unit. The query matrix obtained by initializing the sequence feature vectors is the first... A query vector, The bond matrix obtained by initializing the eigenvectors of the molecular diagram is the first... A key vector, This is the feature dimension of the key vector. Then, a normalized exponential function is applied to the similarity score matrix to obtain the standardized attention weight matrix.
[0093] In practice, the value matrix initialized from the molecular graph feature vectors is weighted and summed based on the calculated attention weight matrix. The value matrix is also obtained by linear transformation of the molecular graph feature vectors. This weighted summation generates a substrate attention-enhanced feature vector. Optionally, the weighted summation can be expressed as a linear combination of each vector in the value matrix and its corresponding attention weight. The original sequence feature vector is then element-wise added to the generated substrate attention-enhanced feature vector. This addition integrates the original enzyme sequence information with the attention-modulated substrate information. The resulting vector is then subjected to layer normalization to stabilize the feature scale, ultimately generating a joint feature representation. The dimension of the joint feature representation is consistent with the dimension of the input sequence feature vector, for example, 128 dimensions.
[0094] In one embodiment of the present invention, a set of candidate enzyme sequences homologous to the target enzyme is retrieved from a bioinformatics database. The database can be UniProt or BRENDA. Homology is determined using sequence alignment tools such as BLAST, and a sequence similarity threshold is set to screen candidate enzymes. In a specific implementation, a set of candidate substrates with similar structures to the reaction substrate is retrieved from a bioinformatics database. Structural similarity is measured using molecular fingerprints such as the Tanimoto coefficient of ECFP4, and a similarity coefficient threshold is set to screen candidate substrates. Each candidate enzyme in the candidate enzyme sequence set is combined with the original reaction substrate to generate a series of candidate enzyme-substrate pairs. For each candidate enzyme-substrate pair, its corresponding joint feature representation is generated through the same feature extraction and fusion process.
[0095] In practice, the cosine similarity between the joint feature representation of each candidate enzyme-substrate pair and the joint feature representation of the target enzyme is calculated, with the cosine similarity value ranging from -1 to 1. A preset threshold is set; this preset threshold is a configurable scalar used to distinguish between similarities and differences, for example, a preset threshold of 0.7. Candidate enzyme-substrate pairs whose cosine similarity with the joint feature representation of the target enzyme is greater than the preset threshold of 0.7 are marked as anchor samples. These anchor samples constitute the positive sample subset in the set of positive and negative sample pairs. It can be understood that the higher the cosine similarity, the closer the candidate enzyme-substrate pair is to the target enzyme-substrate pair in the feature space. Candidate enzyme-substrate pairs whose cosine similarity with the joint feature representation of the target enzyme is less than the preset threshold of 0.7 are marked as difference samples.
[0096] In some embodiments, samples that differ from the target enzyme's catalytic function category are further screened from the differential samples. The catalytic function category is determined based on the Enzyme Committee number. For example, if the target enzyme's number is EC1.1.1.1, then differential samples consisting of candidate enzymes whose numbers are not EC1.1.1.x are screened. A subset of the screened differential samples is selected to form a negative sample subset in the positive-negative sample pair set. Optionally, the construction of the negative sample subset can employ an in-batch random sampling strategy or perform hard negative sample mining based on similarity to the anchor sample. The anchor sample is paired with the negative samples screened from the differential samples to form a complete positive-negative sample pair set containing the anchor sample, positive sample, and negative sample. Each training batch contains multiple such triples.
[0097] In practice, based on the constructed set of positive and negative sample pairs, the comparative similarity score between each anchor sample and its corresponding positive sample is calculated, and the comparative similarity score between each anchor sample and its corresponding negative sample is also calculated. The calculation of the comparative similarity score can be expressed by the following formula:
[0098]
[0099] in: Represents the feature vector of anchor point samples With positive sample feature vectors The comparison similarity score between them, the dot operation represents the dot product of vectors, and Let and represent the Euclidean norms of the vectors, respectively. Based on these contrast similarity scores, a contrastive loss function of the form InfoNCE is constructed. The objective of the contrastive loss function is to maximize the contrast similarity score between the anchor sample and the positive sample, while minimizing the contrast similarity score between the anchor sample and each negative sample.
[0100] In some embodiments, the gradient of the contrastive loss function with respect to all parameters of the contrastive learning encoder is calculated, and the gradient calculation clarifies the direction of parameter updates. An adaptive moment estimation optimizer is used to iteratively update the parameters of the contrastive learning encoder based on the calculated gradient magnitude and direction. The adaptive moment estimation optimizer maintains the first-order and second-order moment estimates of the parameters. The learning rate of the adaptive moment estimation optimizer is set to a mode that decays with the number of training steps, such as using exponential decay or cosine annealing strategies. The forward and backward propagation process from calculating the contrastive similarity score to parameter updates is repeatedly executed, traversing all or part of the training data within one training cycle. The steps from calculating the contrastive similarity score to parameter updates are repeatedly executed. When, in multiple consecutive training iterations, the numerical fluctuation of the contrastive loss function on the validation set is less than a preset convergence threshold and no longer shows a continuous decreasing trend, convergence is determined, training is stopped, and the optimized contrastive learning encoder is saved. Here, multiple consecutive iterations refer to the consecutive iteration rounds commonly used in model training, and the convergence threshold is a non-negative value set based on model training stability to quantify the stability of the loss function.
[0101] In one embodiment of the present invention, when constructing a contrastive loss function of the form InfoNCE, a batch containing one anchor sample, one positive sample, and two negative samples is taken as an example. First, the contrastive similarity score between the anchor sample and the positive sample is calculated, and simultaneously, the contrastive similarity scores between the anchor sample and the first negative sample and the second negative sample are calculated. The contrastive similarity score between the anchor sample and the positive sample is transformed using an exponential function, and the transformation operation generates the probability value of the anchor-positive sample pair. It can be understood that the exponential function maps the similarity score to the positive number space. The contrastive similarity score between the anchor sample and the first negative sample is transformed using an exponential function to generate the probability value of the first anchor-negative sample pair. The contrastive similarity score between the anchor sample and the second negative sample is transformed using an exponential function to generate the probability value of the second anchor-negative sample pair. Referring to Table 1, a specific calculation example is shown.
[0102] Table 1: Example Data Table for Comparative Loss Calculation
[0103]
[0104] The sum of the probability values of the anchor-positive sample pair and all anchor-negative sample pairs is calculated to obtain the total probability. In the example above, the total probability is 2.34 + 1.16 + 0.82 = 4.32. Dividing the probability value of the anchor-positive sample pair by the sum of the above probabilities yields the normalized similarity of the current anchor-positive sample pair. The normalized similarity can be calculated using the following formula:
[0105]
[0106] in: This represents the normalized similarity of anchor-positive sample pairs. Represents anchor point sample Compared with positive samples The comparison similarity score, Represents anchor point sample With the negative samples The comparison similarity score, This represents the total number of negative samples. This represents the natural exponential function. Based on the data in Table 1, substituting it into the formula yields... Optionally, the temperature coefficient can be incorporated into the exponential function to adjust the distribution.
[0107] In practice, the negative natural logarithm of the normalized similarity is taken to obtain the negative log-likelihood value of the current sample pair. Based on the above calculation results, the negative log-likelihood value is... Within a training batch, there are multiple anchor-positive sample pairs. The arithmetic mean of the negative log-likelihood values of all sample pairs within the batch is taken. This arithmetic mean is used as the final output value of the contrastive loss function in the form of InfoNCE. It can be understood that the final output value is a scalar used to guide model optimization.
[0108] In some embodiments, the full gradient of the contrastive loss function with respect to the parameters of the contrastive learning encoder is calculated. The partial derivative of the contrastive loss function with respect to the joint feature representation of the contrastive learning encoder output is calculated; this partial derivative is the gradient of the loss with respect to the final output features, called the joint feature representation gradient. Based on the joint feature representation gradient, the chain rule is applied to back-calculate the partial derivatives of the contrastive loss function with respect to the parameters within the cross-attention mechanism module in the cross-modal feature fusion processing step, including the linear transformation weights and biases of the query matrix, key matrix, and value matrix. The partial derivatives of the parameters of the cross-attention mechanism module reflect how the joint feature representation gradient propagates back to this module through attention weighting and linear transformation.
[0109] In the specific implementation, the chain rule of differentiation is continued to be applied. Based on the gradient of the joint feature representation, the partial derivatives of the contrastive loss function with respect to the parameters of the recurrent neural network hidden layer in the sequence embedding encoding step are calculated. The partial derivatives of the recurrent neural network hidden layer parameters include the parameters involved in the recurrent weight matrix, the input weight matrix, and the update function of the hidden state. Simultaneously, based on the gradient of the joint feature representation, the partial derivatives of the contrastive loss function with respect to the parameters of the first graph convolutional layer of the graph convolutional neural network in the graph structure modeling step are calculated. The partial derivatives of the parameters of the first graph convolutional layer of the graph convolutional neural network include the weight parameters used for neighbor node feature aggregation. The calculated partial derivatives with respect to the parameters of the cross-attention mechanism module, the parameters of the recurrent neural network hidden layer, and the parameters of the first graph convolutional layer of the graph convolutional neural network are summarized. The summarization operation is a concatenation of vectors or tensors to obtain the complete gradient of the contrastive loss function with respect to all parameters of the entire contrastive learning encoder. Optionally, the complete gradient is organized in the form of a tensor list or gradient vector. The complete gradient will serve as the direct basis for the adaptive moment estimation optimizer to perform parameter updates; the optimizer uses the complete gradient to update the values of the corresponding parameters.
[0110] See Figure 4 This graph shows the relationship between normalized similarity and loss value as a function of the number of negative samples, clearly illustrating the impact of the number of negative samples on normalized similarity and negative log-likelihood (loss value). The two are strictly negatively correlated, consistent with the mathematical properties of the InfoNCE loss function: the more negative samples there are, the more the normalized similarity of the anchor-positive sample pair is diluted, resulting in a higher loss value. Too few negative samples result in a low loss value, making the model prone to overfitting and unable to effectively distinguish differential enzyme-substrate pairs; too many negative samples result in an excessively high loss value, drastically increasing the difficulty of model training and leading to gradient explosion or slow convergence. From the inflection point of the curve, three negative samples represent a relatively balanced choice, ensuring the discriminative power of contrastive learning while avoiding the training difficulties caused by excessively high loss values.
[0111] In one embodiment of the present invention, a data augmentation step is introduced during the contrastive learning training process. A random residue masking operation is applied to the amino acid sequence data of the target enzyme. The random residue masking operation randomly selects a subset of residue positions in the sequence with a preset probability, set to 15%. In a specific implementation, the residue symbol at the selected position is replaced with a specific symbol representing an unknown or masked region, such as "X" or "[MASK]", while the rest of the original sequence remains unchanged, generating augmented enzyme sequence data. In some embodiments, the random residue masking operation simulates possible missing or uncertain regions in sequencing, forcing the model to avoid over-reliance on a few specific residues.
[0112] In practice, random bond length perturbation is applied to the molecular structure data of the reaction substrate. This perturbation targets the chemical bonds within the molecular structure. The operation is performed while maintaining the chemical plausibility of the molecular structure, which is constrained by the allowable range of bond length variation. For example, the standard bond length of a carbon-carbon single bond is 1.54 Å, and the allowable perturbation range is ±0.05 Å. Minor adjustments are made to the bond lengths of randomly selected chemical bonds to generate enhanced substrate structure data. The adjusted bond lengths can be expressed by the following formula:
[0113]
[0114] in: Indicates the new bond length after the perturbation. Indicates the original bond length. This represents the value of the applied small perturbation. Follows uniform distribution , This is the preset maximum perturbation amplitude, for example, set to 0.03 Å. It can be understood that the perturbation operation introduces a small conformational change without altering the molecular topological connectivity.
[0115] In practice, the enhanced enzyme sequence data is input into the sequence embedding and encoding processing module, which uses the same structure and parameters as the module used to process the original data, generating enhanced sequence feature vectors. Similarly, the enhanced substrate structure data is input into the graph structure modeling processing module, which uses the same structure and parameters as the module used to process the original data, generating enhanced molecular graph feature vectors. Optionally, data augmentation can be performed dynamically during the forward propagation of each training batch, generating different enhanced versions for the same original data.
[0116] In some embodiments, the enhanced sequence feature vector and the enhanced molecular graph feature vector are subjected to cross-modal feature fusion processing. The cross-attention mechanism used in the cross-modal feature fusion processing is the same as the mechanism used when processing the original data, generating an enhanced joint feature representation. When training the contrastive learning encoder, the joint feature representation generated from the original data and the joint feature representation generated from its enhanced version constitute a positive sample pair. A training batch contains multiple positive sample pairs consisting of the original sample and its enhanced sample. These positive sample pairs are input into the contrastive learning encoder for contrastive learning. The goal of contrastive learning is to make the original representation and the enhanced representation of the same enzyme-substrate pair as close as possible in the feature space. Optionally, data augmentation can significantly increase the diversity of training samples, thereby enhancing the robustness of the features learned by the contrastive learning encoder to small changes in the input.
[0117] See Figure 5This is a graph showing the impact of residue masking ratio on feature stability, clearly demonstrating the effect of amino acid residue masking ratio on enzyme sequence feature stability. The feature stability score after data augmentation is significantly higher than the unenhanced baseline of 0.92 across the entire masking ratio range, proving that this random residue masking strategy effectively improves the robustness of enzyme sequence features. Although the curve fluctuates, the feature stability score remains at a relatively high level above 0.91 near a masking ratio of 0.15 (15%), and the curve does not show a significant decrease at this position. The stability score in the low-ratio range (<0.10) fluctuates, first decreasing and then increasing, indicating that the enhancement effect of too low a masking ratio is unstable; the stability score in the high-ratio range (>0.20) shows a significant decline, suggesting that when the masking ratio exceeds 20%, excessive destruction of sequence information leads to a decrease in feature stability.
[0118] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for predicting enzyme function based on deep contrastive learning, characterized in that, The method includes: Acquire the amino acid sequence data of the target enzyme and the corresponding molecular structure data of the reaction substrate, perform sequence embedding encoding processing on the amino acid sequence data, and generate the sequence feature vector of the target enzyme; The molecular structure data of the reaction substrate are subjected to graph structure modeling to generate the molecular graph feature vector of the reaction substrate. The sequence feature vector and the molecular graph feature vector are subjected to cross-modal feature fusion processing to generate a joint feature representation of the target enzyme and substrate, including: The sequence feature vector and the molecular graph feature vector are concatenated to form an initial joint feature vector, the dimension of which is the sum of the dimensions of the two input vectors; The initial joint feature vector is input into the query matrix and key value matrix of the cross-attention mechanism. The query matrix is initialized by the sequence feature vector, and the key value matrix is initialized by the molecular graph feature vector. An attention weight matrix is generated by calculating the similarity score between the query matrix and each key value matrix. The attention weight matrix reflects the correlation strength between enzyme sequence features and substrate molecule features. The molecular graph feature vector is weighted and summed according to the attention weight matrix to generate a substrate attention-enhanced feature vector. The sequence feature vector is added to the substrate attention enhancement feature vector, and then normalized to generate the joint feature representation, wherein the dimension of the joint feature representation is consistent with the dimension of the input sequence feature vector. The combined features represent the spatial complementarity of the enzyme-substrate binding site and the electron transfer features of the catalytic active center; The pre-trained contrastive learning encoder is invoked to perform contrastive sample mining processing on the joint feature representation, generating a set of positive and negative sample pairs, including: Retrieve from bioinformatics databases a set of candidate enzyme sequences that are homologous to the target enzyme, and a set of candidate substrates that have similar structures to the reaction substrate; Each candidate enzyme in the candidate enzyme sequence set is combined with the reaction substrate to generate a candidate enzyme-substrate pair, and the cosine similarity between the joint feature representation of the candidate enzyme and the joint feature representation of the target enzyme is calculated. Candidate enzyme-substrate pairs whose joint feature representation cosine similarity with the target enzyme is greater than a preset threshold are marked as anchor samples, forming the positive sample subset of the positive and negative sample pair set; Candidate enzyme-substrate pairs whose cosine similarity to the joint feature representation of the target enzyme is less than a preset threshold are marked as differential samples. Samples with different catalytic function categories from the differential samples are selected to form the negative sample subset of the positive and negative sample pair set. The anchor sample is paired with the sample selected from the difference sample to generate the set of positive and negative sample pairs containing the anchor sample, positive sample and negative sample; The set of positive and negative sample pairs includes anchor samples of similar enzyme-substrate pairs and negative samples of differential enzyme-substrate pairs. A contrastive loss function is constructed based on the set of positive and negative sample pairs, and the parameters of the contrastive learning encoder are updated through the backpropagation algorithm to generate an optimized contrastive learning encoder. The amino acid sequence data of the target enzyme and the molecular structure data of the reaction substrate are input into the optimized contrastive learning encoder, which outputs the predicted catalytic function category of the target enzyme.
2. The enzyme function prediction method based on deep contrastive learning according to claim 1, characterized in that, The amino acid sequence data is subjected to sequence embedding encoding processing to generate the sequence feature vector of the target enzyme, including: The amino acid sequence data includes sequence length, residue composition, and distribution of conserved sites; The sequence feature vector includes local residue interaction features and global sequence evolution features; The molecular graph feature vector includes atomic node features and chemical bond edge features; The amino acid sequence data is converted into a one-hot coding matrix, the dimension of which is determined by the total number of amino acid types and the length of the target enzyme sequence. The one-hot encoding matrix is input into the first convolutional layer of the convolutional neural network to extract the local residue interaction features of the target enzyme. The kernel size of the first convolutional layer is set to adapt to the length of short-range residue interactions. The local residue interaction features are input into the hidden layer of the recurrent neural network to capture the global sequence evolution features of the target enzyme. The hidden state dimension of the recurrent neural network is set to a capacity that adapts to long-distance sequence dependencies. The global sequence evolution features are input into the attention mechanism layer, the attention weights at different residue positions are calculated, and the global sequence evolution features are weighted and summed according to the attention weights to generate the sequence feature vector. The dimension of the sequence feature vector is mapped to the same embedding space dimension as the molecular graph feature vector in order to perform subsequent cross-modal feature fusion processing.
3. The enzyme function prediction method based on deep contrastive learning according to claim 2, characterized in that, The molecular structure data of the reaction substrate are subjected to graph structure modeling to generate molecular graph feature vectors of the reaction substrate, including: The molecular structure data of the reaction substrate includes functional group type, spatial configuration, and electron cloud density distribution; The atomic node information and chemical bond edge information in the molecular structure data of the reaction substrate are analyzed to construct the molecular graph data structure of the reaction substrate. The node attributes of the molecular graph data structure include atomic number, electronegativity and spatial coordinates, and the edge attributes include chemical bond type and bond length. The molecular graph data structure is input into the first graph convolutional layer of the graph convolutional neural network, and the features of the neighboring nodes of the atomic nodes are aggregated to generate an atomic embedding vector containing the local environment of the functional groups. The atom embedding vector is input into the hidden layer of a multilayer perceptron to extract the spatial configuration features and electron cloud density distribution features of the reaction substrate. The activation function of the hidden layer of the multilayer perceptron is set to adapt to the type of nonlinear chemical properties. The spatial configuration features and electron cloud density distribution features are input to the readout layer, and global pooling is performed on all atom embedding vectors to generate the molecular graph feature vector. The dimension of the molecular graph feature vector is mapped to the same embedding space dimension as the sequence feature vector in order to perform subsequent cross-modal feature fusion processing.
4. The enzyme function prediction method based on deep contrastive learning according to claim 1, characterized in that, A contrastive loss function is constructed based on the set of positive and negative sample pairs, and the parameters of the contrastive learning encoder are updated using the backpropagation algorithm, including: For each anchor sample in the set of positive and negative sample pairs, calculate its comparison similarity score with the corresponding positive sample and its comparison similarity score with the corresponding negative sample. Based on the contrast similarity scores, a contrast loss function in the form of InfoNCE is constructed. The objective of the contrast loss function is to maximize the similarity score between the anchor sample and the positive sample, while minimizing the similarity score between the anchor sample and the negative sample. The gradient of the contrastive loss function with respect to the parameters of the contrastive learning encoder is calculated, and the gradient reflects the direction of the influence of parameter updates on the value of the loss function. Based on the magnitude and direction of the gradient, the parameters of the contrastive learning encoder are updated using an adaptive moment estimation optimizer, wherein the learning rate of the adaptive moment estimation optimizer is set to a mode that decays with the number of training steps. Repeat the steps from calculating the contrastive similarity score to updating the parameters. When the numerical fluctuation of the contrastive loss function on the validation set is less than the preset convergence threshold and no longer shows a continuous downward trend in multiple training iterations, it is determined to be converged, training is stopped and the optimized contrastive learning encoder is saved.
5. The enzyme function prediction method based on deep contrastive learning according to claim 4, characterized in that, The global sequence evolution features are input into the attention mechanism layer to calculate the attention weights at different residue positions, including: The global sequence evolution features are input into the linear transformation module of the attention mechanism layer to obtain the query vector, key vector, and value vector. Calculate the dot product between the query vector and the key vector to obtain the attention score matrix; The attention score matrix is scaled and then converted into a probability distribution using a normalization function to obtain the attention weight matrix for different residue positions; The attention weight matrix and the value vector are weighted and summed to generate context-aware sequence features; The context-aware sequence features are input into a feedforward neural network for nonlinear transformation to generate weighted sequence context features; The weighted sequence context features are subjected to residual connection and normalization to finally generate the sequence feature vector.
6. The enzyme function prediction method based on deep contrastive learning according to claim 5, characterized in that, Construct a contrastive loss function in the form of InfoNCE based on the contrast similarity score, including: The similarity score between each anchor sample and its corresponding positive sample is converted into a probability value using an exponential function to obtain the probability value of the anchor-positive sample pair. The similarity score between each anchor sample and its corresponding negative sample is converted into a probability value using an exponential function, resulting in a series of probability values for anchor-negative sample pairs. Calculate the sum of the probability values of the anchor point-positive sample pair and the probability values of the anchor point-negative sample pair; Divide the probability value of the anchor point-positive sample pair by the sum of probabilities to obtain the normalized similarity of each anchor point-positive sample pair; Take the negative logarithm of the normalized similarity of all anchor-positive sample pairs within the batch to obtain the negative log-likelihood value of each sample pair; The average of the negative log-likelihood values for all sample pairs is taken as the final output of the contrastive loss function in the form of InfoNCE.
7. The enzyme function prediction method based on deep contrastive learning according to claim 6, characterized in that, Calculating the gradient of the contrastive loss function with respect to the parameters of the contrastive learning encoder includes: The gradient of the joint feature representation is obtained by calculating the partial derivative of the contrastive loss function with respect to the joint feature representation output by the contrastive learning encoder. Based on the gradient of the joint feature representation, the partial derivative of the contrastive loss function with respect to the parameters of the cross-attention mechanism module in the cross-modal feature fusion processing step is calculated using the chain rule. Continuing to use the chain rule of differentiation, based on the gradient of the joint feature representation, calculate the partial derivative of the contrastive loss function with respect to the parameters of the hidden layer of the recurrent neural network in the sequence embedding encoding process, and calculate the partial derivative of the contrastive loss function with respect to the parameters of the first graph convolutional layer of the graph convolutional neural network in the graph structure modeling process; The partial derivatives of the calculated parameters of the cross-attention mechanism module, the hidden layer parameters of the recurrent neural network, and the first graph convolutional layer parameters of the graph convolutional neural network are summarized to obtain the complete gradient of the contrastive loss function with respect to the parameters of the contrastive learning encoder. The complete gradient is used as the basis for guiding the adaptive moment estimation optimizer to update its parameters.
8. The enzyme function prediction method based on deep contrastive learning according to claim 7, characterized in that, It also includes the step of introducing data augmentation during the contrastive learning training process: A random residue masking operation is applied to the amino acid sequence data of the target enzyme to replace some residues in the sequence with unknown residue symbols, thereby generating enhanced enzyme sequence data; Random bond length perturbation was applied to the molecular structure data of the reaction substrate. While maintaining the chemical rationality of the molecular structure, the bond lengths of some chemical bonds were slightly adjusted to generate enhanced substrate structure data. The enhanced enzyme sequence data and enhanced substrate structure data were subjected to sequence embedding encoding and graph structure modeling processing, respectively, to generate enhanced sequence feature vectors and enhanced molecular graph feature vectors. The enhanced sequence feature vector and the enhanced molecular graph feature vector are subjected to cross-modal feature fusion processing to generate an enhanced joint feature representation; The enhanced joint feature representation and the original joint feature representation are used as positive sample pairs and input into the contrastive learning encoder for contrastive learning to enhance the feature robustness of the contrastive learning encoder.