chembl / chembl_webresource_client

Official Python client for accessing ChEMBL API
https://www.ebi.ac.uk/chembl/api/data/docs
Other
368 stars 95 forks source link

bug in resource __getitem__ ignoring the current query #82

Closed juanfmx2 closed 4 years ago

juanfmx2 commented 4 years ago

The getitem method in the resource is ignoring the current query, but the iterator is not

mol_form_data = new_client.molecule_form.filter(molecule_chembl_id='CHEMBL2296002')
parent_chembl_id = mol_form_data[0]['parent_chembl_id'] # parent should be CHEMBL25
# However iterating the results brings the correct result
mol_form_data.__iter__()
parent_chembl_id = mol_form_data.next()['parent_chembl_id']
juanfmx2 commented 4 years ago

I think there is something stuck somewhere in the cloning of the query after a filter: https://colab.research.google.com/drive/1eh7XXvpF1OeZcYiXZ8DDXqQcZ9COJ5vo