From 33d0795e9f472e351f6d3754ef12b95357112b03 Mon Sep 17 00:00:00 2001 From: deeenes Date: Tue, 9 Apr 2024 12:51:44 +0200 Subject: [PATCH] `resources.network`: wrapper around original module adds license information to input definitions from controller - saezlab/OmnipathR#87 --- pypath/resources/network.py | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pypath/resources/network.py diff --git a/pypath/resources/network.py b/pypath/resources/network.py new file mode 100644 index 000000000..05225c0cd --- /dev/null +++ b/pypath/resources/network.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# This file is part of the `pypath` python module +# +# Copyright 2014-2024 +# EMBL, EMBL-EBI, Uniklinik RWTH Aachen, Heidelberg University +# +# Authors: see the file `README.rst` +# Contact: Dénes Türei (turei.denes@gmail.com) +# +# Distributed under the GPLv3 License. +# See accompanying file LICENSE.txt or copy at +# https://www.gnu.org/licenses/gpl-3.0.html +# +# Website: https://pypath.omnipathdb.org/ +# + +import pypath.resources._network as _netres +import pypath.resources as _resources +import pypath.internals.resource as _resfmt +from pypath.resources._network import choose_dataset, dorothea_expand_levels + +_co = _resources.get_controller() + +for _dataset_label in dir(_netres): + + _dataset = getattr(_netres, _dataset_label) + + if not isinstance(_dataset, _resfmt.NetworkDataset): + + continue + + for _label, _resource in _dataset.items(): + + _resource.resource_attrs['license'] = _co.license(_resource.name) + + globals()[_dataset_label] = _dataset