History of multiplex_diseasome
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] human_microbiome, multiplex_diseasome: use American spelling in the descriptions 59b2475
diff --git a/entries/multiplex_diseasome/__init__.py b/entries/multiplex_diseasome/__init__.py
index f68d605..0bf5785 100644
--- a/entries/multiplex_diseasome/__init__.py
+++ b/entries/multiplex_diseasome/__init__.py
@@ -22,8 +22,8 @@ from .. import *
title = "Multiplex network of human diseases (2019)"
description = """Networks of human diseases, their symptoms and their associated genes, from which Halu et al. built the multiplex network of human diseases, in which two diseases are connected in the phenotype layer if they share a symptom, and in the genotype layer if they share a gene. The released data contains the underlying associations: nodes are diseases, symptoms and genes, and an undirected edge connects a disease to a symptom (phenotype layer) or to a gene (genotype layer) associated with it. Each disease is a disorder of the Disease Ontology, which may group several entries (phenotypes) of the Online Mendelian Inheritance in Man (OMIM) database; the symptoms are terms of the Human Phenotype Ontology (HPO). There are two networks, which differ in the source of the disease-gene associations:
-- `omim`: disease-gene associations from OMIM, for 910 diseases (2,255 OMIM entries), the data set analysed in the paper (whose multiplex network contains the 779 diseases that are not isolated in it).
-- `gwas`: disease-gene associations from genome-wide association studies (the GWAS Catalog), for 565 diseases, analysed in the supplementary information of the paper.
+- `omim`: disease-gene associations from OMIM, for 910 diseases (2,255 OMIM entries), the data set analyzed in the paper (whose multiplex network contains the 779 diseases that are not isolated in it).
+- `gwas`: disease-gene associations from genome-wide association studies (the GWAS Catalog), for 565 diseases, analyzed in the supplementary information of the paper.
The networks are bipartite: every edge connects a disease to a symptom or a gene. The source files list, for each disease, its OMIM entries with one symptom each (the symptoms of a disease are the union of those of its entries), and its genes: in `omim` each gene is listed with the OMIM entry it is associated with, while in `gwas` the genes are not specific to OMIM entries: for 553 of the 565 diseases, every gene is listed with every OMIM entry of the disease (for the other 12, some entries are listed with a subset of the genes). Each edge here corresponds to a distinct disease-symptom or disease-gene pair, and lists the OMIM entries of the disease with which the pair appears in the source. Diseases, symptoms and genes are separate nodes even when they have the same name (e.g. some symptoms have the name of a disease). In `omim`, genes (some of which are loci without an identified gene, e.g. "AD10") are identified by their OMIM number, and the gene field contains a comma-separated list of the gene's symbols, the first of which is used as the name; in `gwas`, genes are identified by a single symbol, without OMIM number or cytogenetic location. Two diseases (polycystic kidney and liver disease) have rows with and without a category; the non-empty one is used. No data was left out.
[entries] New entry: multiplex_diseasome 9d7aa4a
diff --git a/entries/multiplex_diseasome/__init__.py b/entries/multiplex_diseasome/__init__.py
new file mode 100644
index 0000000..f68d605
--- /dev/null
+++ b/entries/multiplex_diseasome/__init__.py
@@ -0,0 +1,132 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020-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/>.
+
+
+from .. import *
+
+title = "Multiplex network of human diseases (2019)"
+description = """Networks of human diseases, their symptoms and their associated genes, from which Halu et al. built the multiplex network of human diseases, in which two diseases are connected in the phenotype layer if they share a symptom, and in the genotype layer if they share a gene. The released data contains the underlying associations: nodes are diseases, symptoms and genes, and an undirected edge connects a disease to a symptom (phenotype layer) or to a gene (genotype layer) associated with it. Each disease is a disorder of the Disease Ontology, which may group several entries (phenotypes) of the Online Mendelian Inheritance in Man (OMIM) database; the symptoms are terms of the Human Phenotype Ontology (HPO). There are two networks, which differ in the source of the disease-gene associations:
+
+- `omim`: disease-gene associations from OMIM, for 910 diseases (2,255 OMIM entries), the data set analysed in the paper (whose multiplex network contains the 779 diseases that are not isolated in it).
+- `gwas`: disease-gene associations from genome-wide association studies (the GWAS Catalog), for 565 diseases, analysed in the supplementary information of the paper.
+
+The networks are bipartite: every edge connects a disease to a symptom or a gene. The source files list, for each disease, its OMIM entries with one symptom each (the symptoms of a disease are the union of those of its entries), and its genes: in `omim` each gene is listed with the OMIM entry it is associated with, while in `gwas` the genes are not specific to OMIM entries: for 553 of the 565 diseases, every gene is listed with every OMIM entry of the disease (for the other 12, some entries are listed with a subset of the genes). Each edge here corresponds to a distinct disease-symptom or disease-gene pair, and lists the OMIM entries of the disease with which the pair appears in the source. Diseases, symptoms and genes are separate nodes even when they have the same name (e.g. some symptoms have the name of a disease). In `omim`, genes (some of which are loci without an identified gene, e.g. "AD10") are identified by their OMIM number, and the gene field contains a comma-separated list of the gene's symbols, the first of which is used as the name; in `gwas`, genes are identified by a single symbol, without OMIM number or cytogenetic location. Two diseases (polycystic kidney and liver disease) have rows with and without a category; the non-empty one is used. No data was left out.
+
+This data set differs from the `diseasome` network of Goh et al. (OMIM disorders and their genes, from 2005, with no symptoms) and from the `human_symptoms_diseases` network of Zhou et al. (co-occurrences of MeSH disease and symptom terms in PubMed records).
+
+The networks have the following properties:
+
+- `name`: the name of the disease or symptom (as given in the source), or the (first) symbol of the gene.
+- `kind`: the kind of node, "disease", "symptom" or "gene".
+- `is_disease`, `is_symptom`, `is_gene`: whether the node is a disease, a symptom or a gene.
+- `category`: the category of the disease (e.g. "autosomal recessive disease"; empty for some diseases) or of the symptom (e.g. "Abnormality of the midface"); empty for genes.
+- `disorder_omim`: the OMIM numbers of the entries of the disease (empty for symptoms and genes).
+- `gene_omim` (`omim` only): the OMIM number of the gene (-1 for diseases and symptoms).
+- `gene_symbols` (`omim` only): all the symbols of the gene, as listed in the source (empty for diseases and symptoms).
+- `cytogenetic_location` (`omim` only): the cytogenetic location of the gene (e.g. "6p21.1"; empty for diseases and symptoms).
+- Edge `layer`: "phenotype" for disease-symptom edges, "genotype" for disease-gene edges.
+- Edge `disorder_omim`: the OMIM numbers of the entries of the disease with which the symptom or gene is listed in the source."""
+tags = ['Biological', 'Genetic', 'Public Health', 'Unweighted', 'Multilayer', 'Metadata']
+url = 'https://github.com/CoMuNeLab/MultiplexDiseasome'
+citation = [('A. Halu, M. De Domenico, A. Arenas, A. Sharma, "The multiplex network of human diseases." npj Systems Biology and Applications 5, 15 (2019)', 'https://doi.org/10.1038/s41540-019-0092-5')]
+icon_hash = None
+upstream_license = ('Open Data Commons Open Database License (ODbL) v1.0', 'https://opendatacommons.org/licenses/odbl/1-0/')
+upstream_prefix = 'https://raw.githubusercontent.com/CoMuNeLab/MultiplexDiseasome/45b7807b50ff12f26acf954588323df5aadd7dc1'
+files = [('Datasets/DSG_network_from_OMIM.csv', 'omim', None),
+ ('Datasets/DSG_network_from_GWAS.csv', 'gwas', 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):
+ global files
+ name = __name__.split(".")[-1]
+ for fname, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ with open_upstream_file(name, fname, "r") as f:
+ rows = [l.rstrip("\r\n").split(";") for l in f if l.strip()]
+ assert rows[0] == ["disorder", "disorder_OMIM", "disorder_cat", "symptom",
+ "symptom_cat", "gene_symb", "gene_OMIM",
+ "gene_cytoloc"]
+ rows = rows[1:]
+ assert all(len(r) == 8 for r in rows)
+ has_gene_omim = all(r[6] != "" for r in rows)
+
+ nodes = {} # (kind, key) -> index
+ vals = [] # per node: dict of properties
+ def node(kind, key, name):
+ i = nodes.get((kind, key))
+ if i is None:
+ i = nodes[(kind, key)] = len(vals)
+ vals.append(dict(kind=kind, name=name, category="",
+ disorder_omim=[], gene_omim=-1,
+ gene_symbols=[], cytogenetic_location=""))
+ return i
+
+ edges = {} # (disease, other, layer) -> set of OMIM numbers
+ for (dis, dis_omim, dis_cat, sym, sym_cat, gene, gene_omim,
+ gene_loc) in rows:
+ d = node("disease", dis, dis)
+ if dis_cat != "":
+ assert vals[d]["category"] in ("", dis_cat)
+ vals[d]["category"] = dis_cat
+ if int(dis_omim) not in vals[d]["disorder_omim"]:
+ vals[d]["disorder_omim"].append(int(dis_omim))
+ s = node("symptom", sym, sym)
+ assert vals[s]["category"] in ("", sym_cat)
+ vals[s]["category"] = sym_cat
+ edges.setdefault((d, s, "phenotype"), set()).add(int(dis_omim))
+ if has_gene_omim:
+ symbols = [x.strip() for x in gene.split(",")]
+ gn = node("gene", gene_omim, symbols[0])
+ vals[gn]["gene_omim"] = int(gene_omim)
+ vals[gn]["gene_symbols"] = symbols
+ vals[gn]["cytogenetic_location"] = gene_loc
+ edges.setdefault((d, gn, "genotype"), set()).add(int(dis_omim))
+ else:
+ assert gene_omim == "" and gene_loc == ""
+ gn = node("gene", gene, gene)
+ edges.setdefault((d, gn, "genotype"), set()).add(int(dis_omim))
+
+ g = Graph(directed=False)
+ g.add_vertex(len(vals))
+ for p, t in [("name", "string"), ("kind", "string")]:
+ g.vp[p] = g.new_vp(t, vals=[x[p] for x in vals])
+ for k in ["disease", "symptom", "gene"]:
+ g.vp["is_" + k] = g.new_vp("bool", vals=[x["kind"] == k for x in vals])
+ g.vp.category = g.new_vp("string", vals=[x["category"] for x in vals])
+ g.vp.disorder_omim = g.new_vp("vector<int>",
+ vals=[x["disorder_omim"] for x in vals])
+ if has_gene_omim:
+ g.vp.gene_omim = g.new_vp("int", vals=[x["gene_omim"] for x in vals])
+ g.vp.gene_symbols = g.new_vp("vector<string>",
+ vals=[x["gene_symbols"] for x in vals])
+ g.vp.cytogenetic_location = \
+ g.new_vp("string", vals=[x["cytogenetic_location"] for x in vals])
+ g.ep.layer = g.new_ep("string")
+ g.ep.disorder_omim = g.new_ep("vector<int>")
+ for (u, v, layer), omims in edges.items():
+ e = g.add_edge(u, v)
+ g.ep.layer[e] = layer
+ g.ep.disorder_omim[e] = sorted(omims)
+ yield alt, g