diff --git a/api/wasm/indigo-ketcher/indigo-ketcher.cpp b/api/wasm/indigo-ketcher/indigo-ketcher.cpp index 6c8c0515e6..ec394f40db 100644 --- a/api/wasm/indigo-ketcher/indigo-ketcher.cpp +++ b/api/wasm/indigo-ketcher/indigo-ketcher.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -299,6 +300,9 @@ namespace indigo IndigoKetcherObject loadMoleculeOrReaction(const std::string& data, const std::map& options) { + static std::unordered_map seq_formats = { + {"chemical/x-peptide-sequence", "PEPTIDE"}, {"chemical/x-rna-sequence", "RNA"}, {"chemical/x-dna-sequence", "DNA"}}; + print_js("loadMoleculeOrReaction:"); std::vector exceptionMessages; exceptionMessages.reserve(4); @@ -323,9 +327,18 @@ namespace indigo } exceptionMessages.emplace_back(indigoGetLastError()); } + else if (input_format != options.end()) + { + auto seq_it = seq_formats.find(input_format->second); + if (seq_it != seq_formats.end()) + { + objectId = indigoLoadSequenceFromString(data.c_str(), seq_it->second.c_str()); + if (objectId >= 0) + return IndigoKetcherObject(objectId, IndigoKetcherObject::EKETMolecule); + } + } else { - if (data.find("InChI") == 0) { objectId = indigoInchiLoadMolecule(data.c_str());