ci_query: Retrieve information from ChemIDPlus

View source: R/chemid.R

ci_queryR Documentation

Retrieve information from ChemIDPlus

Description

Retrieve information from ChemIDPlus https://chem.nlm.nih.gov/chemidplus

Usage

ci_query(query, from = c("rn", "inchikey"), verbose = getOption("verbose"))

Arguments

query

character; query string

from

character; type of query string, can be one of "rn" for CAS registry numbers or "inchikey".

verbose

logical; should a verbose output be printed on the console?

Value

A list of 8 entries: name (vector), synonyms (vector), cas (vector), inchi (vector), inchikey (vector), smiles(vector), toxicity (data.frame), physprop (data.frame) and source_url.

Note

Please respect the Terms and Conditions of the National Library of Medicine, https://www.nlm.nih.gov/databases/download.html.

Examples

## Not run: 
# might fail if API is not available
y1 <- ci_query('50-00-0', from = 'rn')
y1[['50-00-0']]$inchikey

# query by inchikey
y2 <- ci_query('WSFSSNUMVMOOMR-UHFFFAOYSA-N', from = 'inchikey')
y2[[1]]$name

# query multiple compounds
comps <- c("50-00-0", "64-17-5")
y3 <- ci_query(comps, from = "rn")

# extract log-P
sapply(y3, function(y){
 if (length(y) == 1 && is.na(y))
   return(NA)
 y$physprop$Value[y$physprop$`Physical Property` == 'log P (octanol-water)']
 })

## End(Not run)

webchem documentation built on Nov. 3, 2022, 1:05 a.m.