logo Netzschleuder network catalog, repository, and centrifuge

History of cambrian_food_webs

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/cambrian_food_webs/__init__.py b/entries/cambrian_food_webs/__init__.py
index 1ab8ae1..4dd9e72 100644
--- a/entries/cambrian_food_webs/__init__.py
+++ b/entries/cambrian_food_webs/__init__.py
@@ -37,7 +37,7 @@ The networks have the following properties:
 tags = ['Biological', 'Food web', 'Weighted', 'Metadata']
 url = 'https://doi.org/10.1371/journal.pbio.0060102'
 citation = [('J. A. Dunne, R. J. Williams, N. D. Martinez, R. A. Wood, D. H. Erwin, "Compilation and network analyses of Cambrian food webs." PLoS Biology 6(4), e102 (2008)', 'https://doi.org/10.1371/journal.pbio.0060102')]
-icon_hash = '5944a6084ed8f1bb6022a494'
+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 = 'https://journals.plos.org/plosbiology/article/file'
[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/cambrian_food_webs/__init__.py b/entries/cambrian_food_webs/__init__.py
index 24ce134..1ab8ae1 100644
--- a/entries/cambrian_food_webs/__init__.py
+++ b/entries/cambrian_food_webs/__init__.py
@@ -29,8 +29,9 @@ description = """Food webs of two Cambrian fossil assemblages, compiled by J. A.
 
 The networks have the following properties:
 
-- Nodes: `name`, the name of the taxon, as in the source (an asterisk marks species with possible synonymous identifications); `taxon_id`, its number in the master taxa list of the paper (Tables S1 and S2).
-- Edges: `certainty`, the certainty of the feeding link: 1 (possible), 2 (probable) or 3 (certain).[^icon]
+- (Node) `name`: the name of the taxon, as in the source (an asterisk marks species with possible synonymous identifications).
+- (Node) `taxon_id`: its number in the master taxa list of the paper (Tables S1 and S2).
+- (Edge) `certainty`: the certainty of the feeding link: 1 (possible), 2 (probable) or 3 (certain).[^icon].
 
 [^icon]: Description obtained in part from the [ICON](https://icon.colorado.edu) project."""
 tags = ['Biological', 'Food web', 'Weighted', 'Metadata']
[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/cambrian_food_webs/__init__.py b/entries/cambrian_food_webs/__init__.py
index c849654..24ce134 100644
--- a/entries/cambrian_food_webs/__init__.py
+++ b/entries/cambrian_food_webs/__init__.py
@@ -54,7 +54,6 @@ def fetch_upstream(force=False):
 @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:
[entries] New entry: cambrian_food_webs by Tiago de Paula Peixoto 2035946
diff --git a/entries/cambrian_food_webs/__init__.py b/entries/cambrian_food_webs/__init__.py
new file mode 100644
index 0000000..c849654
--- /dev/null
+++ b/entries/cambrian_food_webs/__init__.py
@@ -0,0 +1,87 @@
+#! /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 = "Cambrian food webs (2008)"
+description = """Food webs of two Cambrian fossil assemblages, compiled by J. A. Dunne and collaborators: the Early Cambrian Chengjiang Shale (China, about 520 million years ago) and the Middle Cambrian Burgess Shale (Canada, about 505 million years ago), both known for their exceptional preservation of soft-bodied organisms. Nodes are taxa (mostly species), and a directed edge from a resource to a consumer means that the consumer is inferred to feed on the resource. In addition to the taxa found in the fossil record, five taxa commonly used in modern marine food webs were assumed to be present in both ecosystems: phytoplankton, bacterioplankton, suspended organic matter, benthic detritus, and zooplankton. The feeding links were assigned from the inferred ecology of the taxa (trophic role, position in the habitat), based on evidence such as preserved gut contents (in a few cases) and the morphology of the gut, appendages and mouthparts, and each link was given a certainty level. The networks are the "original-species webs" of the paper:
+
+- `chengjiang`: 85 taxa and 559 links.
+- `burgess`: 142 taxa and 771 links.
+
+(The paper also analyses versions of these webs in which taxa with identical consumers and resources are aggregated into "trophic species".)
+
+The networks have the following properties:
+
+- Nodes: `name`, the name of the taxon, as in the source (an asterisk marks species with possible synonymous identifications); `taxon_id`, its number in the master taxa list of the paper (Tables S1 and S2).
+- Edges: `certainty`, the certainty of the feeding link: 1 (possible), 2 (probable) or 3 (certain).[^icon]
+
+[^icon]: Description obtained in part from the [ICON](https://icon.colorado.edu) project."""
+tags = ['Biological', 'Food web', 'Weighted', 'Metadata']
+url = 'https://doi.org/10.1371/journal.pbio.0060102'
+citation = [('J. A. Dunne, R. J. Williams, N. D. Martinez, R. A. Wood, D. H. Erwin, "Compilation and network analyses of Cambrian food webs." PLoS Biology 6(4), e102 (2008)', 'https://doi.org/10.1371/journal.pbio.0060102')]
+icon_hash = '5944a6084ed8f1bb6022a494'
+upstream_license = ("Creative Commons Attribution 4.0 International (CC BY 4.0)",
+                    "https://creativecommons.org/licenses/by/4.0/")
+upstream_prefix = 'https://journals.plos.org/plosbiology/article/file'
+files = [('st006.doc', 'chengjiang', None),
+         ('st007.doc', 'burgess', None)]
+# The supplementary files are served from URLs with a query string
+archived_urls = {f: f'{upstream_prefix}?type=supplementary&id=10.1371/journal.pbio.0060102.{f[:-4]}'
+                 for f, alt, fmt in files}
+
+def fetch_upstream(force=False):
+    return fetch_archived_files(__name__.split(".")[-1], archived_urls, force,
+                                tries=3)
+
+@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, "rb") as f:
+            rows = read_doc(f)[0]
+        if rows[0][0] != "Con. #":
+            raise ValueError(f"unexpected table header in {fname}: {rows[0]}")
+        taxa = {}
+        edges = []
+        consumer = None
+        for r in rows[1:]:
+            if not any(r):
+                continue
+            if r[0]:
+                consumer = int(r[0])
+                taxa.setdefault(consumer, r[1])
+            if len(r) > 2 and r[2]:
+                resource = int(r[2])
+                edges.append((resource, consumer, int(r[4])))
+        ids = sorted(taxa)
+        idx = {t: i for i, t in enumerate(ids)}
+        g = Graph(directed=True)
+        g.add_vertex(len(ids))
+        g.vp.name = g.new_vp("string", vals=[taxa[t] for t in ids])
+        g.vp.taxon_id = g.new_vp("int", vals=ids)
+        g.ep.certainty = g.new_ep("int")
+        g.add_edge_list([(idx[a], idx[b], c) for a, b, c in edges],
+                        eprops=[g.ep.certainty])
+        yield alt, g