A molecular representation method and system based on deep graph neural networks
The deep graph neural network method, which uses dense residual graph convolution and initial graph connections, solves the oversmoothing problem of graph neural networks, improves the quality and efficiency of molecular representation, enhances the expressive power of deep networks, and optimizes the performance of drug classification tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2026-03-10
AI Technical Summary
Existing graph neural networks suffer from oversmoothing in deep networks, resulting in insufficient receptive fields at nodes and high computational complexity, which limits the quality and efficiency of molecular representation generation.
A deep graph neural network method employing dense residual graph convolution and initial graph connection enhances the feature representation of molecular graphs, overcomes the oversmoothing problem, and maintains sufficient information transmission in deep networks.
It improves the quality and efficiency of molecular representation, enhances the expressive power of deep networks, reduces computational complexity, and outperforms existing methods in drug classification tasks.
Smart Images

Figure CN116504333B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application discloses a molecular representation method and system based on a deep graph neural network, and relates to the technical field of artificial intelligence, in particular to the technical fields of biological computing and deep learning. BACKGROUND
[0002] There are three kinds of mainstream molecular representation methods. The first kind uses chemical-chemical interaction and structural similarity to construct a feature matrix, and directly takes out the corresponding row and column in the matrix as the molecular representation when prediction is needed. The second kind uses the SMILES representation method or the molecular extended connectivity fingerprint ECFP to represent a molecule as a Token sequence, and uses related methods in the field of natural language processing NLP to predict molecular properties or design molecules. Both of these two methods have a significant defect that molecules cannot explicitly represent spatial topological properties as non-Euclidean data. The third kind of method is based on a graph neural network, taking a chemical small molecule as an example, regarding atoms as nodes on a graph and chemical bonds as edges, constructing a molecular graph, and using convolution and reading algorithms on the graph to obtain the embedding features of the whole graph as the representation of the molecule.
[0003] The graph neural network has an over-smoothing problem:
[0004] Current graph neural networks are mainly based on a message passing framework, and the transmission of information depends on aggregation and update operations. A node mainly obtains feature representation from surrounding neighbor nodes, and then updates its own feature representation, which causes adjacent nodes to tend to have similar representations. When the network depth increases, with the increase of the number of transmissions, the information of each node of the whole graph will also converge, and the discrimination of different nodes is lacking. Therefore, a deep graph neural network may lead to a decrease in task performance.
[0005] Problems in delaying over-smoothing by using an attention mechanism:
[0006] Existing technologies use the method of calculating attention to improve the message passing mechanism, increase the weight of the node itself when passing messages, and reduce excessive message passing, so as to overcome the over-smoothing problem to a certain extent. However, calculating the attention weight for each node will lead to a large amount of computing power consumption, and after the network depth increases, although the coefficient is low each time, the number of message transmissions increases, and the over-smoothing problem still exists. Such a scheme only delays the over-smoothing problem by using adaptive weights, but the calculation amount explodes when the network is deepened, and the smoothing problem reappears.
[0007] Importance of expanding deep structure on a graph:
[0008] It is a common consensus in the field of deep learning that reasonable deepening of neural networks is beneficial to performance enhancement. In graph deep learning, a graph convolution can aggregate the information of neighboring nodes, and to obtain the information of more distant nodes, it is necessary to increase the number of graph convolutions to increase the node receptive field. However, the problem of over-smoothing limits the expressiveness of the network and the quality of the generated molecular representation, because the graph neural network cannot be deepened.
[0009] Although the method of small molecule representation learning based on Transformer and enhanced interactive MPNN neural network also overcomes the problem of over-smoothing, there are still the following technical problems:
[0010] 1. The problem of over-smoothing is not well solved. Over-smoothing leads to the inability of the graph neural network to increase the number of graph convolutions to increase the node receptive field. The existing attention improvement scheme can only delay the problem of over-smoothing, and the problem of over-smoothing will reappear after deepening the network, which greatly limits the expressiveness of the network and causes the problem of poor quality of the generated molecular representation.
[0011] 2. The network has a shallow layer. Only shallow network can be used to extract molecular representation, and the node receptive field is small, which causes insufficient information transmission and fusion.
[0012] 3. High computational complexity. The existing attention-based scheme needs to assign weights to neighbors when each node receives messages, which will increase the amount of calculation although it is beneficial to performance improvement. SUMMARY
[0013] In view of the above problems, the purpose of the present application is to provide a molecular representation method and system based on deep graph neural network, which solves the problem that the existing technology over-smoothing leads to the inability of the graph neural network to increase the number of graph convolutions to increase the node receptive field, the existing attention improvement scheme can only delay the problem of over-smoothing, and the problem of over-smoothing will reappear after deepening the network, which greatly limits the expressiveness of the network and causes the problem of poor quality of the generated molecular representation.
[0014] In order to achieve the above purpose, the technical scheme adopted by the present application is as follows:
[0015] A molecular representation method based on deep graph neural network, comprising the following steps:
[0016] S1. calling a third-party library to convert the computer storage data of the molecule into a molecular graph, the molecular graph comprising an adjacency matrix, nodes and edges, wherein the third-party library comprises RDKit;
[0017] S2. analyzing the molecular graph to obtain the initial feature vectors of the nodes and edges of the molecular graph;
[0018] S3. Perform dense residual graph convolution operation on the initial feature vectors of nodes and edges based on the graph neural network and the adjacency matrix to obtain new feature vectors of nodes and edges;
[0019] S4. Perform pooling operation on the new feature vectors of nodes and edges to obtain molecular representation.
[0020] Further, the specific steps of the step S1 are:
[0021] S1.1. Obtain computer storage data of the molecule, wherein the computer storage data is a text file of the molecule stored with a suffix of “.MOL”, “.SDF”, “.KCF”, or a string of molecular characters based on SMILES representation method;
[0022] S1.2. If the computer storage data is a text file of the molecule stored with a suffix of “.MOL”, “.SDF”, “.KCF”, go to step S1.3, if the computer storage data is a text file of the molecule stored with a SMILES representation method, go to step S1.4, otherwise, skip;
[0023] S1.3. Initialize an empty molecule class, and use functions in the open source toolkit rdkit to scan the text file of the molecule from top to bottom line by line, read atomic information and chemical bond information into the molecule class in turn, and store the atomic information and the chemical bond information into nodes and edges in the molecule class respectively, to obtain a molecule class storing nodes and edges, wherein the atomic information includes atomic position, atomic descriptor, chemical bond type and atomic ID as unique identifier of the node, the chemical bond information is recorded in the form of atomic IDi-atomic IDj relationship pair, i represents the ith atom, j represents the jth atom, and i≠j, the chemical bond type includes single bond represented by “-”, double bond represented by “=”, triple bond represented by “#”, aromatic bond represented by “:”, and other bond represented by “*”, and the atomic descriptor includes “C”, “H”, “O”;
[0024] S1.4. Initialize an empty molecule class, analyze the atoms, edge types of atoms, branched structures and ring structures in the characters of the stored one-dimensional sequence molecular string by using the functions in the open source toolkit rdkit, and obtain atomic information and chemical bond information based on the atoms, edge types of atoms, branched structures and ring structures, and store the atomic information and chemical bond information into the nodes and edges of the molecule class respectively, to obtain a molecule class storing nodes and edges, wherein a node stores an atomic information and an edge stores a chemical bond information, the one-dimensional sequence molecular string contains atoms represented by English letter element symbols, single bonds represented by “-”, double bonds represented by “=”, triple bonds represented by “#”, aromatic bonds represented by “:”, and the breaking places of carbon chain branches and rings represented by numbers in “()”, the atomic information in the molecule class includes atomic positions, atomic descriptors, bond types and atomic IDs as unique identifiers of nodes, the bond information is recorded in the form of atomic IDi-atomic IDj relationship pair, i represents the ith atom, j represents the jth atom, and i≠j, the bond type includes single bond represented by “-”, double bond represented by “=”, triple bond represented by “#”, aromatic bond represented by “:”, and other bonds represented by “*”, and the atomic descriptor includes “C”, “H”, “O”, “N”, “S”, “P”, “Cl”, “Si”, “H” for hydrogen atom, single bond and aromatic bond are omitted or retained in SMILES and the molecule class;
[0025] S1.5. Initialize a molecule graph class and a zero matrix with the size of the number of nodes, the atomic ID corresponding to the node in the molecule class obtained in step S1.3 or step S1.4, fill 1 in the corresponding position of the zero matrix according to the atomic IDi-atomic IDj relationship pair, to obtain an adjacency matrix A based on an undirected graph, the adjacency matrix contains the topological structure of the molecule graph, store the nodes storing atomic information and the edges storing chemical bond information in the molecule graph class as attributes together with the adjacency matrix, to obtain a molecule graph class storing nodes, edges and adjacency matrix, i.e. a molecule graph.
[0026] Further, the specific steps of step S2 are:
[0027] Step S2.1: According to the atomic number of the atom in the periodic table of elements, a one-hot vector with a length of 118 is constructed for each node storing atomic information, and the obtained vector is stored in the molecule graph as the initial vector of the node, wherein the length of 118 is determined based on the maximum atomic number.
[0028] Step S2.2: input the molecular graph obtained in step S2.1, initialize a list of length 5: [0: single bond, 1: double bond, 2: triple bond, 3: aromatic bond, 4: other], initialize a 5-dimensional zero vector, assign a value of 1 to the corresponding position according to the corresponding number of chemical bond type, obtain a 5-dimensional one-hot vector, and store the obtained vector as the initial feature vector of the edge in the molecular graph.
[0029] Further, the specific steps of the step S3 are:
[0030] Step S3.1: the operation of each layer of the graph neural network is graph convolution, activation, dense residual connection, activation, and batch normalization operation in turn, and one graph convolution is aggregation and update operation in turn, and the l-th layer network is denoted as F l , the subscript l takes the value of 0, 1, …, L, L represents the total number of network layers, and when the layer number is not specified, it is simply denoted as F, the input of the l-th layer network is the output G l-1 =(A, V, E, H l-1 ) of the previous layer network, the input of the first layer network is the molecular graph G0obtained in step S2.2, and the molecular graph output by the l-th layer network is denoted as G l =(A, V, E, H l ), wherein A represents an adjacency matrix, V and E represent the set of nodes and edges, respectively, and H
[0031] represents the initial feature stored in G0. Step S3.2: initialize a new molecular graph, and at the same time, initialize G l =G l -1, copy the nodes, edges, and adjacency matrix of G l -1 into G l as the initialization value, and obtain the molecular graph G l ;
[0032] Step S3.3: aggregation operation, that is, the features of the neighbor nodes and edges adjacent to the neighbor nodes of each node on G l are converged to the current node to obtain new feature vectors of the nodes and edges of the graph, and the formula is:
[0033]
[0034] wherein, represents the parameters learned in the l-th layer aggregation function Aggregate(), and AggregateResult is the obtained aggregation result;
[0035] Step S3.4: based on G lThe update operation is performed on the aggregation result AggregateResult, and an update function is applied to the aggregation result, the update function adopts a linear layer, and new feature vectors of nodes and edges on the graph are obtained, and the formula is:
[0036]
[0037] wherein, represent the parameters learned in the l-th layer update function Update(), and UpdateResult is the obtained update result;
[0038] Step S3.5: Based on the update result UpdateResult obtained in step S3.4, an activation operation is performed, and a RELU function is used as an activation function to activate the update result, and the formula is:
[0039] ActivationResult = RELU (UpdateResult)
[0040] The obtained activation result ActivationResult is denoted as as the new feature vectors of nodes and edges on the molecular graph;
[0041] Step S3.6: Based on the ActivationResult obtained in step S3.5, A dense residual connection is added to obtain the updated
[0042] When l = 1, the formula is as follows:
[0043]
[0044] When l > 1, the formula is as follows:
[0045]
[0046] wherein,... represents an omitted recursive formula, and the density is reflected in contains the output features H1 to H l-1 of all previous network layers; contains the feature H l-1 before the l-th layer network operation; in addition, the formula also reflects the initial connection, contains the original input H0; H l-1 is the result obtained by the batch normalization operation on the previous layer network;
[0047] Step S3.7: Based on the ActivationResult obtained in step S3.6, performing reactivation to obtain The formula is:
[0048]
[0049] Where RELU() is the activation function;
[0050] Step S3.8: Based on the results obtained in step S3.6 Perform batch normalization to obtain H l The formula is:
[0051]
[0052] BatchNorm() is the batch normalization operation function;
[0053] Step S3.9: When l < L, set H l Store G l = (A, V, E, H) l ), used for subsequent network layer steps, execute l = l + 1, and go to step S3.1; when l = L, H L Store G L = (A, V, E, H) L Output the molecular diagram G of the last layer. L This yields the feature vectors of the new nodes and edges; further, the specific steps of step S4 are as follows:
[0054] Step S4.1: If performing node-level and edge-level tasks, directly output the final graph as the final representation;
[0055] Step S4.2: If performing a graph-level task, use a pooling strategy to read out the final graph and output the feature vector as the molecular representation.
[0056] A molecular representation system based on a deep graph neural network, comprising:
[0057] The conversion module calls third-party libraries to convert the computer-stored data of molecules into a molecular graph, which includes an adjacency matrix, nodes, and edges. The third-party libraries called include RDKit.
[0058] Analysis module: Analyzes the molecular graph to obtain the initial feature vectors of the nodes and edges of the molecular graph;
[0059] Dense Residual Graph Convolution Operation Module: Based on graph neural networks and adjacency matrices, dense residual graph convolution operation is performed on the initial feature vectors of nodes and edges to obtain new feature vectors of nodes and edges;
[0060] Molecular representation module: Performs pooling operations on the feature vectors of new nodes and edges to obtain molecular representations.
[0061] Furthermore, the specific implementation steps of the conversion module are as follows:
[0062] S1.1. Obtain the computer storage data of the molecule, wherein the computer storage data is a text file of the molecule stored with the suffixes ".MOL", ".SDF", or ".KCF", or a string of molecules based on SMILES notation;
[0063] S1.2. If the computer stores the data as a text file of molecules with the suffixes “.MOL”, “.SDF”, or “.KCF”, proceed to step S1.3. If the computer stores the data as a text file of molecules with the SMILES notation, proceed to step S1.4. Otherwise, skip.
[0064] S1.3. Initialize an empty molecular class and use functions from the open-source toolkit rdkit to scan the molecular text file line by line from top to bottom. Read the atomic information and chemical bond information into the molecular class in sequence, and store the atomic information and chemical bond information into the nodes and edges of the molecular class respectively, resulting in a molecular class that stores nodes and edges. The atomic information includes the atom position, atom descriptor, chemical bond type, and atom ID as a unique identifier for the node. The chemical bond information is recorded in the relationship of atom IDi-atom IDj, where i represents the i-th atom and j represents the j-th atom, and i≠j. The chemical bond type includes single bonds represented by "-", double bonds represented by "=", triple bonds represented by "#", aromatic bonds represented by ":", and other bonds represented by "*". The atom descriptor includes "C", "H", and "O".
[0065] S1.4. Initialize an empty molecular class. Use functions from the open-source toolkit rdkit to analyze the atoms, edge types, branching structures, and ring structures in the stored one-dimensional sequence molecular string. Based on the atoms, edge types, branching structures, and ring structures, obtain atomic information and chemical bond information. Store the atomic information and chemical bond information into nodes and edges in the molecular class, respectively, resulting in a molecular class that stores nodes and edges. Each node stores one atom's information, and each edge stores one chemical bond's information. The one-dimensional sequence molecular string contains atoms represented by English letter symbols: "-" for single bonds, "=" for double bonds, "#" for triple bonds, and ":" for aromatic bonds. The parentheses “()” indicate the break points of carbon chain branches and rings, marked with numbers. Atomic information in the molecule class includes atomic position, atomic descriptor, chemical bond type, and atomic ID as a unique identifier for the node. Chemical bond information is recorded in the relationship of atom IDi-atom IDj, where i represents the i-th atom and j represents the j-th atom, and i≠j. Chemical bond types include single bonds represented by “-”, double bonds represented by “=”, triple bonds represented by “#”, aromatic bonds represented by “:”, and other bonds represented by “*”. Atomic descriptors include “C”, “H”, “O”, “N”, “S”, “P”, “CI”, and “Si”. Hydrogen atoms “H”, single bonds, and aromatic bonds are omitted or retained in SMILES and molecule classes.
[0066] S1.5. Initialize a molecular graph class and a zero matrix whose rows and columns are equal to the number of nodes. The row and column indices are the corresponding atom IDs in the molecular class obtained in step S1.3 or S1.4. According to the atom IDi-atom IDj relationship pair, fill in 1 at the corresponding position in the zero matrix to obtain the adjacency matrix A based on the undirected graph. The adjacency matrix contains the topological structure of the molecular graph. Store the nodes in the molecular class that store atomic information and the edges that store chemical bond information together with the adjacency matrix into the molecular graph class as attributes to obtain a molecular graph class that stores nodes, edges, and the adjacency matrix, i.e., the molecular graph.
[0067] Furthermore, the specific implementation steps of the analysis module are as follows:
[0068] Step S2.1: Based on the atomic number of the atom in the periodic table in the molecular diagram, construct a 118-dimensional one-hot vector for each node that stores atomic information. The resulting vector is used as the initial vector of the node and stored in the molecular diagram. The 118-dimensional vector is determined based on the maximum atomic number.
[0069] Step S2.2: Input the molecular graph obtained in step S2.1, initialize a list of length 5: [0: single bond, 1: double bond, 2: triple bond, 3: aromatic bond, 4: others], initialize a 5-dimensional zero vector, assign the value 1 to the corresponding position according to the corresponding number of the chemical bond type, obtain a 5-dimensional one-hot vector, and use the obtained vector as the initial feature vector of the edge and store it in the molecular graph.
[0070] Furthermore, the specific implementation steps of the dense residual graph convolution operation module are as follows:
[0071] Step S3.1: The operations of each layer of the graph neural network are graph convolution, activation, dense residual connection, activation, and batch normalization. One graph convolution is followed by aggregation and update operations. For the l-th layer, let's call it F. l The subscript l ranges from 0, 1, ..., L, where L represents the total number of layers in the network. When not specifically referring to a number of layers, it is abbreviated as F. The input of the l-th layer is the output G of the layer above it. l-1 = (A, V, E, H) l-1 The input to the first layer of the network is the molecular graph G0 obtained in step S2.2, and the output molecular graph of the first layer is denoted as G. l = (A, V, E, H) l ), where A represents the adjacency matrix, and V and E represent the sets of nodes and edges, respectively. The feature vectors representing the nodes and edges of the l-th layer are stored in G0 and denoted as H0.
[0072] Step S3.2: Initialize a new molecular diagram, and simultaneously initialize G. l =G l-1 , will G l-1 Copy the nodes, edges, and adjacency matrix into G. l As the initial value, the molecular diagram G is obtained. l ;
[0073] Step S3.3: Aggregation operation, that is, G l The features of each node's neighboring nodes and edges adjacent to those neighbors are converged to the current node, resulting in a new feature vector for the nodes and edges of the graph. The formula is as follows:
[0074]
[0075] in, This represents the parameters learned in the l-th layer aggregation function Aggregate(), and AggregateResult is the obtained aggregation result;
[0076] Step S3.4: Based on G obtained in step S3.3 lAn update operation is performed, applying an update function to the aggregated result, AggregateResult. This update function uses a linear layer to obtain new feature vectors for the nodes and edges in the graph. The formula is as follows:
[0077]
[0078] in, This represents the parameters learned in the l-th layer update function Update(), and UpdateResult is the update result obtained.
[0079] Step S3.5: Based on the update result UpdateResult obtained in step S3.4, perform an activation operation using the ReLU function as the activation function to activate the update result. The formula is as follows:
[0080] ActivationResult=RELU(UpdateResult)
[0081] The activation result, ActivationResult, is denoted as... As new eigenvectors of nodes and edges on the molecular graph;
[0082] Step S3.6: Based on the results obtained in step S3.5 Adding dense residual joins yields the updated result.
[0083] When l = 1, the formula is as follows:
[0084]
[0085] When l > 1, the formula is as follows:
[0086]
[0087] Where, … represents an omitted recursive formula, and the density is reflected in… Contains the output features H1 to H of all previous network layers l-1 The residual is reflected in Features H contained before the operation of the l-th layer network l-1 Furthermore, this formula also embodies the initial connection. Contains the original input H0; H l-1 This is the result obtained from the previous layer network after batch normalization.
[0088] Step S3.7: Based on the results obtained in step S3.6 Reactivate to obtain The formula is:
[0089]
[0090] Where RELU() is the activation function;
[0091] Step S3.8: Based on the results obtained in step S3.6 Perform batch normalization to obtain H l The formula is:
[0092]
[0093] BatchNorm() is the batch normalization operation function;
[0094] Step S3.9: When l < L, set H l Store G l = (A, V, E, H) l ), used for subsequent network layer steps, execute l = l + 1, and go to step S3.1; when l = L, H L Store G L = (A, V, E, H) L Output the molecular diagram G of the last layer. L This yields new feature vectors for nodes and edges; further, the specific implementation steps of the molecular representation module are as follows:
[0095] Step S4.1: If performing node-level and edge-level tasks, directly output the final graph as the final representation;
[0096] Step S4.2: If performing a graph-level task, use a pooling strategy to read out the final graph and output the feature vector as the molecular representation.
[0097] Compared with the prior art, the beneficial effects of this invention are as follows:
[0098] I. This invention can provide explicit modeling of the spatial structure of molecules:
[0099] As a type of heterogeneous non-Euclidean data, graphs cannot be represented by similarity-based or sequence-based methods without capturing explicit topological information. However, the molecular graph design, which models atoms as vertices and molecules as edges, allows for information transfer on the graph, better reflecting the molecular structure and enriching its spatial representation information, thus ensuring a higher-quality molecular representation.
[0100] II. In this invention, the initial connection of the molecular graph retains the initial graph information, which helps to overcome the oversmoothing problem:
[0101] In the past, when graph neural networks were made deeper, their performance actually decreased. One major reason was that too many aggregations caused adjacent nodes to tend to have similar representations. Therefore, it is necessary to retain the original initial graph G0 to provide discriminative and initial class information for the input of each layer of the network, which helps to overcome the oversmoothing problem.
[0102] Third, the graph residual connections in this invention help to deepen the graph network:
[0103] As the number of network layers increases, information vanishing or gradient vanishing may occur. Residual connections on the graph help stabilize the gradients of deep graph convolutions, feed the outputs of previous networks into subsequent networks, and also simplify the learning process.
[0104] IV. The dense connection of graphs in this invention helps to improve information utilization and enrich the representation of graph information:
[0105] The deeper the network, the greater the risk of overfitting and the greater the redundancy of the network. Increasing dense connections allows the network to refer to the computational output of each level during computation, improving the utilization rate of redundant information and enriching the representation of results. This can be used to extract molecular representations from deep networks, and the nodes have larger receptive fields, which makes information transmission and fusion more complete.
[0106] V. In the ATC classification task of drugs, the current state-of-the-art technology is based on the CNN-TEXT method, which uses the string sequence of molecular SMILES to model molecules. The method of this invention can outperform the CNN-TEXT method by 2.2% and 8.3% in the first and second level classification tasks of ATC, respectively.
[0107] VI. This invention has low computational complexity, that is, low hardware performance requirements. Attached Figure Description
[0108] Figure 1 This is a schematic diagram of the process of the present invention;
[0109] Figure 2 This is a schematic diagram of the process for obtaining the molecular map in this invention. Detailed Implementation
[0110] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments.
[0111] A molecular representation method based on deep graph neural networks includes the following steps:
[0112] S1. A third-party library is used to convert the computer-stored data of molecules into a molecular graph. The molecular graph includes an adjacency matrix, nodes, and edges. The third-party library used is RDKit. This involves converting and mapping the computer-stored data of biochemical molecules to obtain a molecular graph topology, also simply called a molecular graph. The molecular graph contains nodes and edges derived from atomic and chemical bond information, as well as an adjacency matrix recording the topological structure. The specific steps are as follows:
[0113] S1.1. Obtain the computer storage data of the molecule, wherein the computer storage data is a text file of the molecule stored with the suffixes ".MOL", ".SDF", or ".KCF", or a string of molecules based on SMILES notation;
[0114] S1.2. If the computer stores the data as a text file of molecules with the suffixes “.MOL”, “.SDF”, or “.KCF”, proceed to step S1.3. If the computer stores the data as a text file of molecules with the SMILES notation, proceed to step S1.4. Otherwise, skip.
[0115] S1.3. Call the MolFromMolFile() method, passing in the path parameter of the molecule's text file, initialize an empty molecule class, and use the function in the open-source toolkit rdkit to scan the molecule's text file line by line from top to bottom. In the molecule class, read in the atomic information and chemical bond information in turn, and store the atomic information and chemical bond information into the nodes and edges in the molecule class respectively, to obtain a molecule class that stores nodes and edges. Among them, the atomic information includes the atom position, atom descriptor, chemical bond type and atom ID as a unique identifier of the node. The chemical bond information is recorded in the relationship of atom IDi-atom IDj, where i represents the i-th atom and j represents the j-th atom, and i≠j. The chemical bond type includes single bond represented by "-", double bond represented by "=", triple bond represented by "#", aromatic bond represented by ":", and other bonds represented by "*". The atom descriptor includes "C", "H", and "O".
[0116] S1.4. Call the `MolFromSmiles()` method, passing in a one-dimensional sequence molecular string based on SMILES notation. Initialize an empty molecular class. Use functions from the open-source toolkit rdkit to analyze the atoms, edge types, branch structures, and ring structures in the stored one-dimensional sequence molecular string. Based on the atoms, edge types, branch structures, and ring structures, obtain atomic information and chemical bond information. Store the atomic information and chemical bond information into nodes and edges in the molecular class, respectively, resulting in a molecular class that stores nodes and edges. Each node stores one atom's information, and each edge stores one chemical bond's information. The one-dimensional sequence molecular string contains atoms represented by English letter symbols, single bonds represented by "-", and equal signs representing... Double bonds are indicated by "#", triple bonds by ":", and aromatic bonds by ":". The numbers within parentheses indicate carbon chain branches and ring breaks. Atomic information in the molecule class includes atomic position, atomic descriptor, chemical bond type, and atom ID as a unique identifier for each node. Chemical bond information is recorded in pairs of atom IDi-atom IDj, where i represents the i-th atom and j represents the j-th atom, and i≠j. Chemical bond types include single bonds (represented by "-"), double bonds (represented by "="), triple bonds (represented by "#"), aromatic bonds (represented by ":"), and other bonds (represented by "*"). Atom descriptors include "C", "H", "O", "N", "S", "P", "Cl", and "Si". Hydrogen atoms "H", single bonds, and aromatic bonds are omitted or retained in SMILES and molecule classes.
[0117] S1.5. Call the MolToBigraph() method, passing in the molecular class obtained in step S1.3 or S1.4, initialize a molecular graph class and a zero matrix with rows and columns equal to the number of nodes, and index the rows and columns according to the corresponding atom IDs in the molecular class obtained in step S1.3 or S1.4. Based on the atom IDi-atom IDj relationship, fill in 1 at the corresponding position in the zero matrix to obtain the adjacency matrix A based on the undirected graph. The adjacency matrix contains the topological structure of the molecular graph. Store the nodes that store atomic information and the edges that store chemical bond information in the molecular class together with the adjacency matrix into the molecular graph class as attributes, and obtain a molecular graph class that stores nodes, edges, and the adjacency matrix, i.e., the molecular graph.
[0118] S2. Analyze the molecular graph to obtain the initial eigenvectors of its nodes and edges; that is, for the obtained molecular graph, analyze its corresponding atomic information to obtain the initial eigenvectors of its nodes and edges. The topology of the molecular graph contains the spatial information of the molecule, and the eigenvectors of its nodes and edges contain the chemical characteristic information of atoms and chemical bonds. The specific steps are as follows:
[0119] Step S2.1: Based on the atomic number of the atom in the periodic table in the molecular diagram, construct a 118-dimensional one-hot vector for each node that stores atomic information. The resulting vector is used as the initial vector of the node and stored in the molecular diagram. The 118-dimensional vector is determined based on the maximum atomic number.
[0120] Step S2.2: Input the molecular graph obtained in step S2.1, initialize a list of length 5: [0: single bond, 1: double bond, 2: triple bond, 3: aromatic bond, 4: others], initialize a 5-dimensional zero vector, assign the value 1 to the corresponding position according to the corresponding number of the chemical bond type, obtain a 5-dimensional one-hot vector, and use the obtained vector as the initial feature vector of the edge and store it in the molecular graph.
[0121] S3. Based on the graph neural network and adjacency matrix, perform dense residual graph convolution on the initial feature vectors of nodes and edges to obtain new feature vectors of nodes and edges; that is, perform at least one dense residual graph convolution operation on the obtained subgraph and initial feature vectors to obtain new feature vectors of nodes and edges. The initial feature vectors and the features of each dense residual graph convolution operation are preserved, providing a dependency for subsequent dense residual graph convolution operations. The specific steps are as follows:
[0122] Step S3.1: The operations of each layer of the graph neural network are graph convolution, activation, dense residual connection, activation, and batch normalization. One graph convolution is followed by aggregation and update operations. The l-th layer is denoted as Fl, and the subscript l ranges from 0, 1, ..., L, where L represents the total number of layers. When not specifically referring to the number of layers, it is simply denoted as F. The input of the l-th layer is the output G of the previous layer. l-1 = (A, V, E, H) l-1 The input to the first layer of the network is the molecular graph G0 obtained in step S2.2, and the output molecular graph of the first layer is denoted as G. l = (A, V, E, H) l ), where A represents the adjacency matrix, and V and E represent the sets of nodes and edges, respectively. The feature vectors representing the nodes and edges of the l-th layer are stored in G0 and denoted as H0.
[0123] Step S3.2: Initialize a new molecular diagram, and simultaneously initialize G. l =G l-1 , will G l-1 Copy the nodes, edges, and adjacency matrix into G. l As the initial value, the molecular diagram G is obtained. l ;
[0124] Step S3.3: Aggregation operation, that is, G lThe features of each node's neighboring nodes and edges adjacent to those neighbors are converged to the current node, resulting in a new feature vector for the nodes and edges of the graph. The formula is as follows:
[0125]
[0126] in, This represents the parameters learned in the l-th layer aggregation function Aggregate(), and AggregateResult is the obtained aggregation result;
[0127] Step S3.4: Based on G obtained in step S3.3 l An update operation is performed, applying an update function to the aggregated result, AggregateResult. This update function uses a linear layer to obtain new feature vectors for the nodes and edges in the graph. The formula is as follows:
[0128]
[0129] in, This represents the parameters learned in the l-th layer update function Update(), and UpdateResult is the update result obtained.
[0130] Step S3.5: Based on the update result UpdateResult obtained in step S3.4, perform an activation operation using the ReLU function as the activation function to activate the update result. The formula is as follows:
[0131] ActivationResult=RELU(UpdateResult)
[0132] The activation result, ActivationResult, is denoted as... As new eigenvectors of nodes and edges on the molecular graph;
[0133] Step S3.6: Based on the results obtained in step S3.5 Adding dense residual joins yields the updated result.
[0134] When l = 1, the formula is as follows:
[0135]
[0136] When l > 1, the formula is as follows:
[0137]
[0138] Where, … represents an omitted recursive formula, and the density is reflected in… Contains the output features H1 to H of all previous network layers l-1The residual is reflected in Features H contained before the operation of the l-th layer network l-1 Furthermore, this formula also embodies the initial connection. Contains the original input H0; H l-1 This is the result obtained from the previous layer network after batch normalization.
[0139] Step S3.7: Based on the results obtained in step S3.6 Reactivate to obtain The formula is:
[0140]
[0141] Where RELU() is the activation function;
[0142] Step S3.8: Based on the results obtained in step S3.6 Perform batch normalization to obtain H l The formula is:
[0143]
[0144] BatchNorm() is the batch normalization operation function;
[0145] Step S3.9: When l < L, set H l Store G l = (A, V, E, H) l ), used for subsequent network layer steps, execute l = l + 1, and go to step S3.1; when l = L, H L Store G L = (A, V, E, H) L Output the molecular diagram G of the last layer. L This yields the eigenvectors of the new nodes and edges.
[0146] S4. Perform pooling operations on the feature vectors of the new nodes and edges to obtain the molecular representation. The specific steps are as follows:
[0147] Step S4.1: If performing a node-level task, directly output the final graph as the final representation;
[0148] Step S4.2: If performing a graph-level task, use a pooling strategy to read out the final graph and output a feature vector of arbitrary length as the molecule representation.
[0149] The resulting molecular representation can be used to train a prediction model or directly input into a pre-trained prediction model for prediction.
[0150] This invention can be directly applied to predicting the properties of compounds, compositions, or mixtures, or to molecular design (e.g., drugs). Addressing the limitation that increasing the number of layers in graph neural networks reduces representational performance, this technique, by introducing dense residual computation, initial connections, skip connections, and dense connections, can enhance the generation of denser latent space representations for biomolecules (e.g., proteins, amino acids) and chemical molecules (e.g., pure substances, compositions, mixtures, polymers), thereby improving the accuracy of predicting compound or drug molecule design.
[0151] The above are merely representative embodiments among the many specific applications of this invention, and do not constitute any limitation on the scope of protection of this invention. All technical solutions formed by transformation or equivalent substitution fall within the scope of protection of this invention.
Claims
1. A method for molecular representation based on deep graph neural networks, characterized in that, The method comprises the following steps: Step S1. calling a third-party library to convert computer storage data of a molecule into a molecular graph, the molecular graph comprising an adjacency matrix, nodes and edges, wherein the third-party library comprises RDKit; Step S2. Analyzing the molecular graph to obtain the initial eigenvectors of the nodes and edges of the molecular graph, and storing them in the molecular graph to obtain a molecular graph ; Step S3. performing dense residual graph convolution operation on initial feature vectors of the nodes and the edges based on a graph neural network and the adjacency matrix to obtain new feature vectors of the nodes and the edges; Step S3 specifically comprises: Step S3.1: The operations of each layer of the graph neural network are graph convolution, activation, dense residual connection, activation, and batch normalization. Each graph convolution operation consists of aggregation and update operations. Layered networks are denoted as subscript The range of values is , Represents the total number of network layers; when not specifically referring to the number of layers, it is abbreviated as... , No. The input of a layer network is the output of the layer above it. The input to the first layer of the network is the molecular diagram obtained in step S2. , No. The molecular diagram output by the layer network is denoted as ,in, Represents the adjacency matrix. and These represent the sets of nodes and edges, respectively. Representing the The feature vectors of layer nodes and edges will be stored in... The initial features are denoted as ; Step S3.2: initialize a new molecular graph, and initialize the nodes, edges, and adjacency matrix of into as the initialization values, and obtain the molecular graph ; Step S3.3: Aggregation operation, i.e. the features of the neighboring nodes of each node on the graph and the edges adjacent to the neighbors are aggregated to the current node, resulting in new feature vectors for the nodes and edges of the graph, given by: where x is the current node, x' is the neighboring node of x, and e is the edge adjacent to x and x'. wherein, represent the first layer aggregation function parameters learned in the middle, is the resulting aggregation result; Step S3.4: Based on the result of step S3.3 Performing the update operation on the aggregated results Applying the update function, which uses a linear layer, to obtain new feature vectors for the nodes and edges on the graph, according to the formula: wherein, represent the first layer update function parameters learned in the middle, is the resulting update; Step S3.5: based on the update result obtained in step S3.4 An activation operation is performed, and the update result is activated by using a RELU function as an activation function, and the formula is: the resulting activation results denoted as new feature vectors for the nodes and edges on the molecular graph; Step S3.6: Based on the result of step S3.5 Adding dense residual connections, resulting in updated ; When the formula is as follows: When the formula is as follows: where, represents the omitted recursive formula, and the denseness is reflected in contains the output features of all previous network layers to , and the residual is reflected in contains the features before the operation of the layer network ; in addition, the formula also reflects the initial connection, contains the original input ; is the result obtained by batch normalization operation on the previous layer network; Step S3.7: Based on the result of step S3.6 A reactivation is performed, resulting in , the formula is: wherein, is an activation function; Step S3.8: Based on the result of step S3.7 The batch normalization operation is performed to obtain , the formula is: wherein, is a batch normalization operation function; Step S3.9: When , store into for the subsequent network layer step, perform and go to step S3.1; when , store into , output the molecular graph of the last layer to get new node and edge feature vectors; Step S4. performing a pooling operation on the new feature vectors of the nodes and the edges to obtain a molecular representation.
2. The method of claim 1, wherein: The specific steps of the step S1 are as follows: S1.
1. obtaining computer storage data of a molecule, wherein the computer storage data is a text file of the molecule stored with a ".MOL", ".SDF" or ".KCF" suffix or a string of molecular strings based on a SMILES representation method; S1.
2. if the computer storage data is a text file of the molecule stored with a ".MOL", ".SDF" or ".KCF" suffix, going to step S1.3, if the computer storage data is a text file of the molecule stored with a SMILES representation method, going to step S1.4, otherwise, skipping; S1.
3. initializing an empty molecule class, and using a function in an open-source toolkit RDKit to scan the text file of the molecule from top to bottom line by line, reading atomic information and chemical bond information into the molecule class in sequence, and storing the atomic information and the chemical bond information into nodes and edges in the molecule class respectively to obtain a molecule class storing the nodes and the edges, wherein the atomic information comprises atomic positions, atomic descriptors, chemical bond types and atomic IDs as unique identifiers of the nodes, the chemical bond information is recorded in the form of atomic IDi-atomic IDj relationship pairs, i represents the i-th atom, j represents the j-th atom, and i≠j, the chemical bond types comprise a single bond represented by "-", a double bond represented by "=", a triple bond represented by "#", an aromatic bond represented by ":", and other bonds represented by "*", and the atomic descriptors comprise "C", "H" and "O"; S1.
4. Initialize an empty molecule class, analyze the atoms, edge types of atoms, branched structures and ring structures in the characters of the stored one-dimensional sequence molecular string using the functions in the open source toolkit RDKit, and obtain atomic information and chemical bond information based on the atoms, edge types of atoms, branched structures and ring structures, and store the atomic information and chemical bond information into the nodes and edges of the molecule class respectively, to obtain a molecule class storing nodes and edges, wherein a node stores an atomic information and an edge stores a chemical bond information, the one-dimensional sequence molecular string contains atoms represented by English letter element symbols, single bonds represented by "-", double bonds represented by "=", triple bonds represented by "#", aromatic bonds represented by ":", and the breaking points of carbon chain branches and rings represented by numbers in the "()" are marked with numbers, the atomic information in the molecule class includes atomic position, atomic descriptor, bond type and atomic ID as unique identifier of the node, the chemical bond information is recorded in the form of atomic IDi-atomic IDj relationship pair, i represents the ith atom, j represents the jth atom, and i≠j, the bond type includes single bond represented by "-", double bond represented by "=", triple bond represented by "#", aromatic bond represented by ":", and other bonds represented by "*", and the atomic descriptor includes "C", "H", "O", "N", "S", "P", "Cl", "Si", hydrogen atom "H", single bond and aromatic bond are omitted or retained in SMILES and molecule class; S1.
5. Initialize a molecular graph class and a zero matrix with the size of the number of nodes in both rows and columns, the corresponding atomic ID in the molecular class obtained in step S1.3 or step S1.4, and fill in 1 in the corresponding position in the zero matrix according to the atomic IDi-atomic IDj relationship pair to obtain an adjacency matrix based on an undirected graph The adjacency matrix contains the topological structure of the molecular graph, and the nodes storing the atomic information in the molecular class and the edges storing the bond information are stored together with the adjacency matrix into the molecular graph class as attributes to obtain a molecular graph class storing nodes, edges, and an adjacency matrix, i.e., a molecular graph.
3. The method of claim 2, wherein: The specific steps of the step S2 are: Step S2.1: According to the atomic number of the atom in the periodic table of elements, a 118-dimensional one-hot vector is constructed for each node storing atomic information, and the obtained vector is stored in the molecule graph as the initial vector of the node, wherein the 118 dimensions are determined based on the maximum atomic number; Step S2.2: The molecule graph obtained in step S2.1 is input, a list of length 5 is initialized: [0: single bond, 1: double bond, 2: triple bond, 3: aromatic bond, 4: other], a 5-dimensional zero vector is initialized, and the corresponding number of the bond type is assigned to the corresponding position as 1 to obtain a 5-dimensional one-hot vector, and the obtained vector is stored as the initial feature vector of the edge in the molecule graph.
4. The method of claim 1, wherein: The specific steps of the step S4 are: Step S4.1: If the node level and edge level task is performed, the final graph is directly output as the final representation; Step S4.2: If the graph level task is performed, the final graph is read out using the pooling strategy, and the feature vector is output as the molecular representation.
5. A deep graph neural network-based molecular representation system, characterized in that, It includes: A conversion module: calling a third-party library to convert the computer storage data of the molecule into a molecule graph, the molecule graph including an adjacency matrix, nodes and edges, wherein the third-party library includes RDKit; analysis module: analyzing the molecular graph to obtain initial eigenvectors of the nodes and edges of the molecular graph, and storing them in the molecular graph to obtain a molecular graph ; A dense residual graph convolution operation module: based on the graph neural network and the adjacency matrix, the initial feature vectors of the nodes and edges are subjected to dense residual graph convolution operation to obtain new feature vectors of the nodes and edges; The specific implementation steps of the dense residual graph convolution operation module are: Step S3.1: The operations of each layer of the graph neural network are graph convolution, activation, dense residual connection, activation, and batch normalization. Each graph convolution operation consists of aggregation and update operations. Layered networks are denoted as subscript The range of values is , Represents the total number of network layers; when not specifically referring to the number of layers, it is abbreviated as... , No. The input of a layer network is the output of the layer above it. The input to the first layer network is the molecular map obtained by the analysis module. , No. The molecular diagram output by the layer network is denoted as ,in, Represents the adjacency matrix. and These represent the sets of nodes and edges, respectively. Representing the The feature vectors of layer nodes and edges will be stored in... The initial features are denoted as ; Step S3.2: initialize a new molecular graph, and initialize , the nodes, edges, and adjacency matrix of to as the initialization value, and obtain the molecular graph ; Step S3.3: Aggregation operation, i.e. the features of the neighboring nodes of each node on the graph and the edges adjacent to the neighbors are aggregated to the current node, resulting in new feature vectors for the nodes and edges of the graph, given by: where x is the current node, x' is the neighboring node of x, and e is the edge adjacent to x and x'. wherein, represent the first layer aggregation function parameters learned in the middle, is the resulting aggregation result; Step S3.4: Based on the result of step S3.3 Performing the update operation on the aggregated results Applying the update function, which takes a linear layer, to obtain new feature vectors for the nodes and edges on the graph, given by: wherein, represent the first layer update function parameters learned in the middle, is the resulting update; Step S3.5: based on the update result obtained in step S3.4 An activation operation is performed on the update result using a RELU function as an activation function, and the formula is: the resulting activation results denoted as new feature vectors for the nodes and edges on the molecular graph; Step S3.6: Based on the result of step S3.5 Add dense residual connections, resulting in updated ; When the formula is as follows: When the formula is as follows: where, represents the omitted recursive formula, and the denseness is reflected in contains the output features of all previous network layers to , and the residual is reflected in contains the features before the operation of the layer network ; in addition, the formula also reflects the initial connection, contains the original input ; is the result obtained by the batch normalization operation of the previous layer network; Step S3.7: Based on the result of step S3.6 A reactivation is performed, resulting in , the formula is: wherein, is an activation function; Step S3.8: Based on the result of step S3.7 The batch normalization operation is performed to obtain , the formula is: wherein, is a batch normalization operation function; Step S3.9: When , store into for the subsequent network layer step, execute and go to step S3.1; when , store into , output the molecular graph of the last layer to get the new node and edge feature vectors; The molecular representation module: the feature vectors of the new nodes and edges are pooled to obtain the molecular representation.
6. The deep graph neural network-based molecular representation system of claim 5, wherein: The specific implementation steps of the conversion module are: S1.
1. Obtain the computer storage data of the molecule, wherein the computer storage data is a text file of the molecule stored with ".MOL", ".SDF", ".KCF" as the suffix, or a string of molecular strings based on the SMILES representation method; S1.
2. If the computer storage data is a text file of the molecule stored with ".MOL", ".SDF", ".KCF" as the suffix, go to step S1.3, if the computer storage data is a text file of the molecule stored with the SMILES representation method, go to step S1.4, otherwise, skip; S1.
3. Initialize an empty molecule class, and use the function in the open source toolkit RDKit to scan the text file of the molecule from top to bottom line by line, read the atomic information and chemical bond information into the molecule class in turn, and store the atomic information and chemical bond information into the nodes and edges in the molecule class respectively to obtain a molecule class storing the nodes and edges, wherein the atomic information includes atomic position, atomic descriptor, chemical bond type and atomic ID as the unique identifier of the node, the chemical bond information is recorded in the form of atomic IDi-atomic IDj relationship, i represents the i-th atom, j represents the j-th atom, and i≠j, the chemical bond type includes single bond represented by "-", double bond represented by "=", triple bond represented by "#", aromatic bond represented by ":", and other bonds represented by "*", and the atomic descriptor includes "C", "H", "O"; S1.
4. Initialize an empty molecule class, analyze the atoms, atomic edge types, branched structures and ring structures in the characters of the stored one-dimensional sequence molecular string by using the function in the open source toolkit RDKit, and obtain atomic information and chemical bond information based on the atoms, atomic edge types, branched structures and ring structures, and store the atomic information and chemical bond information into the nodes and edges in the molecule class respectively to obtain a molecule class storing the nodes and edges, wherein a node stores an atomic information and an edge stores a chemical bond information, the one-dimensional sequence molecular string contains atoms represented by English letter element symbols, single bond represented by "-", double bond represented by "=", triple bond represented by "#", aromatic bond represented by ":", and the breaking place of carbon chain branch and ring is marked by numbers in the form of "()", the atomic information in the molecule class includes atomic position, atomic descriptor, chemical bond type and atomic ID as the unique identifier of the node, the chemical bond information is recorded in the form of atomic IDi-atomic IDj relationship, i represents the i-th atom, j represents the j-th atom, and i≠j, the chemical bond type includes single bond represented by "-", double bond represented by "=", triple bond represented by "#", aromatic bond represented by ":", and other bonds represented by "*", and the atomic descriptor includes "C", "H", "O", "N", "S", "P", "Cl", "Si", hydrogen atom "H", single bond and aromatic bond are omitted or retained in SMILES and the molecule class; S1.
5. Initialize a molecular graph class and a zero matrix with the size of the number of nodes in both rows and columns, the corresponding atomic ID in the molecular class obtained in step S1.3 or step S1.4, and fill in 1 in the corresponding position in the zero matrix according to the atomic IDi-atomic IDj relationship pair to obtain an adjacency matrix based on an undirected graph The adjacency matrix contains the topological structure of the molecular graph, and the nodes storing the atomic information and the edges storing the chemical bond information in the molecular class are stored together with the adjacency matrix into the molecular graph class as attributes to obtain a molecular graph class storing nodes, edges, and an adjacency matrix, i.e., a molecular graph.
7. The deep graph neural network-based molecular representation system of claim 6, wherein: The specific implementation steps of the analysis module are: Step S2.1: According to the atomic number of the atom in the periodic table of elements, a 118-dimensional one-hot vector is constructed for each node storing atomic information, and the obtained vector is used as the initial vector of the node and stored in the molecular graph, wherein the 118 dimensions are determined based on the maximum atomic number; Step S2.2: The molecular graph obtained in step S2.1 is input, a list of length 5 is initialized: [0: single bond, 1: double bond, 2: triple bond, 3: aromatic bond, 4: other], a 5-dimensional zero vector is initialized, and according to the corresponding number of the chemical bond type, the corresponding position is assigned a value of 1 to obtain a 5-dimensional one-hot vector, and the obtained vector is used as the initial feature vector of the edge and stored in the molecular graph.
8. The deep graph neural network-based molecular representation system of claim 7, wherein: The specific implementation steps of the molecular representation module are: Step S4.1: If the node level and edge level tasks are performed, the final graph is directly output as the final representation; Step S4.2: If the graph level task is performed, the pooling strategy is used to read out the final graph, and the feature vector is output as the molecular representation.
Citation Information
Patent Citations
Method and apparatus for molecular toxicity prediction based on multi-task graph neural network
CN113257369A
Molecular feature extraction and performance prediction method based on image convolution
CN113409893A