Skip to content
/ DRKG Public

A knowledge graph and a set of tools for drug repurposing

License

Notifications You must be signed in to change notification settings

gnn4dr/DRKG

Repository files navigation

Drug Repurposing Knowledge Graph (DRKG)

Drug Repurposing Knowledge Graph (DRKG) is a comprehensive biological knowledge graph relating genes, compounds, diseases, biological processes, side effects and symptoms. DRKG includes information from six existing databases including DrugBank, Hetionet, GNBR, String, IntAct and DGIdb, and data collected from recent publications particularly related to Covid19. It includes 97,055 entities belonging to 13 entity-types; and 5,869,294 triplets belonging to 106 edge-types. These 106 edge-types show a type of interaction between one of the 17 entity-type pairs (multiple types of interactions are possible between the same entity-pair), as depicted in the figure below. It also includes a bunch of notebooks about how to explore and analysis the DRKG using statistical methodologies or using machine learning methodologies such as knowledge graph embedding.

DRKG schema
Figure: Interactions in the DRKG. The number next to an edge indicates the number of relation-types for that entity-pair in DRKG.

Statistics of DRKG

The type-wise distribution of the entities in DRKG and their original data-source(s) is shown in following table.

Entity type Drugbank GNBR Hetionet STRING IntAct DGIdb Bibliography Total Entities
Anatomy - - 400 - - - - 400
Atc 4,048 - - - - - - 4,048
Biological Process - - 11,381 - - - - 11,381
Cellular Component - - 1,391 - - - - 1,391
Compound 9,708 11,961 1,538 - 153 6,348 6,250 24,313
Disease - 4,747 257 - - - 33 4,920
Gene 4,973 27,111 19,145 18,316 16,321 2,551 3,181 39,220
Molecular Function - - 2,884 - - - - 2,884
Pathway - - 1,822 - - - - 1,822
Pharmacologic Class - - 345 - - - - 345
Side Effect - - 5,701 - - - - 5,701
Symptom - - 415 - - - - 415
Tax - 215 - - - - - 215
Total 18,729 44,034 45,279 18,316 16,474 8,899 9,464 97,055

The following table shows the number of triplets between different entity-type pairs in DRKG for DRKG and various datasources.

Entity-type pair Drugbank GNBR Hetionet STRING IntAct DGIdb Bibliography Total interactions
(Gene, Gene) - 66,722 474,526 1,496,708 254,346 - 58,629 2,350,931
(Compound, Gene) 24,801 80,803 51,429 - 1,805 26,290 25,666 210,794
(Disease, Gene) - 95,400 27,977 - - - 461 123,838
(Atc, Compound) 15,750 - - - - - - 15,750
(Compound, Compound) 1,379,271 - 6,486 - - - - 1,385,757
(Compound, Disease) - 77,782 1,145 - - - - 78,927
(Gene, Tax) - 14,663 - - - - - 14,663
(Biological Process, Gene) - - 559,504 - - - - 559,504
(Disease, Symptom) - - 3,357 - - - - 3,357
(Anatomy, Disease) - - 3,602 - - - - 3,602
(Disease, Disease) - - 543 - - - - 543
(Anatomy, Gene) - - 726,495 - - - - 726,495
(Gene, Molecular Function) - - 97,222 - - - - 97,222
(Compound, Pharmacologic Class) - - 1,029 - - - - 1,029
(Cellular Component, Gene) - - 73,566 - - - - 73,566
(Gene, Pathway) - - 84,372 - - - - 84,372
(Compound, Side Effect) - - 138,944 - - - - 138,944
Total 1,419,822 335,370 2,250,197 1,496,708 256,151 26,290 84,756 5,869,294

Download DRKG

To analyze DRKG, you can directly download drkg by following commands:

wget https://dgl-data.s3-us-west-2.amazonaws.com/dataset/DRKG/drkg.tar.gz

If you use our notebooks provided in this repository, you don't need to download the file manually. The notebooks can automatically download the file for you.

When you untar drkg.tar.gz, you will see the following files:

./drkg.tsv
./entity2src.tsv
./embed
./embed/DRKG_TransE_l2_relation.npy
./embed/relations.tsv
./embed/entities.tsv
./embed/Readme.md
./embed/DRKG_TransE_l2_entity.npy

DRKG dataset

The whole dataset contains three part:

  • drkg.tsv, a tsv file containg the original drkg in the format of (h, r, t) triplets.
  • embed, a folder containing the pretrained Knowledge Graph Embedding using the entire drkg.tsv as the training set.
  • entity2src.tsv, a directory mapping entities in drkg to their original sources.

Pretrained DRKG embedding

The DRKG mebedding is trained using TransE_l2 model with dimention size of 400, there are four files:

  • DRKG_TransE_l2_entity.npy, NumPy binary data, storing the entity embedding
  • DRKG_TransE_l2_relation.npy, NumPy binary data, storing the relation embedding
  • entities.tsv, mapping from entity_name to tentity_id.
  • relations.tsv, mapping from relation_name to relation_id

To use the pretrained embedding, one can use np.load to load the entity embeddings and relation embeddings separately:

import numpy as np
entity_emb = np.load('./embed/DRKG_TransE_l2_entity.npy')
rel_emb = np.load('./embed/DRKG_TransE_l2_relation.npy')

Tools to analyze DRKG

We analyze DRKG with some deep learning frameworks, including DGL (a framework for graph neural networks) and DGL-KE (a library for computing knowledge graph embeddings). Please follow the instructions below to install the deep learning frameworks.

Install PyTorch

Currently all notebooks use PyTorch as Deep Learning backend. For install other version of pytorch please goto Install PyTorch

sudo pip3 install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

Install DGL

Please install DGL (a framework for graph neural networks) with the following command. It installs DGL with CUDA support.

sudo pip3 install dgl-cu101

For installing other versions of DGL, please go to Install DGL

Install DGL-KE

If you want to training the model with notebooks (e.g., using Train_embeddings.ipynb or Edge_score_analysis.ipynb) at [knowledge-graph-embedding-based-analysis-of-drkg], you need to install both DGL and DGL-KE package here. DGL-KE can work with DGL >= 0.4.3 (either CPU or GPU)

sudo pip3 install dglke

Notebooks for analyzing DRKG

We provide a set of notebooks to analyze DRKG. Some of the notebooks use the tools installed in the previous section.

Basic Graph Analysis of DRKG

To evaluate the structural similarity among a pair of relation types we compute their Jaccard similarity coefficient and the overlap among the two edge types via the overlap coeffcient. This analysis is given in

Knowledge Graph Embedding Based Analysis of DRKG

We analyze the extracted DRKG by learning a TransE KGE model that utilizes the $\ell_2$ distance. As DRKG combines information from different data sources, we want to verify that meaningful entity and relation embeddings can be generated using knowledge graph embedding technology.

We split the edge triplets in training, validation and test sets as follows 90%, 5%, and 5% and train the KGE model as shown in following notebook:

Finally, we obtain the entity and relation embeddings for the DRKG. We can do various embedding based analysis as provided in the following notebooks:

Drug Repurposing Using Pretrained Model for COVID-19

We present an example of using pretrained DRKG model for drug repurposing for COVID-19. In the example, we directly use the pretrined model provided at DRKG dataset and proposed 100 drugs for COVID-19. The following notebook provides the details:

DRKG with DGL

We provide a notebook, with example of using DRKG with Deep Graph Library (DGL).

The following notebook provides an example of building a heterograph from DRKG in DGL; and some examples of queries on the DGL heterograph:

Licence

This project is licensed under the Apache-2.0 License. However, the DRKG integrates data from many resources and users should consider the licensing of each source (see this table) . We apply a license attribute on a per node and per edge basis for sources with defined licenses.