diff 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
line wrap: on
line diff
--- a/chembl.py	Mon Aug 12 12:57:32 2019 -0400
+++ b/chembl.py	Fri Sep 06 07:50:15 2019 -0400
@@ -13,7 +13,7 @@
     """ 
     smiles = set()
     for smi in res: 
-        smiles.add(smi['molecule_structures']['canonical_smiles']) 
+        smiles.add('{}\t{}'.format(smi['molecule_structures']['canonical_smiles'], smi['molecule_chembl_id']))
     return smiles
 
 def sim_search(smiles, tanimoto):
@@ -21,14 +21,14 @@
     Return compounds which are within a Tanimoto range of the SMILES input
     """
     similarity = new_client.similarity
-    return similarity.filter(smiles=smiles, similarity=tanimoto).only(['molecule_structures'])
+    return similarity.filter(smiles=smiles, similarity=tanimoto).only(['molecule_structures', 'molecule_chembl_id'])
     
 def substr_search(smiles):
     """
     Return compounds which contain the SMILES substructure input
     """
     substructure = new_client.substructure
-    return substructure.filter(smiles=smiles).only(['molecule_structures'])
+    return substructure.filter(smiles=smiles).only(['molecule_structures', 'molecule_chembl_id'])
     
 def filter_drugs(mols):
     """