Training method and device for 3D molecule generation model

Through the training of conditional variational autoencoder and diffusion network, the lack of global correlation and conditional flexibility of the existing 3D molecular generation algorithm is solved, and the support and efficient correlation of multiple molecular generation methods is achieved, which improves the generation of molecules diversity and complexity.

CN119274693APending Publication Date: 2025-01-07HANGZHOU CARBON SILICON SMART TECH DEV CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411178618.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

The existing 3D molecular generation algorithms have shortcomings in terms of global correlation, conditional flexibility and generation diversity. They cannot complete R groups, linkers and self-generating simultaneously, and need to give or predict the number of atoms, which limits the application of the algorithm. sex.

Method used

By obtaining model training samples, including the SDF characteristics of the molecule, the SDF characteristics of the protein pocket and the SDF characteristics of the molecule retained part, the conditional variation autoencoder and diffusion network are used for training, so as to achieve support for multiple molecular generation methods to ensure that the molecules and The global correlation of proteins does not require a given number of atoms.

Benefits of technology

It improves the diversity and complexity of the generated molecules, enhances the flexibility and applicability of the algorithm, and realizes the effective correlation between molecules and proteins.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119274693A_ABST
    Figure CN119274693A_ABST
Patent Text Reader

Abstract

The invention provides a training method and device for a 3D molecule generation model. Comprising the steps that a model training sample is obtained, and the model training sample comprises SDF features of molecules in a specified molecule generation mode, SDF features of protein pockets and SDF features of molecule retention parts of the molecules; the SDF features are used for representing the distance from each grid point in three-dimensional grid points of the molecule to an atom closest to the grid point, and the type of each grid point is determined by the atom type of the grid point closest to the grid point; in a first training stage, SDF features of a protein pocket and SDF features of a molecule retention part are used as molecule constraint conditions, and a conditional variational auto-encoder in a to-be-trained 3D molecule generation model is trained based on the SDF features of molecules and the molecule constraint conditions; and in a second training stage, freezing parameters of the conditional variation auto-encoder, training a diffusion network to fit implicit vectors output by the encoder in the conditional variation auto-encoder, and training to obtain a 3D molecular generation model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of 3D molecular reconstruction, and in particular to a training method and device for a 3D molecular generation model. Background Art

[0002] In recent years, molecular generation technology has made significant progress in the field of drug design and discovery. 2D molecular generation methods have attracted much attention due to their speed and efficiency, but their inherent limitations are also becoming increasingly apparent. Due to the lack of sufficient interaction and interaction between proteins and small molecules in the 2D molecular generation process, these generated molecules have low correlation with protein pockets, resulting in the generated molecules often being ineffective.

[0003] At present, 3D molecular generation algorithms have gradually become mainstream, and these algorithms can better capture the complexity of protein-ligand interactions. For example, algorithms such as pocket2mol and difflinker have shown relatively excellent results. However, pocket2mol uses an autoregressive generation method and cannot achieve global correlation during the molecular generation process. The difflinker algorithm requires the number of atoms to be given or predicted in advance as a condition, which has strong limitations. In addition, these two methods cannot simultaneously complete Rgroup, Linker and denovo generation during the generation process.

[0004] Existing 3D generation algorithms have the following problems:

[0005] 1. Insufficient global correlation: For example, pocket2mol, due to the use of autoregressive generation method, cannot achieve global correlation between molecules and protein pockets during the molecule generation process.

[0006] 2. Conditional limitations: For example, difflinker requires the number of atoms to be generated to be given or predicted in advance, which limits the flexibility and applicability of the algorithm.

[0007] 3. Limited generation range: Existing methods cannot simultaneously complete the generation of R groups, linkers, and spontaneous generation, resulting in insufficient diversity and complexity in the generation process. Summary of the invention

[0008] The technical problem to be solved by the embodiments of the present application is to provide a training method and device for a 3D molecular generation model, so as to support a variety of molecular generation methods, ensure that the molecules will not conflict with proteins, and enhance the rationality of the conformation.

[0009] In a first aspect, an embodiment of the present application provides a method for training a 3D molecular generation model, the method comprising:

[0010] Obtaining a model training sample, the model training sample comprising: an SDF feature of a molecule under a specified molecule generation mode, an SDF feature of a protein pocket, and an SDF feature of a molecule retention portion of the molecule; the SDF feature is used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the atom closest to it, and the type of each grid point is determined by the atom type of the grid point closest to it;

[0011] In the first training stage, the SDF features of the protein pocket and the SDF features of the retained part of the molecule are used as molecular constraints, and the conditional variational autoencoder in the 3D molecule generation model to be trained is trained based on the SDF features of the molecule and the molecular constraints;

[0012] In the second training stage, the parameters of the conditional variational autoencoder are frozen, and the diffusion network in the 3D molecular generation model to be trained is trained to fit the latent vector output by the encoder in the conditional variational autoencoder to obtain the 3D molecular generation model through training.

[0013] Optionally, obtaining a model training sample includes:

[0014] When the specified molecule generation method is the Denovo generation method, the molecule is traversed based on the DFS recursive traversal method to construct the atomic order of the molecule;

[0015] Performing noise processing on the molecule to obtain a noisy molecule;

[0016] Constructing the SDF features of the noisy molecule and the SDF features of the protein pocket;

[0017] The atomic order of the molecule, the SDF features of the noisy molecule, and the SDF features of the protein pocket are used as the model training samples.

[0018] Optionally, obtaining a model training sample includes:

[0019] When the designated molecule generation mode is the R-Group generation mode, obtaining the molecular breakpoints of the molecular fragments corresponding to the molecule, and adding breakpoint identifiers to the molecular fragments;

[0020] The molecular breakpoints of each molecular fragment are preferentially added to the traversal queue, and the molecular fragments are traversed based on the BFS recursive traversal method to construct the atomic order of the molecular fragments;

[0021] Performing noise processing on the to-be-generated molecular fragment of the two molecular fragments to obtain a noisy molecular fragment;

[0022] Constructing the SDF features of the molecular fragments after adding noise, the SDF features of the protein pocket, and the SDF features of the retained parts of the two molecular fragments;

[0023] The atomic order of the molecular fragment, the SDF features of the molecular fragment after noise addition, the SDF features of the protein pocket and the SDF features of the retained part of the fragment are used as the model training samples.

[0024] Optionally, obtaining a model training sample includes:

[0025] When the designated molecule generation mode is a Linker generation mode, obtaining molecular breakpoints of three molecular fragments corresponding to the molecule, and adding breakpoint identifiers to the three molecular fragments;

[0026] Each of the molecular breakpoints is preferentially added to the traversal queue, and each of the molecular fragments is traversed based on the BFS recursive traversal method to construct the atomic order of each of the molecular fragments;

[0027] Performing noise processing on the molecular fragment to be generated among the three molecular fragments to obtain a noisy molecular fragment;

[0028] Constructing the SDF features of the molecular fragments after adding noise, the SDF features of the protein pocket and the SDF features of the retained parts of the three molecular fragments;

[0029] The atomic sequence of each of the molecular fragments, the SDF features of the molecular fragments after noise addition, the SDF features of the protein pocket and the SDF features of the retained part of the fragment are used as the model training samples.

[0030] Optionally, the conditional variational autoencoder includes: two first encoders and a second encoder connected in parallel, and a decoder connected to the first encoder and the second encoder,

[0031] The method of using the SDF features of the protein pocket and the SDF features of the retained part of the molecule as molecular constraints, and training the conditional variational autoencoder in the 3D molecule generation model to be trained based on the SDF features of the molecule and the molecular constraints, comprises:

[0032] Calling the first encoder to perform feature processing on the SDF feature of the molecule, the SDF feature of the protein pocket, and the SDF feature of the retained part of the molecule to obtain a latent vector of the input information;

[0033] calling the second encoder to perform feature processing on the SDF features of the protein pocket and the SDF features of the molecule retention part to obtain a molecular constraint condition vector;

[0034] Calling the decoder to process the molecular constraint condition vector and the latent vector to obtain a predicted 3D molecular conformation;

[0035] Based on the predicted 3D molecular conformation and the real conformation of the model training sample, a loss value of the conditional variational autoencoder is calculated;

[0036] When the loss value is within a preset range, it is determined that the training of the conditional variational autoencoder is completed.

[0037] Optionally, calling the decoder to process the molecular constraint condition vector and the latent vector to obtain a predicted 3D molecular conformation includes:

[0038] Randomly adding Gaussian noise to the latent vector to obtain a noisy latent vector;

[0039] Inputting the numerator constraint vector and the noisy latent vector into the decoder;

[0040] The decoder is called to process the molecular constraint condition vector and the noise-added latent vector to obtain the predicted 3D molecular conformation.

[0041] Optionally, the step of training the diffusion network in the 3D molecular generation model to be trained to fit the latent vector output by the encoder in the conditional variational autoencoder comprises:

[0042] Calling the TransformerBlock of the diffusion network to first calculate the attention features of the x-axis and y-axis of the latent vector, and then calculating the attention features of the z-axis;

[0043] Calling the ODE-based rectified flow of the diffusion network to perform denoising on the latent vector according to the calculated attention features to obtain the predicted Gaussian noise of the latent vector at the current moment;

[0044] Based on the predicted Gaussian noise, a loss value of the diffusion network is calculated;

[0045] When the loss value is within a preset range, it is determined that the diffusion network training is completed.

[0046] Optionally, after the training to obtain the 3D molecular generation model, the method further comprises:

[0047] Get protein pockets;

[0048] Sampling the Gaussian distribution to obtain sampling features;

[0049] Calling the encoder of the conditional variational autoencoder to process the protein pocket to obtain a protein pocket encoding vector representation;

[0050] Iteratively processing the sampling features based on the protein pocket encoding vector representation based on the diffusion network, so that the sampling features are gradually migrated from the Gaussian distribution to the distribution of small molecules in the latent space, and the distribution vector representation of the sampling features in the latent space is obtained;

[0051] The decoder of the conditional variational autoencoder is called to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain a 3D molecular conformation.

[0052] Optionally, the decoder calling the conditional variational autoencoder performs self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain a 3D molecular conformation, including:

[0053] Calling the decoder of the conditional variational autoencoder to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain an initial 3D molecular conformation;

[0054] The initial 3D molecular conformation is re-input into the encoder and decoder of the conditional variational autoencoder for denoising and optimization processing to obtain the 3D molecular conformation.

[0055] In a second aspect, an embodiment of the present application provides a training device for a 3D molecular generation model, the device comprising:

[0056] A model sample acquisition module is used to acquire model training samples, wherein the model training samples include: SDF features of molecules under a specified molecular generation mode, SDF features of protein pockets, and SDF features of the molecular retention part of the molecules; the SDF features are used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the atom closest to it, and the type of each grid point is determined by the atom type of the grid point closest to it;

[0057] An autoencoder training module is used for, in a first training phase, using the SDF features of the protein pocket and the SDF features of the retained part of the molecule as molecular constraints, and training a conditional variational autoencoder in the 3D molecule generation model to be trained based on the SDF features of the molecule and the molecular constraints;

[0058] The diffusion network training module is used to freeze the parameters of the conditional variational autoencoder in the second training stage, train the diffusion network in the 3D molecular generation model to be trained to fit the latent vector output by the encoder in the conditional variational autoencoder, so as to train and obtain the 3D molecular generation model.

[0059] Optionally, the model sample acquisition module includes:

[0060] A first atomic order construction unit is used for traversing the molecule based on a DFS recursive traversal method to construct an atomic order of the molecule when the specified molecule generation method is a Denovo generation method;

[0061] A first noise-added molecule acquisition unit, used for performing noise-added processing on the molecule to obtain a noisy molecule;

[0062] A first SDF feature construction unit, used to construct the SDF feature of the noisy molecule and the SDF feature of the protein pocket;

[0063] The first sample acquisition unit is used to use the atomic sequence of the molecule, the SDF feature of the noisy molecule, and the SDF feature of the protein pocket as the model training samples.

[0064] Optionally, the model sample acquisition module includes:

[0065] a molecule breakpoint acquisition unit, configured to acquire the molecule breakpoints of the molecule fragments corresponding to the molecule and add breakpoint identifiers to the molecule fragments when the specified molecule generation mode is the R-Group generation mode;

[0066] A second atomic order construction unit is used to preferentially add the molecular breakpoint of each molecular fragment into the traversal queue, and traverse the molecular fragments based on a BFS recursive traversal method to construct an atomic order of each molecular fragment;

[0067] A second noise-added molecule acquisition unit is used to perform noise processing on the to-be-generated molecular fragments of the two molecular fragments to obtain a noisy molecular fragment;

[0068] A second SDF feature construction unit is used to construct the SDF features of the molecular fragments after the noise addition, the SDF features of the protein pocket, and the SDF features of the retained parts of the two molecular fragments;

[0069] The second sample acquisition unit is used to use the atomic order of the molecular fragment, the SDF feature of the noisy molecular fragment, the SDF feature of the protein pocket and the SDF feature of the retained part of the fragment as the model training samples.

[0070] Optionally, the model sample acquisition module includes:

[0071] a breakpoint identifier adding unit, configured to obtain the molecular breakpoints of three molecular fragments corresponding to the molecule when the specified molecule generation mode is a Linker generation mode, and add breakpoint identifiers to the three molecular fragments;

[0072] A third atomic order construction unit is used to preferentially add each of the molecular breakpoints to the traversal queue, and traverse each of the molecular fragments based on a BFS recursive traversal method to construct an atomic order of each of the molecular fragments;

[0073] A third noisy molecule acquisition unit is used to perform noise processing on the to-be-generated molecular fragments among the three molecular fragments to obtain a noisy molecular fragment;

[0074] A third SDF feature construction unit is used to construct the SDF features of the molecular fragments after the noise addition, the SDF features of the protein pockets, and the SDF features of the retained parts of the three molecular fragments;

[0075] The third sample acquisition unit is used to use the atomic sequence of each of the molecular fragments, the SDF features of the noisy molecular fragments, the SDF features of the protein pockets and the SDF features of the retained part of the fragments as the model training samples.

[0076] Optionally, the conditional variational autoencoder includes: two first encoders and a second encoder connected in parallel, and a decoder connected to the first encoder and the second encoder,

[0077] The autoencoder training module includes:

[0078] a latent vector acquisition unit, configured to call the first encoder to perform feature processing on the SDF feature of the molecule, the SDF feature of the protein pocket, and the SDF feature of the retained part of the molecule to obtain a latent vector of the input information;

[0079] A constraint condition vector acquisition unit, used for calling the second encoder to perform feature processing on the SDF feature of the protein pocket and the SDF feature of the molecule retention part to obtain a molecular constraint condition vector;

[0080] A predicted molecular conformation acquisition unit, used for calling the decoder to process the molecular constraint condition vector and the latent vector to obtain a predicted 3D molecular conformation;

[0081] A first loss calculation unit, configured to calculate a loss value of the conditional variational autoencoder based on the predicted 3D molecular conformation and the real conformation of the model training sample;

[0082] The autoencoder training unit is used to determine that the conditional variational autoencoder training is completed when the loss value is within a preset range.

[0083] Optionally, the predicted molecular conformation acquisition unit comprises:

[0084] A noise vector acquisition subunit, used for randomly adding Gaussian noise to the latent vector to obtain a noisy latent vector;

[0085] A vector input subunit, used for inputting the molecular constraint condition vector and the noisy latent vector into the decoder;

[0086] The predicted molecular conformation acquisition subunit is used to call the decoder to process the molecular constraint condition vector and the noise-added latent vector to obtain the predicted 3D molecular conformation.

[0087] Optionally, the diffusion network training module includes:

[0088] An attention feature calculation unit, used to call the TransformerBlock of the diffusion network to first calculate the attention features of the x-axis and y-axis of the latent vector, and then calculate the attention features of the z-axis;

[0089] A predicted Gaussian distribution acquisition unit is used to call the ODE-based rectified flow of the diffusion network to perform noise reduction processing on the latent vector according to the calculated attention feature, so as to obtain the predicted Gaussian noise of the latent vector at the current moment;

[0090] A second loss calculation unit, configured to calculate a loss value of the diffusion network based on the predicted Gaussian noise;

[0091] The diffusion network training unit is used to determine that the diffusion network training is completed when the loss value is within a preset range.

[0092] Optionally, the device further comprises:

[0093] A protein pocket acquisition module, used to acquire protein pockets;

[0094] A sampling feature acquisition module is used to sample the Gaussian distribution to obtain sampling features;

[0095] A vector representation acquisition module, used for calling the encoder of the conditional variational autoencoder to process the protein pocket to obtain a protein pocket encoding vector representation;

[0096] A distribution representation acquisition module, used for iteratively processing the sampling features based on the protein pocket encoding vector representation based on the diffusion network, so that the sampling features are gradually transferred from the Gaussian distribution to the distribution of small molecules in the latent space, and the distribution vector representation of the sampling features in the latent space is obtained;

[0097] The 3D molecular conformation acquisition module is used to call the decoder of the conditional variational autoencoder to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain the 3D molecular conformation.

[0098] Optionally, the 3D molecular conformation acquisition module includes:

[0099] An initial molecular conformation acquisition unit, used for calling the decoder of the conditional variational autoencoder to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain an initial 3D molecular conformation;

[0100] The 3D molecular conformation acquisition unit is used to re-input the initial 3D molecular conformation into the encoder and decoder of the conditional variational autoencoder for denoising and optimization processing to obtain the 3D molecular conformation.

[0101] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0102] A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the training method for generating a 3D molecular model described in any one of the above items is implemented.

[0103] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the above-mentioned methods for training a 3D molecular generation model.

[0104] Compared with the prior art, the embodiments of the present application have the following advantages:

[0105] In the embodiment of the present application, by obtaining the model training sample, the model training sample includes: the SDF feature of the molecule under the specified molecular generation mode, the SDF feature of the protein pocket and the SDF feature of the molecule retained part of the molecule, the SDF feature is used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the nearest atom, and the type of each grid point is determined by the type of atom of the nearest grid point. In the first training stage, the SDF feature of the protein pocket and the SDF feature of the molecule retained part are used as molecular constraints, and the conditional variational autoencoder in the 3D molecular generation model to be trained is trained based on the SDF feature of the molecule and the molecular constraint. In the second training stage, the parameters of the conditional variational autoencoder are frozen, and the implicit vector output by the encoder in the diffusion network fitting conditional variational autoencoder in the 3D molecular generation model to be trained is trained to obtain the 3D molecular generation model. The embodiment of the present application can make the model support multiple molecular generation modes by training the 3D molecular generation model according to the specified molecular generation mode, that is, R groups, linkers and spontaneous generation can be completed at the same time, which greatly enhances the diversity and complexity of the generated molecules. By using a diffusion network to associate the global information of protein pockets and ligand molecules, global association is achieved during the 3D molecule generation process. At the same time, there is no need to give or predict the number of atoms to be generated, which improves the flexibility and applicability of the algorithm.

[0106] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0107] Figure 1 A flowchart of the steps of a training method for a 3D molecular generation model provided in an embodiment of the present application;

[0108] Figure 2 A schematic diagram of a model training architecture provided in an embodiment of the present application;

[0109] Figure 3 A schematic diagram of a model reasoning process provided in an embodiment of the present application;

[0110] Figure 4 A schematic diagram of the structure of a training device for a 3D molecular generation model provided in an embodiment of the present application;

[0111] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0112] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0113] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0114] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or terminal including the elements.

[0115] Reference Figure 1 , showing a flow chart of the steps of a training method for a 3D molecular generation model provided in an embodiment of the present application, such as Figure 1 As shown, the training method of the 3D molecular generation model may include: step 101, step 102 and step 103.

[0116] Step 101: Obtain model training samples, the model training samples including: SDF features of molecules under a specified molecule generation method, SDF features of protein pockets and SDF features of the molecular retention part of the molecule; the SDF features are used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the atom closest to it, and the type of each grid point is determined by the atom type of the grid point closest to it.

[0117] In this embodiment, the SDF (Signed Distance Function) feature of a molecule can represent a data modeling method of a molecule. It is a new method of characterizing a molecule. The SDF feature can be used to characterize the distance from each grid point in the three-dimensional grid of a molecule to the atom closest to it, and the type of each grid point is determined by the atom type of the grid point closest to it.

[0118] When training the 3D molecular generation model, model training samples may be obtained, wherein the model training samples may include: SDF features of molecules under a specified molecular generation method, SDF features of protein pockets, and SDF features of a molecular retention portion of the molecule.

[0119] In this example, the specified molecule generation method may include at least one of a Denovo generation method, an R-Group generation method, and a Linker generation method.

[0120] Understandably, in the Denovo generation mode, the model training samples may include: the SDF features of the molecule and the SDF features of the protein pocket, and the SDF features of the retained part of the molecule are empty. In the R-Group generation mode and the Linker generation mode, the model training samples may include: the SDF features of the molecule, the SDF features of the protein pocket, and the SDF features of the retained part of the molecule.

[0121] Among them, Denovo refers to generating molecules from scratch. R-Group refers to continuing to grow molecules at specified positions based on existing molecular fragments. Linker refers to generating a molecular local structure that connects two molecular fragments based on two molecular fragments.

[0122] The implementation process of obtaining model training samples can be described in detail as follows in combination with the above three molecular generation methods.

[0123] When the molecule generation method is specified as Denovo generation method, the process of obtaining model training samples may include the following steps:

[0124] A1. Traverse the molecule based on the DFS recursive traversal method to construct the atomic order of the molecule.

[0125] In this embodiment, when using DFS (Depth-First Search) recursive traversal method to traverse molecules, the molecular structure can be defined first. For example, a molecular graph structure, in which nodes represent atoms and edges represent chemical bonds. A node (atom) is selected in the graph as the starting point of the traversal. This is usually a specific atom in the molecule, such as the first atom on the main chain or an atom with specific properties.

[0126] Starting from the starting point, select an unvisited adjacent node (atom) for recursive visit. In the recursive function, operate on the current node (atom) (such as recording it in a list), and then repeat this process for all its unvisited adjacent nodes. Use a stack (implicitly, in the recursive call) to record the visit path to ensure that it is possible to backtrack to the previous node. When there are no more adjacent nodes to visit, the recursive function returns and continues the previous search path.

[0127] During the DFS traversal, the atoms can be added to the list in the order they are visited, thus building up the atomic order of the molecule.

[0128] A2. Performing noise processing on the molecule to obtain a noisy molecule.

[0129] The molecule can be processed by adding noise to obtain a noisy molecule. Specifically, N atoms can be randomly selected and then Gaussian perturbations can be performed on them to enhance the robustness of the encoder. In addition, adding noise to the input of the molecular conformation can force the model to increase the difficulty during training and enhance the model to learn more knowledge.

[0130] Of course, in a specific implementation, other noise adding methods such as atomic replacement, bond breaking and forming, etc. may also be used. This embodiment does not limit the method of molecular noise adding processing.

[0131] A3. Construct the SDF features of the noisy molecule and the SDF features of the protein pocket.

[0132] Then, the SDF features of the noisy molecules and the SDF features of the protein pockets can be constructed. The construction process of the SDF features will be described in detail in the following process, and will not be described in detail in this embodiment.

[0133] A4. Using the atomic sequence of the molecule, the SDF features of the noisy molecule, and the SDF features of the protein pocket as the model training samples.

[0134] Furthermore, the atomic order of the molecule, the SDF features of the noisy molecule, and the SDF features of the protein pocket can be used as model training samples.

[0135] When the molecule generation method is specified as the R-Group generation method, the process of obtaining the model training sample may include the following steps:

[0136] B1. Obtaining the molecular breakpoints of the molecular fragments corresponding to the molecule, and adding breakpoint identifiers to the molecular fragments.

[0137] In this embodiment, when the molecule generation mode is specified as the R-Group generation mode, the molecule can be sliced ​​first to obtain two molecular fragments therein, and the molecular breakpoints of the molecular fragments corresponding to the molecule are obtained, and a breakpoint identifier is added to each molecular fragment.

[0138] B2. The molecular breakpoints of each molecular fragment are preferentially added to the traversal queue, and the molecular fragments are traversed based on the BFS recursive traversal method to construct the atomic order of the molecular fragments.

[0139] When traversing based on the BFS (breadth first search) recursive traversal method, the molecular breakpoints of each molecular fragment can be first added to the traversal queue. Then, each molecular fragment is traversed based on the BFS recursive traversal method to construct the atomic order of each molecular fragment. The traversal method is similar to the traversal method of step A1 above, and this embodiment will not be repeated here.

[0140] B3. Performing noise processing on the molecular fragment to be generated in the two molecular fragments to obtain a noisy molecular fragment.

[0141] Then, the two molecular fragments (the two molecular fragments required by the R-Group generation method) can be subjected to noise processing to obtain the molecular fragments after noise addition. The noise addition method is similar to the noise addition method of step A2 above, and this embodiment will not be repeated here.

[0142] B4. Constructing the SDF features of the noisy molecular fragments, the SDF features of the protein pocket, and the SDF features of the retained parts of the two molecular fragments.

[0143] Furthermore, the SDF features of the noisy molecular fragments, the SDF features of the protein pockets, and the SDF features of the retained parts of the two molecular fragments can be constructed.

[0144] B5. Using the atomic order of the molecular fragment, the SDF features of the molecular fragment after noise addition, the SDF features of the protein pocket and the SDF features of the retained part of the fragment as the model training samples.

[0145] Finally, the atomic order of the molecular fragment, the SDF features of the noisy molecular fragment, the SDF features of the protein pocket and the SDF features of the retained part of the fragment can be used as model training samples.

[0146] When the molecule generation mode is specified as Linker generation mode, the process of obtaining model training samples may include the following steps:

[0147] C1. Obtaining molecular breakpoints of three molecular fragments corresponding to the molecule, and adding breakpoint identifiers to the three molecular fragments.

[0148] In this embodiment, when the molecule generation mode is specified as the Linker generation mode, the molecule may be sliced ​​first to obtain three molecular fragments therein, and the molecular breakpoints of the three molecular fragments are obtained, and breakpoint identifiers are added to the three molecular fragments respectively.

[0149] C2. Each of the molecular breakpoints is preferentially added to the traversal queue, and each of the molecular fragments is traversed based on the BFS recursive traversal method to construct the atomic order of each of the molecular fragments.

[0150] When traversing based on the BFS recursive traversal method, each molecular breakpoint can be first added to the traversal queue. Then, each molecular fragment is traversed based on the BFS recursive traversal method to construct the atomic order of each molecular fragment. The traversal method is similar to the traversal method of step A1 above, and this embodiment will not be repeated here.

[0151] C3. Performing noise processing on the molecular fragments to be generated among the three molecular fragments to obtain the noisy molecular fragments.

[0152] Then, the molecular fragments to be generated among the three molecular fragments can be subjected to noise addition processing to obtain the molecular fragments after noise addition. It can be understood that the molecular fragments to be generated can be the molecular fragments in the middle part of the three molecular fragments, and the molecular fragments at both ends can be used as conditions (i.e., the molecular fragments of the retained part). The noise addition method is similar to the noise addition method of the above step A2, and this embodiment will not be repeated here.

[0153] C4. Constructing the SDF features of the noisy molecular fragments, the SDF features of the protein pockets, and the SDF features of the retained parts of the three molecular fragments.

[0154] Furthermore, the SDF features of each noisy molecular fragment, the SDF features of the protein pocket, and the SDF features of the retained parts of the three molecular fragments can be constructed.

[0155] C5. Using the atomic sequence of each of the molecular fragments, the SDF features of the molecular fragments after noise addition, the SDF features of the protein pocket and the SDF features of the retained part of the fragment as the model training samples.

[0156] Finally, the atomic order of each molecular fragment, the SDF features of the noisy molecular fragment, the SDF features of the protein pocket and the SDF features of the retained part of the fragment can be used as model training samples.

[0157] In the embodiment of the present application, since the decoder is autoregressive, it is necessary to consider the impact of the decoding order on the final generation effect. In this example, the atomic orders of Denovo, Rgroup and Linker are considered respectively. For Denovo generation, the atomic order is constructed using the order of dfs recursive traversal. For Rgroup generation, traversal starts from each fragment, breakpoints are added to the queue first, and then bfs traversal is performed. For Linker generation, traversal starts from each fragment, multiple breakpoints are added to the queue first, and then bfs traversal is performed. Experiments show that this method of sorting in topological order is far superior to random sorting.

[0158] At the same time, in order to further enable the model to perceive the location of breakpoint information and expect the model to eventually grow at the specified breakpoint when executing Rgroup and Linker tasks, breakpoint marks can be made for each atom during data modeling. That is, each atom will have a mark symbol to indicate whether it is a breakpoint. No breakpoint is represented by 0, and the numbers of other breakpoints are incremented in sequence. This is mainly used to strengthen growth at specified sites during generation.

[0159] Next, the construction process of the SDF feature is described in detail.

[0160] In this example, the input of the model is a new way to characterize molecules, namely the SDF feature. Taking the maximum representation range of 15.5A (angstroms) and the resolution of 0.5A as an example, a 32x32x32 sdf three-dimensional feature can be constructed. The feature contains two parts, distance and type. The distance is to fill each grid point with the distance from the coordinates of the grid point to the nearest atom. The SDF feature can be similar to an envelope of a molecule or protein, which can better perceive the relationship between the molecule and the pocket shape. The type is the one-hot feature of the atomic type. For proteins, use each atom of the ligand as the center and 6A as the radius to draw all the atomic types and coordinates of the protein pocket. Both protein and ligand molecules are represented by SDF features.

[0161] During the training process, a data augmentation strategy is used to achieve the generation of Linker and Rgroup at the same time. For Rgroup generation, a fragment is given as a condition, and it is spliced ​​with the protein as part of the protein and sent to the model as a condition. For Linker generation, two fragments are given as conditions, and they are spliced ​​with the protein as part of the protein and sent to the model as a condition, where the fragment segmentation of Rgroup and Linker is achieved by randomly breaking the rotatable bonds. In addition, the complex is pulled to the center of the far point and the conformation of the complex is randomly rotated, so that the model can be more robust to rotation and translation.

[0162] Step 102: In the first training stage, the SDF features of the protein pocket and the SDF features of the retained part of the molecule are used as molecular constraints, and the conditional variational autoencoder in the 3D molecule generation model to be trained is trained based on the SDF features of the molecule and the molecular constraints.

[0163] In this embodiment, the training of the 3D molecular generation model may include two stages. In the first training stage, the SDF features of the protein pocket and the SDF features of the molecule retention part may be used as molecular constraints, and the conditional variational autoencoder in the 3D molecular generation model to be trained may be trained based on the SDF features of the molecule and the molecular constraints. The implementation process may be described in detail in conjunction with the following specific implementation method.

[0164] In a specific implementation of the present application, the above step 102 may include:

[0165] Sub-step S1: calling the first encoder to perform feature processing on the SDF features of the molecule, the SDF features of the protein pocket and the SDF features of the retained part of the molecule to obtain a latent vector of the input information.

[0166] In this embodiment, the conditional variational autoencoder (cVAE) may include two encoders (i.e., a first encoder and a second encoder) connected in parallel, and a decoder connected to the two encoders, such as Figure 2 As shown. The SDF features of the molecule, the SDF features of the protein pocket and the SDF features of the retained portion of the molecule can be used as inputs of the first encoder. The SDF features of the protein pocket and the SDF features of the retained portion of the molecule can be used as inputs of the second encoder. It can be understood that in the case of the Rgroup molecule generation method and the Linker molecule generation method, the SDF features of the retained portion of the molecule need to be input as constraints at the same time.

[0167] When training a 3D molecular generation model, you can first train a cVAE, send the protein pocket and its retained part of the molecule as conditions to the encoder and decoder, and then encode and decode the generated part. The proxy task of the cVAE stage is conformation denoising, rather than direct reconstruction, because the generated conformation can be denoised once in the inference stage. In addition, denoising as a proxy task for training makes the model more robust.

[0168] First, the first encoder can be called to perform feature processing on the SDF features of the molecule, the SDF features of the protein pocket, and the SDF features of the retained part of the molecule to obtain the latent vector of the input information. In this process, the first encoder (i.e., the main encoder) is responsible for receiving the SDF features of the molecule and the conditions (the SDF features of the protein pocket and the SDF features of the retained part of the molecule) as input. The main task of this encoder is to learn the latent representation of the molecule and its conditions, which can capture the key information between the molecular structure and the conditions. The output is the representation in the latent space (i.e., the latent vector), which captures the key information of the molecular structure and conditions. In the latent space, these representations can be operated to generate new molecules that both meet the given conditions and have similar properties to the original molecules.

[0169] In this example, the dimension of the latent vector z is defined in three values ​​(16, 256, 512), and after testing, 512 is found to be the best.

[0170] Sub-step S2: calling the second encoder to perform feature processing on the SDF features of the protein pocket and the SDF features of the retained part of the molecule to obtain a molecular constraint condition vector.

[0171] At the same time, the second encoder (i.e., conditional encoder) can be called to perform feature processing on the SDF features of the protein pocket and the SDF features of the retained part of the molecule (empty in denovo mode) to obtain the molecular constraint vector. The second encoder only receives the conditions (SDF features of the protein pocket and the SDF features of the retained part of the molecule) as input. Its role is to learn the potential representation of the conditions themselves (i.e., the molecular constraint vector), which will be used to guide the generation of molecules during the decoding process to ensure that the generated molecules meet specific conditions.

[0172] Sub-step S3: calling the decoder to process the molecular constraint vector and the latent vector to obtain a predicted 3D molecular conformation.

[0173] The outputs of the first encoder and the second encoder can be used as inputs to the decoder. The decoder is called to process the molecular constraint vector and the latent vector to obtain the predicted 3D molecular conformation. That is, the decoder receives the outputs from the first encoder and the second encoder as inputs. The task of the decoder is to use these potential representations to reconstruct or generate molecular SDF features that meet the conditions. The decoder receives the potential representations from the two encoders as inputs. Using these potential representations, the decoder generates new molecular SDF features through a reverse mapping process. During the generation process, the output of the second encoder (the potential representation of the condition) guides the decoder to generate molecules that meet the conditions.

[0174] Understandably, the output of the model is represented by a string sequence. Taking three atoms as an example, the representation method is: <s> C:xyzb N:xyzb O:xyzb< / s> , where C, N, and O represent carbon, nitrogen, and oxygen atom types, and are arranged strictly in the above order. xyz represents Cartesian coordinates, and b represents the breakpoint id. Here, the tokens composed of the string sequence of each molecule are restricted to not exceed 1536. The string segmentation method can adopt BPE (Byte Pair Encoding) segmentation.

[0175] Of course, in order to ensure the reconstruction accuracy, the constraint weight term of KL divergence loss is often set very small, resulting in little effect of KL divergence loss, the standard deviation is often learned as a small value, VAE will degenerate into AE, resulting in the latent vector z often being uniquely mapped to a point in high-dimensional space, rather than a distributed area. In the generation stage, if the diffusion cannot accurately sample the trained point (often it will not be sampled), then the reconstruction will be an erroneous result. Therefore, a Gaussian noise with a dynamic signal-to-noise ratio can be added to the latent vector z. This has two advantages: one is that z will not be mapped to a single point, thereby causing VAE to degenerate into AE, and it can enhance the robustness of the Decoder. The other is that z is no longer restricted by Gaussian distribution and can be arbitrarily distributed. The specific implementation process can be: randomly add Gaussian noise to the latent vector output by the first encoder to obtain a noisy latent vector. Then, the molecular constraint vector and the noisy latent vector can be input into the decoder. The decoder is called to process the molecular constraint vector and the noisy latent vector to obtain a predicted 3D molecular conformation.

[0176] like Figure 2 As shown, the decoder may include: MLP, Layer Norm, MHA, Layer Norm, LayerNorm: Layer Norm is applied at the input and / or output of each layer (or certain layers) to stabilize the training process and accelerate convergence. Layer Norm reduces the problem of internal covariate shift by normalizing the input or output of the layer. MHA (Multi-Head Attention Mechanism): MHA allows the decoder to focus on different parts of the input sequence and previously generated molecular structure parts at the same time during the generation process. This helps the decoder capture the complex dependencies of the molecular structure. MLP: Multi-layer perceptron is used to perform nonlinear transformations on features after each attention layer to enhance the expressiveness of the model.

[0177] At the same time, combined with an autoregressive decoding strategy, the molecule can be decoded into a variable length according to the generated shape within the cavity of the protein pocket, which improves the effectiveness and relevance of the generated molecules.

[0178] Sub-step S4: Based on the predicted 3D molecular conformation and the actual conformation of the model training sample, the loss value of the conditional variational autoencoder is calculated.

[0179] After obtaining the predicted 3D molecular conformation, the loss value of the conditional variational autoencoder can be calculated based on the predicted 3D molecular conformation and the real conformation of the model training sample. In the conditional variational autoencoder (cVAE), the calculation of the loss function is a key part of model training, which is used to evaluate the difference between the predicted 3D molecular conformation generated by the model and the real conformation of the model training sample. For cVAE based on SDF (Signed Distance Function) features or similar three-dimensional molecular representations, the loss function usually contains several key components: reconstruction loss, latent space regularization loss (such as KL divergence), and may also include conditional matching loss (if the model pays special attention to condition satisfaction). Since this embodiment adds Gaussian noise with a dynamic signal-to-noise ratio to the latent vector output by the first encoder, when calculating the loss value, the latent space regularization loss can be ignored, and only the reconstruction loss and conditional matching loss can be calculated.

[0180] Sub-step S5: When the loss value is within a preset range, determining that the training of the conditional variational autoencoder is completed.

[0181] After the loss value is calculated, it can be determined whether the loss value is within a preset range. If so, it means that the conditional variational autoencoder has converged. At this time, it can be determined that the conditional variational autoencoder training is completed.

[0182] Step 103: In the second training stage, the parameters of the conditional variational autoencoder are frozen, and the diffusion network in the 3D molecular generation model to be trained is trained to fit the latent vector output by the encoder in the conditional variational autoencoder to obtain the 3D molecular generation model through training.

[0183] After completing the training of the conditional variational autoencoder, enter the second training stage. In the second training stage, the model parameters of the conditional variational autoencoder can be frozen. And the diffusion network in the 3D molecular generation model to be trained is trained to fit the latent vector output by the encoder in the conditional variational autoencoder to train the 3D molecular generation model. Specifically, after the cVAE training is completed, the next step is to use the diffusion network to fit the latent vector output by the encoder. The diffusion network generates data by gradually removing noise (or called the "reverse process"), which, combined with the latent space representation of the cVAE, can generate new 3D molecular conformations. The training process of the diffusion network can be described in detail in conjunction with the following specific implementation method.

[0184] In a specific implementation of the present application, the above step 103 may include:

[0185] Sub-step N1: calling the TransformerBlock of the diffusion network to first calculate the attention features of the x-axis and y-axis of the latent vector, and then calculate the second attention feature of the z-axis.

[0186] In this embodiment, the diffusion network (i.e., the Diffusion Model model) can select Dit. Considering the generation efficiency and training overhead, the TransformerBlock of Dit calculates the attention of the xy axis first, and then calculates the attention of the z axis when calculating Attention. This is more efficient, faster inference, and occupies less memory. That is, the TransformerBlock of the diffusion network is called to first calculate the attention features of the x-axis and y-axis of the latent vector, and then calculate the attention features of the z axis.

[0187] Sub-step N2: calling the ODE-based rectified flow of the diffusion network to perform denoising on the latent vector according to the calculated attention features to obtain the predicted Gaussian noise of the latent vector at the current moment.

[0188] Then, the ODE-based rectified flow of the diffusion network can be called to perform noise reduction on the latent vector according to the calculated attention features to obtain the predicted Gaussian noise of the latent vector at the current moment. In the embodiment of the present application, the rectified flow of ODE can make the sampling converge quickly, and only a few sampling steps are needed to achieve the effect of 1000 steps of DDPM sampling, which actually speeds up the sampling by 20 times.

[0189] During the denoising process, the Rectified Flow model can process the latent vector layer by layer in chronological order. In each layer, the model can adjust the denoising strategy based on the attention features of the current layer (combined with the attention features). Specifically, the model can learn how to weight the denoising resources according to the importance of the attention features, so as to more effectively remove noise and retain important information. After the denoising process is completed, the Rectified Flow model needs to predict the Gaussian noise of the latent vector. This usually involves estimating the mean and covariance matrix of the latent vector. Since the model has been optimized based on the attention features, the predicted Gaussian noise will more accurately reflect the true distribution characteristics of the data.

[0190] Sub-step N3: Based on the predicted Gaussian noise, calculate the loss value of the diffusion network.

[0191] After obtaining the predicted Gaussian noise, the loss value of the diffusion network can be calculated based on the predicted Gaussian noise and the true Gaussian noise. After obtaining the predicted Gaussian noise and the true Gaussian noise, the next step is to calculate the difference between the two Gaussian noises as the loss value of the diffusion network. Specifically, the mean square error between the predicted Gaussian noise and the true Gaussian noise can be calculated to obtain the loss value of the diffusion network.

[0192] Sub-step N4: when the loss value is within a preset range, determining that the diffusion network training is completed.

[0193] After the loss value of the diffusion network is calculated, it can be determined whether the loss value is within a preset range.

[0194] If the loss value is within the preset range, it means that the diffusion network has converged. At this time, it can be determined that the diffusion network training is completed.

[0195] After completing the above two stages of model training, a 3D molecular generation model can be obtained.

[0196] This application uses a diffusion model to associate the global information of protein pockets and ligand molecules, thereby achieving global association during the generation process.

[0197] The embodiment of the present application can train the 3D molecule generation model according to the specified molecule generation mode, so that the model can support multiple molecule generation modes, that is, R groups, linkers and spontaneous generation can be completed at the same time, which greatly enhances the diversity and complexity of the generated molecules. The global information of the protein pocket and the ligand molecule is associated by using a diffusion network, so as to achieve global association in the 3D molecule generation process. At the same time, there is no need to give or predict the number of atoms generated, which improves the flexibility and applicability of the algorithm.

[0198] After the 3D molecule generation model is obtained through training, the 3D molecule generation model can be used to perform the 3D molecule generation process. The implementation process can be described in detail in conjunction with the following specific implementation methods.

[0199] In a specific implementation of the present application, after the above step 103, the following may also be included:

[0200] Step M1: Obtaining the protein pocket.

[0201] In this embodiment, when generating 3D molecules, a protein pocket can be obtained, and a reference ligand needs to be obtained at the same time. The reference ligand can be used to segment the protein pocket to obtain the desired portion of the generated molecule. In the specific implementation, after the model training is completed, it is necessary to generate molecules that meet the conditions according to the protein's pdb file and Gaussian distribution, such as Figure 3shown.

[0202] Step M2: Sample the Gaussian distribution to obtain sampling features.

[0203] First, we can sample the Gaussian distribution to obtain sampling features. Figure 3 As shown, z (i.e., sampling features) is sampled from the Gaussian distribution, and the protein pocket (the SDF features of atoms need to be retained in the R-Group and Linker generation methods) is sent to the Encoder for encoding.

[0204] Step M3: calling the encoder of the conditional variational autoencoder to process the SDF features of the protein pocket to obtain a protein pocket encoding vector representation.

[0205] Furthermore, the encoder of the conditional variational autoencoder can be called to process the SDF features of the protein pocket to obtain the protein pocket encoding vector representation.

[0206] Step M4: Iteratively process the sampling features based on the protein pocket encoding vector representation based on the diffusion network, so that the sampling features are gradually migrated from the Gaussian distribution to the distribution of small molecules in the latent space, and obtain the distribution vector representation of the sampling features in the latent space.

[0207] Then, the sampling features can be iteratively processed based on the diffusion network and the protein pocket encoding vector representation, so that the sampling features are gradually transferred from the Gaussian distribution to the distribution of small molecules in the latent space, and the distribution vector representation of the sampling features in the latent space is obtained.

[0208] Step M5: calling the decoder of the conditional variational autoencoder to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain a 3D molecular conformation.

[0209] Finally, the decoder of the conditional variational autoencoder can be called to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain the 3D molecular conformation.

[0210] The 3D molecular conformation generation process can be as follows Figure 3 As shown in the figure, first, z is sampled from the Gaussian distribution, and the SDF features of the protein pocket and the retained part are sent to the encoder for encoding to obtain c. Then, based on c, diffusion schedule is used to sample and z is gradually iterated, so that z gradually migrates from the Gaussian distribution to the distribution of small molecules in the latent space. At this time, z is equivalent to the representation of the outer envelope of the molecule in the latent space. Next, c and z are sent to the decoder for autoregressive decoding, and the 3D conformation of the small molecule is obtained by parsing the string.

[0211] After obtaining the 3D conformation of the small molecule, the 3D conformation of the small molecule can also be optimized. Specifically, the decoder of the conditional variational autoencoder can be called to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain the initial 3D molecular conformation. Then the initial 3D molecular conformation is re-input into the encoder and decoder of the conditional variational autoencoder for denoising optimization processing to obtain the 3D molecular conformation. Specifically, the generated 3D conformation of the small molecule can be re-sent to the Encoder and Decoder to achieve denoising optimization of the small molecule conformation. Then the optimized conformation is converted into a mol object through openbabel. Finally, the generated molecules are post-processed, for example: retaining part of the chiral reduction, deleting atoms that are not generated at the specified site, etc. In order to speed up the sampling speed, in addition to using the rflow sampling strategy to increase the speed by 20 times, the decoder is also int4 quantized, which can also increase the sampling speed by 4-5 times.

[0212] For SDFusion (i.e., the 3D molecular generation model in this embodiment), it is equivalent to referring to the structure of the pocket cavity, and then first generating a molecular outer envelope in the latent space, and then decoding the molecules that conform to the envelope shape through the decoder. Therefore, the molecules generated by SDFusion have a strong interaction and correlation with the protein structure.

[0213] The training method of the 3D molecular generation model provided in the embodiment of the present application, by obtaining the model training sample, the model training sample includes: the SDF feature of the molecule under the specified molecular generation mode, the SDF feature of the protein pocket and the SDF feature of the molecular retention part of the molecule, the SDF feature is used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the nearest atom, and the type of each grid point is determined by the atomic type of the nearest grid point. In the first training stage, the SDF feature of the protein pocket and the SDF feature of the molecular retention part are used as molecular constraints, and the conditional variational self-encoder in the 3D molecular generation model to be trained is trained based on the SDF feature of the molecule and the molecular constraint. In the second training stage, the parameters of the conditional variational self-encoder are frozen, and the implicit vector output by the encoder in the diffusion network fitting conditional variational self-encoder in the 3D molecular generation model to be trained is trained to obtain the 3D molecular generation model. The embodiment of the present application can make the model support multiple molecular generation modes by training the 3D molecular generation model according to the specified molecular generation mode, that is, R groups, linkers and spontaneous generation can be completed at the same time, which greatly enhances the diversity and complexity of the generated molecules. By using a diffusion network to associate the global information of protein pockets and ligand molecules, global association is achieved during the 3D molecule generation process. At the same time, there is no need to give or predict the number of atoms to be generated, which improves the flexibility and applicability of the algorithm.

[0214] Reference Figure 4 , showing a schematic diagram of the structure of a training device for a 3D molecular generation model provided in an embodiment of the present application, such as Figure 4 As shown, the training device 400 for generating a 3D molecular model may include the following modules:

[0215] The model sample acquisition module 410 is used to acquire model training samples, wherein the model training samples include: SDF features of the molecule under the specified molecule generation mode, SDF features of the protein pocket, and SDF features of the molecule retention part of the molecule; the SDF features are used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the atom closest to it, and the type of each grid point is determined by the atom type of the grid point closest to it;

[0216] An autoencoder training module 420 is used for, in a first training phase, using the SDF features of the protein pocket and the SDF features of the retained portion of the molecule as molecular constraints, and training a conditional variational autoencoder in the 3D molecule generation model to be trained based on the SDF features of the molecule and the molecular constraints;

[0217] The diffusion network training module 430 is used to freeze the parameters of the conditional variational autoencoder in the second training stage, and train the diffusion network in the 3D molecular generation model to be trained to fit the latent vector output by the encoder in the conditional variational autoencoder to train the 3D molecular generation model.

[0218] Optionally, the model sample acquisition module includes:

[0219] A first atomic order construction unit is used for traversing the molecule based on a DFS recursive traversal method to construct an atomic order of the molecule when the specified molecule generation method is a Denovo generation method;

[0220] A first noise-added molecule acquisition unit, used for performing noise-added processing on the molecule to obtain a noisy molecule;

[0221] A first SDF feature construction unit, used to construct the SDF feature of the noisy molecule and the SDF feature of the protein pocket;

[0222] The first sample acquisition unit is used to use the atomic sequence of the molecule, the SDF feature of the noisy molecule, and the SDF feature of the protein pocket as the model training samples.

[0223] Optionally, the model sample acquisition module includes:

[0224] a molecule breakpoint acquisition unit, configured to acquire the molecule breakpoints of the molecule fragments corresponding to the molecule and add breakpoint identifiers to the molecule fragments when the specified molecule generation mode is the R-Group generation mode;

[0225] A second atomic order construction unit is used to preferentially add the molecular breakpoint of each molecular fragment into the traversal queue, and traverse the molecular fragments based on a BFS recursive traversal method to construct an atomic order of each molecular fragment;

[0226] A second noise-added molecule acquisition unit is used to perform noise processing on the to-be-generated molecular fragments of the two molecular fragments to obtain a noisy molecular fragment;

[0227] A second SDF feature construction unit is used to construct the SDF features of the molecular fragments after the noise addition, the SDF features of the protein pocket, and the SDF features of the retained parts of the two molecular fragments;

[0228] The second sample acquisition unit is used to use the atomic order of the molecular fragment, the SDF feature of the noisy molecular fragment, the SDF feature of the protein pocket and the SDF feature of the retained part of the fragment as the model training samples.

[0229] Optionally, the model sample acquisition module includes:

[0230] a breakpoint identifier adding unit, configured to obtain the molecular breakpoints of three molecular fragments corresponding to the molecule when the specified molecule generation mode is a Linker generation mode, and add breakpoint identifiers to the three molecular fragments;

[0231] A third atomic order construction unit is used to preferentially add each of the molecular breakpoints to the traversal queue, and traverse each of the molecular fragments based on a BFS recursive traversal method to construct an atomic order of each of the molecular fragments;

[0232] A third noisy molecule acquisition unit is used to perform noise processing on the to-be-generated molecular fragments among the three molecular fragments to obtain a noisy molecular fragment;

[0233] A third SDF feature construction unit is used to construct the SDF features of the molecular fragments after the noise addition, the SDF features of the protein pockets, and the SDF features of the retained parts of the three molecular fragments;

[0234] The third sample acquisition unit is used to use the atomic sequence of each of the molecular fragments, the SDF features of the noisy molecular fragments, the SDF features of the protein pockets and the SDF features of the retained part of the fragments as the model training samples.

[0235] Optionally, the conditional variational autoencoder includes: two first encoders and a second encoder connected in parallel, and a decoder connected to the first encoder and the second encoder,

[0236] The autoencoder training module includes:

[0237] a latent vector acquisition unit, configured to call the first encoder to perform feature processing on the SDF feature of the molecule, the SDF feature of the protein pocket, and the SDF feature of the retained part of the molecule to obtain a latent vector of the input information;

[0238] A constraint condition vector acquisition unit, used for calling the second encoder to perform feature processing on the SDF features of the protein pocket and the molecular retention part to obtain a molecular constraint condition vector;

[0239] A predicted molecular conformation acquisition unit, used for calling the decoder to process the molecular constraint condition vector and the latent vector to obtain a predicted 3D molecular conformation;

[0240] A first loss calculation unit, configured to calculate a loss value of the conditional variational autoencoder based on the predicted 3D molecular conformation and the real conformation of the model training sample;

[0241] The autoencoder training unit is used to determine that the conditional variational autoencoder training is completed when the loss value is within a preset range.

[0242] Optionally, the predicted molecular conformation acquisition unit comprises:

[0243] A noise vector acquisition subunit, used for randomly adding Gaussian noise to the latent vector to obtain a noisy latent vector;

[0244] A vector input subunit, used for inputting the molecular constraint condition vector and the noisy latent vector into the decoder;

[0245] The predicted molecular conformation acquisition subunit is used to call the decoder to process the molecular constraint condition vector and the noise-added latent vector to obtain the predicted 3D molecular conformation.

[0246] Optionally, the diffusion network training module includes:

[0247] An attention feature calculation unit, used to call the TransformerBlock of the diffusion network to first calculate the attention features of the x-axis and y-axis of the latent vector, and then calculate the attention features of the z-axis;

[0248] A predicted Gaussian distribution acquisition unit is used to call the ODE-based rectified flow of the diffusion network to perform noise reduction processing on the latent vector according to the calculated attention feature, so as to obtain the predicted Gaussian noise of the latent vector at the current moment;

[0249] A second loss calculation unit, configured to calculate a loss value of the diffusion network based on the predicted Gaussian noise;

[0250] The diffusion network training unit is used to determine that the diffusion network training is completed when the loss value is within a preset range.

[0251] Optionally, the device further comprises:

[0252] A protein pocket acquisition module, used to acquire protein pockets;

[0253] A sampling feature acquisition module is used to sample the Gaussian distribution to obtain sampling features;

[0254] A vector representation acquisition module, used for calling the encoder of the conditional variational autoencoder to process the protein pocket to obtain a protein pocket encoding vector representation;

[0255] A distribution representation acquisition module, used for iteratively processing the sampling features based on the protein pocket encoding vector representation based on the diffusion network, so that the sampling features are gradually transferred from the Gaussian distribution to the distribution of small molecules in the latent space, and the distribution vector representation of the sampling features in the latent space is obtained;

[0256] The 3D molecular conformation acquisition module is used to call the decoder of the conditional variational autoencoder to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain the 3D molecular conformation.

[0257] Optionally, the 3D molecular conformation acquisition module includes:

[0258] An initial molecular conformation acquisition unit, used for calling the decoder of the conditional variational autoencoder to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain an initial 3D molecular conformation;

[0259] The 3D molecular conformation acquisition unit is used to re-input the initial 3D molecular conformation into the encoder and decoder of the conditional variational autoencoder for denoising and optimization processing to obtain the 3D molecular conformation.

[0260] The training device of the 3D molecular generation model provided in the embodiment of the present application, by obtaining the model training sample, the model training sample includes: the SDF feature of the molecule under the specified molecular generation mode, the SDF feature of the protein pocket and the SDF feature of the molecular retention part of the molecule, the SDF feature is used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the nearest atom, and the type of each grid point is determined by the type of atom of the nearest grid point. In the first training stage, the SDF feature of the protein pocket and the SDF feature of the molecular retention part are used as molecular constraints, and the conditional variational autoencoder in the 3D molecular generation model to be trained is trained based on the SDF feature of the molecule and the molecular constraint. In the second training stage, the parameters of the conditional variational autoencoder are frozen, and the implicit vector output by the encoder in the diffusion network fitting conditional variational autoencoder in the 3D molecular generation model to be trained is trained to obtain the 3D molecular generation model. The embodiment of the present application can make the model support multiple molecular generation modes by training the 3D molecular generation model according to the specified molecular generation mode, that is, R groups, linkers and spontaneous generation can be completed at the same time, which greatly enhances the diversity and complexity of the generated molecules. By using a diffusion network to associate the global information of protein pockets and ligand molecules, global association is achieved during the 3D molecule generation process. At the same time, there is no need to give or predict the number of atoms to be generated, which improves the flexibility and applicability of the algorithm.

[0261] An embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the above-mentioned training method for generating a 3D molecular model when executed by the processor.

[0262] Figure 5 FIG. 5 is a schematic diagram showing the structure of an electronic device 500 according to an embodiment of the present invention. Figure 5 As shown, the electronic device 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 502 or computer program instructions loaded from a storage unit 808 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0263] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, a microphone, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0264] The various processes and processing described above may be performed by the processing unit 501. For example, the method of any of the above embodiments may be implemented as a computer software program, which is tangibly contained in a computer-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the CPU 501, one or more actions in the method described above may be performed.

[0265] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the training method for the above-mentioned 3D molecular generation model.

[0266] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0267] The above is a detailed introduction to the training method, device, electronic device and computer-readable storage medium for a 3D molecular generation model provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technicians in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A training method for generating a 3D molecular model, characterized in that: The method comprises: Obtaining a model training sample, the model training sample comprising: an SDF feature of a molecule under a specified molecule generation mode, an SDF feature of a protein pocket, and an SDF feature of a molecule retention portion of the molecule; the SDF feature is used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the atom closest to it, and the type of each grid point is determined by the atom type of the grid point closest to it; In the first training stage, the SDF features of the protein pocket and the SDF features of the retained part of the molecule are used as molecular constraints, and the conditional variational autoencoder in the 3D molecule generation model to be trained is trained based on the SDF features of the molecule and the molecular constraints; In the second training stage, the parameters of the conditional variational autoencoder are frozen, and the diffusion network in the 3D molecular generation model to be trained is trained to fit the latent vector output by the encoder in the conditional variational autoencoder to obtain the 3D molecular generation model through training.

2. The method according to claim 1, characterized in that The obtaining of model training samples comprises: When the specified molecule generation method is the Denovo generation method, the molecule is traversed based on the DFS recursive traversal method to construct the atomic order of the molecule; Performing noise processing on the molecule to obtain a noisy molecule; Constructing the SDF features of the noisy molecule and the SDF features of the protein pocket; The atomic order of the molecule, the SDF features of the noisy molecule, and the SDF features of the protein pocket are used as the model training samples.

3. The method according to claim 1, characterized in that: The obtaining of model training samples comprises: When the designated molecule generation mode is the R-Group generation mode, obtaining the molecular breakpoints of the molecular fragments corresponding to the molecule, and adding breakpoint identifiers to the molecular fragments; The molecular breakpoints of each molecular fragment are preferentially added to the traversal queue, and the molecular fragments are traversed based on the BFS recursive traversal method to construct the atomic order of each molecular fragment; Performing noise processing on the to-be-generated molecular fragment of the two molecular fragments to obtain a noisy molecular fragment; Constructing the SDF features of the molecular fragments after adding noise, the SDF features of the protein pocket, and the SDF features of the retained parts of the two molecular fragments; The atomic order of the molecular fragment, the SDF features of the molecular fragment after noise addition, the SDF features of the protein pocket and the SDF features of the retained part of the fragment are used as the model training samples.

4. The method according to claim 1, characterized in that The obtaining of model training samples comprises: When the designated molecule generation mode is a Linker generation mode, obtaining molecular breakpoints of three molecular fragments corresponding to the molecule, and adding breakpoint identifiers to the three molecular fragments; Each of the molecular breakpoints is preferentially added to the traversal queue, and each of the molecular fragments is traversed based on the BFS recursive traversal method to construct the atomic order of each of the molecular fragments; Performing noise processing on the molecular fragment to be generated among the three molecular fragments to obtain a noisy molecular fragment; Constructing the SDF features of the molecular fragments after adding noise, the SDF features of the protein pocket and the SDF features of the retained parts of the three molecular fragments; The atomic sequence of each of the molecular fragments, the SDF features of the molecular fragments after noise addition, the SDF features of the protein pocket and the SDF features of the retained part of the fragment are used as the model training samples.

5. The method according to claim 1, characterized in that The conditional variational autoencoder comprises: two first encoders and a second encoder connected in parallel, and a decoder connected to the first encoder and the second encoder, The method of using the SDF features of the protein pocket and the SDF features of the retained part of the molecule as molecular constraints, and training the conditional variational autoencoder in the 3D molecule generation model to be trained based on the SDF features of the molecule and the molecular constraints, comprises: Calling the first encoder to perform feature processing on the SDF feature of the molecule, the SDF feature of the protein pocket, and the SDF feature of the retained part of the molecule to obtain a latent vector of the input information; calling the second encoder to perform feature processing on the SDF features of the protein pocket and the SDF features of the molecule retention part to obtain a molecular constraint condition vector; Calling the decoder to process the molecular constraint condition vector and the latent vector to obtain a predicted 3D molecular conformation; Based on the predicted 3D molecular conformation and the real conformation of the model training sample, a loss value of the conditional variational autoencoder is calculated; When the loss value is within a preset range, it is determined that the training of the conditional variational autoencoder is completed.

6. The method according to claim 5, characterized in that The calling of the decoder to process the molecular constraint condition vector and the latent vector to obtain a predicted 3D molecular conformation includes: Randomly adding Gaussian noise to the latent vector to obtain a noisy latent vector; Inputting the numerator constraint vector and the noisy latent vector into the decoder; The decoder is called to process the molecular constraint condition vector and the noise-added latent vector to obtain the predicted 3D molecular conformation.

7. The method according to claim 1, characterized in that The step of training the diffusion network in the 3D molecular generation model to be trained to fit the latent vector output by the encoder in the conditional variational autoencoder comprises: Calling the TransformerBlock of the diffusion network to first calculate the attention features of the x-axis and y-axis of the latent vector, and then calculating the attention features of the z-axis; Calling the ODE-based rectified flow of the diffusion network to perform denoising on the latent vector according to the calculated attention features to obtain the predicted Gaussian noise of the latent vector at the current moment; Based on the predicted Gaussian noise, a loss value of the diffusion network is calculated; When the loss value is within a preset range, it is determined that the diffusion network training is completed.

8. The method according to claim 1, characterized in that After the 3D molecular generation model is obtained through training, the method further includes: Get protein pockets; Sampling the Gaussian distribution to obtain sampling features; Calling the encoder of the conditional variational autoencoder to process the protein pocket to obtain a protein pocket encoding vector representation; Iteratively processing the sampling features based on the protein pocket encoding vector representation based on the diffusion network, so that the sampling features are gradually migrated from the Gaussian distribution to the distribution of small molecules in the latent space, and the distribution vector representation of the sampling features in the latent space is obtained; The decoder of the conditional variational autoencoder is called to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain a 3D molecular conformation.

9. The method according to claim 8, characterized in that The decoder calling the conditional variational autoencoder performs self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain a 3D molecular conformation, including: Calling the decoder of the conditional variational autoencoder to perform self-decoding processing on the distribution vector representation based on the protein pocket encoding vector representation to obtain an initial 3D molecular conformation; The initial 3D molecular conformation is re-input into the encoder and decoder of the conditional variational autoencoder for denoising and optimization processing to obtain the 3D molecular conformation.

10. A training device for generating a 3D molecular model, characterized in that: The device comprises: A model sample acquisition module is used to acquire model training samples, wherein the model training samples include: SDF features of molecules under a specified molecular generation mode, SDF features of protein pockets, and SDF features of the molecular retention part of the molecules; the SDF features are used to characterize the distance from each grid point in the three-dimensional grid of the molecule to the atom closest to it, and the type of each grid point is determined by the atom type of the grid point closest to it; An autoencoder training module is used for, in a first training phase, using the SDF features of the protein pocket and the SDF features of the retained part of the molecule as molecular constraints, and training a conditional variational autoencoder in the 3D molecule generation model to be trained based on the SDF features of the molecule and the molecular constraints; The diffusion network training module is used to freeze the parameters of the conditional variational autoencoder in the second training stage, train the diffusion network in the 3D molecular generation model to be trained to fit the latent vector output by the encoder in the conditional variational autoencoder, so as to train and obtain the 3D molecular generation model.

Citation Information

Cited By

  • Model training method, diffusion model-based molecule generation method and data processing device

    CN120804707A