mcs07 / PubChemPy

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

Get SDF coordinates #63

Open areyesromero opened 2 years ago

areyesromero commented 2 years ago

Dear all,

Is it possible to get the mol block coordinates of a query structure?

Bests

nbehrnd commented 2 years ago

I'm not sure if this is possible as an output format. Do you want to base your query on PubChem's chemical identifier (CID)? From a previous case, I recall passing the addresses in a format like

https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/1000/SDF?record_type=3d
https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/1001/SDF?record_type=3d

for entries #1000, #1001 etc. e.g., with wget2 worked well enough. Two potential obstacles: PubChem's .sdf (v2000) downloaded contain the cid as an internal label only (files not named as 1000.sdf, 1001.sdf, etc.). Since not all entries actually have the 3d record type, a try/except clause is the safer option.