comparison chembl.py @ 2:f56492688f43 draft

"planemo upload for repository https://github.com/chembl/chembl_webresource_client commit d7fca21744d3c87cf173c1539c069a5c720084f3"
author bgruening
date Fri, 06 Sep 2019 07:50:15 -0400
parents 6f8458d1cf46
children 59eea7d0d720
comparison
equal deleted inserted replaced
1:6f8458d1cf46 2:f56492688f43
11 """ 11 """
12 Get a list of SMILES from function results 12 Get a list of SMILES from function results
13 """ 13 """
14 smiles = set() 14 smiles = set()
15 for smi in res: 15 for smi in res:
16 smiles.add(smi['molecule_structures']['canonical_smiles']) 16 smiles.add('{}\t{}'.format(smi['molecule_structures']['canonical_smiles'], smi['molecule_chembl_id']))
17 return smiles 17 return smiles
18 18
19 def sim_search(smiles, tanimoto): 19 def sim_search(smiles, tanimoto):
20 """ 20 """
21 Return compounds which are within a Tanimoto range of the SMILES input 21 Return compounds which are within a Tanimoto range of the SMILES input
22 """ 22 """
23 similarity = new_client.similarity 23 similarity = new_client.similarity
24 return similarity.filter(smiles=smiles, similarity=tanimoto).only(['molecule_structures']) 24 return similarity.filter(smiles=smiles, similarity=tanimoto).only(['molecule_structures', 'molecule_chembl_id'])
25 25
26 def substr_search(smiles): 26 def substr_search(smiles):
27 """ 27 """
28 Return compounds which contain the SMILES substructure input 28 Return compounds which contain the SMILES substructure input
29 """ 29 """
30 substructure = new_client.substructure 30 substructure = new_client.substructure
31 return substructure.filter(smiles=smiles).only(['molecule_structures']) 31 return substructure.filter(smiles=smiles).only(['molecule_structures', 'molecule_chembl_id'])
32 32
33 def filter_drugs(mols): 33 def filter_drugs(mols):
34 """ 34 """
35 Return only compounds which are approved drugs 35 Return only compounds which are approved drugs
36 """ 36 """