This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is there any way to obtain PubChem CID using IUPAC name ( via eutils ncbi )

Hi all, I am new to ncbi entrez eutility and got stuck with a problem, whenever i am trying a search:

eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=<db_name>&term=<term_name>

I am getting a whole lot of uid's but, i want only a particular id (i.e. of <term_name>)

Is there any way to achieve that.

pubchem ncbi

Would help to show an example term and output. Depending on the precise search term, getting "a whole lot of uids" is a common and expected result.

In my case i need to get a cid (for eg. phenol "CID:996") and then link that id programatically to other db's.

but if I do:

eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pccompound&term=phenol

I'm getting a whole lot of uid's but I only need a particular id (i.e CID:996) and not all other id's as that'll be an overhead.

So, is there any way to get id for the exact term(here:phenol) using eutils[just one id].

You can use qualifiers in the term. For example:

term=phenol[UPAC] 

to search by IUPAC Name. However in this case (and many others), that will still not result in a 1:1 mapping to UIDs. Looks from your comment like you found a good solution.

Yes, even IUPAC field provides a bunch of id's.

Wonder if it can be done via eutils.

1 answer

You can script this easily with the Cactvs Cheminformatics Toolkit (free academic versions at www.xemistry.com/academic)

Here an example for aspirin, Tcl version:

---snip--

echo [ens get "2-acetyloxybenzoic acid" E_CID"]

---snip--

Python version:

---snip--

print(Ens("2-acetyloxybenzoic acid").E_CID)

---snip---

Please be aware that the name resolution is not 100% reliable, and that above script retrieves the structure with most references - the case with multiple CIDs cited above is not an error, but an indication of limitations in name generation, structure standardization, etc.

Well, internally the toolkit uses EUtils and PUG to communicate with PubChem. But if the method is more important to you than the result, this may of course not be the right solution.

Log in to answer this question.