#!/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/#importosimportreimportitertoolsimportcollectionsfromtypingimportListimportpypath.share.curlascurlimportpypath.resources.urlsasurlsimportpypath.inputs.embopressasembo
[docs]defkirouac2010_interactions()->List[tuple]:""" Ligand-receptor pairs from Kirouac et al. 2010 (https://www.embopress.org/doi/10.1038/msb.2010.71). """Kiruac2010Interaction=collections.namedtuple('Kiruac2010Interaction',('ligand','receptor',),)rename=re.compile(r'[A-Z]{2}[A-Z0-9][-A-Z0-9]*')rerange=re.compile(r'([0-9])-([0-9])')reslash=re.compile(r'.*?([A-Z0-9]{1,3}/[/A-Z0-9]+)')defget_names(s):names=set()prev=Nonefornins.split():m=rename.findall(n)ifm:prev=mm=reslash.match(n)ifm:forpostinm.groups()[0].split('/'):forpreinprev:names.add('%s%s'%(pre,post))else:m=rerange.match(n)ifm:intv=m.groups()forpostinrange(int(intv[0]),int(intv[1])+1):forpreinprev:names.add('%s%u'%(pre,post))else:names.update(prev)prev=Nonereturnnamestbl=embo.embopress_supplementary(url=urls.urls['kirouac2010']['url'],init_url=urls.urls['kirouac2010']['init_url'],sheet='S12',)result=[]forrintbl[2:]:namesA=get_names(r[0])namesB=get_names(r[1])result.extend([Kiruac2010Interaction(*lig_rec)forlig_recinitertools.product(namesA,namesB)])returnresult