mcs07 / PubChemPy

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

Is it possible to get 3D coordinates of ligand using CID or SID? #72

Open drorhunvural opened 1 year ago

drorhunvural commented 1 year ago

Is it possible to get 3D coordinates of ligand using CID or SID?

Approach-1

import pubchempy as pcp
pcp.download('SDF', '4369521.sdf', 4369521, 'cid',overwrite=True)

Approach-2

c = pcp.Compound.from_cid(4369521)
coords = [(c.x, c.y, c.z) for c in c.atoms]
print(coords)

In both solutions above, they give the result in 2 dimensions (2D).

I get an error when I try a code like below

import pubchempy as pcp
pcp.download('SDF', '4369521.sdf', 4369521, 'cid',overwrite=True, record_type = '3d')

I'm sure this topic will be useful for this highly sought-after question on the internet.

manassharma07 commented 10 months ago

I am also facing the same issue. Did you happen to resolve it?