logo Netzschleuder network catalog, repository, and centrifuge

History of ogbl_ppa

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 by Tiago de Paula Peixoto 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/ogbl_ppa/__init__.py b/entries/ogbl_ppa/__init__.py
index 5ed0a8c..0d14d78 100644
--- a/entries/ogbl_ppa/__init__.py
+++ b/entries/ogbl_ppa/__init__.py
@@ -36,7 +36,7 @@ url = ['https://ogb.stanford.edu/docs/linkprop/#ogbl-ppa',
        'https://snap.stanford.edu/ogb/data/']
 citation = [('W. Hu, M. Fey, M. Zitnik, Y. Dong, H. Ren, B. Liu, M. Catasta, J. Leskovec, "Open Graph Benchmark: Datasets for Machine Learning on Graphs." Advances in Neural Information Processing Systems 33, 22118-22133 (2020)', 'https://doi.org/10.48550/arXiv.2005.00687'),
             ('D. Szklarczyk et al., "STRING v11: protein-protein association networks with increased coverage, supporting functional discovery in genome-wide experimental datasets." Nucleic Acids Research 47, D607-D613 (2019)', 'https://doi.org/10.1093/nar/gky1131')]
-icon_hash = None
+date_added = '2026-10-28'
 upstream_license = ('CC0 1.0', 'https://creativecommons.org/publicdomain/zero/1.0/')
 upstream_prefix = 'https://snap.stanford.edu/ogb/data'
 z = 'linkproppred/ppassoc.zip:ppassoc'
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto 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/ogbl_ppa/__init__.py b/entries/ogbl_ppa/__init__.py
index 772a7c3..5ed0a8c 100644
--- a/entries/ogbl_ppa/__init__.py
+++ b/entries/ogbl_ppa/__init__.py
@@ -28,9 +28,9 @@ For the benchmark, the edges were split by "throughput": the associations found
 
 The network has the following properties:
 
-- `protein_id`: the identifier of the protein in STRING, e.g. `9606.ENSP00000000233` (the NCBI taxonomy identifier of the species, followed by the identifier of the protein in its source database).
-- `species`: the NCBI taxonomy identifier of the species of the protein, e.g. 9606 (human).
-- Edge `split`: the part of the benchmark the edge belongs to: `train`, `valid` or `test`."""
+- (Node) `protein_id`: the identifier of the protein in STRING, e.g. `9606.ENSP00000000233` (the NCBI taxonomy identifier of the species, followed by the identifier of the protein in its source database).
+- (Node) `species`: the NCBI taxonomy identifier of the species of the protein, e.g. 9606 (human).
+- (Edge) `split`: the part of the benchmark the edge belongs to: `train`, `valid` or `test`."""
 tags = ['Biological', 'Protein interactions', 'Unweighted', 'Metadata']
 url = ['https://ogb.stanford.edu/docs/linkprop/#ogbl-ppa',
        'https://snap.stanford.edu/ogb/data/']
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 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/ogbl_ppa/__init__.py b/entries/ogbl_ppa/__init__.py
index 864c550..772a7c3 100644
--- a/entries/ogbl_ppa/__init__.py
+++ b/entries/ogbl_ppa/__init__.py
@@ -82,7 +82,6 @@ def read_split(name, fname):
 @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] New entry: ogbl_ppa by Tiago de Paula Peixoto 33ad2d3
diff --git a/entries/ogbl_ppa/__init__.py b/entries/ogbl_ppa/__init__.py
new file mode 100644
index 0000000..864c550
--- /dev/null
+++ b/entries/ogbl_ppa/__init__.py
@@ -0,0 +1,113 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 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/>.
+
+import pickle
+import pandas
+
+from .. import *
+
+title = "Protein associations of 58 species (ogbl-ppa, 2020)"
+description = """An undirected network of functional associations between the proteins of 58 species, from the `ogbl-ppa` dataset of the Open Graph Benchmark (OGB), a benchmark for link prediction (version 1, of May 2020). The proteins and associations are a subset of the STRING database (version 11): an edge means that two proteins are associated in a biologically meaningful way, e.g. by a physical interaction, co-expression, homology or genomic neighborhood (the kinds of evidence are not given). The species span the tree of life (e.g. human, mouse, yeast, *Arabidopsis thaliana*, *Plasmodium falciparum*, bacteria). The networks of all the species of STRING are in the entry `string_all`.
+
+For the benchmark, the edges were split by "throughput": the associations found with high-throughput techniques (e.g. automated screens, or predictions) are used for training, and those found with low-throughput, resource-intensive experiments (e.g. experimentally determined interactions of single protein pairs) for validation and testing. All the 30,326,273 edges of the dataset are included here, with their part of the split as an edge property; the negative samples of the benchmark (pairs of proteins that are not associated) are left out. In the benchmark, each node has as features a one-hot vector of its species, which is given here as the species' taxonomy identifier.
+
+The network has the following properties:
+
+- `protein_id`: the identifier of the protein in STRING, e.g. `9606.ENSP00000000233` (the NCBI taxonomy identifier of the species, followed by the identifier of the protein in its source database).
+- `species`: the NCBI taxonomy identifier of the species of the protein, e.g. 9606 (human).
+- Edge `split`: the part of the benchmark the edge belongs to: `train`, `valid` or `test`."""
+tags = ['Biological', 'Protein interactions', 'Unweighted', 'Metadata']
+url = ['https://ogb.stanford.edu/docs/linkprop/#ogbl-ppa',
+       'https://snap.stanford.edu/ogb/data/']
+citation = [('W. Hu, M. Fey, M. Zitnik, Y. Dong, H. Ren, B. Liu, M. Catasta, J. Leskovec, "Open Graph Benchmark: Datasets for Machine Learning on Graphs." Advances in Neural Information Processing Systems 33, 22118-22133 (2020)', 'https://doi.org/10.48550/arXiv.2005.00687'),
+            ('D. Szklarczyk et al., "STRING v11: protein-protein association networks with increased coverage, supporting functional discovery in genome-wide experimental datasets." Nucleic Acids Research 47, D607-D613 (2019)', 'https://doi.org/10.1093/nar/gky1131')]
+icon_hash = None
+upstream_license = ('CC0 1.0', 'https://creativecommons.org/publicdomain/zero/1.0/')
+upstream_prefix = 'https://snap.stanford.edu/ogb/data'
+z = 'linkproppred/ppassoc.zip:ppassoc'
+files = [((f'{z}/raw/edge.csv.gz', f'{z}/split/throughput/valid.pt',
+           f'{z}/split/throughput/test.pt', f'{z}/raw/node-feat.csv.gz',
+           f'{z}/mapping/featdim2speciesid.csv.gz',
+           f'{z}/mapping/nodeidx2proteinid.csv.gz'),
+          None, None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+def read_csv_gz(name, fname, header=None, dtype="int64"):
+    "The gzipped CSV member `fname`, as an array."
+    with open_upstream_file(name, fname, "rb") as f:
+        return pandas.read_csv(f, compression="gzip", header=header,
+                               dtype=dtype).values
+
+class ArrayUnpickler(pickle.Unpickler):
+    """Unpickles only numpy arrays (and dicts of them), and nothing else: the
+    splits are dicts of numpy arrays, saved by torch.save() (in its legacy
+    format: a sequence of pickles)."""
+    allowed = {("numpy.core.multiarray", "_reconstruct"),
+               ("numpy._core.multiarray", "_reconstruct"),
+               ("numpy", "ndarray"), ("numpy", "dtype"), ("_codecs", "encode")}
+    def find_class(self, module, name):
+        if (module, name) not in self.allowed:
+            raise pickle.UnpicklingError(f"forbidden: {module}.{name}")
+        return super().find_class(module, name)
+
+def read_split(name, fname):
+    "The positive edges of a held-out split."
+    with open_upstream_file(name, fname, "rb") as f:
+        u = ArrayUnpickler(f)
+        u.load()                 # magic number
+        assert u.load() == 1001  # protocol version
+        u.load()                 # system information
+        d = u.load()
+    return d["edge"]
+
+@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
+        ids = read_csv_gz(name, fnames[5], header=0, dtype=str)
+        N = len(ids)
+        assert (ids[:, 0].astype("int64") == numpy.arange(N)).all()
+        # one-hot vectors of the species
+        feat = read_csv_gz(name, fnames[3], dtype="float32")
+        assert feat.shape == (N, 58) and (feat.sum(axis=1) == 1).all()
+        species = read_csv_gz(name, fnames[4], header=0)
+        assert (species[:, 0] == numpy.arange(58)).all()
+        g = Graph(directed=False)
+        g.add_vertex(N)
+        g.vp.protein_id = g.new_vp("string", vals=ids[:, 1])
+        g.vp.species = g.new_vp("int64_t", vals=species[feat.argmax(axis=1), 1])
+        del feat, ids
+        edges = read_csv_gz(name, fnames[0])
+        E = len(edges)
+        g.add_edge_list(edges)
+        del edges
+        valid = read_split(name, fnames[1])
+        g.add_edge_list(valid)
+        test = read_split(name, fnames[2])
+        g.add_edge_list(test)
+        g.ep.split = g.new_ep("string", vals=["train"] * E + ["valid"] * len(valid) +
+                                             ["test"] * len(test))
+        yield alt, g