A multi-view embedded drug knowledge graph construction method

By constructing a drug knowledge graph using multi-view embedding technology and graph neural networks, the problems of insufficient capture of biological semantics of drug nodes and unstructured data processing are solved, achieving efficient construction of the drug knowledge graph and improving the accuracy of downstream tasks.

CN122158187APending Publication Date: 2026-06-05YANSHAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YANSHAN UNIV
Filing Date
2026-02-07
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing drug knowledge graph construction methods, random initialization cannot capture the biological semantics of drug nodes, which limits the accuracy of downstream tasks. Furthermore, rule-based triple extraction is difficult to process unstructured data and has poor generalization ability.

Method used

We employ a multi-view embedding approach, using the R language toolkit to filter drug information, and the PyTorch Geometric graph library to construct a drug knowledge graph. By combining regular expressions and multi-view directional embedding techniques, we generate drug-drug and drug-entity triples, and use GNN and ProtBERT models to capture the chemical and biological information of drugs and proteins.

Benefits of technology

It improves the data processing accuracy of drug knowledge graphs, solves the problems of data sparsity and relationship imbalance, and enhances the accuracy of downstream tasks and model training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122158187A_ABST
    Figure CN122158187A_ABST
Patent Text Reader

Abstract

The application belongs to the field of knowledge graphs, and specifically discloses a multi-view embedded drug knowledge graph construction method, which comprises the following steps: obtaining an original XML file of drug information, using an R language toolkit to perform data screening on drug information source data, and obtaining a drug dictionary file, a drug interaction file and a relationship file of drug related entities; extracting key information in the drug interaction relationship file through a regular expression to generate drug-drug triples, and directly mapping corresponding columns of the relationship file of drug related entities into drug-related entity triples; using a graph neural network library PyTorch Geometric to set the triples as nodes and edges of a drug knowledge graph; and initializing information of different types of nodes and edges in the drug knowledge graph through a multi-view directional embedding technology, so that a drug knowledge graph MVDE-DKG is obtained. Compared with the prior art, the application can convert original drug related information into a drug knowledge graph with biological information embedding, so as to perform downstream tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of knowledge graphs, and in particular to a method for constructing a drug knowledge graph with multi-view embedding. Background Technology

[0002] Knowledge graphs (KGs) are knowledge representation frameworks based on graph models. They formally describe entities, concepts, and their complex relationships in the real world through combinations of nodes and edges, and can essentially be described as heterogeneous graphs. Unlike traditional graphs with only single nodes and single relationships, knowledge graphs can encode heterogeneous information with different nodes and different relationships. Their core advantage lies in their ability to integrate heterogeneous data into a structured semantic network, thereby supporting efficient knowledge storage, retrieval, and reasoning. Drug knowledge graphs (DKGs) are a specialized application of knowledge graph technology in the pharmaceutical field. Their core function is to structurally integrate and semantically associate multi-source heterogeneous data from drug development, clinical applications, and pharmacological mechanisms.

[0003] Current DKG construction methods mainly rely on two types of technologies: (1) Node embedding based on random initialization: Drug, target and other nodes are represented as random vectors, but random initialization cannot capture the biological semantics of different nodes (such as functional groups and metabolic pathways), which limits the accuracy of downstream tasks. (2) Rule-based triple extraction: Extract entity relationships from structured databases, but the rules have poor generalization and are difficult to process unstructured data. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides a method for constructing a drug knowledge graph with multi-view embedding.

[0005] To achieve the above objectives, the present invention is implemented according to the following technical solution: A method for constructing a drug knowledge graph with multi-view embedding includes the following steps: S1. Obtain the raw XML file of drug information. Use the R language toolkit to filter the drug information source data to obtain a drug dictionary file, a drug interaction file, and a relational file of drug-related entities. The drug information includes the drug's chemical structure, pharmacological effects, target information, metabolic pathways, side effects, drug interactions, and clinical trial data. The drug dictionary file includes a unique ID column for the drug, the drug name, and drug SMILES information. Drug-related entities include target information: the biological targets of drug action; enzyme information: enzymes involved in drug metabolism; carrier information: carrier proteins involved in drug transport; transport protein information: transport proteins involved in drug absorption and distribution; and pathway information: biological pathways involved in drug action. S2. Extract key information from the drug interaction relationship file using regular expressions to generate drug-drug triples, and directly map the corresponding columns of the relationship file of drug-related entities to drug-related entity triples. S3. Use the graph neural network library PyTorch Geometric to set the triples as nodes and edges of the drug knowledge graph; S4. Initialize the information of different types of nodes and edges in the drug knowledge graph through multi-view directional embedding technology to obtain the drug knowledge graph MVDE-DKG.

[0006] Furthermore, in step S1, the process of using the R language toolkit to filter drug information source data includes: (1) First, use the dbparser and dbdataset packages in R to load the original XML file and store it as an R object dvobject; (2) Next, extract the SMILES information of the drug from the dvobject and store it as a data file; drugs without SMILES information are filtered out. (3) Then, extract the drug's target, enzyme, carrier, transport protein and pathway information respectively, and ensure the accuracy of this information through screening operations; at the same time, in addition to pathway information, if the information of other drug-related entities is missing UniProt ID, it will also be filtered out. (4) Secondly, extract the interaction information between the drug and other drugs from the dvobject and perform deduplication; (5) Finally, use the openxlsx package to export the extracted data as an Excel file for subsequent analysis.

[0007] Furthermore, in step S2, the process of generating the drug-drug triplet is as follows: (1) Read the drug interaction worksheet: extract the two interacting drugs and denote them as drug A and drug B, as the source node and target node of the triple; (2) Construct a regular expression pattern: Connect all drug names with a vertical bar "|" to construct a regular expression pattern, and compile it into a regular expression object using a regularization function; use the regular expression pattern to quickly match drug names in the drug interaction description; (3) Replace drug names with placeholders: Read the interaction descriptions in the drug interaction worksheet; for each sentence, use the text replacement tool to replace the matched drug names with placeholders "[DRUG]" based on the regular expression object, and replace the original sentence with the updated sentence; (4) Deduplication and obtaining fixed sentence patterns: After all sentences are replaced, ensure that only one unique sentence pattern is retained for each interaction type, perform deduplication operation, and obtain 298 different fixed sentence patterns; (5) Assign a label to each sentence pattern: Assign a unique label to each fixed sentence pattern, with the label range from 0 to 297, to facilitate subsequent machine learning and graph neural network modeling; (6) Replace the original sentence with the label to generate the final triple representation, i.e. (drug A, drug B, label).

[0008] Furthermore, in step S2, the process of generating drug-related entities is as follows: Drug-related entity information was extracted from the original XML file containing drug information, and corresponding worksheets were generated. Two filtering rules were applied during entity extraction: only drugs with SMILES representations were retained to ensure the integrity of the chemical structure information of drug nodes; and only protein-type entities, except for pathway information, were retained to ensure the clear biological meaning of entity nodes. These filtering rules removed records with incomplete information or unclear biological meaning, ensuring the initialization of nodes in the drug knowledge graph. Each worksheet contains the following: Drug Unique ID: used to identify the drug; Entity Name: the name of the target, enzyme, vector, transport protein, or pathway; Entity Type; UniProt ID: a unique identifier for the protein sequence; Relationships: the specific relationships between the drug and the entity, including binding, metabolism, and transport.

[0009] Furthermore, step S3 specifically includes: (1) Construction of the node set: The drug knowledge graph contains six types of nodes: drugs, targets, enzymes, carriers, transport proteins, and pathways; the attributes of each type of node are represented as follows: , where m is the number of nodes of this type, and n is the dimension of the initial embedding representation of the node; (2) Construction of edge sets: The drug knowledge graph contains six types of edges: drug-drug, drug-target, drug-enzyme, drug-carrier, drug-transporter, and drug-pathway. Each type of node has its own unique ID-to-unique index mapping dictionary. The unique ID in the original triplet is replaced with the unique index. In addition, based on the node's unique ID, the index of the node in that type is obtained through this dictionary, and the feature vector representation of the node is located. The first two values ​​of the replaced triplet (source node, target node) are taken as edges. The edge set of each type is represented as follows: , where r is the number of edges of this type; (3) By defining the node set and edge set, a heterogeneous graph of the drug knowledge graph is constructed using the graph neural network library PyTorch Geometric. The heterogeneous graph contains 6 types of nodes and 6 types of edges, which can clearly represent the topological structure and semantic information of the drug knowledge graph, providing support for obtaining biomedical information of drug nodes.

[0010] Further, step S4 specifically includes: S41. Use GNN to capture the topological and semantic information of drug molecule structures; S42. Then, the global pooling function is used to obtain the graph embedding representation of the drug molecule graph, which is the initial embedding representation of the drug node. S43. Secondly, a single-layer MLP is used to map the path node type and edge type into a high-dimensional vector representation; S44. Finally, ProtBert[8] reads the protein sequence of the protein node and outputs the embedded representation with biological information.

[0011] Compared with the prior art, the present invention has the following beneficial effects: This invention proposes a hybrid method combining regular expressions and R language data processing to accurately extract drug-drug and drug-entity triples from unstructured drug data. For drug interaction texts, a domain-adaptive regular expression template (298 fixed sentence patterns) is designed to replace drug names with placeholders before classification, thus solving the semantic ambiguity problem of traditional NLP tools in pharmaceutical texts.

[0012] Secondly, this invention employs a multi-perspective differentiated embedding strategy for heterogeneous nodes (drug molecules, proteins, pathways) in drug knowledge graphs. The molecular graph transformed by SMILES is processed using a GNN, and chemical features such as functional groups are captured using a message passing mechanism to generate initial embeddings. A ProtBERT pre-trained model is used to encode UniProt sequences, preserving the physicochemical properties and domain information of amino acids. The original drug-related information is then converted into a drug knowledge graph with biological information embeddings for downstream tasks.

[0013] Finally, this invention designs a complete drug knowledge graph (MVDE-DKG) construction process to solve the problems of data sparsity and relationship imbalance. For drug-drug interactions, a unified label of "1" is used to address type imbalance; for drug-entity relationships, they are categorized by entity type to avoid interference from unknown relationships. Attached Figure Description

[0014] Figure 1 This is a flowchart illustrating the construction process of the MVDE-DKG of this invention.

[0015] Figure 2The extraction process of ternary pairs focusing on drug-drug interaction types.

[0016] Figure 3 It is a multi-view oriented embedding architecture for MVDE-DKG. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. The specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention.

[0018] In the following embodiments, the drug information is sourced from the DrugBank database. DrugBank is a comprehensive drug information database widely used in drug discovery, drug interaction prediction, and drug safety assessment. This database integrates detailed information from multiple data sources, including the drug's chemical structure, pharmacological effects, target information, metabolic pathways, side effects, drug interactions, and clinical trial data.

[0019] like Figure 1 As shown in the figure, this embodiment exemplifies a method for constructing a drug knowledge graph with multi-view embedding, including the following steps: S1. Obtain the original XML file of drug information. Use the R language toolkit to filter the drug information source data to obtain a drug dictionary file, a drug interaction file, and a relational file of drug-related entities. The drug information includes the drug's chemical structure, pharmacological effects, target information, metabolic pathways, side effects, drug interactions, and clinical trial data. The drug dictionary file includes a unique ID column for the drug, the drug name, and drug SMILES information. Drug-related entities include target information: the biological targets of drug action; enzyme information: enzymes involved in drug metabolism; carrier information: carrier proteins involved in drug transport; transport protein information: transport proteins involved in drug absorption and distribution; pathway information: biological pathways involved in drug activity. The original information is stored in XML format, and the information for each drug is represented by "". <drug>The root element is the tag, which contains multiple sub-tags. These sub-tags comprehensively cover the basic information, classification, pharmacological data, interactions, etc. of the drug. First, the raw XML file is loaded using the `dbparser` and `dbdataset` packages in R and stored as an R object (`dvobject`). Next, the drug's SMILES information is extracted from the `dvobject` and stored as a data file. Note that drugs without SMILES information are filtered out. Then, the drug's target, enzyme, vector, transporter, and pathway information are extracted separately, and filtering operations are performed to ensure the accuracy of this information. Additionally, besides pathway information, information on other drug-related entities (such as targets, enzymes, vectors, and transporters) lacking a UniProt ID is also filtered out. Next, the drug's interaction information with other drugs is extracted from the `dvobject` and deduplicated. Finally, the extracted data is exported to an Excel file using the `openxlsx` package for subsequent analysis. Due to the large amount of drug interaction information (millions of entries), it needs to be exported in batches.

[0020] The Excel file exported from the original dataset contains a dictionary file that records core drug information, including the drug's unique ID, drug name, and SMILES representation. This dictionary file serves as a reference for other data files, ensuring data consistency and traceability. Drug-related information in other files (such as target information, enzyme information, and vector information) is matched and replaced against the dictionary file using the drug's unique ID, thus constructing a complete drug knowledge graph.

[0021] S2. Extract key information from the drug interaction relationship file using regular expressions to generate drug-drug triples, and directly map the corresponding columns of the relationship file of drug-related entities to drug-related entity triples. In a drug knowledge graph, drug nodes that interact with each other are connected by edges, while drug nodes that do not interact with each other are not connected by edges.

[0022] The drug interaction worksheet exported from the original dataset contains three columns: drug A, drug B, and a description of the interaction between drug A and drug B. For example, the interaction description between DB00001 (Lepirudin) and DB06605 (Apixaban) is: "Apixaban may increase the anticoagulant activities of Lepirudin." Based on this data, two types of triples were extracted: (1) No focus on the interaction type between drugs. For drugs A and B, as long as there is an interaction between them, the relation type of the triple is marked as 1, i.e., (drug A, drug B, 1). The first two columns (drug A and drug B) of the drug interaction worksheet are taken as the source node and target node of the triple, and the edge type is uniformly set to 1. This type of triple is used for binary classification tasks, i.e., determining whether there is an interaction between two drugs. When constructing the drug knowledge graph, the edge attributes between all drugs are the same.

[0023] (2) Focus on the interaction types between drugs. For drug A and drug B, extract the specific interaction types based on their interaction descriptions. Drug interaction descriptions follow fixed sentence patterns, such as: Drug1 may increase the anticoagulant activities of Drug2; Drug1 can cause a decrease in the absorption of Drug2 resulting in a reduced serum concentration and potentially a decrease in efficacy. Drug1 and Drug2 can be replaced with any drug. By analyzing the drug interaction descriptions, 298 fixed sentence patterns, i.e., 298 interaction types, are extracted. Each sentence pattern corresponds to a relationship type. This type of triple is used for multi-classification tasks, i.e., determining the specific interaction type between two drugs. When constructing a drug knowledge graph, the edge attributes between drugs differ according to the interaction type. Figure 2 The specific extraction process of triplets focusing on the types of drug interactions is demonstrated.

[0024] To extract triplets representing the types of interactions between drugs of interest, this embodiment follows these steps: (1) Read the drug interaction worksheet: extract the contents of the first two columns (drug A and drug B) as the source node and target node of the triple; (2) Constructing a regular expression pattern: Connect all drug names with a vertical bar "|" to construct a regular expression pattern, and compile it into a regular expression object using a regularization function. The regular expression pattern is then used to quickly match drug names in drug interaction descriptions; (3) Replace drug names with placeholders: Read the third column (interaction description) of the drug interaction worksheet. For each sentence, use the text replacement tool to replace the matched drug names with the placeholder "[DRUG]" based on the regular expression object, and replace the original sentence with the updated sentence; (4) Deduplication and obtaining fixed sentence patterns: After all sentences are replaced, ensure that only one unique sentence pattern is retained for each interaction type, perform deduplication operation, and obtain 298 different fixed sentence patterns; (5) Assign a label to each sentence pattern: Assign a unique label to each fixed sentence pattern, with the label range from 0 to 297, to facilitate subsequent machine learning and graph neural network modeling; (6) Replace the original sentence with the label to generate the final triple representation, i.e. (drug A, drug B, label).

[0025] Extraction of drug-related entity triples: The original dataset contained a variety of drug-related information, such as target information, metabolic pathways, side effects, and clinical data. However, due to the sparse nature of some information (such as side effects and clinical data), with only a few drugs having this data, it was difficult to support large-scale analysis. The coverage of target, enzyme, carrier, transporter protein, and pathway information was high, and the data quality was good. Therefore, MVDE-DKG retained only the following five types of entity information: target information: the biological targets of drug action; enzyme information: enzymes involved in drug metabolism; carrier information: carrier proteins involved in drug transport; transporter protein information: transporters involved in drug absorption and distribution; pathway information: biological pathways involved in drug action.

[0026] Extract the information of the five types of entities mentioned above from the original dataset and generate corresponding worksheets. Each worksheet contains the following: Drug Unique ID: used to identify the drug; Entity Name: the name of the target, enzyme, vector, transport protein or pathway; Entity Type; UniProt ID: a unique identifier for the protein sequence; Relationships: the specific relationships between the drug and the entity (such as binding, metabolism, transport, etc.).

[0027] When extracting entity information, the following two filtering rules were applied: only drugs represented by SMILES were retained to ensure the integrity of the chemical structure information of drug nodes; and only protein-type entities, in addition to pathway information, were retained to ensure the clear biological meaning of entity nodes. These filtering rules removed records with incomplete information or unclear biological meaning, ensuring the initialization of nodes in the drug knowledge graph.

[0028] When determining the edge types in a drug knowledge graph, the following two problems are encountered: (1) Imbalance of drug interaction types: The distribution of the number of DDI triplet types focusing on drug interaction types is extremely unbalanced, making it difficult to support effective model training.

[0029] (2) Unknown relationship between drugs and entities: The specific relationship between drugs and related entities (such as targets, enzymes, carriers, transport proteins and pathways) is mostly unknown and difficult to model accurately.

[0030] To address the above issues, MVDE-DKG adopted the following optimization strategies: First, a drug knowledge graph is constructed using DDI triples (drug ID, drug ID, 1) that do not distinguish between specific interaction types. This method avoids the problem of uneven distribution of interaction types and simplifies drug interaction modeling.

[0031] Secondly, since the specific relationships between individual drugs and individual entities are mostly unknown, we only distinguish the relationships between drugs and different entity types, constructing relationship triples such as (drug ID, target ID, 2), (drug ID, enzyme ID, 3), (drug ID, carrier ID, 4), (drug ID, transporter ID, 5), and (drug ID, pathway ID, 6). This approach avoids interference from unknown relationships while successfully preserving high-level semantic information between drugs and various entities, providing a solid foundation for subsequent analysis.

[0032] S3. Use the graph neural network library PyTorch Geometric to set the triples as nodes and edges of the drug knowledge graph; The construction of MVDE-DKG is a core step in drug interaction prediction, providing data support for subsequent graph neural network modeling. This specific type of knowledge graph is represented as... .here, Indicates a collection of drugs. Defined as a set of relations, and A collection that includes drugs and related entities.

[0033] The nodes and edges of the drug knowledge graph are defined based on drug-drug triples and drug-related entity triples. These triples contain all drug nodes and related entity nodes (such as targets, enzymes, carriers, transport proteins, and pathways). By deduplicating these nodes, the node set of the drug knowledge graph is obtained. The types and numbers of the node set and edge set are shown in Table 1.

[0034] (1) Construction of the node set: The drug knowledge graph contains six types of nodes: drugs, targets, enzymes, carriers, transport proteins, and pathways. The attributes of each type of node are represented as follows: Where m is the number of nodes of that type, and n is the dimension of the initial embedding representation of the node. Note that in a heterogeneous graph, each type of node has a type-independent attribute representation, such as HGraph["drug"].x= HGraph["target"].x= .

[0035] Table 1. Number of nodes and edges in DKG

[0036] (2) Construction of Edge Sets: The drug knowledge graph contains six types of edges: drug-drug, drug-target, drug-enzyme, drug-carrier, drug-transporter, and drug-pathway. Each type of node has its own unique ID-to-unique index mapping dictionary. The unique ID in the original triplet is replaced with a unique index. For example, the triplet (DB00001, DB06605, 1) is replaced with (0, 6604, 1). Furthermore, based on the node's unique ID, the index of the node in that type can be obtained through this dictionary, allowing the location of the node's feature vector representation. The first two values ​​(source node, target node) of the replaced triplet are taken as edges. The edge set for each type is represented as follows: , where r is the number of edges of that type. For example, the set of edges between drugs is [[0, 22], [1, 5], ..., [10, 60]]. The attribute of each type of edge is the label of that type of edge, that is, the attribute of the edge between drugs is 1, while the attribute of the edge between drugs and targets is 2.

[0037] By defining node and edge sets, this embodiment successfully constructed the basic structure of a drug knowledge graph using the PyTorch Geometric graph neural network library. This heterogeneous graph contains six types of nodes and six types of edges, clearly representing the topological structure and semantic information of the drug knowledge graph, thus supporting the acquisition of biomedical information from drug nodes.

[0038] S4. Initialize the information of different types of nodes and edges in the drug knowledge graph through multi-view directional embedding technology to obtain the drug knowledge graph MVDE-DKG.

[0039] Randomly initializing the embedding representations of nodes and edges is a common practice when constructing a drug knowledge graph. However, this method has the following problems: (1) Random initialization ignores the inherent characteristics of drugs and related entities, resulting in the loss of important semantic information. (2) Randomly initialized embedding representations are usually far from the optimal solution, resulting in slow convergence speed and prolonged training time during model training. (3) Random initialization cannot capture the biological significance of drugs and related entities, making it difficult for the model to learn meaningful feature representations from the data. This embodiment addresses these problems by employing knowledge-based initialization and pre-trained models, thereby improving the expressive power of the drug knowledge graph and the performance of the model.

[0040] In the aforementioned drug knowledge graph, node types are categorized into six main types: drugs, targets, enzymes, carriers, transport proteins, and pathways. However, the underlying representations of these nodes fall into three categories: drug nodes are represented by their molecular structures, using a drug molecule graph; target, enzyme, carrier, and transport protein nodes are represented by their protein molecules, using protein sequences. During data preprocessing, non-protein entities were filtered out to ensure that the underlying representations of these nodes have consistent biological meaning. Pathway information represents the pathways through which drugs participate in a series of molecular events and interactions within the organism. Therefore, pathway node information lacks a unified biological representation. This embodiment assigns different scalar representations to different pathway nodes. Scalar representations simplify the processing of pathway information while preserving its semantic information within the drug knowledge graph.

[0041] Figure 3 The multi-view directional embedding process of MVDE-DKG is demonstrated. First, GNN is used to capture the topological structure and semantic information of drug molecule structure, and then global pooling function is used to obtain the graph embedding representation of drug molecule graph, which is the initial embedding representation of drug node; second, a single-layer MLP is used to map the pathway node type and edge type into a high-dimensional vector representation; finally, ProtBert[8] reads the protein sequence of protein node and outputs the embedding representation with biological information.

[0042] Embedded representation of drug nodes: The drug's SMILES string representation can be found in the dictionary file using the unique ID of the drug node. The SMILES string can accurately describe the chemical structure of the drug. In order to further extract the topological information of the drug molecular structure, this embodiment uses the Rdkit[9] toolkit to convert the drug's SMILES representation into a two-dimensional molecular graph representation. The graph neural network sets the node and edge attributes of the molecular graph. Through a message passing mechanism, each atom can obtain information about its surrounding atoms, including their types and connections, thereby learning more representative features.

[0043] The initialization embedding representation of drug nodes is as follows: the node information of the drug molecule graph is updated using a message passing mechanism. As shown below: (1) in, For the first Feature representation of layer nodes, For trainable weights, Representative node The neighboring nodes, It is a non-linear activation function.

[0044] Then, the updated node features are processed using a global pooling function to obtain the graph embedding representation of the molecular graph. Details are shown in the formula: (2) Drug molecule diagram embedding representation This is the initial embedding representation of drug nodes in the drug knowledge graph.

[0045] Embedded representation of drug-related entity nodes: UniProt ID is a crucial identifier for proteins in the database, enabling precise location of specific proteins and ensuring accuracy when researchers share and cite protein data globally, avoiding confusion caused by inconsistent protein nomenclature. In MVDE-DKG, targets, enzymes, vectors, transport proteins, and other entities each have a unique UniProt ID.

[0046] The corresponding protein sequence can be located in the UniProt database using the UniProt ID identifier of the protein type node in MVDE-DKG. Since there are many protein types, manually obtaining protein sequences is inefficient; therefore, this embodiment uses an automated script for batch processing. The specific steps are as follows: (1) Read UniProt ID: Read the UniProt ID of each entity sequentially from the local file; (2) Send a search request: Send a search request to the UniProt website via an HTTP request to query the protein sequence corresponding to the UniProtID.

[0047] (3) Get the return value: Receive the response data returned by the UniProt website, which is usually in text or JSON format containing protein sequences.

[0048] (4) Regularized matching: Regularize the returned value to extract the protein sequence.

[0049] (5) Storage results: Store the extracted protein sequences in FASTA format or other suitable formats for later use.

[0050] In bioinformatics research, protein sequences can be considered a special type of biological information language sequence. To gain a deeper understanding of protein structure and function, the core objective of this embodiment is to obtain an effective embedding representation of protein sequences. In recent years, with the rapid development of Natural Language Processing (NLP) technology, the ProtTrans framework innovatively introduces pre-trained models from the NLP field (such as BERT, T5, XLNet, etc.) into the field of protein sequence analysis, achieving this goal by learning the semantic information of protein sequences. In this study, ProtBERT, a pre-trained model based on the BERT architecture, is selected as the foundational model for transfer learning.

[0051] ProtBERT employs a self-supervised learning (SSL) approach, undergoing large-scale pre-training on 216 million protein sequences. Through this self-supervised learning method, ProtBERT effectively captures structural information and functional characteristics of protein sequences, thereby learning deep semantic representations of proteins. Technically, ProtBERT encodes protein sequences into high-dimensional vector representations. These vectors not only contain local features of the sequence (such as the physicochemical properties of amino acids) but also capture global contextual information (such as protein domains and functional sites). This high-dimensional representation is learned through pre-training tasks (such as Masked Language Modeling, MLM) and reflects implicit characteristics in protein sequences, such as secondary and tertiary structures and interaction patterns with other proteins. Based on ProtBERT's powerful representational capabilities, this embodiment applies it to the construction of a drug knowledge graph, particularly for generating initial embedding representations of protein type nodes. Specifically, for each protein node in the knowledge graph, its corresponding amino acid sequence is first extracted, and then encoded into a fixed-dimensional vector representation using a pre-trained ProtBERT model. Obtain the embedding representation of protein nodes The specific steps are as follows: (1) Word embedding representation For a protein sequence ,in Representing protein amino acid residues (similar to "words" in NLP tasks), ProtBERT maps them to a vector space, which can be represented as: (3) in, It is the embedding representation of the i-th amino acid. It is an embedding matrix. It is a bias term.

[0052] Finally, the embedding matrix of the entire sequence is represented as follows: In addition, positional encoding is added to capture sequence information, as shown below: (4) in, It is the position index of the amino acid in the sequence. It is the embedding dimension, the final input representation .

[0053] (2) Feedforward network encoding representation The multi-head attention mechanism is as follows: (5) Each of them Calculate an independent Self-Attention, It is a parameter matrix.

[0055] (6) in, These are training parameters. As an activation function.

[0056] For pathway type nodes, the number in the drug knowledge graph is fixed at 871. This embodiment uses one-hot encoding to represent each pathway node. Specifically, each pathway node is represented as an 871-dimensional sparse vector, where only one element has a value of 1 (representing the current pathway type), and the rest are 0. To map the one-hot encoding of pathway type nodes to the same feature space as other nodes (such as protein nodes), a learnable parameter matrix is ​​introduced. , where d represents the dimension of the target feature space. Through matrix multiplication, the one-hot encoding is mapped to a low-dimensional dense vector representation. The specific details are as follows: (7) in, It is an embedding matrix of path type nodes, where each column corresponds to an embedding representation of a path type. It is the one-hot encoded vector of the path type node.

[0057] In this way, the one-hot encoding of path type nodes is transformed into a continuous low-dimensional vector representation, enabling them to interact and compute with other nodes in the same feature space. This mapping method not only preserves the semantic information of path types but also allows path nodes to participate in the joint representation learning of the knowledge graph, providing a unified input format for subsequent graph neural network modeling (such as graph convolutional networks or graph attention networks).

[0058] Edge embedding representation: In a drug knowledge graph, edge type is crucial semantic information describing the relationships between nodes. To effectively represent edges, this embodiment employs one-hot encoding to initialize the edge embedding representation. Specifically, the drug knowledge graph defines six edge types, each assigned a unique label (label value from 1 to 6). For each edge, this embodiment represents it as a 6-dimensional sparse vector, where only one element has a value of 1 (representing the current edge type), and the remaining elements are all 0. For example, if the edge type label is 3, its one-hot encoding representation is... .

[0059] The technical solutions of the present invention are not limited to the specific embodiments described above. Any technical modifications made in accordance with the technical solutions of the present invention fall within the protection scope of the present invention.< / drug>

Claims

1. A method for constructing a drug knowledge graph using multi-view embedding, characterized in that, Includes the following steps: S1. Obtain the raw XML file of drug information. Use the R language toolkit to filter the drug information source data to obtain a drug dictionary file, a drug interaction file, and a relational file of drug-related entities. The drug information includes the drug's chemical structure, pharmacological effects, target information, metabolic pathways, side effects, drug interactions, and clinical trial data. The drug dictionary file includes a unique ID column for the drug, the drug name, and drug SMILES information. Drug-related entities include target information: the biological targets of drug action; enzyme information: enzymes involved in drug metabolism; carrier information: carrier proteins involved in drug transport; transport protein information: transport proteins involved in drug absorption and distribution; and pathway information: biological pathways involved in drug action. S2. Extract key information from the drug interaction relationship file using regular expressions to generate drug-drug triples, and directly map the corresponding columns of the relationship file of drug-related entities to drug-related entity triples. S3. Use the graph neural network library PyTorch Geometric to set the triples as nodes and edges of the drug knowledge graph; S4. Initialize the information of different types of nodes and edges in the drug knowledge graph through multi-view directional embedding technology to obtain the drug knowledge graph MVDE-DKG.

2. The method for constructing a drug knowledge graph with multi-view embedding according to claim 1, characterized in that, In step S1, the process of using the R language toolkit to filter drug information source data includes: (1) First, use the dbparser and dbdataset packages in R to load the original XML file and store it as an R object dvobject; (2) Next, extract the SMILES information of the drug from the dvobject and store it as a data file; drugs without SMILES information are filtered out. (3) Then, extract the drug's target, enzyme, carrier, transport protein and pathway information respectively, and ensure the accuracy of this information through screening operations; at the same time, in addition to pathway information, if the information of other drug-related entities is missing UniProtID, it will also be filtered out. (4) Secondly, extract the interaction information between the drug and other drugs from the dvobject and perform deduplication; (5) Finally, use the openxlsx package to export the extracted data as an Excel file for subsequent analysis.

3. The method for constructing a drug knowledge graph with multi-view embedding according to claim 2, characterized in that, In step S2, the process of generating drug-drug triplets is as follows: (1) Read the drug interaction worksheet: extract the two interacting drugs and denote them as drug A and drug B, as the source node and target node of the triple; (2) Construct a regular expression pattern: Connect all drug names with a vertical bar "|" to construct a regular expression pattern, and compile it into a regular expression object using a regularization function; use the regular expression pattern to quickly match drug names in the drug interaction description; (3) Replace drug names with placeholders: Read the interaction descriptions in the drug interaction worksheet; for each sentence, use the text replacement tool to replace the matched drug names with placeholders "[DRUG]" based on the regular expression object, and replace the original sentence with the updated sentence; (4) Deduplication and obtaining fixed sentence patterns: After all sentences are replaced, ensure that only one unique sentence pattern is retained for each interaction type, perform deduplication operation, and obtain 298 different fixed sentence patterns; (5) Assign a label to each sentence pattern: Assign a unique label to each fixed sentence pattern, with the label range from 0 to 297, to facilitate subsequent machine learning and graph neural network modeling; (6) Replace the original sentence with the label to generate the final triple representation, i.e. (drug A, drug B, label).

4. The method for constructing a drug knowledge graph with multi-view embedding according to claim 1 or 3, characterized in that, In step S2, the process of generating drug-related entities is as follows: Drug-related entity information was extracted from the original XML file containing drug information, and corresponding worksheets were generated. The following two filtering rules were applied when extracting entity information: only drugs with SMILES representation were retained to ensure the integrity of the chemical structure information of drug nodes. In addition to pathway information, only protein-type entities are retained to ensure that the biological meaning of entity nodes is clear. Through filtering rules, records with incomplete information or unclear biological meaning are removed, and the filtered data provides a guarantee for the initialization of nodes in the drug knowledge graph. Each worksheet contains the following: Drug Unique ID: used to identify the drug; Entity Name: the name of the target, enzyme, carrier, transport protein or pathway. Entity type; UniProt ID: A unique identifier for the protein sequence; Interrelationships: The specific relationships between the drug and the entity, including binding, metabolism, and transport.

5. The method for constructing a drug knowledge graph with multi-view embedding according to claim 4, characterized in that, Step S3 specifically includes: (1) Construction of the node set: The drug knowledge graph contains six types of nodes: drugs, targets, enzymes, carriers, transport proteins, and pathways; the attributes of each type of node are represented as follows: , where m is the number of nodes of this type, and n is the dimension of the initial embedding representation of the node; (2) Construction of edge sets: The drug knowledge graph contains six types of edges: drug-drug, drug-target, drug-enzyme, drug-carrier, drug-transporter, and drug-pathway. Each type of node has its own unique ID-to-unique index mapping dictionary. The unique ID in the original triplet is replaced with a unique index. In addition, based on the node's unique ID, the index of the node in that type is obtained through this dictionary, and the feature vector representation of the node is located. The first two values ​​of the replaced triplet (source node, target node) are taken as edges. The edge set of each type is represented as follows: , where r is the number of edges of this type; (3) By defining the node set and edge set, a heterogeneous graph of the drug knowledge graph is constructed using the graph neural network library PyTorch Geometric. The heterogeneous graph contains 6 types of nodes and 6 types of edges, which can clearly represent the topological structure and semantic information of the drug knowledge graph, providing support for obtaining biomedical information of drug nodes.

6. The method for constructing a drug knowledge graph with multi-view embedding according to claim 5, characterized in that, Step S4 specifically includes: S41. Use GNN to capture the topological and semantic information of drug molecule structures; S42. Then, the global pooling function is used to obtain the graph embedding representation of the drug molecule graph, which is the initial embedding representation of the drug node. S43. Secondly, a single-layer MLP is used to map the path node type and edge type into a high-dimensional vector representation; S44. Finally, ProtBert[8] reads the protein sequence of the protein node and outputs the embedded representation with biological information.