History of human_connectomes_multiscale
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/human_connectomes_multiscale/__init__.py b/entries/human_connectomes_multiscale/__init__.py
index 175ddb8..84e5aad 100644
--- a/entries/human_connectomes_multiscale/__init__.py
+++ b/entries/human_connectomes_multiscale/__init__.py
@@ -36,7 +36,7 @@ tags = ['Biological', 'Connectome', 'Weighted', 'Metadata']
url = 'https://doi.org/10.5281/zenodo.14017270'
citation = [('L. Barjuan, J. Soriano, M. Á. Serrano, "Optimal navigability of weighted human brain connectomes in physical space." NeuroImage 297, 120703 (2024)', 'https://doi.org/10.1016/j.neuroimage.2024.120703'),
('L. Barjuan, M. Zheng, M. Á. Serrano, "The multiscale self-similarity of the weighted human brain connectome." PLOS Computational Biology 21, e1012848 (2025)', 'https://doi.org/10.1371/journal.pcbi.1012848')]
-icon_hash = None
+date_added = '2026-10-27'
upstream_license = ("CC BY 4.0", "https://creativecommons.org/licenses/by/4.0/")
# Zenodo record 14017270
upstream_prefix = 'https://zenodo.org/api/records/14017270/files'
[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/human_connectomes_multiscale/__init__.py b/entries/human_connectomes_multiscale/__init__.py
index 03e80ef..175ddb8 100644
--- a/entries/human_connectomes_multiscale/__init__.py
+++ b/entries/human_connectomes_multiscale/__init__.py
@@ -28,10 +28,10 @@ There is one network per subject and scale, named `<data set>_<subject>_layer<sc
The networks have the following properties:
-- `name`: the name of the region (e.g. `rh_lateralorbitofrontal_9`, where `rh` and `lh` stand for the right and left hemisphere).
-- `x`, `y`, `z`: the coordinates of the center of mass of the region.
-- `weight` (edges): the fiber density between the two regions.
-- `fiber_length` (edges): the mean length of the fibers between the two regions."""
+- (Node) `name`: the name of the region (e.g. `rh_lateralorbitofrontal_9`, where `rh` and `lh` stand for the right and left hemisphere).
+- (Node) `x`, `y`, `z`: the coordinates of the center of mass of the region.
+- (Edge) `weight` (edges): the fiber density between the two regions.
+- (Edge) `fiber_length` (edges): the mean length of the fibers between the two regions."""
tags = ['Biological', 'Connectome', 'Weighted', 'Metadata']
url = 'https://doi.org/10.5281/zenodo.14017270'
citation = [('L. Barjuan, J. Soriano, M. Á. Serrano, "Optimal navigability of weighted human brain connectomes in physical space." NeuroImage 297, 120703 (2024)', 'https://doi.org/10.1016/j.neuroimage.2024.120703'),
[entries] New entry: human_connectomes_multiscale a267d12
diff --git a/entries/human_connectomes_multiscale/__init__.py b/entries/human_connectomes_multiscale/__init__.py
new file mode 100644
index 0000000..03e80ef
--- /dev/null
+++ b/entries/human_connectomes_multiscale/__init__.py
@@ -0,0 +1,110 @@
+#! /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 tarfile
+import numpy as np
+import pandas as pd
+
+title = "Multiscale weighted human connectomes (2024)"
+description = r"""Structural connectomes of the human brain at five scales, for 84 healthy subjects from two data sets: 44 subjects of the test-retest data set of the Human Connectome Project (HCP), aged 22 to 35, and 40 healthy controls of the Lausanne psychosis cohort (UL), with a mean age of about 25. They were computed by Barjuan et al. from diffusion weighted magnetic resonance images with tractography. Nodes are gray matter regions of the multiscale Lausanne parcellation (Cammoun et al. 2012), without the brainstem, and an undirected edge indicates that white matter fibers connect the two regions, weighted by the fiber density.
+
+There is one network per subject and scale, named `<data set>_<subject>_layer<scale>`, e.g. `hcp_05_layer0` or `ul_17_layer4`, where the subjects are numbered from `00` to `43` (HCP) and `00` to `39` (UL), and the scales (layers) are, from finest to coarsest, `layer0` (about 1014 regions), `layer1` (462), `layer2` (233), `layer3` (128) and `layer4` (82). The regions of finer scales subdivide those of coarser ones; their names consist of the name of the anatomical region of the coarsest scale followed by numbers. In three HCP networks of the finest scale (`hcp_11_layer0`, `hcp_20_layer0`, `hcp_32_layer0`) one region is missing. The UL networks contain self-loops (fibers within the same region), the HCP networks do not, as in the upstream files. The coordinates of the HCP and UL data sets are in different reference spaces.
+
+The networks have the following properties:
+
+- `name`: the name of the region (e.g. `rh_lateralorbitofrontal_9`, where `rh` and `lh` stand for the right and left hemisphere).
+- `x`, `y`, `z`: the coordinates of the center of mass of the region.
+- `weight` (edges): the fiber density between the two regions.
+- `fiber_length` (edges): the mean length of the fibers between the two regions."""
+tags = ['Biological', 'Connectome', 'Weighted', 'Metadata']
+url = 'https://doi.org/10.5281/zenodo.14017270'
+citation = [('L. Barjuan, J. Soriano, M. Á. Serrano, "Optimal navigability of weighted human brain connectomes in physical space." NeuroImage 297, 120703 (2024)', 'https://doi.org/10.1016/j.neuroimage.2024.120703'),
+ ('L. Barjuan, M. Zheng, M. Á. Serrano, "The multiscale self-similarity of the weighted human brain connectome." PLOS Computational Biology 21, e1012848 (2025)', 'https://doi.org/10.1371/journal.pcbi.1012848')]
+icon_hash = None
+upstream_license = ("CC BY 4.0", "https://creativecommons.org/licenses/by/4.0/")
+# Zenodo record 14017270
+upstream_prefix = 'https://zenodo.org/api/records/14017270/files'
+_archives = {"hcp": "HCP-dataset.tar.gz/content", "ul": "UL-dataset.tar.gz/content"}
+# number of regions of the UL folder names for each layer
+_ul_scales = {0: "1015", 1: "0463", 2: "0234", 3: "0129", 4: "0083"}
+
+def _members(dset, subject, layer):
+ if dset == "hcp":
+ base = f"HCP/data_nobrainstem/HCP_nobrainstem_{subject}_layer_{layer}"
+ return (f"{base}_nodes.txt", f"{base}_weight_edgelist.txt")
+ d = f"Human13_nobrainstem_{subject:02d}_{_ul_scales[layer]}"
+ base = f"UL/Human13_nobrainstem_data/{d}/{d}"
+ return (f"{base}.coord", f"{base}.edge")
+
+files = [(tuple(f"{_archives[dset]}:tar.gz:{m}" for m in _members(dset, s, l)),
+ f"{dset}_{s:02d}_layer{l}", None)
+ for dset, n in [("hcp", 44), ("ul", 40)]
+ for s in range(n) for l in range(5)]
+
+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):
+ name = __name__.split(".")[-1]
+ for dset, archive in _archives.items():
+ nets = [(fnames, alt) for fnames, alt, fmt in files
+ if alt.startswith(dset + "_") and (alts is None or alt in alts)]
+ if not nets:
+ continue
+ # the archive is read once, keeping the members in memory
+ members = {}
+ with open_upstream_file(name, archive, "rb") as f:
+ with tarfile.open(fileobj=f, mode="r|gz") as tf:
+ for m in tf:
+ if m.isfile():
+ members[m.name] = tf.extractfile(m).read()
+ for fnames, alt in nets:
+ fnodes, fedges = [x.split(":tar.gz:")[1] for x in fnames]
+ if dset == "hcp":
+ nodes = pd.read_csv(io.BytesIO(members[fnodes]), sep=r"\s+",
+ comment="#", header=None,
+ names=["i", "x", "y", "z", "name"])
+ # a few files skip an index (a region missing in that subject)
+ idx = pd.Series(np.arange(len(nodes)), index=nodes["i"].to_numpy())
+ else:
+ nodes = pd.read_csv(io.BytesIO(members[fnodes]), sep=r"\s+",
+ comment="#", header=None,
+ names=["name", "x", "y", "z"])
+ idx = pd.Series(np.arange(len(nodes)))
+ edges = pd.read_csv(io.BytesIO(members[fedges]), sep="\t")
+ g = Graph(directed=False)
+ g.add_vertex(len(nodes))
+ g.vp.name = g.new_vp("string", vals=nodes["name"].astype(str).tolist())
+ for c in "xyz":
+ g.vp[c] = g.new_vp("double", vals=nodes[c].to_numpy())
+ if "region_i" in edges.columns:
+ # the UL edge lists give the names of the regions
+ names = nodes["name"].to_numpy()
+ assert (names[edges["i"]] == edges["region_i"].to_numpy()).all()
+ assert (names[edges["j"]] == edges["region_j"].to_numpy()).all()
+ g.add_edge_list(np.column_stack((idx.loc[edges["i"].to_numpy()].to_numpy(),
+ idx.loc[edges["j"].to_numpy()].to_numpy())))
+ g.ep.weight = g.new_ep("double", vals=edges["fiber_density"].to_numpy())
+ g.ep.fiber_length = g.new_ep("double", vals=edges["fiber_length_mean"].to_numpy())
+ yield alt, g
+ del members