A retrosynthesis prediction method, device, medium and equipment based on deep learning
By embedding the degree information and adjacency matrix information of molecules in the Transformer model, the problem that the SMILES sequence cannot fully consider the molecular structure information is solved, and the accuracy of reverse synthesis prediction is improved, helping chemists design more reasonable synthesis routes.
Patent Information
- Application Number
- CN202111441439.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-11-30
AI Technical Summary
The existing inverse synthesis prediction method based on deep learning has the problem that SMILES sequence cannot fully consider molecular structure information, resulting in insufficient accuracy of prediction results.
By embedding the structure information of molecules, including the degree information of atoms and the adjacency matrix information in the Transformer model, the encoding of the SMILES sequence is optimized to improve the accuracy of the prediction results. The specific steps include converting the target product into a SMILES sequence, extracting structural information, encoding, and inputting the encoded information into the Transformer model for decoding to obtain a set of reactants.
It improves the accuracy of model prediction results, helps chemists design more reasonable synthetic routes, and enhances the ability to design synthetic pathways for targeted molecules.
Smart Images

Figure CN114220496B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of retrosynthesis prediction technology, and more specifically, to a retrosynthesis prediction method, device, medium and equipment based on deep learning. Background Art
[0002] Nowadays, organic synthesis has become one of the most important disciplines in the field of chemistry. Its research content covers various disciplines such as materials, energy, and life, and plays an extremely important role in the development of social civilization and people's daily life. Organic synthesis refers to the process of using chemical methods to make simple inorganic substances or simple organic substances into relatively complex organic substances. In recent years, the technology of Computer-Assisted Synthetic Planning (CASP) has developed rapidly, especially retrosynthetic design has brought great convenience to chemists in drug synthesis. Retrosynthetic design aims to find a series of commercially available reactants for a certain product molecule. Retrosynthetic prediction is the process of predicting the corresponding reactants based on a given target organic compound.
[0003] Most traditional retrosynthesis prediction methods are template-based. Template-based methods extract retrosynthesis reaction center templates based on existing chemical reactions, then match the products with the extracted reaction center templates, and predict the set of reactants based on the matched templates. Since the templates extracted by template-based methods are based on known chemical reactions, there are always some reactions that cannot be matched to the extracted templates. For these reactions, the retrosynthesis prediction results finally obtained by the model are usually not ideal. Therefore, template-based methods have the problem of insufficient generalization.
[0004] In recent years, with the rise and development of artificial intelligence, new attempts to apply deep learning have gradually entered people's horizons, and the retrosynthesis prediction task is also regarded as a deep learning task for research. The methods of using deep learning for retrosynthesis prediction are mainly divided into two categories, one is the method based on retrosynthesis analysis, and the other is the end-to-end method. The method based on retrosynthesis analysis divides the retrosynthesis prediction task into two steps. The first step is to use a model to identify the reaction center of the product, and then disconnect the reaction center to obtain multiple synthons; the second step is to use another model to convert multiple synthons into corresponding reactant sets. The method based on retrosynthesis analysis has certain interpretability, but the implementation process is relatively cumbersome. The end-to-end method regards the retrosynthesis prediction task as a sequence-to-sequence translation task. Specifically, both the product and the reactant can be represented as a certain sequence, which is called the simplified molecular input line entry specification (SMILES). Therefore, the retrosynthesis prediction task can be regarded as the conversion process from the product SMILES sequence to the reactant SMILES sequence. The end-to-end method can achieve retrosynthesis prediction in one step, but the use of only the SMILES sequence cannot fully consider the structural information of the molecule.
[0005] In summary, there is room for improvement in the current retrosynthesis prediction methods based on deep learning. Summary of the invention
[0006] In order to overcome the shortcomings and deficiencies in the prior art, the purpose of the present invention is to provide a retrosynthesis prediction method, device, medium and equipment based on deep learning; this method solves the problem that the SMILES sequence cannot fully consider the molecular structure information, and improves the accuracy of the model prediction results.
[0007] In order to achieve the above object, the present invention is implemented by the following technical scheme: a retrosynthetic prediction method based on deep learning, comprising the following steps:
[0008] Step S1: convert the target product into a corresponding SMILES sequence; extract the structural information of the SMILES sequence, which includes the degree information of atoms in the molecule and the adjacency matrix information indicating the connection status between atoms in the molecule;
[0009] Step S2, encoding the degree information to obtain the degree information encoding; encoding the adjacency matrix information to obtain the adjacency information encoding;
[0010] Step S3: Input the SMILES sequence into the Transformer model encoder, and use degree information encoding and adjacency information encoding to optimize the encoding of the SMILES sequence; the Transformer model inputs the encoding result of the encoder into the decoder for decoding to obtain the SMILES sequence of the reactant set; the SMILES sequence of the reactant set is transformed to obtain the corresponding reactants;
[0011] The Transformer model refers to a Transformer model that has been trained and tested.
[0012] Preferably, in the step S1, the SMILES sequence is extracted: for degree information, the degree information of each atom in the SMILES sequence is set to the number of bonds associated with the atom, and the degree information of special symbols other than atoms is set to '0'; for adjacency matrix information, the corresponding position of the adjacency matrix information between two atoms connected is set to '1', the corresponding position of the adjacency matrix information between two atoms not connected is set to '0', and the remaining corresponding positions are set to 'N'.
[0013] Preferably, in step S2, each symbol of the degree information is regarded as a word, a corresponding vocabulary is constructed, and the degree information is converted into a corresponding one-hot vector through the vocabulary; and the one-hot vector is converted into a corresponding degree information encoding:
[0014] d emb =dW d
[0015] Among them, the dimension of d is the length of the degree information vocabulary, W d is the learnable parameter matrix, d emb It is the degree information encoding corresponding to d, and its dimension is the word vector dimension of each symbol in the SMILES sequence.
[0016] Preferably, each symbol of the adjacency matrix information is regarded as a word, and a corresponding vocabulary is constructed. The adjacency matrix information is converted into a corresponding one-hot vector through the vocabulary; the one-hot vector is converted into a corresponding adjacency information code, and the head adjacency information code matrix is constructed from the adjacency information code:
[0017] a emb =aW a
[0018] Among them, the dimension of a is the length of the adjacency matrix information vocabulary, W a is the learnable parameter matrix, a embIt is the adjacency information encoding corresponding to a, and its dimension is the number of attention heads in the multi-head self-attention layer in the Transformer encoder.
[0019] Preferably, in step S3, the degree information encoding and the word vector of the SMILES sequence are added as the input of the Transformer model encoder; the adjacency information encoding is embedded into the multi-head self-attention layer of the Transformer model encoder to adjust the attention relationship between atoms in the SMILES sequence through the adjacency information.
[0020] Preferably, embedding the adjacency information encoding into the multi-head self-attention layer of the Transformer model encoder means: performing a dot multiplication of the adjacency information encoding matrix and the attention coefficient matrix in the multi-head self-attention layer of the Transformer model encoder:
[0021]
[0022] Among them, Q i , K i Respectively represent the Query matrix and Key matrix of the i-th attention head, d k Indicates the dimension of the key matrix, A i represents the i-th adjacency information encoding matrix.
[0023] A retrosynthesis prediction device based on deep learning, comprising:
[0024] The structural information extraction module is used to convert the target product into the corresponding SMILES sequence; extract the structural information of the SMILES sequence, and the structural information includes the degree information of the atoms in the molecule and the adjacency matrix information indicating the connection status between the atoms in the molecule;
[0025] An information encoding module is used to encode the degree information to obtain the degree information encoding; encode the adjacency matrix information to obtain the adjacency information encoding;
[0026] The prediction module is used to input the SMILES sequence into the Transformer model encoder and optimize the encoding of the SMILES sequence by using degree information encoding and adjacency information encoding; the Transformer model inputs the encoding result of the encoder into the decoder for decoding to obtain the SMILES sequence of the reactant set; the SMILES sequence of the reactant set is converted to obtain the corresponding reactants; the Transformer model refers to a Transformer model that has been trained and tested.
[0027] A storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the above-mentioned retrosynthesis prediction method based on deep learning.
[0028] A computing device includes a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the above-mentioned deep learning-based retrosynthesis prediction method is implemented.
[0029] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0030] The advantage of the present invention is that a Transformer model that is more suitable for retrosynthesis prediction is proposed to address the problems existing in the current end-to-end retrosynthesis prediction method, and the problem that the SMILES sequence cannot fully consider the molecular structure information is solved by embedding two kinds of structural information, namely, degree and adjacency matrix, into the Transformer model, thereby improving the accuracy of the model prediction results. The model proposed by the present invention is used to perform reasonable retrosynthesis prediction, which helps chemists design the synthesis route of targeted molecules and can greatly help chemists design the way to synthesize new molecules. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic diagram of the principle of the retrosynthetic prediction method based on deep learning of the present invention;
[0032] Figure 2 It is a flow chart of the retrosynthetic prediction method based on deep learning of the present invention;
[0033] Figure 3 It is a schematic diagram of molecular structure information extraction of the retrosynthesis prediction method based on deep learning of the present invention;
[0034] Figure 4 It is a schematic diagram of degree information encoding of the retrosynthetic prediction method based on deep learning of the present invention;
[0035] Figure 5 It is a schematic diagram of the adjacency information encoding of the retrosynthesis prediction method based on deep learning of the present invention;
[0036] Figure 6 It is a schematic diagram of the Transformer model of the retrosynthetic prediction method based on deep learning of the present invention. DETAILED DESCRIPTION
[0037] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0038] Embodiment 1
[0039] At present, most of the retrosynthesis prediction methods based on sequence-to-sequence models only consider the SMILES sequence information of molecules, but lack the consideration of molecular structure information, which is very important in the chemical reaction process. This paper aims to solve the problem that the SMILES sequence in the retrosynthesis prediction methods based on sequence-to-sequence models cannot fully consider the structural information of molecules.
[0040] This embodiment proposes a retrosynthesis prediction method based on deep learning, which solves the problems existing in SMILES sequence representation by embedding the structural information of molecules into the Transformer model and improves the accuracy of retrosynthesis prediction results. The principle is as follows Figure 1 shown.
[0041] The retrosynthetic prediction method includes the following steps: Figure 2 As shown:
[0042] Step S1: Convert the target product into the corresponding SMILES sequence; extract the structural information of the SMILES sequence, which includes the degree information of the atoms in the molecule and the adjacency matrix information representing the connection status between the atoms in the molecule. The degree information refers to the number of bonds associated with the atom. The adjacency matrix information reflects the connection status between atoms, that is, the topological structure information of the molecule.
[0043] The extraction of degree information and adjacency matrix information mainly uses a chemical tool library Rdkit, which can be used to process SMILES sequences. For degree information, the degree information of each atom in the SMILES sequence is set to the number of bonds associated with the atom; Figure 3 In the cyclic molecule shown, each atom has 2 bonds associated with it, so the degree information for each atom is set to '2'.
[0044] For the adjacency matrix information, the corresponding position of the adjacency matrix information between two atoms connected is set to '1', and the corresponding position of the adjacency matrix information between two atoms not connected is set to '0'.
[0045] Generally speaking, degree information and adjacency matrix information only contain information about atoms or atoms, while there are some special symbols in the SMILES sequence. Therefore, in order to better embed degree information and adjacency matrix information into the Transformer model, the present invention expands the original degree information and adjacency matrix information based on the SMILES sequence of molecules, such as Figure 3As shown. The degree information of special symbols other than atoms, such as '1' and '=', are set to '0' respectively; for the adjacency matrix information, the adjacency information between atomic symbols in the SMILES sequence corresponds to the adjacency matrix information obtained from Rdkit one by one, and the other corresponding positions (the adjacency information of special symbols and all other symbols) are uniformly represented by 'N'.
[0046] Step S2, encode the degree information to obtain the degree information encoding, such as Figure 4 As shown; the adjacency matrix information is encoded to obtain the adjacency information encoding, such as Figure 5 shown.
[0047] Specifically, each symbol of the degree information is regarded as a word, and a corresponding vocabulary is constructed, such as {'0':0,'1':1,'2':2,...}. The degree information is converted into a corresponding one-hot vector through the vocabulary. Assuming that the corresponding one-hot vector of the degree information of a symbol is d, the one-hot vector is converted into the corresponding degree information encoding:
[0048] d emb =dW d
[0049] Among them, the dimension of d is the length of the degree information vocabulary, W d is the learnable parameter matrix, d emb is the degree information encoding corresponding to d, and its dimension is the word vector dimension of each symbol in the SMILES sequence. Figure 4 As shown in the figure, the same degree information is encoded the same way, and the degree information '2' is encoded as d emb2 , the code obtained by the degree information '0' is d emb0 .
[0050] Treat each symbol of the adjacency matrix information as a word and construct a corresponding vocabulary, such as {'0':0,'1':1,'N':2}. Convert the adjacency matrix information into the corresponding one-hot vector through the vocabulary; assuming that the corresponding one-hot vector of a certain adjacency information is a, convert the one-hot vector into the corresponding adjacency information encoding, and construct the head adjacency information encoding matrix from the adjacency information encoding:
[0051] a emb =aW a
[0052] Among them, the dimension of a is the length of the adjacency matrix information vocabulary, W a is the learnable parameter matrix, a embis the adjacent information encoding corresponding to a, and its dimension is the number of attention heads in the multi-head self-attention layer in the Transformer encoder. Figure 5 As shown, by constructing an adjacency information encoding matrix using the same dimension of all adjacency information encoding vectors, the head adjacency information encoding matrices can be obtained.
[0053] In step S3, the Transformer model is a classic model in the field of Natural Language Processing (NLP) proposed by Google. The Transformer model contains N encoders and N decoders. After the source language sentence is word-embedded and position-encoded, it is first input into N serial encoders, and then the encoded results are respectively input into N serial decoders for decoding, and finally the target language sentence is obtained based on the output probability.
[0054] The present invention applies the Transformer model to retrosynthesis prediction, and the structure is as follows Figure 6 As shown, the SMILES sequence is input into the Transformer model encoder, and the degree information encoding and adjacency information encoding are used to optimize the encoding of the SMILES sequence; the Transformer model inputs the encoding result of the encoder into the decoder for decoding to obtain the SMILES sequence of the reactant set; the SMILES sequence of the reactant set is converted to obtain the corresponding reactants.
[0055] Specifically, the degree information encoding and the word vector of the SMILES sequence are added as the input of the Transformer model encoder, so that the encoding information of each symbol in the SMILES sequence contains the degree information, enriching the encoding information of each symbol in the SMILES sequence. The adjacency information encoding is embedded in the multi-head self-attention layer of the Transformer model encoder; specifically, the adjacency information encoding matrix and the attention coefficient matrix in the multi-head self-attention layer of the Transformer model encoder are point-multiplied to adjust the attention relationship between atoms in the SMILES sequence through the adjacency information:
[0056]
[0057] Among them, Q i , K i Respectively represent the Query matrix and Key matrix of the i-th attention head, d k Indicates the dimension of the key matrix, A i represents the i-th adjacency information encoding matrix.
[0058] The Query matrix and Key matrix of the attention head are obtained by linearly transforming the input P:
[0059]
[0060] Among them, Q, K, and V are the Query matrix, Key matrix, and Value matrix of the attention head respectively, and the dimensions of Q, K, and V are (l,d q ), (l,d k ), (l,d v );W q , W k , W v is the learnable parameter matrix.
[0061] The Transformer model refers to a Transformer model that has been trained and tested. The training and testing process is: the sample is processed by step S1 and step S2 to obtain the degree information encoding and adjacency information encoding of the sample; then the SMILES sequence, degree information encoding and adjacency information encoding of the sample are input into the Transformer model for training and testing.
[0062] In order to verify the prediction effect of the method of the present invention, test samples were used to test the pure Transformer model, the Transformer model with embedded degree information encoding, the Transformer model with embedded adjacency information encoding, and the Transformer model with embedded degree information encoding and adjacency information encoding. The test results show that either embedded degree information encoding or adjacency information encoding can improve the prediction effect of the model, and the prediction effect of both embedded degree information encoding and adjacency information encoding is better than that of embedding only one information encoding.
[0063] In order to implement the above-mentioned retrosynthesis prediction method based on deep learning, this embodiment also provides a retrosynthesis prediction device based on deep learning, including:
[0064] The structural information extraction module is used to convert the target product into the corresponding SMILES sequence; extract the structural information of the SMILES sequence, and the structural information includes the degree information of the atoms in the molecule and the adjacency matrix information indicating the connection status between the atoms in the molecule;
[0065] An information encoding module is used to encode the degree information to obtain the degree information encoding; encode the adjacency matrix information to obtain the adjacency information encoding;
[0066] The prediction module is used to input the SMILES sequence into the Transformer model encoder and optimize the encoding of the SMILES sequence by using degree information encoding and adjacency information encoding; the Transformer model inputs the encoding result of the encoder into the decoder for decoding to obtain the SMILES sequence of the reactant set; the SMILES sequence of the reactant set is converted to obtain the corresponding reactants; the Transformer model refers to a Transformer model that has been trained and tested.
[0067] Embodiment 2
[0068] This embodiment provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the deep learning-based retrosynthesis prediction method described in Embodiment 1.
[0069] Embodiment 3
[0070] This embodiment provides a computing device, including a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the deep learning-based retrosynthesis prediction method described in Embodiment 1 is implemented.
[0071] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A retrosynthetic prediction method based on deep learning, characterized in that: The steps include: Step S1: convert the target product into a corresponding SMILES sequence; extract the structural information of the SMILES sequence, which includes the degree information of atoms in the molecule and the adjacency matrix information representing the connection status between atoms in the molecule; Step S2, encoding the degree information to obtain degree information encoding; Encoding the adjacency matrix information to obtain adjacency information encoding; Step S3: Input the SMILES sequence into the Transformer model encoder, and use degree information encoding and adjacency information encoding to optimize the encoding of the SMILES sequence; The Transformer model inputs the encoding result of the encoder into the decoder for decoding to obtain the SMILES sequence of the reactant set; the SMILES sequence of the reactant set is transformed to obtain the corresponding reactants; The Transformer model refers to a Transformer model that has been trained and tested; In the step S1, the SMILES sequence is extracted: for degree information, the degree information of each atom in the SMILES sequence is set to the number of bonds associated with the atom, and the degree information of special symbols other than atoms is set to '0'; for adjacency matrix information, the corresponding position of the adjacency matrix information between two atoms connected is set to '1', the corresponding position of the adjacency matrix information between two atoms not connected is set to '0', and the remaining corresponding positions are set to 'N'; In step S2, each symbol of the degree information is regarded as a word, a corresponding vocabulary is constructed, and the degree information is converted into a corresponding one-hot vector through the vocabulary; the one-hot vector is converted into the corresponding degree information encoding: d emb =dW d Among them, the dimension of d is the length of the degree information vocabulary, W d is the learnable parameter matrix, d emb Encodes the degree information corresponding to d, and its dimension is the word vector dimension of each symbol in the SMILES sequence; Treat each symbol of the adjacency matrix information as a word, construct a corresponding vocabulary, and convert the adjacency matrix information into the corresponding one-hot vector through the vocabulary; convert the one-hot vector into the corresponding adjacency information encoding, and construct the head adjacency information encoding matrix from the adjacency information encoding: yes emb =aW a Among them, the dimension of a is the length of the adjacency matrix information vocabulary, W a is the learnable parameter matrix, a emb is the adjacent information encoding corresponding to a, and its dimension is the number of attention heads in the multi-head self-attention layer in the Transformer encoder; In step S3, the degree information encoding and the word vector of the SMILES sequence are added as the input of the Transformer model encoder; the adjacency information encoding is embedded into the multi-head self-attention layer of the Transformer model encoder to adjust the attention relationship between atoms in the SMILES sequence through the adjacency information.
2. The deep learning-based retrosynthesis prediction method according to claim 1, characterized in that: The embedding of the adjacency information encoding into the multi-head self-attention layer of the Transformer model encoder refers to: performing a dot multiplication of the adjacency information encoding matrix and the attention coefficient matrix in the multi-head self-attention layer of the Transformer model encoder: Among them, Q i , K i Respectively represent the Query matrix and Key matrix of the i-th attention head, d k Indicates the dimension of the key matrix, A i represents the i-th adjacency information encoding matrix.
3. A retrosynthesis prediction device based on deep learning, characterized in that: Used to implement the deep learning-based retrosynthesis prediction method of claim 1; the deep learning-based retrosynthesis prediction device comprises: The structural information extraction module is used to convert the target product into the corresponding SMILES sequence; extract the structural information of the SMILES sequence, and the structural information includes the degree information of the atoms in the molecule and the adjacency matrix information indicating the connection status between the atoms in the molecule; An information encoding module is used to encode the degree information to obtain the degree information encoding; encode the adjacency matrix information to obtain the adjacency information encoding; The prediction module is used to input the SMILES sequence into the Transformer model encoder and optimize the encoding of the SMILES sequence by using degree information encoding and adjacency information encoding; the Transformer model inputs the encoding result of the encoder into the decoder for decoding to obtain the SMILES sequence of the reactant set; the SMILES sequence of the reactant set is converted to obtain the corresponding reactants; the Transformer model refers to a Transformer model that has been trained and tested.
4. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, enables the processor to execute the deep learning-based retrosynthesis prediction method according to claim 1 or 2.
5. A computing device comprising a processor and a memory for storing a program executable by the processor, characterized in that: When the processor executes the program stored in the memory, the deep learning-based retrosynthesis prediction method described in claim 1 or 2 is implemented.
