History of dgidb
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/dgidb/__init__.py b/entries/dgidb/__init__.py
index f4e763b..fcd3140 100644
--- a/entries/dgidb/__init__.py
+++ b/entries/dgidb/__init__.py
@@ -44,7 +44,7 @@ citation = [('M. Cannon, J. Stevenson, K. Stahl, R. Basu, A. Coffman, S. Kiwala,
'https://doi.org/10.1093/nar/gkad1040'),
('S. L. Freshour, S. Kiwala, K. C. Cotto, A. C. Coffman, J. F. McMichael, J. J. Song, M. Griffith, O. L. Griffith, A. H. Wagner, "Integration of the Drug-Gene Interaction Database (DGIdb 4.0) with open crowdsource efforts." Nucleic Acids Research 49, D1144-D1151 (2021)',
'https://doi.org/10.1093/nar/gkaa1084')]
-icon_hash = None
+date_added = '2026-10-31'
# DGIdb: "The data used in DGIdb is all open access"; its code is under the
# MIT license; the sources have their own licenses (listed on the site)
upstream_license = ('Open access data, collected from sources with their own licenses (DGIdb code: MIT)',
[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/dgidb/__init__.py b/entries/dgidb/__init__.py
index b280bba..f4e763b 100644
--- a/entries/dgidb/__init__.py
+++ b/entries/dgidb/__init__.py
@@ -28,16 +28,16 @@ There is one network for each data release of DGIdb that is available for downlo
The networks have the following properties:
-- `is_drug`: whether the node is a drug (otherwise it is a gene).
-- `concept_id`: the identifier of the normalized concept of the drug (e.g. `rxcui:12574`, `chembl:CHEMBL296468`, `ncit:C70982`) or of the gene (in DGIdb 5 its HGNC identifier, e.g. `hgnc:5466`; in DGIdb 4 its NCBI Gene identifier, written here as `ncbigene:1022`); empty for the drugs and genes that were not normalized.
-- `name`: the name of the normalized drug or the gene symbol, or the name given by the source if it was not normalized.
-- `approved`, `immunotherapy`, `antineoplastic` (from `2023-12`): whether the drug is approved, an immunotherapy, and an antineoplastic drug (false if not given).
-- Edge `source`: the source of the claim, and `source_version` its version (from `2023-12`).
-- Edge `gene_claim`, `drug_claim`: the names of the gene and the drug as given by the source.
-- Edge `interaction_types`: the types of the interaction, e.g. `inhibitor`, `agonist`, separated by `|` in DGIdb 5 and by `,` in DGIdb 4 (empty if not given).
-- Edge `interaction_score`: the interaction score of DGIdb, which grows with the number of sources and publications supporting the interaction, and with the specificity of the drug and the gene (NaN if not given).
-- Edge `drug_specificity_score`, `gene_specificity_score`, `evidence_score` (from `2024-12`): the parts of the interaction score (NaN or -1 if not given).
-- Edge `pmids` (`2021-05`, `2022-02`): the PubMed identifiers of the articles supporting the claim, separated by `,`."""
+- (Node) `is_drug`: whether the node is a drug (otherwise it is a gene).
+- (Node) `concept_id`: the identifier of the normalized concept of the drug (e.g. `rxcui:12574`, `chembl:CHEMBL296468`, `ncit:C70982`) or of the gene (in DGIdb 5 its HGNC identifier, e.g. `hgnc:5466`; in DGIdb 4 its NCBI Gene identifier, written here as `ncbigene:1022`); empty for the drugs and genes that were not normalized.
+- (Node) `name`: the name of the normalized drug or the gene symbol, or the name given by the source if it was not normalized.
+- (Node) `approved`, `immunotherapy`, `antineoplastic` (from `2023-12`): whether the drug is approved, an immunotherapy, and an antineoplastic drug (false if not given).
+- (Edge) `source`: the source of the claim, and `source_version` its version (from `2023-12`).
+- (Edge) `gene_claim`, `drug_claim`: the names of the gene and the drug as given by the source.
+- (Edge) `interaction_types`: the types of the interaction, e.g. `inhibitor`, `agonist`, separated by `|` in DGIdb 5 and by `,` in DGIdb 4 (empty if not given).
+- (Edge) `interaction_score`: the interaction score of DGIdb, which grows with the number of sources and publications supporting the interaction, and with the specificity of the drug and the gene (NaN if not given).
+- (Edge) `drug_specificity_score`, `gene_specificity_score`, `evidence_score` (from `2024-12`): the parts of the interaction score (NaN or -1 if not given).
+- (Edge) `pmids` (`2021-05`, `2022-02`): the PubMed identifiers of the articles supporting the claim, separated by `,`."""
tags = ['Biological', 'Drug interactions', 'Unweighted', 'Multigraph', 'Bipartite', 'Metadata']
url = ['https://dgidb.org/', 'https://github.com/dgidb/dgidb-data/releases']
citation = [('M. Cannon, J. Stevenson, K. Stahl, R. Basu, A. Coffman, S. Kiwala, J. F. McMichael, K. Kuzma, D. Morrissey, K. Cotto, E. R. Mardis, O. L. Griffith, M. Griffith, A. H. Wagner, "DGIdb 5.0: rebuilding the drug-gene interaction database for precision medicine and drug discovery platforms." Nucleic Acids Research 52, D1227-D1235 (2024)',
[entries] New entry: dgidb af37bd0
diff --git a/entries/dgidb/__init__.py b/entries/dgidb/__init__.py
new file mode 100644
index 0000000..b280bba
--- /dev/null
+++ b/entries/dgidb/__init__.py
@@ -0,0 +1,164 @@
+#! /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 csv
+import math
+
+from .. import *
+
+title = "DGIdb drug-gene interactions (2021-2026)"
+description = r"""Bipartite networks of drugs and genes from the Drug-Gene Interaction Database (DGIdb), which collects drug-gene interactions (e.g. a drug that inhibits the product of a gene) from about 40 sources (e.g. ChEMBL, DrugBank, the Guide to Pharmacology, TTD, CIViC, the FDA, clinical trial and cancer knowledge bases, the literature), and normalizes the drugs and genes they name to common concepts. Each edge is an interaction claim of a source, so that a drug and a gene are often connected by several edges, one per source (and the networks are multigraphs).
+
+There is one network for each data release of DGIdb that is available for download, named by its date: `2021-05` and `2022-02` (DGIdb 4), `2023-12`, `2024-06`, `2024-12`, `2026-06`, `2026-06b` (a corrected release of the same month) and `2026-10` (DGIdb 5); the release `2026-09` is identical to `2026-10`, and is left out. The drugs and genes of the claims that DGIdb could not normalize (about a tenth of the claims) are kept as nodes identified by the name given by the source (with an empty `concept_id`), so that the same drug or gene may appear in several of these nodes.
+
+The networks have the following properties:
+
+- `is_drug`: whether the node is a drug (otherwise it is a gene).
+- `concept_id`: the identifier of the normalized concept of the drug (e.g. `rxcui:12574`, `chembl:CHEMBL296468`, `ncit:C70982`) or of the gene (in DGIdb 5 its HGNC identifier, e.g. `hgnc:5466`; in DGIdb 4 its NCBI Gene identifier, written here as `ncbigene:1022`); empty for the drugs and genes that were not normalized.
+- `name`: the name of the normalized drug or the gene symbol, or the name given by the source if it was not normalized.
+- `approved`, `immunotherapy`, `antineoplastic` (from `2023-12`): whether the drug is approved, an immunotherapy, and an antineoplastic drug (false if not given).
+- Edge `source`: the source of the claim, and `source_version` its version (from `2023-12`).
+- Edge `gene_claim`, `drug_claim`: the names of the gene and the drug as given by the source.
+- Edge `interaction_types`: the types of the interaction, e.g. `inhibitor`, `agonist`, separated by `|` in DGIdb 5 and by `,` in DGIdb 4 (empty if not given).
+- Edge `interaction_score`: the interaction score of DGIdb, which grows with the number of sources and publications supporting the interaction, and with the specificity of the drug and the gene (NaN if not given).
+- Edge `drug_specificity_score`, `gene_specificity_score`, `evidence_score` (from `2024-12`): the parts of the interaction score (NaN or -1 if not given).
+- Edge `pmids` (`2021-05`, `2022-02`): the PubMed identifiers of the articles supporting the claim, separated by `,`."""
+tags = ['Biological', 'Drug interactions', 'Unweighted', 'Multigraph', 'Bipartite', 'Metadata']
+url = ['https://dgidb.org/', 'https://github.com/dgidb/dgidb-data/releases']
+citation = [('M. Cannon, J. Stevenson, K. Stahl, R. Basu, A. Coffman, S. Kiwala, J. F. McMichael, K. Kuzma, D. Morrissey, K. Cotto, E. R. Mardis, O. L. Griffith, M. Griffith, A. H. Wagner, "DGIdb 5.0: rebuilding the drug-gene interaction database for precision medicine and drug discovery platforms." Nucleic Acids Research 52, D1227-D1235 (2024)',
+ 'https://doi.org/10.1093/nar/gkad1040'),
+ ('S. L. Freshour, S. Kiwala, K. C. Cotto, A. C. Coffman, J. F. McMichael, J. J. Song, M. Griffith, O. L. Griffith, A. H. Wagner, "Integration of the Drug-Gene Interaction Database (DGIdb 4.0) with open crowdsource efforts." Nucleic Acids Research 49, D1144-D1151 (2021)',
+ 'https://doi.org/10.1093/nar/gkaa1084')]
+icon_hash = None
+# DGIdb: "The data used in DGIdb is all open access"; its code is under the
+# MIT license; the sources have their own licenses (listed on the site)
+upstream_license = ('Open access data, collected from sources with their own licenses (DGIdb code: MIT)',
+ 'https://dgidb.org/about/overview/data-accessibility')
+upstream_prefix = 'https://github.com/dgidb/dgidb-data/releases/download'
+releases = ["2021-05", "2022-02", "2023-12", "2024-06", "2024-12", "2026-06",
+ "2026-06b", "2026-10"]
+files = [(f"{r}/interactions.tsv", r, None) for r in releases]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+def null(x):
+ return "" if x in ("NULL", '""') else x
+
+def fnum(x):
+ x = null(x)
+ return float(x) if x else math.nan
+
+def fbool(x):
+ return x.lower() == "true"
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ name = __name__.split(".")[-1]
+ for rel in releases:
+ if alts is not None and rel not in alts:
+ continue
+ old = rel < "2023"
+ new = rel >= "2024-12"
+ vidx = {}
+ vprops = {k: [] for k in ("is_drug", "concept_id", "name", "approved",
+ "immunotherapy", "antineoplastic")}
+ def vertex(is_drug, cid, nm, flags=(False, False, False)):
+ key = (is_drug, cid) if cid else (is_drug, None, nm)
+ v = vidx.get(key)
+ if v is None:
+ v = vidx[key] = len(vidx)
+ for k, x in zip(vprops, (is_drug, cid, nm) + tuple(flags)):
+ vprops[k].append(x)
+ return v
+ edges = []
+ eprops = {k: [] for k in ("source", "source_version", "gene_claim",
+ "drug_claim", "interaction_types",
+ "interaction_score",
+ "drug_specificity_score",
+ "gene_specificity_score", "evidence_score",
+ "pmids")}
+ with open_upstream_file(name, f"{rel}/interactions.tsv", "r") as f:
+ lines = (l for l in f if not l.startswith("#"))
+ reader = csv.reader(lines, delimiter="\t", quoting=csv.QUOTE_NONE)
+ header = next(reader)
+ ix = {c: i for i, c in enumerate(header)}
+ for r in reader:
+ r = [null(x) for x in r]
+ r += [""] * (len(header) - len(r))
+ if old:
+ gid = r[ix["entrez_id"]]
+ g = vertex(False, f"ncbigene:{gid}" if gid else "",
+ r[ix["gene_name"]] if gid else r[ix["gene_claim_name"]])
+ did = r[ix["drug_concept_id"]]
+ d = vertex(True, did, r[ix["drug_name"]] if did else
+ (r[ix["drug_claim_primary_name"]] or r[ix["drug_claim_name"]]))
+ vals = dict(source=r[ix["interaction_claim_source"]],
+ source_version="",
+ interaction_types=r[ix["interaction_types"]],
+ interaction_score=fnum(r[ix["interaction_group_score"]]),
+ pmids=r[ix["PMIDs"]])
+ else:
+ gid = r[ix["gene_concept_id"]]
+ g = vertex(False, gid, r[ix["gene_name"]] if gid else
+ r[ix["gene_claim_name"]])
+ did = r[ix["drug_concept_id"]]
+ if new:
+ flags = [r[ix[c]] for c in ("drug_is_approved",
+ "drug_is_immunotherapy",
+ "drug_is_antineoplastic")]
+ else:
+ flags = [r[ix[c]] for c in ("approved", "immunotherapy",
+ "anti_neoplastic")]
+ d = vertex(True, did, r[ix["drug_name"]] if did else
+ r[ix["drug_claim_name"]], [fbool(x) for x in flags])
+ itype = "interaction_types" if new else "interaction_type"
+ vals = dict(source=r[ix["interaction_source_db_name"]],
+ source_version=r[ix["interaction_source_db_version"]],
+ interaction_types=r[ix[itype]],
+ interaction_score=fnum(r[ix["interaction_score"]]))
+ if new:
+ vals.update(drug_specificity_score=fnum(r[ix["drug_specificity_score"]]),
+ gene_specificity_score=fnum(r[ix["gene_specificity_score"]]),
+ evidence_score=int(r[ix["evidence_score"]] or -1))
+ vals.update(gene_claim=r[ix["gene_claim_name"]],
+ drug_claim=r[ix["drug_claim_name"]])
+ edges.append((d, g))
+ for k in eprops:
+ if k in vals:
+ eprops[k].append(vals[k])
+ gr = Graph(directed=False)
+ gr.add_vertex(len(vidx))
+ gr.add_edge_list(numpy.array(edges, dtype="int64"))
+ gr.vp.is_drug = gr.new_vp("bool", vals=vprops["is_drug"])
+ gr.vp.concept_id = gr.new_vp("string", vals=vprops["concept_id"])
+ gr.vp.name = gr.new_vp("string", vals=vprops["name"])
+ if not old:
+ for k in ("approved", "immunotherapy", "antineoplastic"):
+ gr.vp[k] = gr.new_vp("bool", vals=vprops[k])
+ for k, vs in eprops.items():
+ if len(vs) != len(edges):
+ assert len(vs) == 0, k
+ continue
+ t = ("int" if k == "evidence_score" else
+ "double" if "score" in k else "string")
+ gr.ep[k] = gr.new_ep(t, vals=vs)
+ yield rel, gr