diff --git a/api/wasm/indigo-ketcher/indigo-ketcher.cpp b/api/wasm/indigo-ketcher/indigo-ketcher.cpp index 8106df730b..9b3bf31cc8 100644 --- a/api/wasm/indigo-ketcher/indigo-ketcher.cpp +++ b/api/wasm/indigo-ketcher/indigo-ketcher.cpp @@ -143,6 +143,11 @@ namespace indigo { return _checkResultString(indigoInchiGetInchi(id())); } + else if (outputFormat == "inchi-key" || outputFormat == "chemical/x-inchi-key") + { + std::string inchi_str = _checkResultString(indigoInchiGetInchi(id())); + return _checkResultString(indigoInchiGetInchiKey(inchi_str.c_str())); + } else if (outputFormat == "inchi-aux" || outputFormat == "chemical/x-inchi-aux") { std::stringstream ss; diff --git a/api/wasm/indigo-ketcher/test.js b/api/wasm/indigo-ketcher/test.js index 1658d97568..c1947aa744 100644 --- a/api/wasm/indigo-ketcher/test.js +++ b/api/wasm/indigo-ketcher/test.js @@ -401,6 +401,13 @@ M END options.delete(); }); + test("convert", "inchi-key", () => { + let options = new indigo.MapStringString(); + const inchi = indigo.convert(mol_smiles, "inchi-key", options); + assert.equal(inchi, "UHOVQNZJYSORNB-UHFFFAOYSA-N"); + options.delete(); + }); + test("convert", "inchi-aux", () => { let options = new indigo.MapStringString(); const inchi_aux = indigo.convert(mol_smiles, "inchi-aux", options); diff --git a/utils/indigo-service/service/v2/indigo_api.py b/utils/indigo-service/service/v2/indigo_api.py index 67666e8c35..d3cd661b20 100644 --- a/utils/indigo-service/service/v2/indigo_api.py +++ b/utils/indigo-service/service/v2/indigo_api.py @@ -362,6 +362,10 @@ def save_moldata(md, output_format=None, options={}): return md.struct.cml() elif output_format == "chemical/x-inchi": return md.struct.dispatcher.inchi.getInchi(md.struct) + elif output_format == "chemical/x-inchi-key": + return md.struct.dispatcher.inchi.getInchiKey( + md.struct.dispatcher.inchi.getInchi(md.struct) + ) elif output_format == "chemical/x-inchi-aux": res = md.struct.dispatcher.inchi.getInchi(md.struct) aux = md.struct.dispatcher.inchi.getAuxInfo() @@ -726,6 +730,7 @@ def convert(): - chemical/x-chemaxon-cxsmiles - chemical/x-cml - chemical/x-inchi + - chemical/x-inchi-key - chemical/x-iupac - chemical/x-daylight-smarts - chemical/x-inchi-aux