Skip to content

Commit

Permalink
#2332 - Error message should use "ambiguous monomer" instead of "var…
Browse files Browse the repository at this point in the history
…iant monomer" (#2691)
  • Loading branch information
AliaksandrDziarkach authored Dec 17, 2024
1 parent cd267b4 commit e142194
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions api/tests/integration/ref/formats/idt_to_ket.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ idt_unresolved.ket:SUCCEED
idt_unresolved_many.ket:SUCCEED
idt_unsplit.ket:SUCCEED
Test '!+A-$#12w12r23e32e33': got expected error 'Invalid symbols in the sequence: !,-,$,#,1,2,w,1,2,2,3,e,3,2,e,3,3'
Test '(Y:)': got expected error 'Invalid IDT ambiguous monomer (Y:)'
Test '(YY:00330067)': got expected error 'Invalid mixed base - only numerical index allowed.'
Test '+/5Phos/A': got expected error 'Sugar prefix could not be used with modified monomer.'
Test '/': got expected error 'Unexpected end of data'
Expand Down
1 change: 1 addition & 0 deletions api/tests/integration/tests/formats/idt_to_ket.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def find_diff(a, b):
"/3Phos/*": "Symbol '*' could be placed only between two nucleotides/nucleosides.",
"r(B1:50003000)(B1)": "Unknown mixed base 'B1'",
"(YY:00330067)": "Invalid mixed base - only numerical index allowed.",
"(Y:)": "Invalid IDT ambiguous monomer (Y:)",
}
for idt_seq in sorted(idt_errors.keys()):
error = idt_errors[idt_seq]
Expand Down
6 changes: 3 additions & 3 deletions core/indigo-core/molecule/src/ket_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ KetAmbiguousMonomerTemplate& KetDocument::addAmbiguousMonomerTemplate(const std:
IdtAlias idt_alias, std::vector<KetAmbiguousMonomerOption>& options)
{
if (_ambiguous_templates.find(id) != _ambiguous_templates.end())
throw Error("Variant monomer template '%s' already exists.", id.c_str());
throw Error("Ambiguous monomer template '%s' already exists.", id.c_str());
_ambiguous_templates_ids.emplace_back(id);
auto it = _ambiguous_templates.try_emplace(id, subtype, id, name, idt_alias, options);
_template_id_to_type.emplace(id, KetBaseMonomerTemplate::TemplateType::AmbiguousMonomerTemplate);
Expand All @@ -120,7 +120,7 @@ std::unique_ptr<KetBaseMonomer>& KetDocument::addAmbiguousMonomer(const std::str
std::unique_ptr<KetBaseMonomer>& KetDocument::addAmbiguousMonomer(const std::string& id, const std::string& alias, const std::string& template_id)
{
if (_monomers.find(id) != _monomers.end())
throw Error("Variant monomer '%s' already exists.", id.c_str());
throw Error("Ambiguous monomer '%s' already exists.", id.c_str());
auto it = _monomers.try_emplace(id, std::make_unique<KetAmbiguousMonomer>(id, alias, template_id));
it.first->second->setAttachmentPoints(_ambiguous_templates.at(template_id).attachmentPoints());
_monomer_ref_to_id.emplace(it.first->second->ref(), id);
Expand Down Expand Up @@ -222,7 +222,7 @@ void KetDocument::processAmbiguousMonomerTemplates()
has_probability = true;
}
if (has_ratio && has_probability)
throw Error("Variant monomer template '%s' has options with both ratio and probability set.", it.first.c_str());
throw Error("Ambiguous monomer template '%s' has options with both ratio and probability set.", it.first.c_str());
MonomerClass monomer_class = _templates.at(options[0].templateId()).monomerClass();
for (auto& opt_it : options)
{
Expand Down
2 changes: 1 addition & 1 deletion core/indigo-core/molecule/src/ket_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ const std::map<std::string, int>& KetConnection::getStringPropStrToIdx() const
return str_to_idx;
}

IMPL_ERROR(KetAmbiguousMonomer, "Ket Variant Monomer")
IMPL_ERROR(KetAmbiguousMonomer, "Ket Ambiguous Monomer")

const std::map<std::string, int>& KetAmbiguousMonomer::getIntPropStrToIdx() const
{
Expand Down

0 comments on commit e142194

Please sign in to comment.