Home > Community > How to get smiles from pubchem CID
Upvote

VOTE

Downvote
+ Cheminformatics
+ Chemistry
Posted by
Non Academic

How to get smiles from pubchem CID

Charles McLeman  Follow

TL,DR: Assuming you still are connected to NIH, possibly a constrain by the database's rules of access.

I don't understand much why you want to re-define the generation of pubchempy's report of SMILES (which needn't be canonical ones). For example,

import pubchempy as pcpc = pcp.Compound.from_cid(5090)print(c.isomeric_smiles)

yields CS(=O)(=O)C1=CC=C(C=C1)C2=C(C(=O)OC2)C3=CC=CC=C3 (condensed from the documentation) works well (just checked with Python 3.9.8). Of course the above may be extended to query lists of compounds, too. Not for beauty, e.g.

import pubchempy as pcpcompounds = [5090, 5091, 5092]for entry in compounds:    c = pcp.Compound.from_cid(entry)    print(c.isomeric_smiles)

reports

CS(=O)(=O)C1=CC=C(C=C1)C2=C(C(=O)OC2)C3=CC=CC=C3CCCC(=O)OC1C(OC(CC1(C)OC(=O)CC)OC2C(OC(C(C2N(C)C)O)OC3C(CC(C(C=CC=CCC(OC(=O)CC(C3OC)O)C)O)C)CC=O)C)CCOC1=C(C=C(C=C1)C2CC(=O)NC2)OC3CCCC3

However, pubchempy has to follow NIH's rules of access like any other mode of access, i.e.

  • No more than 5 requests per second.
  • No more than 400 requests per minute.
  • No longer than 300 second running time per minute.

NIH's documentation, programmatic access

regardless if using NIH's PUG (with time out after $\pu{30 s}$ server time, ref), or an interface like pubchempy which recommends e.g., grouping the requests in smaller portions as strategy.

More

Upvote

VOTE

Downvote
Imran Mustifa  Follow
Thank you for the Clarification it helped me a lot!More
Upvote

VOTE

Downvote