logo Netzschleuder network catalog, repository, and centrifuge

History of mammal_virus_hp3

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 by Tiago de Paula Peixoto 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/mammal_virus_hp3/__init__.py b/entries/mammal_virus_hp3/__init__.py
index f1f0a26..0705af5 100644
--- a/entries/mammal_virus_hp3/__init__.py
+++ b/entries/mammal_virus_hp3/__init__.py
@@ -50,7 +50,7 @@ tags = ['Biological', 'Unweighted', 'Multigraph', 'Metadata']
 url = 'https://github.com/ecohealthalliance/HP3'
 citation = [('K. J. Olival, P. R. Hosseini, C. Zambrana-Torrelio, N. Ross, T. L. Bogich, P. Daszak, "Host and viral traits predict zoonotic spillover from mammals." Nature 546, 646-650 (2017)', 'https://doi.org/10.1038/nature22975'),
             ('K. J. Olival, P. R. Hosseini, C. Zambrana-Torrelio, N. Ross, T. L. Bogich, P. Daszak, "Host and Viral Traits Predict Zoonotic Spillover from Mammals" (data and code), Zenodo (2017)', 'https://doi.org/10.5281/zenodo.596810')]
-icon_hash = '5d0d268151da6551647736a6'
+date_added = '2026-10-25'
 upstream_license = ("MIT", "https://github.com/ecohealthalliance/HP3/blob/master/LICENSE")
 upstream_prefix = 'https://raw.githubusercontent.com/ecohealthalliance/HP3/master/data'
 files = [(('associations.csv', 'hosts.csv', 'viruses.csv'), None, None)]
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto 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/mammal_virus_hp3/__init__.py b/entries/mammal_virus_hp3/__init__.py
index ec3b274..f1f0a26 100644
--- a/entries/mammal_virus_hp3/__init__.py
+++ b/entries/mammal_virus_hp3/__init__.py
@@ -26,10 +26,26 @@ A node is either a mammal species or a virus species, and each edge is a host-vi
 
 The network has the following properties:
 
-- All nodes: `name`, the species name (with underscores in place of spaces); `is_host`, whether the node is a mammal species (otherwise it is a virus); `order`, `family`, and `genus`, the taxonomic order, family, and genus of the host or virus.
-- Hosts: `common_name`, the English common name(s); `wild_domestic`, whether the species is wild or domestic according to the FAO (or "human"); `marine_terrestrial`, whether the species is marine or terrestrial; `mass_grams`, the average body mass in grams (NaN if unknown); `redlist_status`, the IUCN Red List status; `citations`, the number of Zoological Abstracts records for the species, and `disease_citations`, the number of such records that also match disease-related keywords (both are measures of research effort, -1 if unknown).
-- Viruses: `nucleic_acid` (DNA or RNA), `strandedness` (SS or DS), `envelope` (enveloped or non-enveloped), `genome_length`, the average genome length in nucleotides (NaN if unknown), `vector_borne` ("Y", "N", or "NA" if unknown), `is_zoonotic`, whether the virus has been detected both in humans and in other mammals, and `is_zoonotic_stringent`, the same but considering only detections by PCR or virus isolation.
-- Edges: `detection_method`, the method used to detect the virus in the host (e.g. antibodies, PCR, isolation); `detection_quality`, the strength of the evidence: 0 for serology, 1 for a viral neutralization test, and 2 for PCR or virus isolation (-1 if not given); `host_status`, whether the host in the reference was wild, domestic, captive, or human; and `reference`, the short reference (author and year) reporting the association."""
+- (Node) `name`: the species name (with underscores in place of spaces).
+- (Node) `is_host`: whether the node is a mammal species (otherwise it is a virus).
+- (Node) `order`, `family`, `genus`: the taxonomic order, family, and genus of the host or virus.
+- (Node) `common_name` (hosts): the English common name(s).
+- (Node) `wild_domestic` (hosts): whether the species is wild or domestic according to the FAO (or "human").
+- (Node) `marine_terrestrial` (hosts): whether the species is marine or terrestrial.
+- (Node) `mass_grams` (hosts): the average body mass in grams (NaN if unknown).
+- (Node) `redlist_status` (hosts): the IUCN Red List status.
+- (Node) `citations`, `disease_citations` (hosts): the number of Zoological Abstracts records for the species, and the number of such records that also match disease-related keywords (both are measures of research effort, -1 if unknown).
+- (Node) `nucleic_acid` (viruses): DNA or RNA.
+- (Node) `strandedness` (viruses): SS or DS.
+- (Node) `envelope` (viruses): enveloped or non-enveloped.
+- (Node) `genome_length` (viruses): the average genome length in nucleotides (NaN if unknown).
+- (Node) `vector_borne` (viruses): "Y", "N", or "NA" if unknown.
+- (Node) `is_zoonotic` (viruses): whether the virus has been detected both in humans and in other mammals.
+- (Node) `is_zoonotic_stringent` (viruses): the same, but considering only detections by PCR or virus isolation.
+- (Edge) `detection_method`: the method used to detect the virus in the host (e.g. antibodies, PCR, isolation).
+- (Edge) `detection_quality`: the strength of the evidence: 0 for serology, 1 for a viral neutralization test, and 2 for PCR or virus isolation (-1 if not given).
+- (Edge) `host_status`: whether the host in the reference was wild, domestic, captive, or human.
+- (Edge) `reference`: the short reference (author and year) reporting the association."""
 tags = ['Biological', 'Unweighted', 'Multigraph', 'Metadata']
 url = 'https://github.com/ecohealthalliance/HP3'
 citation = [('K. J. Olival, P. R. Hosseini, C. Zambrana-Torrelio, N. Ross, T. L. Bogich, P. Daszak, "Host and viral traits predict zoonotic spillover from mammals." Nature 546, 646-650 (2017)', 'https://doi.org/10.1038/nature22975'),
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 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/mammal_virus_hp3/__init__.py b/entries/mammal_virus_hp3/__init__.py
index f772228..ec3b274 100644
--- a/entries/mammal_virus_hp3/__init__.py
+++ b/entries/mammal_virus_hp3/__init__.py
@@ -59,7 +59,6 @@ def _int(x):
 @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: mammal_virus_hp3 by Tiago de Paula Peixoto 9f4e347
diff --git a/entries/mammal_virus_hp3/__init__.py b/entries/mammal_virus_hp3/__init__.py
new file mode 100644
index 0000000..f772228
--- /dev/null
+++ b/entries/mammal_virus_hp3/__init__.py
@@ -0,0 +1,137 @@
+#! /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 = "Mammal-virus associations (2017)"
+description = """Bipartite network of mammal species and the viruses known to infect them, from the database of host-virus associations compiled by Olival et al. (the Host-Pathogen Phylogeny Project, HP3) to study which host and viral traits predict zoonotic spillover. The associations were collected from a systematic review of the published literature, for virus species recognized by the International Committee on Taxonomy of Viruses (ICTV), with host names harmonized to the IUCN taxonomy. The database contains 754 mammal species (including humans) and 586 virus species.
+
+A node is either a mammal species or a virus species, and each edge is a host-virus association reported in a reference, annotated with the method used to detect the virus in the host. A few host-virus pairs are reported in more than one reference with different methods, and appear as parallel edges.
+
+The network has the following properties:
+
+- All nodes: `name`, the species name (with underscores in place of spaces); `is_host`, whether the node is a mammal species (otherwise it is a virus); `order`, `family`, and `genus`, the taxonomic order, family, and genus of the host or virus.
+- Hosts: `common_name`, the English common name(s); `wild_domestic`, whether the species is wild or domestic according to the FAO (or "human"); `marine_terrestrial`, whether the species is marine or terrestrial; `mass_grams`, the average body mass in grams (NaN if unknown); `redlist_status`, the IUCN Red List status; `citations`, the number of Zoological Abstracts records for the species, and `disease_citations`, the number of such records that also match disease-related keywords (both are measures of research effort, -1 if unknown).
+- Viruses: `nucleic_acid` (DNA or RNA), `strandedness` (SS or DS), `envelope` (enveloped or non-enveloped), `genome_length`, the average genome length in nucleotides (NaN if unknown), `vector_borne` ("Y", "N", or "NA" if unknown), `is_zoonotic`, whether the virus has been detected both in humans and in other mammals, and `is_zoonotic_stringent`, the same but considering only detections by PCR or virus isolation.
+- Edges: `detection_method`, the method used to detect the virus in the host (e.g. antibodies, PCR, isolation); `detection_quality`, the strength of the evidence: 0 for serology, 1 for a viral neutralization test, and 2 for PCR or virus isolation (-1 if not given); `host_status`, whether the host in the reference was wild, domestic, captive, or human; and `reference`, the short reference (author and year) reporting the association."""
+tags = ['Biological', 'Unweighted', 'Multigraph', 'Metadata']
+url = 'https://github.com/ecohealthalliance/HP3'
+citation = [('K. J. Olival, P. R. Hosseini, C. Zambrana-Torrelio, N. Ross, T. L. Bogich, P. Daszak, "Host and viral traits predict zoonotic spillover from mammals." Nature 546, 646-650 (2017)', 'https://doi.org/10.1038/nature22975'),
+            ('K. J. Olival, P. R. Hosseini, C. Zambrana-Torrelio, N. Ross, T. L. Bogich, P. Daszak, "Host and Viral Traits Predict Zoonotic Spillover from Mammals" (data and code), Zenodo (2017)', 'https://doi.org/10.5281/zenodo.596810')]
+icon_hash = '5d0d268151da6551647736a6'
+upstream_license = ("MIT", "https://github.com/ecohealthalliance/HP3/blob/master/LICENSE")
+upstream_prefix = 'https://raw.githubusercontent.com/ecohealthalliance/HP3/master/data'
+files = [(('associations.csv', 'hosts.csv', 'viruses.csv'), None, None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+def _float(x):
+    try:
+        return float(x)
+    except ValueError:
+        return numpy.nan
+
+def _int(x):
+    try:
+        return int(x)
+    except ValueError:
+        return -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:
+            # The files are encoded in Mac OS Roman
+            fs = [stack.enter_context(open_upstream_file(name, fn, "r",
+                                                         encoding="mac_roman"))
+                  for fn in fnames]
+            assoc, hosts, viruses = [list(csv.DictReader(f)) for f in fs]
+
+        g = Graph(directed=False)
+        vp = {k: g.new_vp(t) for k, t in
+              [("name", "string"), ("is_host", "bool"), ("order", "string"),
+               ("family", "string"), ("genus", "string"),
+               ("common_name", "string"), ("wild_domestic", "string"),
+               ("marine_terrestrial", "string"), ("mass_grams", "double"),
+               ("redlist_status", "string"), ("citations", "int"),
+               ("disease_citations", "int"), ("nucleic_acid", "string"),
+               ("strandedness", "string"), ("envelope", "string"),
+               ("genome_length", "double"), ("vector_borne", "string"),
+               ("is_zoonotic", "bool"), ("is_zoonotic_stringent", "bool")]}
+
+        def na(x):
+            return "" if x == "NA" else x
+
+        vs = {}
+        g.add_vertex(len(hosts) + len(viruses))
+        for v, h in enumerate(hosts):
+            vs[("h", h["hHostNameFinal"])] = v
+            vp["name"][v] = h["hHostNameFinal"]
+            vp["is_host"][v] = True
+            vp["order"][v] = na(h["hOrder"])
+            vp["family"][v] = na(h["hFamily"])
+            vp["genus"][v] = na(h["hGenus"])
+            vp["common_name"][v] = na(h["Common_names_Eng"])
+            vp["wild_domestic"][v] = na(h["hWildDomFAO"])
+            vp["marine_terrestrial"][v] = na(h["hMarOTerr"])
+            vp["mass_grams"][v] = _float(h["hMassGrams"])
+            vp["redlist_status"][v] = na(h["RedList_status"])
+            vp["citations"][v] = _int(h["hAllZACites"])
+            vp["disease_citations"][v] = _int(h["hDiseaseZACites"])
+            vp["genome_length"][v] = numpy.nan
+        for i, x in enumerate(viruses):
+            v = len(hosts) + i
+            vs[("v", x["vVirusNameCorrected"])] = v
+            vp["name"][v] = x["vVirusNameCorrected"]
+            vp["order"][v] = na(x["vOrder"])
+            vp["family"][v] = na(x["vFamily"])
+            vp["genus"][v] = na(x["vGenus"])
+            vp["nucleic_acid"][v] = na(x["vDNAoRNA"])
+            vp["strandedness"][v] = na(x["vSSoDS"])
+            vp["envelope"][v] = na(x["vEnvelope"])
+            vp["genome_length"][v] = _float(x["vGenomeAveLength"])
+            vp["vector_borne"][v] = x["vVectorYNna"]
+            vp["is_zoonotic"][v] = x["IsZoonotic"] == "1"
+            vp["is_zoonotic_stringent"][v] = x["IsZoonotic.stringent"] == "1"
+            vp["mass_grams"][v] = numpy.nan
+            vp["citations"][v] = -1
+            vp["disease_citations"][v] = -1
+        for k, p in vp.items():
+            g.vp[k] = p
+
+        g.ep.detection_method = g.new_ep("string")
+        g.ep.detection_quality = g.new_ep("int")
+        g.ep.host_status = g.new_ep("string")
+        g.ep.reference = g.new_ep("string")
+        for a in assoc:
+            e = g.add_edge(vs[("h", a["hHostNameFinal"])],
+                           vs[("v", a["vVirusNameCorrected"])])
+            g.ep.detection_method[e] = na(a["DetectionMethod"])
+            g.ep.detection_quality[e] = _int(a["DetectionQuality"])
+            g.ep.host_status[e] = na(a["WildDomInReference"])
+            g.ep.reference[e] = a["Reference"]
+        yield alt, g