History of sanak_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 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/sanak_food_webs/__init__.py b/entries/sanak_food_webs/__init__.py
index dbefc30..4d043a8 100644
--- a/entries/sanak_food_webs/__init__.py
+++ b/entries/sanak_food_webs/__init__.py
@@ -32,7 +32,7 @@ A directed edge goes from a consumer (predator) to its resource (prey). Self-loo
tags = ['Biological', 'Food web', 'Unweighted', 'Metadata']
url = 'https://www.nature.com/articles/srep21179'
citation = [('J. A. Dunne, H. Maschner, M. W. Betts, N. Huntly, R. Russell, R. J. Williams, S. A. Wood, "The roles and impacts of human hunter-gatherers in North Pacific marine food webs." Scientific Reports 6, 21179 (2016)', 'https://doi.org/10.1038/srep21179')]
-icon_hash = '59233fe762da63251188ee90'
+date_added = '2026-10-25'
upstream_license = ("CC BY 4.0", "https://creativecommons.org/licenses/by/4.0/")
upstream_prefix = 'https://media.springernature.com/original/springer-static/esm/art%3A10.1038%2Fsrep21179/MediaObjects'
files = [('41598_2016_BFsrep21179_MOESM98_ESM.xls', 'intertidal', 0),
[entries] sanak_food_webs, bitcoin_transactions: show the placeholders in angle brackets as code 14b2f04
"san<number>" and "nonstandard<hash of the script>" were rendered as HTML tags, and hidden by the browser.
diff --git a/entries/sanak_food_webs/__init__.py b/entries/sanak_food_webs/__init__.py
index 5ef47da..dbefc30 100644
--- a/entries/sanak_food_webs/__init__.py
+++ b/entries/sanak_food_webs/__init__.py
@@ -28,7 +28,7 @@ description = """Two highly resolved food webs of the Sanak Archipelago, in the
- `intertidal`: the Sanak intertidal food web.
- `nearshore`: the Sanak nearshore marine food web.
-A directed edge goes from a consumer (predator) to its resource (prey). Self-loops denote cannibalism. Node properties: `name`, the scientific name of the taxon (or a descriptive name for groups such as "Detritus complex"); `tsn`, the Taxonomic Serial Number of the taxon in the Integrated Taxonomic Information System (ITIS), or an identifier of the form "san<number>" for taxa without one; `phylum`, the phylum of the taxon ("NA" for non-living nodes and biofilm). Humans are the node "Homo sapiens". The source lists the phylum of the American dipper (Cinclus mexicanus) as "Mollusca" in the intertidal web (and "Chordata" in the nearshore web); it is kept as given."""
+A directed edge goes from a consumer (predator) to its resource (prey). Self-loops denote cannibalism. Node properties: `name`, the scientific name of the taxon (or a descriptive name for groups such as "Detritus complex"); `tsn`, the Taxonomic Serial Number of the taxon in the Integrated Taxonomic Information System (ITIS), or an identifier of the form `san<number>` for taxa without one; `phylum`, the phylum of the taxon ("NA" for non-living nodes and biofilm). Humans are the node "Homo sapiens". The source lists the phylum of the American dipper (Cinclus mexicanus) as "Mollusca" in the intertidal web (and "Chordata" in the nearshore web); it is kept as given."""
tags = ['Biological', 'Food web', 'Unweighted', 'Metadata']
url = 'https://www.nature.com/articles/srep21179'
citation = [('J. A. Dunne, H. Maschner, M. W. Betts, N. Huntly, R. Russell, R. J. Williams, S. A. Wood, "The roles and impacts of human hunter-gatherers in North Pacific marine food webs." Scientific Reports 6, 21179 (2016)', 'https://doi.org/10.1038/srep21179')]
@@ -46,7 +46,6 @@ def fetch_upstream(force=False):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fname, alt, web in files:
if alts is not None and alt not in alts:
[entries] New entry: sanak_food_webs be21756
diff --git a/entries/sanak_food_webs/__init__.py b/entries/sanak_food_webs/__init__.py
new file mode 100644
index 0000000..5ef47da
--- /dev/null
+++ b/entries/sanak_food_webs/__init__.py
@@ -0,0 +1,89 @@
+#! /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 openpyxl import load_workbook
+import shutil
+import subprocess
+import tempfile
+from .. import *
+
+title = "Sanak Archipelago food webs with humans (2016)"
+description = """Two highly resolved food webs of the Sanak Archipelago, in the western Gulf of Alaska (50 km south of the tip of the Alaska Peninsula), which include humans as the hunter-gatherer Aleut (Unangan) top predator. The intertidal web covers the benthic habitat up to the terrestrial vegetation exposed at low tide and the pelagic habitat above it at high tide, and the taxa were compiled from quadrats, sediment cores and visual searches over three years across the archipelago. The nearshore marine web covers the marine habitat within 80 km of the archipelago, with taxa from shallow-water observations and published occurrence records (mostly from GBIF and OBIS). Several ubiquitous microscopic taxa (e.g. bacteria, ciliates, dinoflagellates, foraminifera) were assumed to be present in both webs, and birds were included in one or both webs according to their foraging. The feeding links were observed in the field or compiled from 1,532 publications, reports and databases (from observations, gut or scat contents, and expert opinion); the human feeding links come from the zooarchaeology of Sanak Island middens, ethnographic data, and interviews with modern Unangan. Taxa were resolved as finely as possible, and lumped into coarser taxonomic groups (e.g. genus or family) when the information was incomplete. The webs are cumulative, describing the feeding relationships of taxa that lived or fed in those habitats since the human settlement of the archipelago, about 7,000 years ago.
+
+- `intertidal`: the Sanak intertidal food web.
+- `nearshore`: the Sanak nearshore marine food web.
+
+A directed edge goes from a consumer (predator) to its resource (prey). Self-loops denote cannibalism. Node properties: `name`, the scientific name of the taxon (or a descriptive name for groups such as "Detritus complex"); `tsn`, the Taxonomic Serial Number of the taxon in the Integrated Taxonomic Information System (ITIS), or an identifier of the form "san<number>" for taxa without one; `phylum`, the phylum of the taxon ("NA" for non-living nodes and biofilm). Humans are the node "Homo sapiens". The source lists the phylum of the American dipper (Cinclus mexicanus) as "Mollusca" in the intertidal web (and "Chordata" in the nearshore web); it is kept as given."""
+tags = ['Biological', 'Food web', 'Unweighted', 'Metadata']
+url = 'https://www.nature.com/articles/srep21179'
+citation = [('J. A. Dunne, H. Maschner, M. W. Betts, N. Huntly, R. Russell, R. J. Williams, S. A. Wood, "The roles and impacts of human hunter-gatherers in North Pacific marine food webs." Scientific Reports 6, 21179 (2016)', 'https://doi.org/10.1038/srep21179')]
+icon_hash = '59233fe762da63251188ee90'
+upstream_license = ("CC BY 4.0", "https://creativecommons.org/licenses/by/4.0/")
+upstream_prefix = 'https://media.springernature.com/original/springer-static/esm/art%3A10.1038%2Fsrep21179/MediaObjects'
+files = [('41598_2016_BFsrep21179_MOESM98_ESM.xls', 'intertidal', 0),
+ ('41598_2016_BFsrep21179_MOESM98_ESM.xls', 'nearshore', 1)]
+
+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, web in files:
+ if alts is not None and alt not in alts:
+ continue
+
+ with open_upstream_file(name, fname, "rb") as f:
+ with tempfile.TemporaryDirectory(dir="./cache/temp", suffix=name) as tdir:
+ with open(f"{tdir}/dump.xls", "wb") as fw:
+ shutil.copyfileobj(f, fw)
+ subprocess.run(["localc", "--headless", "--convert-to", "xlsx",
+ "dump.xls"], cwd=tdir, check=True,
+ stdout=subprocess.DEVNULL)
+ wb = load_workbook(f"{tdir}/dump.xlsx", read_only=True)
+ taxa = list(wb["Taxa Lists"].iter_rows(values_only=True))
+ links = list(wb["Trophic Links"].iter_rows(values_only=True))
+ wb.close()
+
+ # The two webs are side by side in each sheet, the intertidal one
+ # first, separated by an empty column; the first two rows are
+ # headers.
+ toff = 5 * web
+ loff = 3 * web
+ g = Graph(directed=True)
+ g.vp.name = g.new_vp("string")
+ g.vp.tsn = g.new_vp("string")
+ g.vp.phylum = g.new_vp("string")
+ idx = {}
+ for r in taxa[2:]:
+ if r[toff] is None:
+ continue
+ v = g.add_vertex()
+ idx[int(r[toff])] = int(v)
+ g.vp.tsn[v] = str(r[toff + 1])
+ g.vp.name[v] = str(r[toff + 2]).strip()
+ g.vp.phylum[v] = str(r[toff + 3]).strip()
+
+ edges = [(idx[int(r[loff])], idx[int(r[loff + 1])]) for r in links[2:]
+ if r[loff] is not None]
+ g.add_edge_list(edges)
+ yield alt, g