History of plant_fungus_japan
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/plant_fungus_japan/__init__.py b/entries/plant_fungus_japan/__init__.py
index f4fedcb..7a307e8 100644
--- a/entries/plant_fungus_japan/__init__.py
+++ b/entries/plant_fungus_japan/__init__.py
@@ -39,7 +39,7 @@ The networks have the following properties:
tags = ['Biological', 'Weighted', 'Metadata']
url = 'https://doi.org/10.1186/s40168-018-0497-1'
citation = [('H. Toju, H. Tanabe, H. S. Ishii, "Network hubs in root-associated fungal metacommunities." Microbiome 6, 116 (2018)', 'https://doi.org/10.1186/s40168-018-0497-1')]
-icon_hash = '5d0d428351da6551647736aa'
+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://static-content.springer.com/esm/art%3A10.1186%2Fs40168-018-0497-1/MediaObjects'
# Data S3 (species-level matrices) and Data S4 (OTU information)
[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/plant_fungus_japan/__init__.py b/entries/plant_fungus_japan/__init__.py
index 4a0a1a5..f4fedcb 100644
--- a/entries/plant_fungus_japan/__init__.py
+++ b/entries/plant_fungus_japan/__init__.py
@@ -28,10 +28,14 @@ description = """Bipartite networks of associations between plants and root-asso
The networks have the following properties:
-- Nodes: `name`, the plant species/taxon (e.g. "Acer", "Poaceae_1"; in `metacommunity` with the code of the forest appended, e.g. "Acer_TES") or the OTU identifier (e.g. "F_0001"); `is_fungus`, whether the node is a fungal OTU (otherwise a plant).
-- Plant nodes in `metacommunity`: `site`, the code of the forest.
-- Fungal nodes: `otu_code`, the sequence identifier of the OTU; `phylum`, `class`, `order`, `family`, `genus` and `species`, the taxonomic assignment (empty if not resolved at that level); `guild` and `trophic_mode`, the functional guild and trophic mode inferred with FUNGuild (empty if not assigned); `category`, the functional category used in the paper (e.g. "Arbuscular_Mycorrhizal", "Ectomycorrhizal", "Saprotroph", "Plant_Pathogen", "Others_Unknown").
-- Edges: `weight`, the number of root samples in which the association was observed."""
+- (Node) `name`: the plant species/taxon (e.g. "Acer", "Poaceae_1"; in `metacommunity` with the code of the forest appended, e.g. "Acer_TES") or the OTU identifier (e.g. "F_0001").
+- (Node) `is_fungus`: whether the node is a fungal OTU (otherwise a plant).
+- (Node) `site` (plants, in `metacommunity`): the code of the forest.
+- (Node) `otu_code` (fungi): the sequence identifier of the OTU.
+- (Node) `phylum`, `class`, `order`, `family`, `genus`, `species` (fungi): the taxonomic assignment (empty if not resolved at that level).
+- (Node) `guild`, `trophic_mode` (fungi): the functional guild and trophic mode inferred with FUNGuild (empty if not assigned).
+- (Node) `category` (fungi): the functional category used in the paper (e.g. "Arbuscular_Mycorrhizal", "Ectomycorrhizal", "Saprotroph", "Plant_Pathogen", "Others_Unknown").
+- (Edge) `weight`: the number of root samples in which the association was observed."""
tags = ['Biological', 'Weighted', 'Metadata']
url = 'https://doi.org/10.1186/s40168-018-0497-1'
citation = [('H. Toju, H. Tanabe, H. S. Ishii, "Network hubs in root-associated fungal metacommunities." Microbiome 6, 116 (2018)', 'https://doi.org/10.1186/s40168-018-0497-1')]
[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/plant_fungus_japan/__init__.py b/entries/plant_fungus_japan/__init__.py
index 9842cec..4a0a1a5 100644
--- a/entries/plant_fungus_japan/__init__.py
+++ b/entries/plant_fungus_japan/__init__.py
@@ -50,7 +50,6 @@ def fetch_upstream(force=False):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
# All networks come from the same two workbooks, which are read once
fnames = files[0][0]
[entries] New entry: plant_fungus_japan ee1efa0
diff --git a/entries/plant_fungus_japan/__init__.py b/entries/plant_fungus_japan/__init__.py
new file mode 100644
index 0000000..9842cec
--- /dev/null
+++ b/entries/plant_fungus_japan/__init__.py
@@ -0,0 +1,108 @@
+#! /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 *
+from openpyxl import load_workbook
+import io
+
+title = "Japanese plant-root fungal associations (2018)"
+description = """Bipartite networks of associations between plants and root-associated fungi in eight forests across the Japanese Archipelago (four cool-temperate, one warm-temperate and three subtropical forests, from 45.0 to 24.4 °N), from Toju et al. In each forest, 2 cm segments of terminal roots were sampled at 1 m intervals (240 samples per forest), irrespective of their morphology or mycorrhizal type. The plant of each sample was identified by DNA barcoding (rbcL and ITS1 regions; not all could be identified to species level), and its fungi by Illumina sequencing of the fungal ITS1 region, with reads clustered into operational taxonomic units (OTUs) at 97% sequence similarity (94% for Glomeromycota), with taxonomic assignment based on the NCBI nt database and functional groups inferred with FUNGuild. Associations that represented less than 0.1% of the reads of a sample were removed. The data include arbuscular mycorrhizal, ectomycorrhizal, endophytic, saprotrophic and pathogenic fungi, among others. In each network, an edge connects a plant to a fungal OTU found in its root samples, weighted by the number of root samples in which the association was observed.
+
+- `metacommunity`: the metacommunity-scale network of all eight forests, in which each plant node is a local population of a plant species/taxon in one forest (227 populations of 150 plant species/taxa) and each fungal node an OTU (8080 OTUs). The paper also analyzes the networks of the four northern (cool-temperate) and four southern forests, which are subnetworks of this one.
+- `site1` to `site8`: the local networks of each forest, with plant species/taxa and fungal OTUs as nodes. Sites 1 to 4 are cool-temperate forests (codes TES, TOMA, YKS and SGD), site 5 a warm-temperate forest (YSD), and sites 6 to 8 subtropical forests (YAKU, YONA and IRI).
+
+The networks have the following properties:
+
+- Nodes: `name`, the plant species/taxon (e.g. "Acer", "Poaceae_1"; in `metacommunity` with the code of the forest appended, e.g. "Acer_TES") or the OTU identifier (e.g. "F_0001"); `is_fungus`, whether the node is a fungal OTU (otherwise a plant).
+- Plant nodes in `metacommunity`: `site`, the code of the forest.
+- Fungal nodes: `otu_code`, the sequence identifier of the OTU; `phylum`, `class`, `order`, `family`, `genus` and `species`, the taxonomic assignment (empty if not resolved at that level); `guild` and `trophic_mode`, the functional guild and trophic mode inferred with FUNGuild (empty if not assigned); `category`, the functional category used in the paper (e.g. "Arbuscular_Mycorrhizal", "Ectomycorrhizal", "Saprotroph", "Plant_Pathogen", "Others_Unknown").
+- Edges: `weight`, the number of root samples in which the association was observed."""
+tags = ['Biological', 'Weighted', 'Metadata']
+url = 'https://doi.org/10.1186/s40168-018-0497-1'
+citation = [('H. Toju, H. Tanabe, H. S. Ishii, "Network hubs in root-associated fungal metacommunities." Microbiome 6, 116 (2018)', 'https://doi.org/10.1186/s40168-018-0497-1')]
+icon_hash = '5d0d428351da6551647736aa'
+upstream_license = ('Creative Commons Attribution 4.0 International (CC BY 4.0)', 'https://creativecommons.org/licenses/by/4.0/')
+upstream_prefix = 'https://static-content.springer.com/esm/art%3A10.1186%2Fs40168-018-0497-1/MediaObjects'
+# Data S3 (species-level matrices) and Data S4 (OTU information)
+files = [(('40168_2018_497_MOESM3_ESM.xlsx', '40168_2018_497_MOESM4_ESM.xlsx'),
+ alt, None) for alt in ['metacommunity'] + [f'site{i}' for i in range(1, 9)]]
+
+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]
+ # All networks come from the same two workbooks, which are read once
+ fnames = files[0][0]
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
+ wb = load_workbook(io.BytesIO(fs[0].read()), read_only=True)
+ sheets = {}
+ for fn, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ sheet = "Metacommunity.Full" if alt == "metacommunity" else f"Site{alt[4:]}"
+ sheets[alt] = list(wb[sheet].iter_rows(values_only=True))
+ wb = load_workbook(io.BytesIO(fs[1].read()), read_only=True)
+ info = list(wb["OTU.Info"].iter_rows(values_only=True))
+ for alt, rows in sheets.items():
+ # Plant (rows) x OTU code (columns) matrix
+ otus = rows[0][1:]
+ plants = [r[0] for r in rows[1:] if r[0] is not None]
+ A = numpy.array([[float(x or 0) for x in r[1:]] for r in rows[1:]
+ if r[0] is not None])
+ hdr = info[0]
+ oinfo = {r[1]: dict(zip(hdr, r)) for r in info[1:]}
+
+ g = Graph(directed=False)
+ P = len(plants)
+ g.add_vertex(P + len(otus))
+ i, j = numpy.nonzero(A)
+ g.ep.weight = g.new_ep("int")
+ g.add_edge_list(numpy.column_stack((i, P + j, A[i, j])),
+ eprops=[g.ep.weight])
+ g.vp.name = g.new_vp("string")
+ g.vp.is_fungus = g.new_vp("bool")
+ g.vp.is_fungus.a[P:] = True
+ if alt == "metacommunity":
+ g.vp.site = g.new_vp("string")
+ for k, p in enumerate(plants):
+ g.vp.name[k] = p
+ if alt == "metacommunity":
+ g.vp.site[k] = p.rsplit("_", 1)[1]
+ fields = [("otu_code", "OTU.code"), ("phylum", "phylum"),
+ ("class", "class"), ("order", "order"), ("family", "family"),
+ ("genus", "genus"), ("species", "species"),
+ ("guild", "Guild"), ("trophic_mode", "Trophic_Mode"),
+ ("category", "Category.In.This.Study")]
+ for pname, _ in fields:
+ g.vp[pname] = g.new_vp("string")
+ for k, o in enumerate(otus):
+ v = g.vertex(P + k)
+ r = oinfo[o]
+ g.vp.name[v] = r["OTU"]
+ for pname, col in fields:
+ # Unresolved values are given as 0 or "-"
+ x = r[col]
+ g.vp[pname][v] = "" if x in (0, "0", "-", None) else str(x)
+ yield alt, g