is.inchikey: Check if input is a valid inchikey

View source: R/utils.R

is.inchikeyR Documentation

Check if input is a valid inchikey

Description

This function checks if a string is a valid inchikey. Inchikey must fulfill the following criteria: 1) consist of 27 characters; 2) be all uppercase, all letters (no numbers); 3) contain two hyphens at positions 15 and 26; 4) 24th character (flag character) be 'S' (Standard InChI) or 'N' (non-standard) 5) 25th character (version character) must be 'A' (currently).

Usage

is.inchikey(
  x,
  type = c("format", "chemspider"),
  verbose = getOption("verbose")
)

Arguments

x

character; input InChIKey

type

character; How should be checked? Either, by format (see above) ('format') or by ChemSpider ('chemspider').

verbose

logical; print messages during processing to console?

Value

a logical

Note

This function can handle only one inchikey string.

References

Heller, Stephen R., et al. "InChI, the IUPAC International Chemical Identifier." Journal of Cheminformatics 7.1 (2015): 23.

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). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v093.i13")}.

Examples

is.inchikey('BQJCRHHNABKAKU-KBQPJGBKSA-N')
is.inchikey('BQJCRHHNABKAKU-KBQPJGBKSA')
is.inchikey('BQJCRHHNABKAKU-KBQPJGBKSA-5')
is.inchikey('BQJCRHHNABKAKU-KBQPJGBKSA-n')
is.inchikey('BQJCRHHNABKAKU/KBQPJGBKSA/N')
is.inchikey('BQJCRHHNABKAKU-KBQPJGBKXA-N')
is.inchikey('BQJCRHHNABKAKU-KBQPJGBKSB-N')

webchem documentation built on July 9, 2023, 5:30 p.m.