From e259d0021f82239f745b16f7838b92ffcdda3f80 Mon Sep 17 00:00:00 2001 From: even1024 Date: Tue, 29 Mar 2022 01:55:28 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=C3=AFnchi=20key=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/wasm/indigo-ketcher/indigo-ketcher.cpp | 5 +++++ api/wasm/indigo-ketcher/test.js | 7 +++++++ utils/indigo-service/service/v2/indigo_api.py | 3 +++ 3 files changed, 15 insertions(+) diff --git a/api/wasm/indigo-ketcher/indigo-ketcher.cpp b/api/wasm/indigo-ketcher/indigo-ketcher.cpp index 8106df730b..8a3379b95c 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..14944578d7 100644 --- a/utils/indigo-service/service/v2/indigo_api.py +++ b/utils/indigo-service/service/v2/indigo_api.py @@ -362,6 +362,8 @@ 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 +728,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 From e3f3d8b1bce2bf4e94fbc8875cb039d895334615 Mon Sep 17 00:00:00 2001 From: Roman Porozhnetov Date: Tue, 29 Mar 2022 03:34:14 +0300 Subject: [PATCH 2/3] clang fix --- api/wasm/indigo-ketcher/indigo-ketcher.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/wasm/indigo-ketcher/indigo-ketcher.cpp b/api/wasm/indigo-ketcher/indigo-ketcher.cpp index 8a3379b95c..fd14477ec7 100644 --- a/api/wasm/indigo-ketcher/indigo-ketcher.cpp +++ b/api/wasm/indigo-ketcher/indigo-ketcher.cpp @@ -145,8 +145,8 @@ namespace indigo } else if (outputFormat == "inchi-key" || outputFormat == "chemical/x-inchi-key") { - std::string inchi_str = _checkResultString( indigoInchiGetInchi( id() ) ); - return _checkResultString( indigoInchiGetInchiKey( inchi_str.c_str() ) ); + std::string inchi_str = _checkResultString(indigoInchiGetInchi(id())); + return _checkResultString(ndigoInchiGetInchiKey(inchi_str.c_str())); } else if (outputFormat == "inchi-aux" || outputFormat == "chemical/x-inchi-aux") { From c4a7e6eee1eb560b53378318ba8755450dd0ddfc Mon Sep 17 00:00:00 2001 From: Roman Porozhnetov Date: Tue, 29 Mar 2022 04:28:06 +0300 Subject: [PATCH 3/3] clang fix --- api/wasm/indigo-ketcher/indigo-ketcher.cpp | 2 +- utils/indigo-service/service/v2/indigo_api.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/wasm/indigo-ketcher/indigo-ketcher.cpp b/api/wasm/indigo-ketcher/indigo-ketcher.cpp index fd14477ec7..9b3bf31cc8 100644 --- a/api/wasm/indigo-ketcher/indigo-ketcher.cpp +++ b/api/wasm/indigo-ketcher/indigo-ketcher.cpp @@ -146,7 +146,7 @@ namespace indigo else if (outputFormat == "inchi-key" || outputFormat == "chemical/x-inchi-key") { std::string inchi_str = _checkResultString(indigoInchiGetInchi(id())); - return _checkResultString(ndigoInchiGetInchiKey(inchi_str.c_str())); + return _checkResultString(indigoInchiGetInchiKey(inchi_str.c_str())); } else if (outputFormat == "inchi-aux" || outputFormat == "chemical/x-inchi-aux") { diff --git a/utils/indigo-service/service/v2/indigo_api.py b/utils/indigo-service/service/v2/indigo_api.py index 14944578d7..d3cd661b20 100644 --- a/utils/indigo-service/service/v2/indigo_api.py +++ b/utils/indigo-service/service/v2/indigo_api.py @@ -363,7 +363,9 @@ def save_moldata(md, output_format=None, options={}): 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)) + 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()