#!/usr/bin/env python# Dénes Türei EMBL 2017# turei.denes@gmail.comimportpypathdeflogp_neg(slogp):returnslogpisnotNoneandfloat(slogp)<0.0defpchembl_gt_5(pch):returnany(float(p)>5.0forpinpch.split(';'))# initialize a PyPath instance:pa=pypath.PyPath()pa.kinases_list()# load the list of kinases from kinase.com# create a Chembl instance:chembl_access=('defaults.mysql','chembl')c=pypath.chembl.Chembl(chembl_access)# run a targets for compounds query:c.pchembl_select+=',\nmd.max_phase AS max_phase\n'c.compounds_targets(pa.lists['kin'],# UniProt IDs of the kinasesassay_types=['B'],# only binding assayspchembl=True,# include pchembl valuesaction_type=True,compound_props=['alogp','acd_logp']# include logp values)result=list(c.result)hdr=sorted(result[0].keys())result=[[r[h]forhinhdr]forrinresult]# filter to negative logPneg_logp=[rforrinresultiflogp_neg(r[0])orlogp_neg(r[2])]# filter to pChEMBL > 5.0pchembl5=[rforrinneg_logpifpchembl_gt_5(r[6])]# filter to development phasephase1=[rforrinpchembl5ifr[5]>0]# add gene names_=[r.append(pa.mapper.map_name(r[-2],'uniprot','genesymbol')[0])forrinpchembl5]hdr.append('gene_symbol')# write to filewithopen('chembl_kinases_neg-logp_pchembl5_phase1234.tab','w')asfp:_=fp.write('%s\n'%'\t'.join(hdr))_=fp.write('\n'.join('\t'.join(map(str,r))forrinphase1))
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.