Skip to contents

Retrieve computed physico-chemical properties for one or more PubChem Compound IDs (CIDs) via the PUG REST API.

Usage

pubchem_properties(cid, properties = NULL, cache = TRUE)

Arguments

cid

Integer or character vector of PubChem CIDs. Does NOT accept compound names or DTXSIDs — use pubchem_search() first to resolve CIDs.

properties

Character vector of property names to retrieve. If NULL (default), returns 13 core properties: MolecularFormula, MolecularWeight, CanonicalSMILES, InChI, InChIKey, XLogP, TPSA, HBondDonorCount, HBondAcceptorCount, Complexity, ExactMass, MonoisotopicMass, HeavyAtomCount.

cache

Logical. If TRUE (default), results are cached in the session environment keyed by CID and property set, so repeated calls are instant.

Value

A tibble with one row per CID and columns for each requested property plus a CID column. Returns an empty tibble if no results are found.

Details

Property names are validated against PubChem's documented allowlist before the request is made. Invalid property names cause an immediate error.

For multiple CIDs, requests are batched at 100 CIDs per POST request (PubChem's documented limit for list-based requests).

See also

pubchem_search() to find CIDs by name/structure, ct_chemical_property_summary_search() for CompTox Dashboard properties.

Examples

if (FALSE) { # \dontrun{
# Default properties for aspirin
pubchem_properties(2244)

# Specific properties for multiple CIDs
pubchem_properties(c(2244, 6623), properties = c("MolecularWeight", "XLogP"))
} # }