Learn R Programming

webchem (version 0.5.0)

get_csid: ChemSpider ID from compound name, formula, SMILES, InChI or InChIKey

Description

Query one or more compunds by name, formula, SMILES, InChI or InChIKey and return a vector of ChemSpider IDs.

Usage

get_csid(query, from = "name", apikey = NULL, control = cs_control())

Arguments

query

character; search term.

from

character; the type of the identifier to convert from. Valid values are "name", "formula", "smiles", "inchi", "inchikey". The default value is "name".

apikey

character; your API key. If NULL (default), cs_check_key() will look for it in .Renviron or .Rprofile.

control

list; see details.

Value

Returns a data frame.

Details

Queries by SMILES, InChI or InChiKey do not use cs_control options. Queries by name use order_by and order_direction. Queries by formula also use datasources. See cs_control() for a full list of valid values for these control options.

formula can be expressed with and without LaTeX syntax.

References

https://developer.rsc.org/compounds-v1/apis

Examples

Run this code
# NOT RUN {
get_csid("triclosan")
get_csid(c("carbamazepine", "naproxene","oxygen"))
get_csid("C2H6O", from = "formula")
get_csid("C_{2}H_{6}O", from = "formula")
get_csid("CC(O)=O", from = "smiles")
get_csid("InChI=1S/C2H4O2/c1-2(3)4/h1H3,(H,3,4)", from = "inchi")
get_csid("QTBSBXVTEAMEQO-UHFFFAOYAR", from = "inchikey")
# }

Run the code above in your browser using DataLab