History of mice_contacts
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/mice_contacts/__init__.py b/entries/mice_contacts/__init__.py
index 3a4aa10..04ae5f5 100644
--- a/entries/mice_contacts/__init__.py
+++ b/entries/mice_contacts/__init__.py
@@ -35,7 +35,7 @@ tags = ['Animal', 'Offline', 'Temporal', 'Timestamps', 'Multigraph', 'Unweighted
url = 'https://doi.org/10.5281/zenodo.4725155'
citation = [('J. C. Evans, A. K. Lindholm, B. König, "Long-term overlap of social and genetic structure in free-ranging house mice reveals dynamic seasonal and group size effects." Current Zoology 67, 59-69 (2021)', 'https://doi.org/10.1093/cz/zoaa030'),
('A. Bovet, J.-C. Delvenne, R. Lambiotte, "Flow stability for dynamic community detection." Science Advances 8, eabj3063 (2022)', 'https://doi.org/10.1126/sciadv.abj3063')]
-icon_hash = None
+date_added = '2026-10-27'
upstream_license = ("CC BY 4.0", "https://creativecommons.org/licenses/by/4.0/")
# Zenodo record 4725155
upstream_prefix = 'https://zenodo.org/api/records/4725155/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/mice_contacts/__init__.py b/entries/mice_contacts/__init__.py
index 9f5085f..3a4aa10 100644
--- a/entries/mice_contacts/__init__.py
+++ b/entries/mice_contacts/__init__.py
@@ -27,10 +27,10 @@ description = r"""Temporal network of contacts among the house mice (*Mus muscul
Nodes are mice, and each edge is a contact between two mice, so that two mice are connected by as many edges as the number of their contacts. The network has the following properties:
-- `id`: the identifier of the mouse in the data set.
-- `sex`: the sex of the mouse (`male`, `female`, or `unknown` for two mice).
-- `time` (edges): the start of the contact, in Unix time (rounded down to the second). The source gives the times in seconds from 28 February 2017 00:00:00; this is taken here as local time (CET).
-- `duration` (edges): the duration of the contact, in seconds."""
+- (Node) `id`: the identifier of the mouse in the data set.
+- (Node) `sex`: the sex of the mouse (`male`, `female`, or `unknown` for two mice).
+- (Edge) `time` (edges): the start of the contact, in Unix time (rounded down to the second). The source gives the times in seconds from 28 February 2017 00:00:00; this is taken here as local time (CET).
+- (Edge) `duration` (edges): the duration of the contact, in seconds."""
tags = ['Animal', 'Offline', 'Temporal', 'Timestamps', 'Multigraph', 'Unweighted', 'Metadata']
url = 'https://doi.org/10.5281/zenodo.4725155'
citation = [('J. C. Evans, A. K. Lindholm, B. König, "Long-term overlap of social and genetic structure in free-ranging house mice reveals dynamic seasonal and group size effects." Current Zoology 67, 59-69 (2021)', 'https://doi.org/10.1093/cz/zoaa030'),
[entries] New entry: mice_contacts 3a56efd
diff --git a/entries/mice_contacts/__init__.py b/entries/mice_contacts/__init__.py
new file mode 100644
index 0000000..9f5085f
--- /dev/null
+++ b/entries/mice_contacts/__init__.py
@@ -0,0 +1,75 @@
+#! /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 json
+import datetime
+import numpy as np
+import pandas as pd
+
+title = "Free-ranging house mice contacts (2017)"
+description = r"""Temporal network of contacts among the house mice (*Mus musculus domesticus*) of a free-ranging population living in a barn near Zurich, Switzerland, studied by the group of Barbara König since 2002. The adult mice carry implanted RFID transponders, and antennas at the entrances of the nest boxes of the barn record when each mouse enters and leaves a nest box. Two mice are in contact while they are in the same nest box at the same time. The data cover the period from 28 February to 1 May 2017, and were released by Bovet et al. with their study of community detection in temporal networks.
+
+Nodes are mice, and each edge is a contact between two mice, so that two mice are connected by as many edges as the number of their contacts. The network has the following properties:
+
+- `id`: the identifier of the mouse in the data set.
+- `sex`: the sex of the mouse (`male`, `female`, or `unknown` for two mice).
+- `time` (edges): the start of the contact, in Unix time (rounded down to the second). The source gives the times in seconds from 28 February 2017 00:00:00; this is taken here as local time (CET).
+- `duration` (edges): the duration of the contact, in seconds."""
+tags = ['Animal', 'Offline', 'Temporal', 'Timestamps', 'Multigraph', 'Unweighted', 'Metadata']
+url = 'https://doi.org/10.5281/zenodo.4725155'
+citation = [('J. C. Evans, A. K. Lindholm, B. König, "Long-term overlap of social and genetic structure in free-ranging house mice reveals dynamic seasonal and group size effects." Current Zoology 67, 59-69 (2021)', 'https://doi.org/10.1093/cz/zoaa030'),
+ ('A. Bovet, J.-C. Delvenne, R. Lambiotte, "Flow stability for dynamic community detection." Science Advances 8, eabj3063 (2022)', 'https://doi.org/10.1126/sciadv.abj3063')]
+icon_hash = None
+upstream_license = ("CC BY 4.0", "https://creativecommons.org/licenses/by/4.0/")
+# Zenodo record 4725155
+upstream_prefix = 'https://zenodo.org/api/records/4725155/files'
+files = [(('mice_contact_sequence.csv.gz/content', 'mice_sex.json/content'), None, None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+# the origin of the times, 28 February 2017 00:00:00 CET
+t0 = int(datetime.datetime(2017, 2, 28, tzinfo=datetime.timezone(datetime.timedelta(hours=1))).timestamp())
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ name = __name__.split(".")[-1]
+ for (fcontacts, fsex), alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ with open_upstream_file(name, fsex, "r") as f:
+ sex = json.load(f)
+ with open_upstream_file(name, fcontacts, "rb") as f:
+ c = pd.read_csv(f, compression="gzip")
+ ids = sorted(set(c["source_nodes"]) | set(c["target_nodes"]) |
+ set(i for s in sex.values() for i in s))
+ sexes = {i: s for s, l in sex.items() for i in l}
+ idx = pd.Series(np.arange(len(ids)), index=ids)
+ g = Graph(directed=False)
+ g.add_vertex(len(ids))
+ g.vp.id = g.new_vp("int", vals=ids)
+ g.vp.sex = g.new_vp("string", vals=[sexes.get(i, "") for i in ids])
+ g.add_edge_list(np.column_stack((idx.loc[c["source_nodes"].to_numpy()].to_numpy(),
+ idx.loc[c["target_nodes"].to_numpy()].to_numpy())))
+ g.ep.time = g.new_ep("int64_t", vals=t0 + np.floor(c["starting_times"].to_numpy()).astype("int64"))
+ g.ep.duration = g.new_ep("double", vals=(c["ending_times"] - c["starting_times"]).to_numpy())
+ yield alt, g