PubChem CID versus a name, which identifier to trust
A PubChem CID points to one standardised structure. A name can point to a salt, a mixture, a stereoisomer or a typo. Resolve by CID, keep names for people.
A PubChem Compound Identifier, or CID, points to exactly one standardised structure in PubChem, so resolving a compound by CID gives you a defined molecule every time. A name points to whatever people have called that name, which may be the free base, a salt, a racemate, a single enantiomer or a misspelling. When you have both, trust the CID for the structure and keep the name for communicating with people. When you have only a name, resolve it to a CID and check the result before you compute anything.
What a CID is, and what a SID is
PubChem stores two kinds of record. A Substance, with an SID, is a deposition exactly as a contributor supplied it, with its own name, drawing and data. A Compound, with a CID, is the standardised structure that PubChem computes from one or more substances. Many substances map to one compound, which is how a drug deposited by dozens of vendors and databases ends up with one CID. Caffeine is CID 2519, aspirin is CID 2244, paracetamol is CID 1983, ibuprofen is CID 3672 and imatinib is CID 5291.
Standardisation is the point. PubChem checks valences, normalises functional group drawings, handles charges and assigns a canonical form before issuing a CID. Two depositors who drew the same molecule differently get the same CID. Two depositors who drew different things, such as the free base and the hydrochloride, get different CIDs, because to PubChem those are different structures. That is the right behaviour for an identifier, and it is also the first trap for the unwary.
Four ways a name goes wrong
A name is a label for a chemical concept, and the concept is often broader than one structure.
- Synonyms. Paracetamol, acetaminophen, APAP and several trade names refer to the same CID, but a search for one synonym in a table keyed by another returns nothing.
- Salts hidden in trade names. The trade name of imatinib refers to the mesylate, while the pharmacology literature discusses the free base. A name lookup can return either CID, and the molecular weight changes by almost a hundred grams per mole between them. The guide on salts and parent compounds explains how to recover the parent.
- Stereochemistry. Ibuprofen as a name usually means the racemate and resolves to the structure with unspecified configuration. Dexibuprofen is the single (S)-enantiomer and has a different CID. Nothing in the name warns you that one record has a stereo layer and the other does not.
- Spelling and systematic names. A dropped locant or a transposed letter in an IUPAC name can resolve to a different compound or to nothing at all. Programs that parse systematic names also disagree on edge cases.
Names also drift between languages and between regulatory regions. The International Nonproprietary Name is the most stable choice when you must use a name, and even an INN usually refers to the active moiety rather than to the marketed salt.
A resolution routine that catches most errors
Resolving by name is unavoidable when your input is a paper, a lab notebook or a spreadsheet from a colleague. A short routine keeps the errors visible.
- Look the name up and record the CID that comes back. PubChem's PUG REST interface answers a URL such as
https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/caffeine/cids/TXTwith the CID as plain text. - Fetch the molecular formula and compare it with what you expected. A chloride or a calcium in the formula tells you a salt came back.
- Check whether the structure has defined stereocentres and whether your source meant a single isomer. The guide on stereochemistry in SMILES shows how to inspect this.
- Store the CID, the InChIKey and a SMILES next to the original name, so that the next person can see what was resolved and from what.
Done once per compound, this routine takes a minute. Skipped, it produces datasets in which the same drug appears as three rows with three molecular weights.
Molecule Analysis resolves a compound from a name, a CID or a SMILES and shows the resolved structure with its formula and property profile before anything else runs. Looking at that structure for a second, and confirming it is the parent and the stereoisomer you meant, is the cheapest quality control in the whole workflow.
When the name is the right identifier
Identifiers are for machines. Names are for the people who read your report, the regulator who approves the drug and the clinician who prescribes it. A CID means nothing in a slide deck, and a trade name means a great deal to a formulation scientist, because it tells them which salt and dosage form are on the market. Drug databases such as DrugCentral key their records by the active ingredient and list the marketed forms, approvals and indications underneath, and the guide on DrugCentral explains how that catalog is built. The Drug Catalog presents those records with targets and ATC classes, so a name is often the natural starting point for a human and a CID the natural key for the pipeline.
Use the right one for each audience, and keep the mapping between them in your data.
Key points
- A PubChem CID identifies one standardised structure. A SID identifies one deposition as supplied.
- A name can refer to a free base, a salt, a racemate or a single enantiomer, and synonyms multiply the problem.
- Resolve names to CIDs, then check the formula, the stereochemistry and the salt form before computing properties.
- Store CID, InChIKey and SMILES alongside the original name so the resolution is auditable.
- Names remain the right identifier for people. Identifiers are for joins and pipelines.
Questions people ask
- What is a PubChem CID?
- A CID is the Compound Identifier that PubChem assigns to one standardised chemical structure. Caffeine is CID 2519 and aspirin is CID 2244. Many deposited substances, each with its own SID, map to one CID after PubChem standardises their structures.
- Why does a drug name return several PubChem records?
- A name can refer to the free base, one or more salts, the racemate and single enantiomers, and each of those is a separate structure with its own CID. Trade names usually point to the marketed salt while the nonproprietary name points to the parent compound.
- How do I convert a chemical name to a CID programmatically?
- PubChem's PUG REST interface accepts a name in the URL and returns the matching CIDs as text or JSON. Check the formula and stereochemistry of the result before using it, because the name lookup returns the best match rather than a guaranteed one.
- Should I store names or identifiers in my dataset?
- Store both. Keep the original name for people and for traceability, and store the resolved CID, InChIKey and SMILES as the keys you join and compute on.
Further reading
- Wikipedia, PubChem
- PubChem, PUG REST documentation
- PubChem, home page
- DrugCentral, online drug compendium
In practice: The ADMET dashboard resolves a name, a PubChem CID or a SMILES to one compound and shows the identifiers side by side, so a mismatch is visible before anything is computed.