History of human_symptoms_diseases
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/human_symptoms_diseases/__init__.py b/entries/human_symptoms_diseases/__init__.py
index 723ce07..6b618cc 100644
--- a/entries/human_symptoms_diseases/__init__.py
+++ b/entries/human_symptoms_diseases/__init__.py
@@ -36,7 +36,7 @@ The networks have the following properties:
tags = ['Biological', 'Public Health', 'Weighted', 'Metadata']
url = 'https://doi.org/10.1038/ncomms5212'
citation = [('X. Zhou, J. Menche, A.-L. Barabási, A. Sharma, "Human symptoms-disease network." Nature Communications 5, 4212 (2014)', 'https://doi.org/10.1038/ncomms5212')]
-icon_hash = '5da4f4ab48da354f03d1945d'
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://media.springernature.com/original/springer-static/esm/art%3A10.1038%2Fncomms5212/MediaObjects'
# Supplementary Data 1 (diseases), 2 (symptoms), 3 (symptom-disease
[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/human_symptoms_diseases/__init__.py b/entries/human_symptoms_diseases/__init__.py
index e58f2f1..723ce07 100644
--- a/entries/human_symptoms_diseases/__init__.py
+++ b/entries/human_symptoms_diseases/__init__.py
@@ -27,10 +27,12 @@ description = """Networks of human diseases and their symptoms, extracted from t
The networks have the following properties:
-- Nodes: `name`, the MeSH term; `pubmed_occurrence`, the number of PubMed records with the term in their MeSH metadata.
-- `symptoms_diseases` nodes: `is_symptom`, whether the node is a symptom (otherwise a disease). 248 terms are listed both as diseases and as symptoms in the source data, and correspond to two different nodes.
-- `symptoms_diseases` edges: `occurrence`, the number of PubMed records in which the symptom and disease co-occur; `tfidf`, the TF-IDF weight of the association.
-- `disease_links` edges: `weight`, the symptom similarity of the two diseases."""
+- (Node) `name`: the MeSH term.
+- (Node) `pubmed_occurrence`: the number of PubMed records with the term in their MeSH metadata.
+- (Node) `is_symptom` (`symptoms_diseases`): whether the node is a symptom (otherwise a disease). 248 terms are listed both as diseases and as symptoms in the source data, and correspond to two different nodes.
+- (Edge) `occurrence` (`symptoms_diseases`): the number of PubMed records in which the symptom and disease co-occur.
+- (Edge) `tfidf` (`symptoms_diseases`): the TF-IDF weight of the association.
+- (Edge) `weight` (`disease_links`): the symptom similarity of the two diseases."""
tags = ['Biological', 'Public Health', 'Weighted', 'Metadata']
url = 'https://doi.org/10.1038/ncomms5212'
citation = [('X. Zhou, J. Menche, A.-L. Barabási, A. Sharma, "Human symptoms-disease network." Nature Communications 5, 4212 (2014)', 'https://doi.org/10.1038/ncomms5212')]
[entries] Remove unneeded code from the entries 2c69f19
Unneeded "global files" statements, unused imports and variables, f-strings without placeholders, duplicate keys in foodweb_little_rock (keeping the order and the values used), and the second definition of get_lines() in twitter_higgs. Nothing changes in the networks or descriptions. Changed: none
diff --git a/entries/human_symptoms_diseases/__init__.py b/entries/human_symptoms_diseases/__init__.py
index 7be1d75..e58f2f1 100644
--- a/entries/human_symptoms_diseases/__init__.py
+++ b/entries/human_symptoms_diseases/__init__.py
@@ -55,7 +55,6 @@ def _read_tsv(f):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] New entry: human_symptoms_diseases a552903
diff --git a/entries/human_symptoms_diseases/__init__.py b/entries/human_symptoms_diseases/__init__.py
new file mode 100644
index 0000000..7be1d75
--- /dev/null
+++ b/entries/human_symptoms_diseases/__init__.py
@@ -0,0 +1,96 @@
+#! /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 = "Human symptoms-disease network (2014)"
+description = """Networks of human diseases and their symptoms, extracted from the biomedical literature by Zhou et al. The authors extracted the 7,109,429 records of the PubMed bibliographic database with at least one disease or symptom term (according to the Medical Subject Headings, MeSH) in their MeSH metadata field, yielding 4,442 disease terms and 322 symptom terms; 849,103 records contain at least one disease and one symptom term.
+
+- `symptoms_diseases`: bipartite network of symptoms and diseases, where an edge connects a symptom and a disease that co-occur in the MeSH metadata of at least one PubMed record (322 symptoms and 4,219 diseases). The edges are weighted by the number of co-occurrences, and by their term frequency-inverse document frequency (TF-IDF), which discounts symptoms that occur with many diseases: w = W log(N / n), where W is the number of co-occurrences, N the number of diseases and n the number of diseases in which the symptom appears. From these weights, the authors computed the symptom similarity between diseases as the cosine similarity of their vectors of symptom weights, which defines the (dense) human symptoms disease network (HSDN).
+- `disease_links`: network of the 133,106 links of the HSDN between 1,596 diseases that have both significant shared symptoms and shared genes or protein-protein interactions (as reported in Supplementary Data 4 of the paper), weighted by their symptom similarity.
+
+The networks have the following properties:
+
+- Nodes: `name`, the MeSH term; `pubmed_occurrence`, the number of PubMed records with the term in their MeSH metadata.
+- `symptoms_diseases` nodes: `is_symptom`, whether the node is a symptom (otherwise a disease). 248 terms are listed both as diseases and as symptoms in the source data, and correspond to two different nodes.
+- `symptoms_diseases` edges: `occurrence`, the number of PubMed records in which the symptom and disease co-occur; `tfidf`, the TF-IDF weight of the association.
+- `disease_links` edges: `weight`, the symptom similarity of the two diseases."""
+tags = ['Biological', 'Public Health', 'Weighted', 'Metadata']
+url = 'https://doi.org/10.1038/ncomms5212'
+citation = [('X. Zhou, J. Menche, A.-L. Barabási, A. Sharma, "Human symptoms-disease network." Nature Communications 5, 4212 (2014)', 'https://doi.org/10.1038/ncomms5212')]
+icon_hash = '5da4f4ab48da354f03d1945d'
+upstream_license = None
+upstream_prefix = 'https://media.springernature.com/original/springer-static/esm/art%3A10.1038%2Fncomms5212/MediaObjects'
+# Supplementary Data 1 (diseases), 2 (symptoms), 3 (symptom-disease
+# associations) and 4 (disease links)
+_sd = [f'41467_2014_BFncomms5212_MOESM{i}_ESM.txt' for i in [1043, 1044, 1045, 1046]]
+files = [((_sd[2], _sd[0], _sd[1]), 'symptoms_diseases', None),
+ ((_sd[3], _sd[0]), 'disease_links', None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+def _read_tsv(f):
+ rows = [l.rstrip("\r\n").split("\t") for l in f if l.strip()]
+ return rows[1:]
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ global files
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+ tables = [_read_tsv(f) for f in fs]
+ if alt == "symptoms_diseases":
+ # symptom, disease, PubMed occurrence, TF-IDF score
+ edges, diseases, symptoms = tables
+ g = Graph(directed=False)
+ terms = [(s, True, int(c)) for s, c in symptoms] + \
+ [(d, False, int(c)) for d, c in diseases]
+ g.add_vertex(len(terms))
+ g.vp.name = g.new_vp("string", vals=[t[0] for t in terms])
+ g.vp.is_symptom = g.new_vp("bool", vals=[t[1] for t in terms])
+ g.vp.pubmed_occurrence = g.new_vp("int", vals=[t[2] for t in terms])
+ idx = {(t[0], t[1]): i for i, t in enumerate(terms)}
+ g.ep.occurrence = g.new_ep("int")
+ g.ep.tfidf = g.new_ep("double")
+ g.add_edge_list([(idx[(s, True)], idx[(d, False)], int(c), float(w))
+ for s, d, c, w in edges],
+ eprops=[g.ep.occurrence, g.ep.tfidf])
+ # Diseases without any symptom association are not included
+ g = GraphView(g, vfilt=g.degree_property_map("total").a > 0)
+ g = Graph(g, prune=True)
+ else:
+ # disease, disease, symptom similarity
+ edges, diseases = tables
+ occ = {d: int(c) for d, c in diseases}
+ g = Graph(directed=False)
+ g.ep.weight = g.new_ep("double")
+ g.vp.name = g.add_edge_list([(a, b, float(w)) for a, b, w in edges],
+ hashed=True, hash_type="string",
+ eprops=[g.ep.weight])
+ g.vp.pubmed_occurrence = g.new_vp("int", vals=[occ.get(g.vp.name[v], -1)
+ for v in g.vertices()])
+ yield alt, g