History of trrust
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] New entry: trrust 6714c3a
diff --git a/entries/trrust/__init__.py b/entries/trrust/__init__.py
new file mode 100644
index 0000000..bb09253
--- /dev/null
+++ b/entries/trrust/__init__.py
@@ -0,0 +1,73 @@
+#! /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 csv
+
+title = "TRRUST transcriptional regulatory networks (2018)"
+description = r"""Human and mouse transcriptional regulatory networks from TRRUST ("Transcriptional Regulatory Relationships Unraveled by Sentence-based Text mining"), version 2, compiled by Han et al. by text mining of PubMed abstracts for sentences describing transcriptional regulation, followed by manual curation of the candidate interactions. Nodes are genes (identified by their gene symbols), and a directed edge $(i, j)$ indicates that the transcription factor $i$ regulates the expression of gene $j$, with the mode of regulation (activation or repression) when it is known.
+
+There are two networks, `human` (8,427 regulatory links) and `mouse` (6,490 links), from the release of 16 April 2018. A pair of genes for which both activation and repression are reported (or a known and an unknown mode) is connected by one edge per mode, as listed in the source (9,396 edges for human, 7,057 for mouse).
+
+The networks have the following properties:
+
+- `name`: the gene symbol of the gene (e.g. `AATF`).
+- `regulation` (edges): the mode of regulation (`Activation`, `Repression` or `Unknown`).
+- `sign` (edges): the mode of regulation as a number, +1 for activation, -1 for repression and 0 if unknown.
+- `pmids` (edges): the PubMed identifiers of the publications describing the regulation, separated by `;`."""
+tags = ['Biological', 'Gene regulation', 'Signed', 'Unweighted', 'Multigraph', 'Metadata']
+url = 'https://www.grnpedia.org/trrust/'
+citation = [('H. Han et al., "TRRUST v2: an expanded reference database of human and mouse transcriptional regulatory interactions." Nucleic Acids Research 46, D380-D386 (2018)', 'https://doi.org/10.1093/nar/gkx1013')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'https://www.grnpedia.org/trrust/data'
+files = [("trrust_rawdata.human.tsv", "human", None),
+ ("trrust_rawdata.mouse.tsv", "mouse", None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+signs = {"Activation": 1, "Repression": -1, "Unknown": 0}
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ name = __name__.split(".")[-1]
+ for fname, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ g = Graph()
+ g.vp.name = g.new_vp("string")
+ g.ep.regulation = g.new_ep("string")
+ g.ep.sign = g.new_ep("int")
+ g.ep.pmids = g.new_ep("string")
+ vs = {}
+ def vertex(x):
+ if x not in vs:
+ v = vs[x] = g.add_vertex()
+ g.vp.name[v] = x
+ return vs[x]
+ with open_upstream_file(name, fname, "r") as f:
+ for tf, target, reg, pmids in csv.reader(f, delimiter="\t"):
+ e = g.add_edge(vertex(tf), vertex(target))
+ g.ep.regulation[e] = reg
+ g.ep.sign[e] = signs[reg]
+ g.ep.pmids[e] = pmids
+ yield alt, g