#!/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/#importpypath.resources.urlsasurlsimportpypath.share.curlascurlimportpypath.share.commonascommon
[docs]defcpdb_interactions(exclude=None):""" Interactions from ConsensusPathDB. Args exclude (set): A set of resource names to exclude. """exclude=common.to_set(exclude)result=[]url=urls.urls['cpdb']['url']c=curl.Curl(url,silent=False)data=c.resultdata=[x.split('\t')forxindata.split('\n')ifnotx.startswith('#')andlen(x)>0]forlindata:participants=l[2].split(',')iflen(participants)==2:if(notexcludeorset(l[0].split(','))-exclude):result.append([participants[0],participants[1],l[0],l[1],])returnresult
[docs]defcpdb_interactions_ltp():""" Low-throughput interactions from ConsensusPathDB. Calls ``cpdb_interactions`` with excluding HPRD, BioGRID, PhosphoPOINT, MINT, BIND and IntAct. Args exclude (set): A set of resource names to exclude. """returncpdb_interactions(exclude={'HPRD','BioGRID','PhosphoPOINT','MINT','BIND','IntAct',})