#!/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/#importcollectionsimportpypath.share.curlascurlimportpypath.resources.urlsasurlsimportpypath.utils.mappingasmappingimportpypath.inputs.commonasinputs_common
[docs]defkinasedotcom_annotations():""" Downloads and processes kinase annotations from kinase.com. """KinasedotcomAnnotation=collections.namedtuple('KinasedotcomAnnotation',['group','family','subfamily'])KinasedotcomAnnotation.__new__.__defaults__=(None,)defadd_record(uniprot,rec,offset=2):ifrec[offset].strip():result[uniprot].add(KinasedotcomAnnotation(group=rec[offset].strip(),family=rec[offset+1].strip(),subfamily=rec[offset+2].strip()orNone,))url=urls.urls['kinome']['rescued']c=curl.Curl(url,large=True,silent=False)xlsf=c.fileobjxlsname=xlsf.namexlsf.close()tbl=inputs_common.read_xls(xlsname)result=collections.defaultdict(set)forrecintbl:uniprots=mapping.map_name(rec[23].strip(),'genesymbol','uniprot')foruniprotinuniprots:add_record(uniprot,rec)ifrec[12].strip():add_record(uniprot,rec,offset=12)returndict(result)