This is a test version of Biostars. For the public version, visit https://www.biostars.org.
SDF data from pubchem database by entering SID or CID of molecule

Hi All, I want to download the SDF file data for a list of pubchem compounds. I have SID, CID information of all of the molecules. It will be difficult to retrieve the SDF one by one for all of these compounds. Is there any tools/softwares to collect the SDF data by entering these SID or CID? Thank you for suggestion

pubchem sdf file of molecule sdf from pubchem

2 answers

You can use PubChemPy Python wrapper for PUG REST API:

import pubchempy as pcp
pcp.download('SDF', '5090.sdf', 5090, 'cid')

So above code downloads an SDF file for compound with CID 5090.

Thank you. i will work on it

I have tried using SID but it is not working, that is

pcp.download('SDF', '134310260.sdf', 134310260, 'sid')

Log in to answer this question.