Retrieve the synonym list for one or more PubChem Compound IDs (CIDs) via the PUG REST API. Synonyms include IUPAC names, common names, CAS numbers, DTXSIDs, trade names, and other identifiers.
Arguments
- cid
Integer or character vector of PubChem CIDs.
- tidy
Logical. If
TRUE(default), returns a long-format tibble withcidandsynonymcolumns. IfFALSE, returns a list of lists withCIDandSynonymelements.- cache
Logical. If
TRUE(default), results are cached in the session environment keyed by CID, so repeated calls for the same CIDs are instant.
Value
When tidy = TRUE: a tibble with columns cid (integer) and
synonym (character). When tidy = FALSE: a list where each element
contains CID and Synonym fields. Returns an empty tibble/list for
invalid CIDs.
Details
For multiple CIDs, requests are batched at 100 CIDs per POST request. This is significantly faster than per-CID GET requests (e.g., 500 CIDs requires 5 POST requests instead of 500 GET requests).
See also
pubchem_search() to find CIDs,
util_pubchem_resolve_dtxsid() to extract DTXSIDs from synonym lists,
ct_chemical_synonym_search() for CompTox Dashboard synonyms.
Examples
if (FALSE) { # \dontrun{
# Single CID
pubchem_synonyms(2244)
# Multiple CIDs (uses bulk POST)
pubchem_synonyms(c(2244, 6623))
# Raw list format
pubchem_synonyms(2244, tidy = FALSE)
} # }
