Multi-modal property prediction method based on syntax tree constraint molecular representation
By combining context-free grammars and graph convolutional networks, a multimodal feature fusion framework is constructed, which overcomes the limitations of existing molecular property prediction models in parsing chemical syntax rules, and achieves more efficient and accurate molecular property prediction, supporting drug design.
Patent Information
- Application Number
- CN202511615543.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-01-27
AI Technical Summary
In the existing technology, molecular property prediction models based on sequence features or graph structure features have limitations in resolving nested molecular substructures and chemical grammar rules, resulting in prediction results that lack chemical rationality and accuracy, especially in drug design.
We combine context-free syntax tree representation with molecular property prediction tasks. We capture the sequence dependencies of SMILES and the topological structure of molecular graphs through Transformer and GCN respectively, and use channel splicing strategy to achieve cross-dimensional feature interaction, thus constructing a comprehensive representation that includes chemical semantics, spatial structure and syntactic information.
It improves the accuracy and reliability of molecular property prediction, provides interpretable chemical structure clues, and enhances the precision of drug design and the ability to capture chemical semantics.
Smart Images

Figure CN121415917A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of computational chemistry and artificial intelligence, and more specifically, relates to a method for predicting multimodal properties of molecular representations based on syntax tree constraints. Background Technology
[0002] Molecular property prediction is one of the core tasks of computational chemistry and drug discovery, aiming to efficiently predict key properties such as solubility, toxicity, and bioactivity based on molecular structure. With the development of deep learning technology, molecular representation learning has become a core challenge in this field. Currently, molecular property prediction techniques are mainly divided into two categories: sequence representation-based methods and graph representation-based methods.
[0003] In sequence representation-based methods, researchers, inspired by natural language processing, have widely adopted Simplified Molecular Linear Input Specifications (SMILES) to describe molecular structures. Early work utilized recurrent neural networks (RNNs) to construct language models of SMILES expressions; for example, the Bidirectional Long Short-Term Memory (BiLSTM) architecture has been used to extract drug SMILES features. Subsequently, Word2vec models were applied to treat each symbol in the molecular expression as a word, learning word vectors of molecular substructures on SMILES data. With the rise of the Transformer architecture, models such as the SMILES Transformer learned molecular fingerprints required for downstream tasks through unsupervised pre-training of sequence language models. The emergence of BERT further propelled the research paradigm towards fine-tuning pre-trained models. However, plain text-based SMILES representations have significant drawbacks: their linear encoding implicitly handles the hierarchical structure of molecules, such as the nested relationships of branching and loop substructures, requiring models to learn complex SMILES grammar rules to generate legitimate molecules. This not only increases training difficulty but may also lead to predictions deviating from chemical plausibility due to the lack of grammatical constraints.
[0004] To address the challenge of linear encoding of molecules (SMILES) in representing their intrinsic structure, graph neural networks (GNNs) have been extensively studied. These models treat molecules as graphs, with atoms or functional groups as nodes and chemical bonds as edges. Graph convolutional networks (GCNs) encode molecular graphs based on atomic features, while the introduction of attention mechanisms further enhances molecular representation capabilities. Message-passing neural networks (MPNNs) perform edge-based message passing on directed graphs to obtain vector representations of atoms and bonds. Graph contrastive learning (GCL) methods have demonstrated good performance in addressing the scarcity of labeled data. However, traditional GNNs rely on adjacency matrices to describe molecular topology, lack explicit constraints on chemical syntax rules such as atomic valence matching and functional group connection validity, and struggle to directly encode the hierarchical structural information implicit in SMILES.
[0005] The core problem with existing technologies lies in the fact that models relying solely on sequence features or graph structure features face limitations in the dimensionality of semantic representation: linear sequences of SMILES struggle to resolve nested substructures of molecules, while adjacency representations of two-dimensional graphs ignore the hierarchical combination logic of chemical functional groups. This results in molecular representations lacking chemical grammatical constraints, reducing the chemical plausibility and accuracy of predictions. In practical applications, these limitations severely hinder the development of computer-aided drug design, especially in scenarios requiring precise prediction of molecular properties. Summary of the Invention
[0006] This invention aims to provide a multimodal property prediction method based on syntax tree-constrained molecular representation, which can efficiently predict key biophysical and chemical properties of molecules through deep learning models, and support data-driven drug design.
[0007] This invention constructs a molecular syntax tree representation by introducing a context-free grammar and designs a multimodal feature fusion framework to effectively integrate sequence syntax features with graph topology features, thereby constructing a high-quality molecular characterization that combines chemical syntax constraints and structural integrity, and improving the accuracy and reliability of molecular property prediction.
[0008] To address at least one of the aforementioned technical problems, according to one aspect of the present invention, a method for predicting multimodal properties based on syntax tree-constrained molecular representations is provided, comprising the following steps:
[0009] By combining context-free grammar-based syntax tree representations with molecular property prediction tasks, the hierarchical structure and chemical syntax rules of encoded molecules are revealed.
[0010] A multimodal feature fusion framework is set up, which captures the sequence dependence of SMILES and the topological structure of molecular graphs through Transformer and GCN respectively, and realizes cross-dimensional feature interaction by channel splicing strategy to construct a comprehensive representation containing chemical semantics, spatial structure and syntactic information.
[0011] By compressing multidimensional features into low-dimensional vectors, a strong correlation between features and prediction results is established.
[0012] The fused features are finally input into the predictor network module to complete the prediction of the properties of the target molecule.
[0013] Furthermore, the steps of combining context-free grammar-based syntax tree representation with molecular property prediction tasks include: inputting molecules SMILES, processing them through two paths, the first path being a one-dimensional syntax tree sequence path: using context-free grammar, i.e., CFG, to generate a molecular syntax tree structure, and extracting tree sequence features through Tree Sequence Encoder: TransformerModule;
[0014] The second path, which is being implemented simultaneously, uses RDKit to convert SMILES into 2D molecular graphs, which are then input into an encoder based on a graph convolutional network. This module processes graph data containing atomic connections, bond attributes, and batch information. It learns node representations through embedding layers and multi-layer graph convolution operations, applies Dropout regularization, and then extracts molecular graph features that characterize molecular topological information through global pooling and feature transformation.
[0015] Finally, the framework effectively integrates and interacts the tree sequence features output from the first and second paths with the molecular graph features through a multi-dimensional feature fusion module, generating a comprehensive molecular representation that integrates grammatical structure and topological structure.
[0016] Furthermore, in the first path, the process of extracting molecular syntax tree sequence features is as follows: the tree structure is first extracted through CFG indexing, the molecular syntax tree structure is converted into a token number sequence, and it is input into a Transformer-based sequence encoder. After processing through embedding layers, multi-head attention mechanism, residual connections and layer normalization, and feedforward network, the final output is a tree sequence feature containing grammatical and structural information.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the multimodal property prediction method based on syntax tree-constrained molecular representation of the present invention.
[0018] According to another aspect of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the multimodal property prediction method based on syntax tree-constrained molecular representation of the present invention.
[0019] Compared with the prior art, the present invention has at least the following beneficial effects:
[0020] This invention combines context-free syntax tree representation with molecular property prediction tasks to reveal the hierarchical structure and chemical syntax rules of encoded molecules, ensuring that predicted molecules conform to the SMILES syntax specification, and fundamentally solving the problem of missing syntax constraints in traditional sequence models.
[0021] This invention designs a multimodal feature fusion framework that captures the sequence dependence of SMILES and the topological structure of molecular graphs through Transformer and GCN respectively, and uses a channel splicing strategy to achieve cross-dimensional feature interaction, thereby constructing a comprehensive representation that includes chemical semantics, spatial structure and syntactic information.
[0022] This invention compresses multidimensional features into low-dimensional vectors, establishing a strong correlation between features and prediction results. This improves the accuracy of model predictions while providing interpretable chemical structural clues for drug design. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings of the embodiments will be briefly described below. Obviously, the drawings described below only relate to some embodiments of the present invention and are not intended to limit the present invention.
[0024] Figure 1 This is a schematic diagram of a preferred embodiment of the MolGramTreeNet framework and its key modules; it is divided into three parts: Figure 1 A illustrates the overall workflow of MolGramTreeNet, demonstrating how input molecular SMILES are transformed using a CFG syntax tree and RDkit, and then processed by a one-dimensional syntax tree sequence encoder (Transformer Encoder) and a two-dimensional molecular graph encoder (GCN) to extract syntactic and topological information. The extracted features are then integrated and concatenated before being input into the predictor network module to predict the properties of the target molecule. Figure 1 B is a one-dimensional syntax tree sequence encoder: The network framework of Transformer Encoder illustrates the process of feature extraction from molecular syntax tree sequences; Figure 1 C represents the network framework of the two-dimensional molecular graph encoder: GCN, which demonstrates the extraction process of molecular graph topological features.
[0025] Figure 2 This is a schematic diagram of a preferred embodiment of the present invention, which combines a context-free grammar and the simplified molecular SMILES rule syntax in Table 1 to parse and obtain the parse tree of 4-pyrimidinone SMILES: O=C1C=CNN=C1 in the BBBP dataset;
[0026] Figure 3 This is a visualization of the Clintox regression task dataset, a preferred embodiment of the present invention, demonstrating how the model learns to separate molecules of different categories; the left side shows random initialization with no meaningful separation, while the right side shows clusters appearing after training. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention.
[0028] Unless otherwise defined, the technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0029] Example 1: As Figures 1-3 As shown, a multimodal property prediction method based on syntax tree-constrained molecular representation includes:
[0030] The core idea of this invention is to integrate molecular syntax tree representation into a multimodal molecular property prediction model framework, such as... Figure 1 As shown, the overall framework of the model and its key modules are illustrated, divided into three parts: Figure 1 A describes the overall workflow of the model. After inputting molecular SMILES, it is processed through two paths. The first path is the one-dimensional syntax tree sequence path: generating the molecular syntax tree structure using a context-free grammar (CFG), and then extracting tree sequence features via the Tree Sequence Encoder: Transformer Module, such as... Figure 1 As shown in .B, this module details the process of extracting features from molecular syntax tree sequences. The tree structure is first extracted using CFG indexing, converting it into a token number sequence. This sequence is then input into a Transformer-based sequence encoder, where it undergoes processing through embedding layers, multi-head attention mechanisms, residual connections and layer normalization, and feedforward networks. The final output is a tree sequence feature containing syntactic and structural information. A second path is also performed simultaneously, such as... Figure 1 As shown in .C, RDKit is used to convert SMILES into 2D molecular graphs, which are then input into an encoder based on a graph convolutional network (GCN). This module processes graph data containing atomic connections (edge_index), bond attributes (edge_attr), and batch information. It learns node representations through embedding layers and multi-layer graph convolution operations, applies Dropout regularization, and then performs global pooling and feature transformation to extract molecular graph features that represent molecular topological information. Finally, the framework effectively integrates and interacts with the tree sequence features output from the two paths using a multi-dimensional feature fusion module, generating a comprehensive molecular representation that integrates syntactic and topological structures. This fused feature is ultimately input into the predictor network module to predict the properties of the target molecule.
[0031] Construction and encoding of molecular syntax trees
[0032] 1.1 Context-Free Grammar
[0033] Molecular representation based on SMILES strings is a formal grammatical system where each character is analogous to a word, and each string represents a sentence. Therefore, in the molecular representation task, this invention uses CFG to parse the grammatical structure of molecular SMILES strings. The concept behind CFG is that sentences can be recursively constructed from smaller phrases, and these components can be organized based on a semantic hierarchy. Formally, context-free grammar is defined by a quadruple G = (V, Σ, R, S), where V is the set of non-terminal symbols, representing decomposable units in the grammatical structure; Σ is the set of terminal symbols, corresponding to the basic atomic elements in the language; R is the set of production rules, describing the decomposition logic of the non-terminal symbols; and S is the start symbol, representing the highest-level structure of the language. Each production rule is of the form A → α, where α ∈ V is a non-terminal symbol, and α is a tuple of terminal or non-terminal symbols.
[0034] The context-free grammar used for molecular SMILES representation includes characters in the SMILES string as terminal symbols and meta-information about the molecular structure as non-terminal symbols. Table 1 presents a representative subset of the SMILES syntax used in this invention. The notation for CFG is defined in this example as follows:
[0035] V:{chain,branched_atom,bond,atom,ringbond,BB,RB,branch,digit,aromatic_organic,aliphatic_organic}
[0036] Σ:{=,C,N,O,1}
[0037] R:production rules 1through 20in Table
[0038] S:SMILES
[0039] Molecular Grammar
[0040] The molecular SMILES grammar used in this invention is compiled based on the official OPENSMILES (Weininger, 1988). The grammar rules of MolGramTreeNet are designed for the MoleculeNet dataset. The MoleculeNet dataset used in this study consists of a seven-class, three-regression dataset, containing 67,868 molecular SMILES. The grammar designed for them includes 83 generation rules and 25 non-terminal symbols to specify different structural components of the SMILES strings. Table 1 in other sources summarizes all the generation rules of the grammar used in this work. The first and last generation rules, SMILES→CHAIN and NOTHING→NONE, are additional rules indicating the beginning and end of the SMILES string, similar to marking the beginning and end of a sentence in natural language processing. <start>and <end>mark.
[0041] To verify the grammar representation method proposed in this framework, this invention randomly selects a molecule SMILES example from the BBBP dataset: 4-pyrimidinone, whose string representation is 'O=C1C=CNN=C1'. The parse tree structure corresponding to this string is as follows: Figure 2 As shown. The syntax tree representation of the molecule SMILES is based on the generation rules in Table 1 (Note: To simplify the table, these generation rules are specifically designed for O=C1C=CNN=C1; complete and standardized syntax generation rules can be found in Table 1 of other materials). Specifically, it corresponds to adopting a bottom-up, left-to-right order, and this generation rule sequence is extracted when parseting the tree structure, as shown in the first column of Table 1.
[0042] Table 1. Simplified syntax of molecular SMILES
[0043]
[0044]
[0045] To parse the SMILES string (O=C1C=CNN=C1) of the molecule 4-pyrimidinone in more detail according to the production rules in Table 1, this invention derives the syntax tree step by step from bottom to top and from left to right. First, for the character O, starting from the leaf node, it is matched according to generation rule 19: aliphatic_organic→O to determine that it is an aliphatic organic atom (aliphatic_organic). Then, using aliphatic_organic as the leaf, it is deduced upwards sequentially, constructing the first chain of the branch tree according to rules 16: atom→aliphatic_organic, 6: branched_atom→atom, and 4: chain→branched_atom respectively. Then, combined with the character "=", a double bond is derived according to rule 14: bond→=", thus constructing the second chain of the branch tree.
[0046] Continuing the derivation from the terminating character '=", for the characters C and 1, this invention first identifies the aliphatic organic atom and the ring bond (RB) according to rules 19: AO→C and 20: digit→1. Following these two branches, the derivation continues upwards according to rules 16: atom→aliphatic_organic and 13: ring bond→digit. Finally, the third chain of the branch tree is constructed using rule 9: branched_atom→atom RB. Finally, according to rule 3: chain→chainbond branched_atom, the three derived chains are combined to form a branch tree representation.
[0047] Similarly, according to rule 19: AO→C, the fifth character 'C' of 4-pyrimidinone is determined to be an aliphatic organic atom. Then, through rule 16: atom→aliphatic_organic and rule 6: branched_atom→atom, and through rule 2: chain→chain BA, it is combined with the first branch tree just derived to form a higher-level branch tree representation.
[0048] For the remaining characters '=CNN=C1', this study repeats the above parsing process, applying generation rules step by step from bottom to top and from left to right, constructing branching syntax trees level by level, and finally building a complete syntax tree representation, such as... Figure 2 As shown. At the top level of the syntax tree, according to rule 3: chain → chain bond branched_atom, this invention combines all subtree structures layer by layer and connects them with the start symbol SMILES, ultimately forming a complete parse tree corresponding to the molecular SMILES representation.
[0049] This parsing method, based on context-free grammar (CFG), systematically deconstructs the syntactic logic of SMILES strings, mapping the hierarchical features of molecular structures (such as atomic connection order, chemical bond types, and ring and branched structures) into a computable syntax tree representation. This structured parsing paradigm not only reveals the explicit correlations of molecular composition rules but also provides an interpretable theoretical framework for automated molecular characterization modeling through the dynamic combination capability of syntax tree nodes, thus significantly enhancing the model's ability to capture and generalize chemical semantics. This greatly assists subsequent molecular property prediction tasks.
[0050] 1.3 From syntax tree structure to number sequence
[0051] The core of converting a molecular syntax tree into a numerical sequence lies in the indexing of context-free grammar (CFG) rules, transforming the hierarchical information of the tree structure into a computable discrete sequence. The syntax tree is constructed using a bottom-up strategy, while the encoding into a numerical sequence follows a top-down rule application order, ensuring that the sequence strictly reflects the hierarchical decomposition logic of the tree structure. The specific methods and implementation details are described below:
[0052] right Figure 2 The molecular syntax tree (CFG) encoding method employs an indexed mapping of syntax rules. First, a unique numerical index is assigned to each CFG rule, forming a "rule-index" mapping table. Taking the simplified syntax in Table 1 as an example:
[0053] Rule 1: SMILES → CHAIN → Index
[0054] Rule 6: BRANCHED_ATOM → ATOM → Index 6
[0055] Rule 16: ATOM → ALIPHATIC_ORGANIC → Index 16
[0056] Rule 19: ALIPHATIC_ORGANIC → O → Index 19
[0057] Rule 20: DIGIT → 1 → Index 20
[0058] Similarly, the decomposition rule for each non-terminal symbol corresponds to a unique integer, forming a "grammar dictionary" of the molecular structure.
[0059] After the syntax tree is constructed, the tree structure is traversed from top to bottom and left to right (from the root node to the leaf node), extracting indices according to the order in which the rules are applied. First, starting from the root node SMILES, rule 1 (SMILES → chain) is applied, and index 1 is recorded. Next, for the non-terminal symbols of the current node, they are decomposed into child nodes according to the rules, and the rule indices are recorded sequentially. For example... Figure 2 As shown in the parse tree, applying rule 3 (chain→chain bondbranched_atom) to the chain node, index 3 is recorded. Then, the child nodes chain, bond, and branched_atom are recursively expanded. The traversal begins with the leftmost chain node, applying rule 2 (chain→chain BA), and index 2 is recorded. The traversal continues downwards according to the rule order until the terminal symbol 'O' is encountered, at which point the expansion stops, and the traversal returns to the parent node to continue. Finally, the top-down index extraction path of the grammar tree for the molecule 4-pyrimidinone (O=C1C=CNN=C1) in the BBBP dataset is as follows: Figure 2 As indicated by the arrows, this invention uses different colors to distinguish different rule indices, generating the following index sequence: [1,3,2,3,2,3,4,6,16,19,14,9,16,19,13,20,6,16,19,14,6,16,19,7,16,19,16,19,14,9,16,19,13,20]. This process of "syntax tree structure construction - tree sequence indexing - model inference" transforms the semantic information of molecular structure into a computable discrete symbol sequence, providing a structured modeling foundation for the prediction and design of multimodal molecular properties.
[0060] Transformer-based one-dimensional syntax tree digital sequence feature encoder
[0061] To capture the hierarchical semantics and contextual dependencies of molecular syntax tree digit sequences, this invention employs a multi-layer Transformer encoder as the sequence feature extraction model, such as... Figure 1 As shown in B.
[0062] This module is based on the Transformer's self-attention mechanism, adaptively learning the long-distance dependencies between rule indices. The architecture mainly includes an embedding layer, a multi-layer Transformer encoder layer, and a global feature extraction module. First, the numerical sequence x after index rule extraction enters the first network layer of this invention: the embedding layer, which mainly consists of label embedding and position embedding. Label embedding maps the rule indices (integers) to d. model A semantic vector is used to learn the basic representation of the rules. Position embeddings encode sequence positional information, capturing the order dependency of rule application. The two are then summed and normalized to output the initial features.
[0063] H0 = LayerNorm(E tok (x)+E pos (p)) (1)
[0064] Where x is the regular index sequence and p is the position index. (N is the sequence length, d) model (Model latitude).
[0065] Next, we move to the multi-layer Transformer encoder layer. The attention mechanism is the core of the Transformer's ability to capture the dynamic relationships between elements in the sequence. By simulating the behavior of "focusing on key information," the model adaptively mines semantic dependencies at different positions. In molecular syntax tree encoding, multi-head self-attention further extends this capability: for hidden state H... l-1 First, a query (Q), key (K), and value (V) matrix is generated through linear transformation, which can be represented as:
[0066] Q = H l-1 W Q (2)
[0067] K = H l-1 W K (3)
[0068] V = H l-1 W V (4)
[0069] Among them, W Q W K W V These are learnable weights. The input hidden feature H can be decomposed into h low-dimensional subspaces, each with dimension d. k =d model / h. In each subspace, association weights are calculated using scaled dot product attention, which involves multiplying the query by the transpose of the key and dividing by . To mitigate vanishing gradient, after Softmax normalization, multiply by the value matrix to obtain a single-head output:
[0070]
[0071] Then, the outputs of all the heads are concatenated and subjected to a linear transformation W. out The recovery dimension, namely:
[0072] MultiHead(H ι-1 = Concat(head1,…,head) h W out (6)
[0073] This allows us to capture the local and global relationships between molecular rules from multiple perspectives, such as atomic connections and ring hierarchical structures.
[0074] After attention calculation is completed, the feedforward network layer will perform a non-linear transformation on the features at each location to enhance the model's expressive power.
[0075]
[0076] Output via residual connections and layer normalization:
[0077] H l =LayerNorm(H l-1 +FFN(LayerNorm(H l-1 +MultiHead(H l-1 )))) (9)
[0078] Finally, in the global feature extraction stage, the hidden state at the first position of the sequence is extracted as the global tree sequence feature:
[0079] h tree =H N [:,0,:] (10)
[0080] It is fused with molecular graph features (GCN module) for downstream prediction.
[0081] In adapting the molecular syntax tree, the embedding layer plays a grammatical role in learning the rules, while the self-attention mechanism is responsible for capturing hierarchical dependencies between rules. This model employs an end-to-end training approach, meaning parameters are randomly initialized without pre-training, focusing solely on chemical semantic modeling. For the regularized representation of the molecular syntax tree, the discrete rule index sequence is first mapped to a continuous high-dimensional feature vector, and the feature distribution is stabilized simultaneously through normalization. Based on this, a multi-head self-attention mechanism dynamically captures semantic relationships between rules from a parallel perspective, masking invalid information at sequence padding positions. Subsequently, the encoder layer concatenates the self-attention module with the feedforward network, constructing deep feature extraction units based on residual connections and layer normalization, aggregating local and global semantics layer by layer. After iterative optimization through multiple encoder layers, global pooling outputs a dimension of d. model The global features of the molecular syntax tree, such as h in formula (10). tree As shown, this feature is summed and fused with the two-dimensional structural features of the molecular graph encoder. By leveraging the complementarity of multimodal features, the model's ability to jointly model molecular-level semantics and topological structures is enhanced.
[0082] The advantages of this encoder are: it efficiently captures long-distance hierarchical dependencies between rules using Transformer self-attention, which is superior to traditional models such as LSTM; its architecture is lightweight and interpretable, and the self-attention weights visualize the importance of rules, aiding in the analysis of molecular grammatical logic; the output tree sequence features are complementary to the 2D molecular graph features, enhancing chemical semantic modeling and improving prediction performance. Through Transformer_Encoder, the model achieves efficient encoding of molecular syntax tree sequences, providing a 1D feature foundation for the multimodal fusion of MolGramTreeNet, strengthening the understanding and expression of hierarchical semantics of molecular structure, and supporting downstream molecular property prediction tasks.
[0083] 3. GCN-based molecules Figure 2 3D feature encoder
[0084] To extract the two-dimensional structural features of molecules, this invention employs a graph convolutional network (GCN) as a molecular graph encoder, such as... Figure 1 As shown in Figure C, the molecule is modeled as a graph G = (V, E), where: node V represents an atom, and its features consist of two parts: atom type (e.g., C, N, O, etc., a total of 119 types, including mask markers) and chirality tags (3 types, describing the chiral properties of the atom). Edge E represents a chemical bond, and its features consist of two parts: bond type (single bond, double bond, aromatic bond, etc., a total of 5 types, including self-loop edges) and bond direction (3 types, describing the directional information of the bond). GCN aggregates the structural information of nodes and their neighborhoods layer by layer through multi-layer graph convolution operations, ultimately generating a molecular representation vector containing global structural features. Its core layer iteratively updates the node representation as follows:
[0085]
[0086] in It is the feature vector of node v in the l-th layer. It is the set of neighbors of node v.
[0087] W (l) It is a learnable weight matrix. It is edge e u,v The embedding representation is given by σ, where σ is a nonlinear activation function.
[0088] The input molecular graph is first subjected to feature extraction to obtain x, edge_index, edge_attr, and batch to describe the structure and features of the molecular graph. These features are then input into the node embedding layer, which maps the discrete features (type, chirality) of atoms into continuous embedding vectors. For the input atom feature vector x = [x...] type ,x chirality ], where x type ∈Z 1 (Atom type index), x chirality ∈Z 1 (Chiral marker index). Atomic feature embedding is performed on it:
[0089] x v =E type (t v )+E chirality (c v (12)
[0090] Where t v ∈{1,...,119} is an atomic type, c v ∈{1, 2, 3} is a chiral label, E type and E chirality It is a learnable embedding matrix. Then, key feature embedding is performed on it:
[0091] e u,v =E bond_type (b u,v )+E direction (d u,v (13)
[0092] Where b u,v ∈{1,...,5} is the key type, d u,v ∈{1, 2, 3} is the bond direction, E bond_type and E direction It is a learnable embedding matrix.
[0093] The GCN encoder takes the above formulas (12) and (13) as input, that is, the atomic feature embedding and bond feature embedding of the molecular graph as input, and aggregates the neighborhood information layer by layer through stacked L layers of graph convolutional units to realize the iterative update of atomic features and the construction of global representation. In each layer, the message passing mechanism first aggregates the feature contributions of its neighboring (including itself) nodes u for node v: the l-th layer features of node u are... Layer-specific weight matrix Linear transformation, with edge attribute embedding e u,v Add them together, then multiply by the normalization coefficient c derived from the degree matrix. v,u This forms a message;
[0094]
[0095] Subsequently, node updates process messages using activation functions σ (such as ReLU) and batch normalization (BatchNorm) to obtain the next layer of node features:
[0096]
[0097] This enhances training stability and introduces non-linearity. After L layers of iteration, global feature aggregation uses mean pooling to aggregate the final features of all nodes. Summarized into an atlas:
[0098]
[0099] Then, through a linear transformation, the final global graph features are projected onto a unified feature space:
[0100] h gcn =W out .h graph +b out (17)
[0101] Where b out It is the bias vector of the linear transformation and belongs to the learnable parameters of the model. The global feature representation of the output molecular graph is shown in Equation (17), that is, h gcn This provides a feature representation of the two-dimensional molecular structure for MolGramTreeNet, which is similar to the one-dimensional sequence features of a syntax tree. tree They complement each other, and their fusion enhances the model's ability to predict molecular properties.
[0102] 4. Multidimensional feature fusion coding
[0103] To achieve multi-dimensional semantic modeling of molecules, MolGramTreeNet fuses feature representations from a 1D syntax tree sequence encoder (Transformer_Encoder) and a 2D molecular graph encoder (GCN) using a channel concatenation strategy. Specifically, the global syntax tree features h output by the Transformer_Encoder... tree =H N [:,0,:](dimensional d) model (capturing the hierarchical syntax logic of molecular structure) and the molecular graph features output by GCN h gcn =W out .h graph +b out (dimension d) feat (Capturing the two-dimensional structural dependencies between atoms) is directly merged in the channel dimension to form a unified multimodal feature vector:
[0104] h fusion =Concat(h tree +h gcn (18)
[0105] The output dimension is d model +d feat .
[0106] Compared to complex attention fusion or weight learning methods, channel concatenation offers advantages in simplicity and efficiency. It requires no additional parameter tuning, directly preserves the complete information of both modalities, has low computational complexity, and is suitable for end-to-end training. The fused features can be directly input into downstream task modules, such as classifiers or regression layers, and mapped to the target dimension through fully connected layers, achieving efficient prediction of molecular properties. Furthermore, the explicit separation and fusion of features facilitates model interpretability analysis. By visualizing self-attention weights (Transformer_Encoder) and graph convolutional edge weights (GCN), the contributions of different modalities to the prediction results can be clearly traced, enhancing the chemical semantic interpretability of the model.
[0107] In summary, the multidimensional feature fusion module, as a core component of MolGramTreeNet, organically combines the one-dimensional grammatical logic and two-dimensional structural information of molecules through a simple and efficient channel splicing strategy, forming a multidimensional semantic representation. This provides a rich feature foundation for downstream molecular property prediction tasks and significantly improves the model's prediction performance and generalization ability.
[0108] 5. Loss Function
[0109] To construct the prediction model, MolGramTreeNet uses a multi-channel, two-dimensional drug feature encoder that fuses molecular syntax tree information and two different dimensions. Downstream tasks include a regression task and a classification task. MolGramTreeNet is optimized using cross-entropy loss and MAE loss functions. Cross-entropy loss is used for the classification task and tested on all classification tasks of MolGramTreeNet. For the regression task, this invention uses the MAE loss function and tests it on the ESOL, FreeSolv, and Lipophilicity datasets.
[0110] The total loss function of MolGramTreeNet is:
[0111]
[0112] Where N is the true label of the sample, Let y represent the model's predicted probability for the sample, and y represent the sample's class label. The predicted value for the sample.
[0113] Tables 2 and 3 report the overall performance comparison of the proposed model MolGramTreeNet, along with three ablation models and nine existing baseline methods, on classification and regression tasks. Table 2 shows the area under the receiver operating characteristic curve (ROC-AUC) of MolGramTreeNet on the classification benchmark. These models were re-evaluated using laboratory equipment in the same manner. All datasets were randomly split, with the best-performing model highlighted in bold and the second-best result underlined. Furthermore, the root mean square error (RMSE) performance of the models and baselines was evaluated on the regression benchmark, as shown in Table 2. MolGramTreeNet performed best on the three classification tasks (Clintox, Tox21, and Toxcast) and second best on BBBP. For the regression task, as shown in Table 3, it achieved the highest performance on ESOL. Specifically, MolGramTreeNet improved the average performance of 1.86%–20.45% across 10 tasks compared to seven baseline models, including GCN and MPNN. On the ESOL dataset, it achieves a performance improvement of 18.36% compared to the suboptimal model KCL, significantly enhancing its ability to screen for water-soluble molecules. On the Clintox dataset, it achieves a ROC-AUC of 0.994, surpassing KANO (0.926) and KCL (0.919), and a performance improvement of 7.34% compared to the suboptimal model KANO, significantly enhancing its ability to identify clinically toxic molecules.
[0114] Table 2. Calculated area of MolGramTreeNet on the receiver operating characteristic curve (ROC-AUC) of the classification benchmark.
[0115]
[0116] Table 3. Comparison results of MolGramTreeNet and baseline models on regression tasks.
[0117]
[0118] Example 2:
[0119] The computer-readable storage medium of this embodiment stores a computer program that, when executed by a processor, implements the steps in the multimodal property prediction method based on syntax tree-constrained molecular representation of Embodiment 1.
[0120] The computer-readable storage medium in this embodiment can be an internal storage unit of the terminal, such as the terminal's hard disk or memory; the computer-readable storage medium in this embodiment can also be an external storage device of the terminal, such as a plug-in hard disk, smart memory card, secure digital card, flash memory card, etc. equipped on the terminal; furthermore, the computer-readable storage medium can include both the terminal's internal storage unit and external storage devices.
[0121] The computer-readable storage medium of this embodiment is used to store computer programs and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0122] Example 3:
[0123] The computer device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the multimodal property prediction method based on syntax tree-constrained molecular representation of Embodiment 1.
[0124] In this embodiment, the processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. The memory can include read-only memory and random access memory, and provides instructions and data to the processor. A portion of the memory can also include non-volatile random access memory. For example, the memory can also store device type information.
[0125] Those skilled in the art will understand that the content disclosed in the embodiments can be provided as a method, system, or computer program product. Therefore, this solution can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this solution can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage) containing computer-usable program code.
[0126] This solution is described with reference to flowchart illustrations and / or block diagrams of methods and computer program products according to embodiments of this solution. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0127] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0128] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0129] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0130] The examples described herein are merely preferred embodiments of the invention and are not intended to limit the concept and scope of the invention. Any modifications and improvements made by those skilled in the art to the technical solutions of the invention without departing from the design concept of the invention should fall within the protection scope of the invention.< / end> < / start>
Claims
1. A method for predicting multimodal properties based on syntax tree-constrained molecular representations, characterized in that, Includes the following steps: By combining context-free grammar-based syntax tree representations with molecular property prediction tasks, the hierarchical structure and chemical syntax rules of encoded molecules are revealed. A multimodal feature fusion framework is set up, which captures the sequence dependence of SMILES and the topological structure of molecular graphs through Transformer and GCN respectively, and realizes cross-dimensional feature interaction by channel splicing strategy to construct a comprehensive representation containing chemical semantics, spatial structure and syntactic information. By compressing multidimensional features into low-dimensional vectors, a strong correlation between features and prediction results is established. The fused features are finally input into the predictor network module to complete the prediction of the properties of the target molecule.
2. The method according to claim 1, characterized in that, The steps to combine context-free grammar-based syntax tree representation with molecular property prediction tasks include: inputting molecules SMILES, processing them through two paths, the first path being a one-dimensional syntax tree sequence path: using a context-free grammar, i.e., CFG, to generate a molecular syntax tree structure, and extracting tree sequence features through the Tree SequenceEncoder: Transformer Module; The second path, which is being implemented simultaneously, uses RDKit to convert SMILES into 2D molecular graphs, which are then input into an encoder based on a graph convolutional network. This module processes graph data containing atomic connections, bond attributes, and batch information. It learns node representations through embedding layers and multi-layer graph convolution operations, applies Dropout regularization, and then extracts molecular graph features that characterize molecular topological information through global pooling and feature transformation. Finally, the framework effectively integrates and interacts the tree sequence features output from the first and second paths with the molecular graph features through a multi-dimensional feature fusion module, generating a comprehensive molecular representation that integrates grammatical structure and topological structure.
3. The method according to claim 2, characterized in that, In the first path, the process of extracting molecular syntax tree sequence features is as follows: the tree structure is first extracted through CFG indexing, the molecular syntax tree structure is converted into a token number sequence, and then input into a Transformer-based sequence encoder. After processing through embedding layers, multi-head attention mechanism, residual connections and layer normalization, and feedforward network, the final output is a tree sequence feature containing grammatical and structural information.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processor, it implements the steps in the multimodal property prediction method based on syntax tree-constrained molecular representation as described in any one of claims 1 to 3.
5. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the multimodal property prediction method based on syntax tree-constrained molecular representation as described in any one of claims 1 to 3.