logo Netzschleuder network catalog, repository, and centrifuge

History of gateway_foodwebs

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/gateway_foodwebs/__init__.py b/entries/gateway_foodwebs/__init__.py
index c082a0b..cba8d49 100644
--- a/entries/gateway_foodwebs/__init__.py
+++ b/entries/gateway_foodwebs/__init__.py
@@ -46,7 +46,7 @@ tags = ['Biological', 'Food web', 'Unweighted', 'Metadata', 'Multigraph']
 url = 'https://doi.org/10.25829/idiv.283-3-756'
 citation = [('U. Brose et al., "Predator traits determine food-web architecture across ecosystems." Nature Ecology & Evolution 3(6), 919-927 (2019)', 'https://doi.org/10.1038/s41559-019-0899-x'),
             ('U. Brose, "GlobAL daTabasE of traits and food Web Architecture (GATEWAy) version 1.0." iDiv Data Repository, dataset (2018)', 'https://doi.org/10.25829/idiv.283-3-756')]
-icon_hash = '5ce4597a51da655164737213'
+date_added = '2026-10-25'
 upstream_license = ('Creative Commons Attribution 4.0 International (CC BY 4.0)', 'https://creativecommons.org/licenses/by/4.0/')
 upstream_prefix = None
 files = [('idiv_283_v756.zip:283_2_FoodWebDataBase_2018_12_10.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/gateway_foodwebs/__init__.py b/entries/gateway_foodwebs/__init__.py
index d04cd24..c082a0b 100644
--- a/entries/gateway_foodwebs/__init__.py
+++ b/entries/gateway_foodwebs/__init__.py
@@ -25,8 +25,23 @@ description = """The GlobAL daTabasE of traits and food Web Architecture (GATEWA
 
 The network has the following properties:
 
-- Nodes: `name`, the taxon, at the highest available taxonomic resolution; `taxonomy_level`, the taxonomic level of the name (e.g. "species", "genus", "family"); `common_name`, its common name; `lifestage`, the life stage (e.g. "adults", "juveniles", "larvae"); `metabolic_type` ("invertebrate", "ectotherm vertebrate", "endotherm vertebrate", "primary producer", "heterotrophic bacteria", "heterotrophic fungi"); `movement_type` ("walking", "swimming", "flying", "sessile", "other"); `mass_mean`, `mass_min` and `mass_max`, the mean, minimum and maximum body mass in grams of the population involved in the interactions; `length_mean`, `length_min` and `length_max`, the corresponding body lengths in cm (missing values are NaN; for a few nodes, the values differ between interactions, and the first is used); `foodweb`, the name of the food web; `ecosystem_type` ("marine", "lakes", "streams", "terrestrial aboveground", "terrestrial belowground"); `location`, the geographic location of the food web; `latitude` and `longitude`, its coordinates. Missing string values (given as "NA" in the source) are empty.
-- Edges: `interaction_type`, the type of interaction ("predacious", "herbivorous", "detritivorous", "fungivorous", "parasitoid", "parasitic", "bacterivorous", "pathogen"); `dimensionality`, whether the search space of the consumer is two- or three-dimensional ("2D" or "3D"); `classification`, whether the interaction is individual-based ("ibi") or non-individual-based ("nibi") intake and attack; `methodology`, how the link was established; `citation`, the source of the link."""
+- (Node) `name`: the taxon, at the highest available taxonomic resolution.
+- (Node) `taxonomy_level`: the taxonomic level of the name (e.g. "species", "genus", "family").
+- (Node) `common_name`: its common name.
+- (Node) `lifestage`: the life stage (e.g. "adults", "juveniles", "larvae").
+- (Node) `metabolic_type` ("invertebrate", "ectotherm vertebrate", "endotherm vertebrate", "primary producer", "heterotrophic bacteria", "heterotrophic fungi").
+- (Node) `movement_type` ("walking", "swimming", "flying", "sessile", "other").
+- (Node) `mass_mean`, `mass_min` and `mass_max`: the mean, minimum and maximum body mass in grams of the population involved in the interactions.
+- (Node) `length_mean`, `length_min` and `length_max`: the corresponding body lengths in cm (missing values are NaN; for a few nodes, the values differ between interactions, and the first is used).
+- (Node) `foodweb`: the name of the food web.
+- (Node) `ecosystem_type` ("marine", "lakes", "streams", "terrestrial aboveground", "terrestrial belowground").
+- (Node) `location`: the geographic location of the food web.
+- (Node) `latitude` and `longitude`: its coordinates. Missing string values (given as "NA" in the source) are empty.
+- (Edge) `interaction_type`: the type of interaction ("predacious", "herbivorous", "detritivorous", "fungivorous", "parasitoid", "parasitic", "bacterivorous", "pathogen").
+- (Edge) `dimensionality`: whether the search space of the consumer is two- or three-dimensional ("2D" or "3D").
+- (Edge) `classification`: whether the interaction is individual-based ("ibi") or non-individual-based ("nibi") intake and attack.
+- (Edge) `methodology`: how the link was established.
+- (Edge) `citation`: the source of the link."""
 tags = ['Biological', 'Food web', 'Unweighted', 'Metadata', 'Multigraph']
 url = 'https://doi.org/10.25829/idiv.283-3-756'
 citation = [('U. Brose et al., "Predator traits determine food-web architecture across ecosystems." Nature Ecology & Evolution 3(6), 919-927 (2019)', 'https://doi.org/10.1038/s41559-019-0899-x'),
[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/gateway_foodwebs/__init__.py b/entries/gateway_foodwebs/__init__.py
index 44063ff..d04cd24 100644
--- a/entries/gateway_foodwebs/__init__.py
+++ b/entries/gateway_foodwebs/__init__.py
@@ -69,7 +69,6 @@ def _str(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: gateway_foodwebs by Tiago de Paula Peixoto 6365b34
diff --git a/entries/gateway_foodwebs/__init__.py b/entries/gateway_foodwebs/__init__.py
new file mode 100644
index 0000000..44063ff
--- /dev/null
+++ b/entries/gateway_foodwebs/__init__.py
@@ -0,0 +1,125 @@
+#! /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 *
+import io
+
+title = "GATEWAy global food web database (2018)"
+description = """The GlobAL daTabasE of traits and food Web Architecture (GATEWAy, version 1.0), compiled by Brose et al., which contains 290 food webs from freshwater (lakes and streams), marine and terrestrial (aboveground and belowground) ecosystems on all continents, with 222,151 feeding interactions between consumers and resources, annotated with their body masses, metabolic and movement types. The food webs were assembled from published studies (23 sources) and were established by various methods (published accounts, expert knowledge, direct field observation, gut content analysis, extrapolation from similar taxa, etc.). Here, all food webs are combined into a single network, in which each node is a taxon at a given life stage in a given food web, so that the food webs are disjoint components (a taxon that appears in more than one food web corresponds to more than one node). A directed edge goes from a consumer to its resource. A few interactions (432) are listed more than once within a food web, and are kept as parallel edges. Some of the food webs are also available separately: the Carpinteria Salt Marsh web of Lafferty et al. (2006) is the network `food_web_lafferty` of the entry `iwdb` (later versions, resolved by life stage or aggregated by species, are in `california_estuaries` and `coastal_parasite_webs`), and the ten New Zealand stream webs of Townsend et al. (1998) match the corresponding `food_web_thompson_*` networks of `iwdb` (which have no taxon names), with the same or nearly the same number of links.
+
+The network has the following properties:
+
+- Nodes: `name`, the taxon, at the highest available taxonomic resolution; `taxonomy_level`, the taxonomic level of the name (e.g. "species", "genus", "family"); `common_name`, its common name; `lifestage`, the life stage (e.g. "adults", "juveniles", "larvae"); `metabolic_type` ("invertebrate", "ectotherm vertebrate", "endotherm vertebrate", "primary producer", "heterotrophic bacteria", "heterotrophic fungi"); `movement_type` ("walking", "swimming", "flying", "sessile", "other"); `mass_mean`, `mass_min` and `mass_max`, the mean, minimum and maximum body mass in grams of the population involved in the interactions; `length_mean`, `length_min` and `length_max`, the corresponding body lengths in cm (missing values are NaN; for a few nodes, the values differ between interactions, and the first is used); `foodweb`, the name of the food web; `ecosystem_type` ("marine", "lakes", "streams", "terrestrial aboveground", "terrestrial belowground"); `location`, the geographic location of the food web; `latitude` and `longitude`, its coordinates. Missing string values (given as "NA" in the source) are empty.
+- Edges: `interaction_type`, the type of interaction ("predacious", "herbivorous", "detritivorous", "fungivorous", "parasitoid", "parasitic", "bacterivorous", "pathogen"); `dimensionality`, whether the search space of the consumer is two- or three-dimensional ("2D" or "3D"); `classification`, whether the interaction is individual-based ("ibi") or non-individual-based ("nibi") intake and attack; `methodology`, how the link was established; `citation`, the source of the link."""
+tags = ['Biological', 'Food web', 'Unweighted', 'Metadata', 'Multigraph']
+url = 'https://doi.org/10.25829/idiv.283-3-756'
+citation = [('U. Brose et al., "Predator traits determine food-web architecture across ecosystems." Nature Ecology & Evolution 3(6), 919-927 (2019)', 'https://doi.org/10.1038/s41559-019-0899-x'),
+            ('U. Brose, "GlobAL daTabasE of traits and food Web Architecture (GATEWAy) version 1.0." iDiv Data Repository, dataset (2018)', 'https://doi.org/10.25829/idiv.283-3-756')]
+icon_hash = '5ce4597a51da655164737213'
+upstream_license = ('Creative Commons Attribution 4.0 International (CC BY 4.0)', 'https://creativecommons.org/licenses/by/4.0/')
+upstream_prefix = None
+files = [('idiv_283_v756.zip:283_2_FoodWebDataBase_2018_12_10.csv', None, None)]
+archive_url = 'https://idata.idiv.de/ddm/Data/DownloadZip/283?version=756'
+
+def fetch_upstream(force=False):
+    # The download URL carries a query string, so it is fetched here directly
+    name = __name__.split(".")[-1]
+    fname = "idiv_283_v756.zip"
+    if not force:
+        try:
+            with open_upstream_file(name, fname, "rb"):
+                return
+        except (FileNotFoundError, IOError):
+            pass
+    with open_url(archive_url) as f:
+        data = f.read()
+    if not data.startswith(b"PK"):
+        raise RuntimeError(f"unexpected content for {fname}")
+    with open_upstream_file(name, fname, "wb") as output:
+        output.write(data)
+
+def _float(x):
+    try:
+        x = float(x)
+    except ValueError:
+        return numpy.nan
+    return numpy.nan if x == -999 else x
+
+def _str(x):
+    x = x.strip()
+    return "" if x == "NA" else x
+
+@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 open_upstream_file(name, fnames, "rb") as f:
+            rows = list(csv.DictReader(io.TextIOWrapper(f, "utf-8-sig")))
+        g = Graph(directed=True)
+        vprops = [("name", "string"), ("taxonomy_level", "string"),
+                  ("common_name", "string"), ("lifestage", "string"),
+                  ("metabolic_type", "string"), ("movement_type", "string"),
+                  ("mass_mean", "double"), ("mass_min", "double"),
+                  ("mass_max", "double"), ("length_mean", "double"),
+                  ("length_min", "double"), ("length_max", "double"),
+                  ("foodweb", "string"), ("ecosystem_type", "string"),
+                  ("location", "string"), ("latitude", "double"),
+                  ("longitude", "double")]
+        for p, t in vprops:
+            g.vp[p] = g.new_vp(t)
+        eprops = [("interaction_type", "interaction.type"),
+                  ("dimensionality", "interaction.dimensionality"),
+                  ("classification", "interaction.classification"),
+                  ("methodology", "link.methodology"),
+                  ("citation", "link.citation")]
+        for p, c in eprops:
+            g.ep[p] = g.new_ep("string")
+        vs = {}
+        def get_v(r, pre):
+            key = (r["foodweb.name"], r[pre + "taxonomy"], r[pre + "lifestage"])
+            v = vs.get(key)
+            if v is not None:
+                return v
+            v = vs[key] = g.add_vertex()
+            g.vp.name[v] = _str(r[pre + "taxonomy"])
+            g.vp.taxonomy_level[v] = _str(r[pre + "taxonomy.level"]).lower()
+            g.vp.common_name[v] = _str(r[pre + "common"])
+            g.vp.lifestage[v] = _str(r[pre + "lifestage"])
+            g.vp.metabolic_type[v] = _str(r[pre + "metabolic.type"])
+            g.vp.movement_type[v] = _str(r[pre + "movement.type"])
+            for q in ["mass", "length"]:
+                unit = "g" if q == "mass" else "cm"
+                for s in ["mean", "min", "max"]:
+                    g.vp[f"{q}_{s}"][v] = _float(r[f"{pre}{q}.{s}.{unit}."])
+            g.vp.foodweb[v] = r["foodweb.name"]
+            g.vp.ecosystem_type[v] = _str(r["ecosystem.type"])
+            g.vp.location[v] = _str(r["geographic.location"])
+            g.vp.latitude[v] = _float(r["latitude"])
+            g.vp.longitude[v] = _float(r["longitude"])
+            return v
+        for r in rows:
+            e = g.add_edge(get_v(r, "con."), get_v(r, "res."))
+            for p, c in eprops:
+                g.ep[p][e] = _str(r[c])
+        yield alt, g