#!/usr/bin/env python# -*- coding: utf-8 -*-## This file is part of the `pypath` python module## Copyright 2014-2023# 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/#importcollectionsfromtypingimportList,Literal,Unionimportpypath.resources.urlsasurlsimportpypath.share.curlascurlimportpypath.share.settingsassettingsimportpypath.inputs.embopressasemboimportpypath.inputs.ca1asca1importpypath.utils.mappingasmappingKEY={'NA':None,'Neucleus':'Nucleus','Ribosomes':'Ribosome','Vesicles':'Vesicle','Endoplasmic reticulum':'ER','Not available':None,'Not Available':None,'Mitochondrial':'Mitochondrion','Mitochondria':'Mitochondrion','Anti-Apoptic':'Anti-apoptotic',}ca1_interactions=ca1.ca1_interactions
[docs]defhsn_interactions(source:Literal['rescued','researchgate']='rescued',)->List[tuple]:""" Downloads and processes HumanSignalingNetwork version 6 (published 2014 Jan by Edwin Wang). Args source: The same file is available from two domains: the OmniPath rescued repository and Research Gate. These both are secondary sources, the dataset is not available any more from its original site of publication, which was the old webpage of the Wang Lab. Details: This dataset is identical to the one returned by `wang_interactions`, but it does not contain function and localization details. """effects={'Pos':'+','Neg':'-','Phy':'0',}classHsnInteraction(collections.namedtuple('HsnInteractionBase',('genesymbol_source','genesymbol_target','entrez_source','entrez_target','effect',),),):def__new__(cls,*args):args=args[0]iflen(args)==1elseargsidentifiers=dict(zip(('entrez_source','genesymbol_source','entrez_target','genesymbol_target',),args[:-1]))returnsuper(HsnInteraction,cls).__new__(cls,**identifiers,effect=effects.get(args[-1],args[-1]),)url=urls.urls['hsn'][source]c=curl.Curl(url,silent=False,large=True,req_headers=[settings.get('user_agent')],)_=next(c.result)result=[HsnInteraction(*r.strip().split(','))forrinc.resultifr]returnresult
[docs]defwang_interactions()->List[tuple]:""" Downloads and processes Wang Lab HumanSignalingNetwork. Returns list of interactions as tuples of source, target and effect. """url=urls.urls['wang']['rescued']c=curl.Curl(url,silent=False)data=c.resultdata=data.split('\n')return_wang_process(data)
[docs]defcui_interactions()->List[tuple]:""" Interactions from Supplementary Table 9 of Cui et al. 2007 (https://www.embopress.org/doi/full/10.1038/msb4100200). """raw=embo.embopress_supplementary(url=urls.urls['wang']['cui'],init_url=urls.urls['wang']['cui_init'],sheet='Supplementary Table 9',)return_wang_process(raw)