Learn R Programming

webchem (version 0.0.4.0)

cid_compinfo: Retrieve compound information from pubchem CID

Description

Retrieve compound information from pubchem CID, see https://pubchem.ncbi.nlm.nih.gov/

Usage

cid_compinfo(cid, first = FALSE, verbose = TRUE, ...)

Arguments

cid
character; Pubchem ID (CID).
first
logical; return only first list items? That is: a list with entries of lenght 1 (for easy conversion in a data.frame)
verbose
logical; should a verbose output be printed on the console?
...
currently not used.

Value

  • a list with entries: CID (Pubchem ID), InChIKey, InChI, synonyms, IUPACName, Canonical SMILES, Isomeric SMILES, MolecularFormula, MolecularWeight, TotalFormalCharge, XlogP, HydrogenBondDonorCount, HydrogenBondAcceptorCount, Complexity, HeavyAtomCount, AtomChiralCount, AtomChiralDefCount, AtomChiralUndefCount, BondChiralCount, BondChiralDefCount, BondChiralUndefCount, IsotopeAtomCount, CovalentUnitCount, TautomerCount

See Also

get_cid to retrieve Pubchem IDs.

Examples

Run this code
# might fail if API is not available
cid <- get_cid('Triclosan')
cid_compinfo(cid[1])

###
# multiple CIDS
comp <- c('Triclosan', 'Aspirin')
cids <- sapply(comp, function(x) get_cid(x, first = TRUE))
(ll <- lapply(cids, cid_compinfo, first = TRUE))
# as mtrix
do.call(rbind, ll)

Run the code above in your browser using DataLab