Learn R Programming

webchem (version 0.5.0)

cs_convert: Convert identifiers using ChemSpider

Description

Submit one or more identifiers (CSID, SMILES, InChI, InChIKey or Mol) and return one or more identifiers in another format (CSID, SMILES, InChI, InChIKey or Mol).

Usage

cs_convert(query, from, to, apikey = NULL)

Arguments

query

character; query ID.

from

character; type of query ID.

to

character; type to convert to.

apikey

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

Value

Returns a vector containing the converted identifier(s).

Details

Not all conversions are supported. Allowed conversions:

  • CSID <-> InChI

  • CSID <-> InChIKey

  • CSID <-> SMILES

  • CSID -> Mol file

  • InChI <-> InChIKey

  • InChI <-> SMILES

  • InChI -> Mol file

  • InChIKey <-> Mol file

References

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

Examples

Run this code
# NOT RUN {
cs_convert("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"
)
cs_convert(160, from = "csid", to = "smiles")
# }

Run the code above in your browser using DataLab