History of drkg
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/drkg/__init__.py b/entries/drkg/__init__.py
index c4caeeb..36d826c 100644
--- a/entries/drkg/__init__.py
+++ b/entries/drkg/__init__.py
@@ -39,7 +39,7 @@ tags = ['Biological', 'Informational', 'Drug interactions', 'Unweighted', 'Multi
url = ['https://github.com/gnn4dr/DRKG', 'https://dgl-data.s3-us-west-2.amazonaws.com/dataset/DRKG/drkg.tar.gz']
citation = [('V. N. Ioannidis, X. Song, S. Manchanda, M. Li, X. Pan, D. Zheng, X. Ning, X. Zeng, G. Karypis, "DRKG - Drug Repurposing Knowledge Graph for Covid-19." GitHub repository (2020)',
'https://github.com/gnn4dr/DRKG')]
-icon_hash = None
+date_added = '2026-10-31'
# The repository is under the Apache 2.0 license; the data come from sources
# with their own licenses (e.g. DrugBank, CC BY-NC 4.0)
upstream_license = ('Apache License 2.0 (repository); the sources keep their own licenses (e.g. DrugBank: CC BY-NC 4.0)',
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/drkg/__init__.py b/entries/drkg/__init__.py
index f12552c..c4caeeb 100644
--- a/entries/drkg/__init__.py
+++ b/entries/drkg/__init__.py
@@ -29,12 +29,12 @@ description = r"""A biomedical knowledge graph of genes, compounds, diseases and
The network has the following properties:
-- `entity`: the identifier of the entity in DRKG, made of its type and its identifier in the source (e.g. `Gene::2157`, an NCBI Gene identifier, `Compound::DB00001`, a DrugBank identifier, `Disease::MESH:D015673`).
-- `kind`: the type of the entity, e.g. `Gene`.
-- Edge `relation`: the relation, made of its source, its name and the types of the entities it joins (e.g. `DRUGBANK::ddi-interactor-in::Compound:Compound`, `GNBR::E+::Compound:Gene`).
-- Edge `source`: the source of the relation (`DRUGBANK`, `Hetionet`, `GNBR`, `STRING`, `INTACT`, `DGIDB`, `bioarx`).
-- Edge `interaction_type`: the type of interaction of the relation, from the glossary of DRKG (e.g. `activation`; empty if not given).
-- Graph `relation_glossary`: the glossary of the relations of DRKG, in JSON: for each relation, its data source, the types of entities it joins, its interaction type, its description and the reference of the description."""
+- (Node) `entity`: the identifier of the entity in DRKG, made of its type and its identifier in the source (e.g. `Gene::2157`, an NCBI Gene identifier, `Compound::DB00001`, a DrugBank identifier, `Disease::MESH:D015673`).
+- (Node) `kind`: the type of the entity, e.g. `Gene`.
+- (Edge) `relation`: the relation, made of its source, its name and the types of the entities it joins (e.g. `DRUGBANK::ddi-interactor-in::Compound:Compound`, `GNBR::E+::Compound:Gene`).
+- (Edge) `source`: the source of the relation (`DRUGBANK`, `Hetionet`, `GNBR`, `STRING`, `INTACT`, `DGIDB`, `bioarx`).
+- (Edge) `interaction_type`: the type of interaction of the relation, from the glossary of DRKG (e.g. `activation`; empty if not given).
+- (Graph) `relation_glossary`: the glossary of the relations of DRKG, in JSON: for each relation, its data source, the types of entities it joins, its interaction type, its description and the reference of the description."""
tags = ['Biological', 'Informational', 'Drug interactions', 'Unweighted', 'Multigraph', 'Metadata']
url = ['https://github.com/gnn4dr/DRKG', 'https://dgl-data.s3-us-west-2.amazonaws.com/dataset/DRKG/drkg.tar.gz']
citation = [('V. N. Ioannidis, X. Song, S. Manchanda, M. Li, X. Pan, D. Zheng, X. Ning, X. Zeng, G. Karypis, "DRKG - Drug Repurposing Knowledge Graph for Covid-19." GitHub repository (2020)',
[entries] New entry: drkg da54762
diff --git a/entries/drkg/__init__.py b/entries/drkg/__init__.py
new file mode 100644
index 0000000..f12552c
--- /dev/null
+++ b/entries/drkg/__init__.py
@@ -0,0 +1,94 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import json
+
+import pyarrow
+import pyarrow.csv
+import pyarrow.compute as pc
+
+from .. import *
+
+title = "Drug Repurposing Knowledge Graph (DRKG, 2020)"
+description = r"""A biomedical knowledge graph of genes, compounds, diseases and other biological entities, the Drug Repurposing Knowledge Graph (DRKG) assembled by Amazon and collaborators for drug repurposing, notably for COVID-19. It integrates DrugBank, Hetionet, GNBR (relations mined from the literature), STRING, IntAct, DGIdb and data from publications related to COVID-19 (the "bibliography"). The nodes are entities of 13 types (`Gene`, `Compound`, `Disease`, `Anatomy`, `Atc`, `Biological Process`, `Cellular Component`, `Molecular Function`, `Pathway`, `Pharmacologic Class`, `Side Effect`, `Symptom`, `Tax`), and each directed edge is a triple (head, relation, tail) with one of 107 relation types, from the head entity to the tail entity. Two entities can be joined by several edges with different relations (e.g. from different sources), so that the network is a multigraph. The data are those of the release of June 2020.
+
+The network has the following properties:
+
+- `entity`: the identifier of the entity in DRKG, made of its type and its identifier in the source (e.g. `Gene::2157`, an NCBI Gene identifier, `Compound::DB00001`, a DrugBank identifier, `Disease::MESH:D015673`).
+- `kind`: the type of the entity, e.g. `Gene`.
+- Edge `relation`: the relation, made of its source, its name and the types of the entities it joins (e.g. `DRUGBANK::ddi-interactor-in::Compound:Compound`, `GNBR::E+::Compound:Gene`).
+- Edge `source`: the source of the relation (`DRUGBANK`, `Hetionet`, `GNBR`, `STRING`, `INTACT`, `DGIDB`, `bioarx`).
+- Edge `interaction_type`: the type of interaction of the relation, from the glossary of DRKG (e.g. `activation`; empty if not given).
+- Graph `relation_glossary`: the glossary of the relations of DRKG, in JSON: for each relation, its data source, the types of entities it joins, its interaction type, its description and the reference of the description."""
+tags = ['Biological', 'Informational', 'Drug interactions', 'Unweighted', 'Multigraph', 'Metadata']
+url = ['https://github.com/gnn4dr/DRKG', 'https://dgl-data.s3-us-west-2.amazonaws.com/dataset/DRKG/drkg.tar.gz']
+citation = [('V. N. Ioannidis, X. Song, S. Manchanda, M. Li, X. Pan, D. Zheng, X. Ning, X. Zeng, G. Karypis, "DRKG - Drug Repurposing Knowledge Graph for Covid-19." GitHub repository (2020)',
+ 'https://github.com/gnn4dr/DRKG')]
+icon_hash = None
+# The repository is under the Apache 2.0 license; the data come from sources
+# with their own licenses (e.g. DrugBank, CC BY-NC 4.0)
+upstream_license = ('Apache License 2.0 (repository); the sources keep their own licenses (e.g. DrugBank: CC BY-NC 4.0)',
+ 'https://github.com/gnn4dr/DRKG/tree/master/licenses')
+upstream_prefix = 'https://s3.us-west-2.amazonaws.com/dgl-data/dataset/DRKG'
+files = [(("drkg.tar.gz:drkg.tsv", "drkg.tar.gz:relation_glossary.tsv"), None, None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ name = __name__.split(".")[-1]
+ with open_upstream_file(name, files[0][0][0], "rb") as f:
+ t = pyarrow.csv.read_csv(
+ f,
+ read_options=pyarrow.csv.ReadOptions(column_names=["h", "r", "t"]),
+ parse_options=pyarrow.csv.ParseOptions(delimiter="\t",
+ quote_char=False),
+ convert_options=pyarrow.csv.ConvertOptions(
+ column_types={c: pyarrow.string() for c in "hrt"}))
+ glossary = {}
+ with open_upstream_file(name, files[0][0][1], "r") as f:
+ header = next(f).rstrip("\n").split("\t")
+ for l in f:
+ r = l.rstrip("\n").split("\t")
+ r += [""] * (len(header) - len(r))
+ glossary[r[0]] = dict(zip(header[1:], r[1:]))
+ ents = pc.unique(pyarrow.chunked_array(t.column("h").chunks + t.column("t").chunks))
+ g = Graph(directed=True)
+ g.add_vertex(len(ents))
+ g.add_edge_list(numpy.column_stack(
+ [pc.index_in(t.column("h"), value_set=ents).to_numpy(),
+ pc.index_in(t.column("t"), value_set=ents).to_numpy()]))
+ ents = ents.to_pylist()
+ g.vp.entity = g.new_vp("string", vals=ents)
+ g.vp.kind = g.new_vp("string", vals=[e.partition("::")[0] for e in ents])
+ d = t.column("r").combine_chunks().dictionary_encode()
+ labels = d.dictionary.to_pylist()
+ codes = g.new_ep("int", vals=d.indices.to_numpy())
+ for p, f in (("relation", lambda i: labels[i]),
+ ("source", lambda i: labels[i].partition("::")[0]),
+ ("interaction_type",
+ lambda i: glossary.get(labels[i], {}).get("Interaction-type", ""))):
+ q = g.new_ep("string")
+ map_property_values(codes, q, f)
+ g.ep[p] = q
+ g.gp.relation_glossary = g.new_gp("string", val=json.dumps(glossary))
+ yield None, g