Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inchi key api #696

Merged
merged 3 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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