Skip to content

Commit

Permalink
sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
even1024 committed Dec 26, 2023
1 parent 0d31775 commit eac0055
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion api/wasm/indigo-ketcher/indigo-ketcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -299,6 +300,9 @@ namespace indigo

IndigoKetcherObject loadMoleculeOrReaction(const std::string& data, const std::map<std::string, std::string>& options)
{
static std::unordered_map<std::string, std::string> seq_formats = {
{"chemical/x-peptide-sequence", "PEPTIDE"}, {"chemical/x-rna-sequence", "RNA"}, {"chemical/x-dna-sequence", "DNA"}};

print_js("loadMoleculeOrReaction:");
std::vector<std::string> exceptionMessages;
exceptionMessages.reserve(4);
Expand All @@ -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());
Expand Down

0 comments on commit eac0055

Please sign in to comment.