Skip to content

Commit

Permalink
Merge pull request #696 from epam/inchi_key_api
Browse files Browse the repository at this point in the history
inchi key api
  • Loading branch information
even1024 authored Mar 30, 2022
2 parents a426f2b + c4a7e6e commit 3e5eee2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/wasm/indigo-ketcher/indigo-ketcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions api/wasm/indigo-ketcher/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions utils/indigo-service/service/v2/indigo_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3e5eee2

Please sign in to comment.