Learn R Programming

webchem (version 0.4.0)

cs_convert: Convert identifiers using ChemSpider

Description

Convert identifiers using ChemSpider

Usage

cs_convert(query, from = c("csid", "inchikey", "inchi", "smiles"),
  to = c("csid", "inchikey", "inchi", "smiles", "mol"), verbose = TRUE,
  token = NULL, ...)

Arguments

query

character; query ID.

from

character; type of query ID.

to

character; type to convert to.

verbose

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

token

character; security token. Converting from csid to mol requires a token.

...

futher arguments passed. Currently onl parse, see also cs_csid_mol

Value

Depends on to. if to = 'mol' then an RMol-Object, else a character string.

See Also

There are many low level functions underlying, which are exported from the package. The naming scheme is cs_from_to() here's a list and links to their manual pages:

Check parse_mol for a description of the Mol R Object.

Examples

Run this code
# NOT RUN {
# might fail if API is not available
cs_convert('BQJCRHHNABKAKU-KBQPJGBKSA-N', from = 'inchikey', to = 'csid')
cs_convert(c('BQJCRHHNABKAKU-KBQPJGBKSA-N', 'BQJCRHHNABKAKU-KBQPJGBKSA-N'),
    from = 'inchikey', to = 'csid')
cs_convert('BQJCRHHNABKAKU-KBQPJGBKSA-N', from = 'inchikey', to = 'inchi')
cs_convert('BQJCRHHNABKAKU-KBQPJGBKSA-N', from = 'inchikey', to = 'mol')
# }

Run the code above in your browser using DataLab