History of mouse_mesoscale
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/mouse_mesoscale/__init__.py b/entries/mouse_mesoscale/__init__.py
index d54871e..e564e15 100644
--- a/entries/mouse_mesoscale/__init__.py
+++ b/entries/mouse_mesoscale/__init__.py
@@ -42,7 +42,7 @@ The networks have the following properties:
tags = ['Biological', 'Connectome', 'Weighted', 'Metadata']
url = 'https://doi.org/10.1038/nature13186'
citation = [('S. W. Oh et al., "A mesoscale connectome of the mouse brain." Nature 508, 207-214 (2014)', 'https://doi.org/10.1038/nature13186')]
-icon_hash = '56a85c8e26855e083a2f794e'
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://media.springernature.com/original/springer-static/esm/art%3A10.1038%2Fnature13186/MediaObjects'
regions_file = '41586_2014_BFnature13186_MOESM69_ESM.xlsx'
[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/mouse_mesoscale/__init__.py b/entries/mouse_mesoscale/__init__.py
index 9069ee7..d54871e 100644
--- a/entries/mouse_mesoscale/__init__.py
+++ b/entries/mouse_mesoscale/__init__.py
@@ -26,9 +26,19 @@ description = """Networks of axonal projections between regions of the mouse bra
The networks have the following properties:
-- Region nodes: `name`, the region acronym (for experiment nodes, the image series identifier) in the Allen Reference Atlas; `full_name`, the region name; `major_region`, the major brain division (e.g. "Isocortex", "Thalamus"; acronyms such as "ISOCORTEX" or "TH" in `projections`); `hemisphere`, "ipsilateral" (right) or "contralateral" (left); `voxel_count`, the volume of the region in voxels of the reference atlas (100 micrometres on each side).
-- Experiment nodes (`projections`): `is_injection`, whether the node is an injection experiment (otherwise it is a region); `image_series_id` and `specimen`, the identifiers of the experiment and the animal; `primary_structure` and `secondary_structure`, the regions containing the injection site; `injection_volume`, in cubic millimeters; `major_region`, the major division of the injection site.
-- Edges: `weight`, the normalized projection volume (`projections`) or the fitted normalized connection strength (`model`); `pvalue`, the p-value of the fitted connection strength (NaN when it could not be computed) (`model` only); `distance`, the distance between the centers of mass of the two regions, in micrometres (`model` only)."""
+- (Node) `name` (regions): the region acronym (for experiment nodes, the image series identifier) in the Allen Reference Atlas.
+- (Node) `full_name` (regions): the region name.
+- (Node) `major_region` (regions): the major brain division (e.g. "Isocortex", "Thalamus"; acronyms such as "ISOCORTEX" or "TH" in `projections`).
+- (Node) `hemisphere` (regions): "ipsilateral" (right) or "contralateral" (left).
+- (Node) `voxel_count` (regions): the volume of the region in voxels of the reference atlas (100 micrometers on each side).
+- (Node) `is_injection` (`projections`): whether the node is an injection experiment (otherwise it is a region).
+- (Node) `image_series_id`, `specimen` (experiments, in `projections`): the identifiers of the experiment and the animal.
+- (Node) `primary_structure`, `secondary_structure` (experiments, in `projections`): the regions containing the injection site.
+- (Node) `injection_volume` (experiments, in `projections`): in cubic millimeters.
+- (Node) `major_region` (experiments, in `projections`): the major division of the injection site.
+- (Edge) `weight`: the normalized projection volume (`projections`) or the fitted normalized connection strength (`model`).
+- (Edge) `pvalue`: the p-value of the fitted connection strength (NaN when it could not be computed) (`model` only).
+- (Edge) `distance`: the distance between the centers of mass of the two regions, in micrometers (`model` only)."""
tags = ['Biological', 'Connectome', 'Weighted', 'Metadata']
url = 'https://doi.org/10.1038/nature13186'
citation = [('S. W. Oh et al., "A mesoscale connectome of the mouse brain." Nature 508, 207-214 (2014)', 'https://doi.org/10.1038/nature13186')]
[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/mouse_mesoscale/__init__.py b/entries/mouse_mesoscale/__init__.py
index 3f3c032..9069ee7 100644
--- a/entries/mouse_mesoscale/__init__.py
+++ b/entries/mouse_mesoscale/__init__.py
@@ -81,7 +81,6 @@ def add_region_props(g, regions, acronyms):
@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] Use American spelling in the descriptions 802d564
British spellings in the titles and descriptions of 69 entries (e.g. labelled, organisation, millimetres, centres, anonymised, neighbours, analysed, modelled, colour, licence) are replaced by the American ones. Proper names keep their spelling (Otago Harbour, the Centre for Water Systems, the Centre jeunesse de Montréal, the Dutch Ministry of Defence), as do quoted upstream terms, citations, and property names.
diff --git a/entries/mouse_mesoscale/__init__.py b/entries/mouse_mesoscale/__init__.py
index b3cd435..3f3c032 100644
--- a/entries/mouse_mesoscale/__init__.py
+++ b/entries/mouse_mesoscale/__init__.py
@@ -19,7 +19,7 @@
from .. import *
title = "Mouse brain mesoscale connectome (2014)"
-description = """Networks of axonal projections between regions of the mouse brain, from the Allen Mouse Brain Connectivity Atlas of Oh et al. (Allen Institute for Brain Science). In each of 469 experiments, an adeno-associated viral tracer expressing EGFP was injected into one location of the right hemisphere of a C57BL/6J mouse, and the fluorescently labelled axons were imaged brain-wide by serial two-photon tomography, registered to the Allen Reference Atlas, and segmented. The brain was divided into 295 non-overlapping regions (plus fiber tracts) in each hemisphere.
+description = """Networks of axonal projections between regions of the mouse brain, from the Allen Mouse Brain Connectivity Atlas of Oh et al. (Allen Institute for Brain Science). In each of 469 experiments, an adeno-associated viral tracer expressing EGFP was injected into one location of the right hemisphere of a C57BL/6J mouse, and the fluorescently labeled axons were imaged brain-wide by serial two-photon tomography, registered to the Allen Reference Atlas, and segmented. The brain was divided into 295 non-overlapping regions (plus fiber tracts) in each hemisphere.
- `projections`: bipartite network between the 469 injection experiments and the 592 target regions (296 per hemisphere, including "fiber tracts"), from Supplementary Table 2. An edge connects an experiment to each target region where projections were detected, weighted by the normalized projection volume (the number of segmented signal pixels in the target region divided by that in the injection volume). Target regions are distinguished by hemisphere, ipsilateral (right) or contralateral (left) to the injection. 106 entries of the source table have the value -1, which is not documented, and are omitted.
- `model`: directed network of the 213 regions on each hemisphere (426 nodes) from Supplementary Tables 3 and 4, obtained by the authors by fitting a linear model of connectivity, in which the projection signal of each experiment is a combination of the projections of the source regions covered by its injection. Edges point from a source region (on the right hemisphere) to an ipsilateral or contralateral target region, for every non-zero fitted connection strength (32,822 edges, 16,954 of them ipsilateral). Nodes on the left (contralateral) hemisphere therefore have no outgoing edges.
@@ -27,8 +27,8 @@ description = """Networks of axonal projections between regions of the mouse bra
The networks have the following properties:
- Region nodes: `name`, the region acronym (for experiment nodes, the image series identifier) in the Allen Reference Atlas; `full_name`, the region name; `major_region`, the major brain division (e.g. "Isocortex", "Thalamus"; acronyms such as "ISOCORTEX" or "TH" in `projections`); `hemisphere`, "ipsilateral" (right) or "contralateral" (left); `voxel_count`, the volume of the region in voxels of the reference atlas (100 micrometres on each side).
-- Experiment nodes (`projections`): `is_injection`, whether the node is an injection experiment (otherwise it is a region); `image_series_id` and `specimen`, the identifiers of the experiment and the animal; `primary_structure` and `secondary_structure`, the regions containing the injection site; `injection_volume`, in cubic millimetres; `major_region`, the major division of the injection site.
-- Edges: `weight`, the normalized projection volume (`projections`) or the fitted normalized connection strength (`model`); `pvalue`, the p-value of the fitted connection strength (NaN when it could not be computed) (`model` only); `distance`, the distance between the centres of mass of the two regions, in micrometres (`model` only)."""
+- Experiment nodes (`projections`): `is_injection`, whether the node is an injection experiment (otherwise it is a region); `image_series_id` and `specimen`, the identifiers of the experiment and the animal; `primary_structure` and `secondary_structure`, the regions containing the injection site; `injection_volume`, in cubic millimeters; `major_region`, the major division of the injection site.
+- Edges: `weight`, the normalized projection volume (`projections`) or the fitted normalized connection strength (`model`); `pvalue`, the p-value of the fitted connection strength (NaN when it could not be computed) (`model` only); `distance`, the distance between the centers of mass of the two regions, in micrometres (`model` only)."""
tags = ['Biological', 'Connectome', 'Weighted', 'Metadata']
url = 'https://doi.org/10.1038/nature13186'
citation = [('S. W. Oh et al., "A mesoscale connectome of the mouse brain." Nature 508, 207-214 (2014)', 'https://doi.org/10.1038/nature13186')]
[entries] New entry: mouse_mesoscale abf91bc
diff --git a/entries/mouse_mesoscale/__init__.py b/entries/mouse_mesoscale/__init__.py
new file mode 100644
index 0000000..b3cd435
--- /dev/null
+++ b/entries/mouse_mesoscale/__init__.py
@@ -0,0 +1,188 @@
+#! /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 = "Mouse brain mesoscale connectome (2014)"
+description = """Networks of axonal projections between regions of the mouse brain, from the Allen Mouse Brain Connectivity Atlas of Oh et al. (Allen Institute for Brain Science). In each of 469 experiments, an adeno-associated viral tracer expressing EGFP was injected into one location of the right hemisphere of a C57BL/6J mouse, and the fluorescently labelled axons were imaged brain-wide by serial two-photon tomography, registered to the Allen Reference Atlas, and segmented. The brain was divided into 295 non-overlapping regions (plus fiber tracts) in each hemisphere.
+
+- `projections`: bipartite network between the 469 injection experiments and the 592 target regions (296 per hemisphere, including "fiber tracts"), from Supplementary Table 2. An edge connects an experiment to each target region where projections were detected, weighted by the normalized projection volume (the number of segmented signal pixels in the target region divided by that in the injection volume). Target regions are distinguished by hemisphere, ipsilateral (right) or contralateral (left) to the injection. 106 entries of the source table have the value -1, which is not documented, and are omitted.
+- `model`: directed network of the 213 regions on each hemisphere (426 nodes) from Supplementary Tables 3 and 4, obtained by the authors by fitting a linear model of connectivity, in which the projection signal of each experiment is a combination of the projections of the source regions covered by its injection. Edges point from a source region (on the right hemisphere) to an ipsilateral or contralateral target region, for every non-zero fitted connection strength (32,822 edges, 16,954 of them ipsilateral). Nodes on the left (contralateral) hemisphere therefore have no outgoing edges.
+
+The networks have the following properties:
+
+- Region nodes: `name`, the region acronym (for experiment nodes, the image series identifier) in the Allen Reference Atlas; `full_name`, the region name; `major_region`, the major brain division (e.g. "Isocortex", "Thalamus"; acronyms such as "ISOCORTEX" or "TH" in `projections`); `hemisphere`, "ipsilateral" (right) or "contralateral" (left); `voxel_count`, the volume of the region in voxels of the reference atlas (100 micrometres on each side).
+- Experiment nodes (`projections`): `is_injection`, whether the node is an injection experiment (otherwise it is a region); `image_series_id` and `specimen`, the identifiers of the experiment and the animal; `primary_structure` and `secondary_structure`, the regions containing the injection site; `injection_volume`, in cubic millimetres; `major_region`, the major division of the injection site.
+- Edges: `weight`, the normalized projection volume (`projections`) or the fitted normalized connection strength (`model`); `pvalue`, the p-value of the fitted connection strength (NaN when it could not be computed) (`model` only); `distance`, the distance between the centres of mass of the two regions, in micrometres (`model` only)."""
+tags = ['Biological', 'Connectome', 'Weighted', 'Metadata']
+url = 'https://doi.org/10.1038/nature13186'
+citation = [('S. W. Oh et al., "A mesoscale connectome of the mouse brain." Nature 508, 207-214 (2014)', 'https://doi.org/10.1038/nature13186')]
+icon_hash = '56a85c8e26855e083a2f794e'
+upstream_license = None
+upstream_prefix = 'https://media.springernature.com/original/springer-static/esm/art%3A10.1038%2Fnature13186/MediaObjects'
+regions_file = '41586_2014_BFnature13186_MOESM69_ESM.xlsx'
+files = [(('41586_2014_BFnature13186_MOESM70_ESM.xlsx', regions_file),
+ 'projections', None),
+ (('41586_2014_BFnature13186_MOESM71_ESM.xlsx',
+ '41586_2014_BFnature13186_MOESM72_ESM.xlsx', regions_file),
+ 'model', None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+def read_sheet(f, sheet=0):
+ wb = load_workbook(f, read_only=True, data_only=True)
+ ws = wb.worksheets[sheet] if isinstance(sheet, int) else wb[sheet]
+ return list(ws.iter_rows(values_only=True))
+
+def read_regions(f):
+ # Supplementary Table 1, second sheet: the 295 selected regions
+ rows = read_sheet(f, 1)
+ header = rows[0]
+ i_acr = header.index("Acronym")
+ i_name = header.index("Name")
+ i_major = header.index("Major Region")
+ i_vox = header.index("Voxel Count")
+ regions = {}
+ for row in rows[1:]:
+ if row[i_acr] is None:
+ continue
+ regions[row[i_acr]] = (row[i_name], row[i_major], int(row[i_vox]))
+ return regions
+
+def add_region_props(g, regions, acronyms):
+ g.vp.full_name = g.new_vp("string")
+ g.vp.voxel_count = g.new_vp("int", val=-1)
+ for v, acr in enumerate(acronyms):
+ if acr in regions:
+ name, major, vox = regions[acr]
+ g.vp.full_name[v] = name
+ g.vp.voxel_count[v] = vox
+ elif acr == "fiber tracts":
+ g.vp.full_name[v] = "fiber tracts"
+
+@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:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "rb", seekable=True))
+ for fn in fnames]
+ regions = read_regions(fs[-1])
+
+ if alt == "projections":
+ rows = read_sheet(fs[0])
+ c0 = 6 # first target column
+ acrs = list(rows[2][c0:])
+ hemis = ["ipsilateral" if h == "R" else "contralateral"
+ for h in rows[3][c0:]]
+ majors = []
+ m = None
+ for x in rows[1][c0:]:
+ m = x if x is not None else m
+ majors.append(m)
+ M = len(acrs)
+ exps = [row for row in rows[4:] if row[1] is not None]
+ g = Graph(directed=False)
+ g.add_vertex(M + len(exps))
+ g.vp.is_injection = g.new_vp("bool")
+ g.vp.name = g.new_vp("string")
+ g.vp.hemisphere = g.new_vp("string")
+ g.vp.major_region = g.new_vp("string")
+ g.vp.image_series_id = g.new_vp("int64_t")
+ g.vp.specimen = g.new_vp("string")
+ g.vp.primary_structure = g.new_vp("string")
+ g.vp.secondary_structure = g.new_vp("string")
+ g.vp.injection_volume = g.new_vp("double")
+ for v in range(M):
+ g.vp.name[v] = acrs[v]
+ g.vp.hemisphere[v] = hemis[v]
+ g.vp.major_region[v] = majors[v]
+ add_region_props(g, regions, acrs + [None] * len(exps))
+ edges = []
+ m = None
+ for i, row in enumerate(exps):
+ v = M + i
+ m = row[0] if row[0] is not None else m
+ g.vp.is_injection[v] = True
+ g.vp.major_region[v] = m
+ g.vp.image_series_id[v] = int(row[1])
+ g.vp.name[v] = str(row[1])
+ g.vp.specimen[v] = str(row[2])
+ g.vp.primary_structure[v] = row[3] or ""
+ g.vp.secondary_structure[v] = row[4] or ""
+ g.vp.injection_volume[v] = float(row[5])
+ for j, x in enumerate(row[c0:]):
+ # zero: no projection; -1: undocumented placeholder
+ if isinstance(x, (int, float)) and x > 0:
+ edges.append((v, j, float(x)))
+ g.ep.weight = g.new_ep("double")
+ g.add_edge_list(edges, eprops=[g.ep.weight])
+ else:
+ wb = load_workbook(fs[0], read_only=True, data_only=True)
+ sheets = {s: list(wb[s].iter_rows(values_only=True))
+ for s in wb.sheetnames}
+ acrs = list(sheets["W_ipsi"][0][1:])
+ N = len(acrs)
+ dist = read_sheet(fs[1])
+ didx = {x: i for i, x in enumerate(dist[0]) if x is not None}
+ assert all(dist[i][0] == x for x, i in didx.items())
+
+ g = Graph(directed=True)
+ g.add_vertex(2 * N)
+ g.vp.name = g.new_vp("string")
+ g.vp.hemisphere = g.new_vp("string")
+ g.vp.major_region = g.new_vp("string")
+ for v in range(2 * N):
+ acr = acrs[v % N]
+ g.vp.name[v] = acr
+ g.vp.hemisphere[v] = "ipsilateral" if v < N else "contralateral"
+ g.vp.major_region[v] = regions[acr][1] if acr in regions else ""
+ add_region_props(g, regions, acrs + acrs)
+
+ def num(x):
+ return float(x) if isinstance(x, (int, float)) else numpy.nan
+
+ edges = []
+ for h, (ws, ps, suf) in enumerate([("W_ipsi", "PValue_ipsi", "ipsi"),
+ ("W_contra", "PValue_contra", "contra")]):
+ W = sheets[ws]
+ P = sheets[ps]
+ assert list(W[0][1:]) == acrs and list(P[0][1:]) == acrs
+ for i in range(N):
+ assert W[i + 1][0] == acrs[i] and P[i + 1][0] == acrs[i]
+ di = didx[f"{acrs[i]}_ipsi"]
+ for j in range(N):
+ w = num(W[i + 1][j + 1])
+ if not w > 0:
+ continue
+ d = num(dist[di][didx[f"{acrs[j]}_{suf}"]])
+ edges.append((i, j + h * N, w,
+ num(P[i + 1][j + 1]), d))
+ g.ep.weight = g.new_ep("double")
+ g.ep.pvalue = g.new_ep("double")
+ g.ep.distance = g.new_ep("double")
+ g.add_edge_list(edges, eprops=[g.ep.weight, g.ep.pvalue,
+ g.ep.distance])
+ yield alt, g