post_convert: Convert between chemical identifiers

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/TOOLS-post_convert.R

Description

Functionality to convert between different chemical identifier formats: InChI, InChIKey, Mol, and SMILES.

Usage

1
2
3
4
5
6
7
8
post_convert(
  input,
  inputFormat,
  outputFormat,
  apikey,
  coerce = FALSE,
  simplify = FALSE
)

Arguments

input

A character string in the specified inputFormat.

inputFormat

A character string indicating which format the input has. Can be one of the following: InChI, InChIKey, Mol, or SMILES. See Details for possible conversions.

outputFormat

A character string indicating which type of output is desired. Can be one of the following: InChI, InChIKey, Mol, or SMILES. See Details for possible conversions.

apikey

A 32-character string with a valid key for ChemSpider's API services.

coerce

logical: should the list be coerced to a data.frame? Defaults to FALSE.

simplify

logical: should the results be simplified to a vector? Defaults to FALSE.

Details

"Specify the input format as a string called 'inputFormat', and the output as a string called 'outputFormat'. Allowed conversions: from InChI to InChI Key, from InChI to Mol file, from InChI to SMILES, from InChIKey to InChI, from InChI Key to Mol file, from Mol file to InChI, from Mol file to InChI Key, from SMILES to InChI."

The identifier names are NOT case sensitive!

Value

A character string with the desired converted identifier

Author(s)

Raoul Wolf (https://github.com/RaoulWolf/)

See Also

https://developer.rsc.org/compounds-v1/apis/post/tools/convert

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
## Convert the InChI string of caffeine to a SMILES formula
input <- "InChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3"
inputFormat <- "InChI"
outputFormat <- "SMILES"
apikey <- "A valid 32-character Chemspider API key"
post_convert(input = input, inputFormat = inputFormat, outputFormat = outputFormat, apikey = apikey)

## End(Not run)

NIVANorge/chemspiderapi documentation built on Jan. 10, 2021, 10:12 a.m.