Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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, verbose = TRUE, apikey = 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?

apikey

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

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

Value

Returns a vector containing the converted identifier(s).

Note

An API key is needed. Register at https://developer.rsc.org/ for an API key. Please respect the Terms & Conditions. The Terms & Conditions can be found at https://developer.rsc.org/terms.

References

Eduard Szöcs, Tamás Stirling, Eric R. Scott, Andreas Scharmüller, Ralf B. Schäfer (2020). webchem: An R Package to Retrieve Chemical Information from the Web. Journal of Statistical Software, 93(13). doi: 10.18637/jss.v093.i13.

Examples

## 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")

## End(Not run)

webchem

Chemical Information from the Web

v1.1.1
MIT + file LICENSE
Authors
Eduard Szöcs [aut], Robert Allaway [ctb], Daniel Muench [ctb], Johannes Ranke [ctb], Andreas Scharmüller [ctb], Eric R Scott [ctb], Jan Stanstrup [ctb], João Vitor F Cavalcante [ctb], Gordon Getzinger [ctb], Tamás Stirling [ctb, cre]
Initial release
2021-02-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.