#!/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/#frompast.builtinsimportxrange,rangeimportcsvimportcollectionsimportpypath.resources.urlsasurlsimportpypath.share.curlascurlimportpypath.share.commonascommonimportpypath.share.settingsassettingsimportpypath.utils.mappingasmapping
[docs]defintogen_annotations():""" Returns a list of cancer driver genes with their annotations, according to the IntOGen database. """IntogenAnnotation=collections.namedtuple('IntogenAnnotation',['type','role','curated','oncodrive_role_prob',],)url=urls.urls['intogen']['db2014_2']withsettings.context(curl_connect_timeout=100):c=curl.Curl(url,large=True,silent=False,files_needed=['Drivers_type_role.tsv'],compr='zip',)for_inxrange(7):__=c.result['Drivers_type_role.tsv'].readline()data=csv.DictReader(c.result['Drivers_type_role.tsv'],delimiter='\t',)result=collections.defaultdict(set)forrecindata:uniprots=mapping.map_name(rec['geneHGNCsymbol'],'genesymbol','uniprot',)foruniprotinuniprots:role_prob,curated=((1.0,True,)ifrec['OncodriveROLE_prob']=='Manually curated'else(common.float_or_nan(rec['OncodriveROLE_prob']),False,))result[uniprot].add(IntogenAnnotation(type=rec['Driver_type'],role=rec['Role'],curated=curated,oncodrive_role_prob=role_prob,))returndict(result)