Skip to contents

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.

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).

Native credential and configuration errors stop the call; other PubChem Faults retain their warning and empty-result behavior.

Usage

pubchem_synonyms(cid, tidy = TRUE, cache = TRUE)

Arguments

cid

Integer or character vector of PubChem CIDs.

tidy

Logical. If `TRUE` (default), returns a long-format tibble with `cid` and `synonym` columns. If `FALSE`, returns a list of lists with `CID` and `Synonym` elements.

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.

See also

[pubchem_search()] to find CIDs, [util_pubchem_resolve_dtxsid()] to extract DTXSIDs from synonym lists, [ct_chemical_synonym_search_by_dtxsid()] for CompTox Dashboard synonyms.

Examples

if (FALSE) { # \dontrun{
pubchem_synonyms(cid = 2244L)
pubchem_synonyms(cid = 2244L, tidy = FALSE)
} # }