mcs07 / PubChemPy

Python wrapper for the PubChem PUG REST API.
http://pubchempy.readthedocs.io
MIT License
379 stars 106 forks source link

Search with InChI and InChI key not working #66

Closed voidpunk closed 2 years ago

voidpunk commented 2 years ago

Search with InChI and InChI key not working with pubchempy.get_compounds() (tried with many different compounds copying the codes from PumChem.

Searching for InChI gives:

'PUGREST.BadRequest: error: '
2022-01-16 21:20:43.003 'PUGREST.NotFound: No CID found that matches the given InChI key'

Searching for InChI key gives:

'PUGREST.NotFound: No CID found that matches the given InChI key'
voidpunk commented 2 years ago

Sorry, it was just me being dumb (a bug in my code), everything works perfectly guys :sweat_smile:

nbehrnd commented 2 years ago

As a MWE:

import pubchempy as pcp

entry = results.get_compounds("InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/h2-11H,1H2/t2-,3-,4+,5-,6?/m1/s1", "inchi")
print(entry)

yields

[Compound(5793)]

But be aware, without fixed H-layer (and non-standard InChI), you might not discern e.g., between 2-hydroxy pyridine and its tautomeric form, the pyridone.