A flow model-based molecular graph generation method and device

By incorporating a flow generation model based on graph attention, the problems of low molecular generation efficiency and poor diversity in existing technologies are solved, achieving rapid generation of effective new molecules and improving the efficiency and success rate of drug discovery.

CN116525029BActive Publication Date: 2026-01-02WUHAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310499015.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-26
Publication Date
2026-01-02
Estimated Expiration
2043-04-26

AI Technical Summary

Technical Problem

Existing molecular generation methods are inefficient and have a high failure rate when generating new molecules. The generated molecules have poor effectiveness and diversity, and the model training is unstable, making it difficult to quickly find effective new molecules in the vast chemical space.

Method used

A flow generation model incorporating graph attention is adopted. The chemical features and graph topology of molecules are learned through graph neural networks. The flow generation framework is used to generate chemically effective, low-repetition, and highly novel molecular graphs. The model parameters are optimized by combining maximum likelihood estimation to generate molecular graphs that conform to chemical rules.

Benefits of technology

It improves the speed and success rate of drug discovery, reduces costs and time in the early stages, lowers the failure rate in the later stages, and generates molecules that are highly efficient, diverse, and novel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116525029B_ABST
    Figure CN116525029B_ABST
Patent Text Reader

Abstract

The application discloses a kind of molecular graph generation method and device based on flow model, it is related to artificial intelligence auxiliary drug discovery field, which comprises the following steps: collecting public molecular dataset, converting the representation form of molecule, and calculating topological structure and chemical information, to extract the first node matrix and the first edge matrix of molecule;According to the first node matrix and the first edge matrix, the node model of fusion self-attention is constructed, and the edge model of fusion two-dimensional convolution is constructed according to the first edge matrix;The model parameters of node model and edge model are optimized by maximum likelihood estimation;Random node sample and edge sample are obtained, the second node matrix is generated by inverse mapping of the optimized node model, and the second edge matrix is generated by inverse mapping of the optimized edge model;Second node matrix and second edge matrix are checked and corrected by chemical rule, and combined to generate molecular graph.The candidate molecule with effectiveness, diversity and novelty can be quickly generated in the application.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of artificial intelligence assisted drug discovery, and particularly relates to a molecule graph generation method and device based on a flow model. BACKGROUND

[0002] In recent years, deep learning has shown broad research prospects in the field of drug discovery, especially in generating new molecular structures. Rapidly obtaining a large number of novel molecular structures is an important task in various applications such as drug discovery and material science, which helps to speed up the discovery process of effective new drugs and other chemical materials, and is of great significance to the development of medicine and chemistry. However, due to the discrete nature of chemical space and the large search space, new molecule generation has always faced the problems of low efficiency and high failure rate.

[0003] In the task of molecule generation, the generated molecules not only need to conform to the valence effectiveness, but also should have good drug-likeness, diversity and novelty, etc. In recent years, various deep generation methods have shown effectiveness in rapidly generating a large number of molecules, including molecule generation methods based on simplified molecular linear input canonical (SMILES) sequences or graph structures. At present, the molecule generation algorithm based on graph structure mainly includes generation model based on variational autoencoder, autoregressive generation model and generative adversarial network, etc. Generally, the graph generation algorithm includes two steps, i.e. learning the feature representation of the molecule and generating the molecule graph, following the sequence or one-time generation method.

[0004] Some early molecule generation works use generation methods based on variational autoencoder

[40] , which usually first use an encoder to map high-dimensional original data to a feature space to represent molecules in a continuous method, and then use a decoder to map the continuous molecular representation back to the molecular graph, and most of them use KL divergence to evaluate the difference between the generated distribution and the real distribution, and the calculation difficulty of the optimization target is large. JT-VAE is a classical generation model based on VAE, which first decomposes the molecular graph into tree-like substructures, encodes the molecular graph and the substructure, and then maps it back to the molecular graph through decoding, and assembles the tree-like substructure into a molecule. However, considering the complexity of the tree-like substructure, this model is not suitable for generating small molecular compounds with fewer atoms. Since the generation model based on VAE is trained by optimizing the lower bound of the log-likelihood of the data, rather than directly optimizing the log-likelihood, there may be a large gap between the log-likelihood and its lower bound, and the optimization difficulty is high.

[0005] Some molecule generation methods use a way of generative adversarial networks (GANs), use a generative adversarial network on a molecule dataset, and combine reinforcement learning to generate molecules with ideal properties. The molecule generation model based on the generative adversarial network generally includes a generator, a discriminator and a reward network, and the generator and the discriminator are constantly trained to improve each other through mutual confrontation, wherein the discriminator and the reward network can be implemented using a graph neural network. However, the generation model based on the GAN has the problem of being prone to mode collapse, that is, the diversity of generated samples is poor, and the model training is unstable, which needs to be solved by careful adjustment of hyperparameters.

[0006] In summary, the current methods generally have problems including poor effectiveness or diversity of generated molecules, low success rate of molecule reconstruction, low drug similarity of generated molecules, and high model complexity caused by combining reinforcement learning. Recently, flow-based generation models have become one of the frontiers of graph generation. The flow generation model aims to learn the reversible transformation between the base distribution (such as Gaussian distribution) and the real high-dimensional space, and its advantages are that it does not need to design an additional decoder, can accurately encode real sample points into corresponding latent variables, and accurately calculate the log-likelihood of latent variables, directly uses maximum likelihood estimation as the optimization target, and performs outstanding performance on image generation. In addition, considering that molecules are natural graph structure data, therefore, integrating a graph neural network into the flow generation model can effectively realize molecule graph generation.

[0007] Therefore, there is a need for a flow generation model integrating a graph neural network for molecule generation, which models molecules as graph data, can learn the chemical features and graph topological structure of molecules through a graph neural network, encodes molecules into a more accurate latent space using a flow generation framework, and finally generates a large number of chemically effective, low-repetitive and highly novel chemical molecule graphs, thereby avoiding molecule search in a vast chemical space and improving the speed and success rate of the drug discovery process. SUMMARY

[0008] To solve the above problems, the first aspect of the present application provides a molecule flow generation model integrating a graph attention mechanism. It can utilize the chemical information and graph topological structure in molecules, and learn the features of molecule graphs through graph convolution integrating a self-attention mechanism, and effectively learn the latent representation of molecules.

[0009] To achieve the above object, the technical scheme adopted by the present application is:

[0010] A molecule graph generation method based on a flow model, characterized in that it comprises the following steps:

[0011] Collecting a public molecule dataset, converting the representation form of the molecule, and calculating the topological structure and chemical information to extract a first node matrix and a first edge matrix of the molecule;

[0012] construct a node model of fusion self-attention according to the first node matrix and the first edge matrix, and construct an edge model of fusion two-dimensional convolution according to the first edge matrix;

[0013] optimizing the model parameters of the node model and the edge model by maximum likelihood estimation;

[0014] obtaining a random node sample and an edge sample, generating a second node matrix by inverse mapping of the optimized node model, and generating a second edge matrix by inverse mapping of the optimized edge model;

[0015] combining the second node matrix and the second edge matrix to generate a molecular graph through chemical rule checking and correction.

[0016] In some embodiments, the collection of public molecular data sets, the conversion of the representation form of the molecules, and the calculation of the topological structure and chemical information to extract the first node matrix and the first edge matrix of the molecules include:

[0017] calculating the chemical properties of each molecule using a chemical informatics software package RDKit to obtain the information of atoms and edges;

[0018] carbonyl processing the molecules to retain the heavy atom skeleton of the molecules;

[0019] converting the heavy atom skeleton of the molecules into graph structure data;

[0020] obtaining a node matrix and an edge matrix from the graph structure data.

[0021] In some embodiments, the construction of the node model of fusion self-attention according to the first node matrix and the first edge matrix includes:

[0022] dividing the input node matrix V into two parts (V1, V2) along the channel dimension, and inputting the edge matrix E as a constant;

[0023] by the formula:

[0024] V1, V2 = Split(V)

[0025] h = σ (p (AttnGCN (V1, E)))

[0026] t, logs = Chunk (h)

[0027] s = Sigmoid (logs)

[0028]

[0029]

[0030]

[0031] obtain a single graph coupling layer f V (V, E), where h is the output tensor, t is the transformation coefficient for affine transformation, log s is the scaling coefficient in logarithmic form, σ represents the activation function, ρ represents normalization, AttnGCN is the graph convolution module with attention fusion, Split is the split operation, and Chunk is the split function.

[0032] Through the formula:

[0033]

[0034] obtain a node model where is a single graph coupling layer f V (V, E).

[0035] In some embodiments, the edge model is constructed according to the first edge matrix, including:

[0036] Divide the input edge matrix along the channel dimension into two parts (E1, E2);

[0037] Through the formula:

[0038] E1, E2 = Split (E)

[0039] h = σ (ρ (Conv2d (E1)))

[0040] t, log s = Chunk (h)

[0041] s = Sigmoid (log s)

[0042]

[0043] Z E = f ε (E)

[0044] obtain a single edge coupling layer f E (E), where h is the output tensor, t is the transformation coefficient for affine transformation, log s is the scaling coefficient in logarithmic form, σ represents the activation function, ρ represents normalization, Conv2d is a two-dimensional convolution function.

[0045] Through the formula:

[0046]

[0047] obtain an edge model where f E is a single edge coupling layer f E (E).

[0048] In some embodiments, optimizing the model parameters of the node model and the edge model through maximum likelihood estimation includes:

[0049] From the true distribution Sample points (V, E) are extracted from the data.

[0050] Through the formula:

[0051]

[0052]

[0053] The node model generation distribution P is derived. V (V) and the edge model generation distribution P E (E);

[0054] Through the formula:

[0055]

[0056]

[0057] Derive the node model generation distribution log-likelihood With the edge model generating distribution P ε The log-likelihood of (E) logP E (E);

[0058] Through the formula:

[0059]

[0060] Calculate the optimized model parameters θ.

[0061] In some embodiments, the step of obtaining random node samples and edge samples, generating a second node matrix through inverse mapping of the optimized node model, and generating a second edge matrix through inverse mapping of the optimized edge model includes:

[0062] Randomly sampled node samples Z in the latent space V and edge sample Z E ;

[0063] Through the formula:

[0064]

[0065]

[0066] t, log s = Chunk(h)

[0067] s = Sigmoid(log s)

[0068]

[0069] E' = E1||E2

[0070] An edge matrix E' is obtained, wherein || is a splicing operation, sigma represents an activation function, and rho represents normalization.

[0071] Through the formula:

[0072]

[0073]

[0074] t, log s = Chunk(h)

[0075] s = Sigmoid(log s)

[0076]

[0077] V' = V1||V2

[0078] A node matrix V' is obtained, wherein || is a splicing operation, sigma represents an activation function, and rho represents normalization.

[0079] In some embodiments, the combining the second node matrix and the second edge matrix through the checking and correction of chemical rules to generate a molecular graph comprises:

[0080] Creating a blank molecular object using the RdKit chemical tool;

[0081] Adding all atoms to the molecular object according to the generated node matrix;

[0082] Adding chemical bonds between atoms step by step according to the generated adjacency matrix, and performing valence checking each time a chemical bond is added;

[0083] Outputting the maximum connected graph as a molecular graph by randomly selecting chemical bonds within a valid range.

[0084] The second aspect of the application provides a molecular graph generation device based on a flow model, which can utilize chemical information and graph topological structure in molecules, and learn the characteristics of molecular graphs through graph convolution of fused self-attention mechanism, to effectively learn the potential representation of molecules.

[0085] A molecular graph generation device based on a flow model, characterized by comprising:

[0086] A collection module is configured to collect a public molecular dataset, convert the representation of molecules, and calculate the topological structure and chemical information, to extract a first node matrix and a first edge matrix of the molecules.

[0087] a model construction module, configured to construct a node model with fused self-attention according to the first node matrix and the first edge matrix, and construct an edge model with fused two-dimensional convolution according to the first edge matrix;

[0088] an optimization module, configured to optimize model parameters of the node model and the edge model by maximum likelihood estimation;

[0089] a generation module, configured to obtain random node samples and edge samples, generate a second node matrix by inverse mapping of the optimized node model, generate a second edge matrix by inverse mapping of the optimized edge model, and combine the second node matrix and the second edge matrix to generate a molecule graph through checking and correction according to chemical rules.

[0090] In some embodiments, the construction module is configured to:

[0091] divide the input node matrix V into two parts (V1, V2) along the channel dimension, and keep the input edge matrix E as a constant;

[0092] by the formula:

[0093] V1, V2 = Split(V)

[0094] h = σ(ρ(AttnGCN(V1, E)))

[0095] t, log s = Chunk(h)

[0096] s = Sigmoid(log s)

[0097]

[0098]

[0099]

[0100] obtain a single graph coupling layer f V (V, E), where h is an output tensor, t is a transformation coefficient for affine transformation, log s is a scaling coefficient in logarithmic form, σ represents an activation function, ρ represents normalization, AttnGCN is a graph convolution module with fused attention, Split is a splitting operation, and Chunk is a splitting function.

[0101] by the formula:

[0102]

[0103] obtain a node model where is a single graph coupling layer f V (V, E).

[0104] The construction module is further configured to:

[0105] split the input edge matrix into two parts (E1, E2) along the channel dimension;

[0106] by the formula:

[0107] E1, E2 = Split(E)

[0108] h = σ(ρ(Conv2d(E1)))

[0109] t, log s = Chunk(h)

[0110] s = Sigmoid(log s)

[0111]

[0112] Z E = f ε (E)

[0113] obtain a single edge coupling layer f E (E), where h is an output tensor, t is a transformation coefficient for affine transformation, log s is a scaling coefficient in logarithmic form, σ represents an activation function, ρ represents normalization, and Conv2d is a two-dimensional convolution function.

[0114] by the formula:

[0115]

[0116] obtain an edge model , where f E is a single edge coupling layer f E (E).

[0117] In some embodiments, the training module is configured to:

[0118] draw sample points (V, E) from a real distribution ;

[0119] by the formula:

[0120]

[0121]

[0122] obtain a node model generation distribution P V (V) and an edge model generation distribution P E (E);

[0123] by the formula:

[0124]

[0125]

[0126] Derive the node model generation distribution log-likelihood With the edge model generating distribution P ε The log-likelihood of (E) logP E (E);

[0127] Through the formula:

[0128]

[0129] Calculate the optimized model parameters θ.

[0130] The flow model-based molecular graph generation method of this invention includes the following steps: collecting public molecular datasets, transforming the representation of molecules, and calculating topological and chemical information to extract the first node matrix and the first edge matrix of the molecules; constructing a node model fused with self-attention based on the first node matrix and the first edge matrix, and constructing an edge model fused with two-dimensional convolution based on the first edge matrix; optimizing the model parameters of the node model and the edge model through maximum likelihood estimation; obtaining random node samples and edge samples, generating a second node matrix through inverse mapping of the optimized node model, and generating a second edge matrix through inverse mapping of the optimized edge model; combining the second node matrix and the second edge matrix through chemical rule checking and correction to generate a molecular graph. The flow model-based molecular graph generation method of this invention can rapidly generate candidate molecules that possess effectiveness, diversity, and novelty, helping to reduce costs and time in the early stages of drug discovery and lower the failure rate in the later stages of drug discovery. Attached Figure Description

[0131] Figure 1 This is a flowchart of the molecular graph generation method based on the flow model in an embodiment of the present invention;

[0132] Figure 2 This is a schematic diagram of the molecular graph generation method for the flow model in this embodiment of the invention;

[0133] Figure 3 This is a diagram of the node model structure in an embodiment of the present invention; Detailed Implementation

[0134] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the scope of protection of the present application.

[0135] Referring to Figure 1 and Figure 2 As shown in the present application, a molecule graph generation method based on a flow model comprises the following steps: collecting a public molecular dataset, converting the representation form of the molecule, and calculating the topological structure and chemical information to extract a first node matrix and a first edge matrix of the molecule; constructing a node model fused with self-attention according to the first node matrix and the first edge matrix, and constructing an edge model fused with two-dimensional convolution according to the first edge matrix; optimizing the model parameters of the node model and the edge model through maximum likelihood estimation; obtaining random node samples and edge samples, generating a second node matrix through inverse mapping of the optimized node model, and generating a second edge matrix through inverse mapping of the optimized edge model; and combining the second node matrix and the second edge matrix to generate a molecule graph through chemical rule checking and correction.

[0136] Among them, collecting a public molecular dataset, converting the representation form of the molecule, and calculating the topological structure and chemical information to extract a first node matrix and a first edge matrix of the molecule, specifically, the original public molecular dataset contains four types of chemical bonds (edges), namely single bond, double bond, triple bond and benzene ring structure, and provides a standard SMILES representation method encoded molecule.

[0137] The chemical information software package RDKit is used to preprocess the molecule, calculate the chemical properties of each molecule, obtain the information of atoms and edges, and in addition, follow the baseline method to process all molecules into ketones and remove hydrogen atoms, and only keep the molecular heavy atom skeleton.

[0138] It is worth noting that the processed dataset only contains three types of chemical bonds, namely single bond, double bond and triple bond, and the benzene ring structure is expressed through the combination of single bond and double bond. In order to facilitate the assembly of the generated nodes and adjacency matrix into molecules, another type of edge with type 0 and type 0 node are set, which represent empty edges and empty nodes respectively.

[0139] Referring to Figure 3 As shown in the present application, the node model fused with self-attention is constructed according to the first node matrix and the first edge matrix, wherein the Jacobian coefficient matrix of each graph coupling layer is:

[0140]

[0141] where l is the identity matrix. diag(s) is a diagonal matrix composed of vector s, and The log form of the Jacobian determinant of the graph convolution layer

[0142]

[0143] According to the chain rule, the Jacobian determinant of the node model is the product of the Jacobian determinants of each graph convolution layer, which is calculated as:

[0144]

[0145] where represents the i-th graph convolution layer.

[0146] It is worth mentioning that for the graph convolution model AttnGCN with attention fusion in the graph convolution layer, the input is the first node matrix and the edge matrix The output is the embedding vector of all nodes, and the specific calculation is divided into the following steps:

[0147] 1) Message generation stage.

[0148] First, for each node in the molecular graph, first map the node feature vector to a latent space using AttnNode to get

[0149] In addition, through the node message generation function AttnMessage, the feature message of the node under various types of relationships r e R is generated

[0150] AttnNode and AttnMessage have the same model structure but different parameters. Taking AttnNode as an example, the calculation formula is as follows:

[0151] q = W q v

[0152] k = W k v

[0153] z = W z v

[0154] In the above formula, the dimensions of the parameter matrices W q , W k , W z are d q , d k , d z respectively.

[0155] The attention score is further calculated as:

[0156]

[0157] Then, the attention score is normalized by using a Softmax function to obtain an attention weight coefficient, and the input feature vector is weighted and summed according to the attention weight coefficient to obtain a reconstructed node feature vector with fused attention:

[0158] h′ v =Softmax(α v )*v

[0159] 2) Message aggregation stage.

[0160] According to the adjacency matrix, the feature messages of adjacent nodes are propagated and aggregated:

[0161]

[0162] wherein, denotes a set of adjacent nodes of node v connected by edges of type r

[0163] 3) Update and readout stage.

[0164] The aggregated neighborhood feature message is added to the node's own feature to update the embedding vector representation of the node, and then output through a readout function ReadOut:

[0165] h v =σ(ρ(ReadOut(h′ v ,m v )))

[0166] =σ(h′ v +m v )

[0167]

[0168] Here, the readout function can be implemented by using a multi-layer perceptron or a network with the same structure as AttnNode. The readout function is used to ensure that the input and output dimensions of the graph coupling layer are the same.

[0169] In this embodiment, the edge model with fused two-dimensional convolution is constructed according to the first edge matrix, wherein the Jacobian determinant of the edge model is the product of the Jacobian determinants of each edge coupling layer, and is calculated as:

[0170]

[0171] where the log form of the Jacobian of each edge coupling layer is

[0172]

[0173] To perform 2D convolution on the adjacency matrix tensor and obtain more feature channels when affine coupling transformation, before inputting the edge tensor into the model, first transform the feature space of each adjacency matrix tensor from to Then the transformed data is subjected to affine transformation. The data output by the edge model is subjected to inverse transformation operation to restore the data to an edge tensor with dimension In addition, in order to enhance the nonlinearity of the model, the adjacent edge coupling layers use alternating partition on the input vector, and the lth edge coupling layer is divided into (E1, E2) = Split l (E), and the next layer is divided into (E2, E1) = Split l+1 (E) alternately, so that the part directly output in the coupling layer is used for transformation in the next coupling layer.

[0174] In this embodiment, the model of the node model and the edge model is optimized by maximum likelihood estimation, wherein the model parameters are optimized by maximum likelihood estimation during parameter training, that is, the KL divergence between the real distribution and the model generated distribution on the training set is minimized, so that they are as similar as possible, and the probability distribution P G (G) = P V (V) x P E (E) is obtained:

[0175]

[0176] Since the greater the likelihood estimate is, the more the model parameters meet the expectation, therefore, after taking the negative of the maximum likelihood, the smaller the negative log likelihood obtained is, the more it meets the expectation, therefore, the negative log likelihood of the sample points is calculated during training.

[0177] In this embodiment, the second node matrix and the second edge matrix are combined to generate a molecular graph through chemical rule checking and correction. Specifically, a blank molecular object is first created using the RdKit chemical tool, then all atoms are added to the molecular object according to the generated second node matrix, and then chemical bonds are gradually added between atoms according to the generated second edge matrix. Chemical valence checking is performed each time a chemical bond is added. If the newly added chemical bond does not conform to the valence of the two end atoms, the valence rule is destroyed, and the chemical bond is replaced with a smaller value newbondtype by randomly selecting a chemical bond in the effective range newbondtype=randInt(1,bondtype-1), and the maximum connected graph in the molecular graph is output, achieving minimal changes in the generated molecule while maintaining diversity, and without the need to recheck the chemical properties of the new molecule and generate a new molecule.

[0178] It is worth noting that the following method can also be used for correction: after assembling into a complete molecular graph, the valence of the atoms or edges that do not conform to the rules is checked and corrected. If the molecule satisfies the chemical constraints, the largest connected component of the molecule is output as the final generated molecule. If there are atoms with invalid valence in the molecule, find the chemical bond with the largest value bondtype connected to the atom, replace it with a smaller value newbondtype by randomly selecting a chemical bond in the effective range newbondtype=randInt(1,bondtype-1), and recheck the chemical properties of the new molecule and generate a new molecule, achieving minimal changes in the generated molecule while maintaining diversity.

[0179] In summary, the molecular graph generation method based on the flow model in the present application includes the following steps: collecting a public molecular dataset, converting the representation form of the molecule, and calculating the topological structure and chemical information to extract the first node matrix and the first edge matrix of the molecule; constructing a node model fused with self-attention according to the first node matrix and the first edge matrix, and constructing an edge model fused with two-dimensional convolution according to the first edge matrix; optimizing the model parameters of the node model and the edge model through maximum likelihood estimation; obtaining random node samples and edge samples, generating a second node matrix through inverse mapping of the optimized node model, and generating a second edge matrix through inverse mapping of the optimized edge model; and combining the second node matrix and the second edge matrix to generate a molecular graph through chemical rule checking and correction. The molecular graph generation method based on the flow model in the present application can quickly generate candidate molecules with effectiveness, diversity, and novelty, which helps to reduce the cost and time in the early stage of drug discovery and reduce the failure rate in the later stage of drug discovery.

[0180] In the description of the present application, it should be noted that the terms "upper", "lower", and the like are used for indicating the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connecting" should be interpreted broadly, for example, can be fixed connection, can also be detachable connection, or integral connection; can be mechanical connection, can also be electrical connection; can be directly connected, can also be indirectly connected through an intermediate medium, can be internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0181] It should be noted that in the present application, relational terms such as "first" and "second" and the like are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0182] The above is only a specific embodiment of the present application, which enables those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied herein.

Claims

1. A method for generating a molecular graph based on a flow model, characterized in that, The method comprises the following steps: Collecting a public molecular dataset, converting the representation of the molecules, and calculating the topological structure and chemical information to extract a first node matrix and a first edge matrix of the molecules, comprising: Calculating the chemical properties of each molecule using a chemical informatics software package RDKit to obtain atomic and edge information; Performing ketonization processing on the molecules to retain the heavy atom skeleton of the molecules; Converting the heavy atom skeleton of the molecules into graph structure data; Obtaining a node matrix and an edge matrix from the graph structure data; Building a node model fused with self-attention according to the first node matrix and the first edge matrix, and building an edge model fused with two-dimensional convolution according to the first edge matrix; the node model fused with self-attention according to the first node matrix and the first edge matrix comprises: Divide the input node matrix V into two parts along the channel dimension , the input edge matrix E remains constant Through the formula: Obtaining individual graph coupling layers where h is the output tensor, t is the transformation coefficient for affine transformation, log s is the scaling coefficient in logarithmic form, σ represents the activation function, ρ represents normalization, AttnGCN is the attention-fused graph convolution module, Split is the split operation, and Chunk is the split function. Through the formula: obtaining a node model wherein for a single graph coupling layer ; Optimizing the model parameters of the node model and the edge model through maximum likelihood estimation; Obtaining random node samples and edge samples, generating a second node matrix through inverse mapping of the optimized node model, and generating a second edge matrix through inverse mapping of the optimized edge model, comprising: randomly sampling node samples in latent space and edge samples ; Through the formula: obtaining the edge matrix wherein is a concatenation operation, denotes an activation function, denotes a normalization; Through the formula: obtaining a node matrix wherein is a concatenation operation, denotes an activation function, denotes a normalization; Combining the second node matrix and the second edge matrix through chemical rule checking and correction to generate a molecular graph.

2. The flow model based molecular graph generation method of claim 1, wherein, The edge model fused with two-dimensional convolution according to the first edge matrix comprises: dividing the input edge matrix into two parts along the channel dimension ; Through the formula: Obtaining a single edge-coupled layer where h is the output tensor, t is the transformation coefficient for affine transformation, log s is the scaling coefficient in logarithmic form, σ represents the activation function, p represents normalization, and Conv2d is a two-dimensional convolution function. Through the formula: obtaining edge models wherein for a single edge coupling layer .

3. The flow model based molecular graph generation method of claim 1, wherein, The optimization of the model parameters of the node model and the edge model through maximum likelihood estimation comprises: sample points are drawn from a real distribution ;​ Through the formula: Deriving node model generating distribution With edge model generating distribution ; Through the formula: Derive the node model generation distribution log-likelihood Distribution generated by edge model log-likelihood ; Through the formula: The optimized model parameters are calculated .

4. The flow model based molecular graph generation method of claim 1, wherein, The combining of the second node matrix and the second edge matrix through chemical rule checking and correction to generate a molecular graph comprises: Creating a blank molecular object using the RdKit chemical tool; Adding all atoms to the molecular object according to the generated node matrix; Adding chemical bonds between atoms step by step according to the generated adjacency matrix, and performing valence checking each time a chemical bond is added; Outputting the maximum connected graph as a molecular graph by randomly selecting chemical bonds within a valid range.

5. A flow model-based molecular graph generation apparatus, characterized by comprising: Comprise: The acquisition module is used for collecting a public molecular dataset, converting the representation of the molecules, and calculating the topological structure and chemical information to extract a first node matrix and a first edge matrix of the molecules; The model building module is used for building a node model fused with self-attention according to the first node matrix and the first edge matrix, and building an edge model fused with two-dimensional convolution according to the first edge matrix; The optimization module is used for optimizing the model parameters of the node model and the edge model through maximum likelihood estimation; The generation module is used for obtaining random node samples and edge samples, generating a second node matrix through inverse mapping of the optimized node model, and generating a second edge matrix through inverse mapping of the optimized edge model; and combining the second node matrix and the second edge matrix through chemical rule checking and correction to generate a molecular graph; The acquisition module is specifically used for: Calculating the chemical properties of each molecule using a chemical informatics software package RDKit to obtain atomic and edge information; Performing ketonization processing on the molecules to retain the heavy atom skeleton of the molecules; Converting the heavy atom skeleton of the molecules into graph structure data; Obtaining a node matrix and an edge matrix from the graph structure data; The model building module is specifically used for: Divide the input node matrix V into two parts along the channel dimension The input edge matrix E remains constant as a constant Through the formula: Obtaining individual graph coupling layers where h is the output tensor, t is the transformation coefficient for affine transformation, log s is the scaling coefficient in logarithmic form, σ represents the activation function, ρ represents normalization, AttnGCN is the attention-fused graph convolution module, Split is the split operation, and Chunk is the split function. Through the formula: obtaining a node model wherein for a single graph coupling layer ; The generation module is specifically configured to: randomly sampling node samples in latent space and edge samples ; Through the formula: obtaining the edge matrix wherein for the stitching operation, denotes an activation function, denotes normalization; Through the formula: obtaining a node matrix wherein is a concatenation operation, denotes an activation function, represents a normalization.

6. The molecular graph generation device based on a flow model according to claim 5, characterized in that, The model construction module is further specifically configured to: dividing the input edge matrix into two parts along the channel dimension ; Through the formula: Obtaining a single edge-coupled layer where h is the output tensor, t is the transformation coefficient for affine transformation, log s is the scaling coefficient in logarithmic form, σ represents the activation function, p represents normalization, and Conv2d is a two-dimensional convolution function. Through the formula: obtaining edge models wherein is a single edge coupling layer .

7. The flow model based molecule graph generation apparatus of claim 5, wherein, The optimization is used for: sample points are drawn from a real distribution ;​ Through the formula: Deriving node model generating distribution With edge model generating distribution ; Through the formula: deriving a node model generating distribution log-likelihood of the edge model generating distribution log-likelihood of the edge model generating distribution log-likelihood of the edge model generating distribution ; Through the formula: The optimized model parameters are calculated .

Citation Information

Patent Citations

  • Single cell clustering method, device and equipment and readable storage medium

    CN114334013A

  • Molecular generation method based on attribute editing stream

    CN115206456A