-
Notifications
You must be signed in to change notification settings - Fork 114
Bugfix/#2045 Export of unresolved monomer to everything except KET and IDT should cause specific error message (but it doesn't) #2806
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
base: master
Are you sure you want to change the base?
Changes from all commits
6f54586
eb37624
1072a52
d744462
70c94e3
18dcaee
4527c8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,3 +316,167 @@ TEST_F(IndigoApiFormatsTest, ket_to_idt) | |
// printf("res=%s", res); | ||
ASSERT_STREQ("ARAS", res); | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_mol_v3000_unknown_monomers) | ||
{ | ||
try | ||
{ | ||
int molecule = -1; | ||
molecule = indigoLoadKetDocumentFromFile(dataPath("molecules/basic/unknown_monomers.ket").c_str()); | ||
indigoSetOption("molfile-saving-mode", "3000"); | ||
|
||
indigoMolfile(molecule); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("molfile saver: i2AmPr cannot be written in MDL Molfile format.", e.what()); | ||
} | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_mol_v2000_unknown_monomers) | ||
{ | ||
try | ||
{ | ||
int molecule = -1; | ||
molecule = indigoLoadKetDocumentFromFile(dataPath("molecules/basic/unknown_monomers.ket").c_str()); | ||
indigoSetOption("molfile-saving-mode", "2000"); | ||
|
||
indigoMolfile(molecule); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("molfile saver: i2AmPr cannot be written in MDL Molfile format.", e.what()); | ||
} | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_sdf_v3000_unknown_monomers) | ||
{ | ||
try | ||
{ | ||
int molecule = -1; | ||
molecule = indigoLoadKetDocumentFromFile(dataPath("molecules/basic/unknown_monomers.ket").c_str()); | ||
indigoSetOption("molfile-saving-mode", "3000"); | ||
|
||
auto buffer = indigoWriteBuffer(); | ||
auto comp_it = indigoIterateComponents(molecule); | ||
AliaksandrDziarkach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
while (indigoHasNext(comp_it)) | ||
{ | ||
const auto frag = indigoNext(comp_it); | ||
const auto mol = indigoClone(frag); | ||
indigoSdfAppend(buffer, mol); | ||
} | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("molfile saver: i2AmPr cannot be written in MDL Molfile format.", e.what()); | ||
} | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_sdf_v2000_unknown_monomers) | ||
{ | ||
try | ||
{ | ||
int molecule = -1; | ||
molecule = indigoLoadKetDocumentFromFile(dataPath("molecules/basic/unknown_monomers.ket").c_str()); | ||
indigoSetOption("molfile-saving-mode", "2000"); | ||
|
||
auto buffer = indigoWriteBuffer(); | ||
auto comp_it = indigoIterateComponents(molecule); | ||
|
||
while (indigoHasNext(comp_it)) | ||
{ | ||
const auto frag = indigoNext(comp_it); | ||
const auto mol = indigoClone(frag); | ||
indigoSdfAppend(buffer, mol); | ||
} | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("molfile saver: i2AmPr cannot be written in MDL Molfile format.", e.what()); | ||
} | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_rdf_v3000_unknown_reaction) | ||
{ | ||
try | ||
{ | ||
int reaction = -1; | ||
reaction = indigoLoadReactionFromFile(dataPath("molecules/basic/unknown_reaction.ket").c_str()); | ||
indigoSetOption("molfile-saving-mode", "2000"); | ||
|
||
auto buffer = indigoWriteBuffer(); | ||
auto reac_it = indigoIterateReactions(reaction); | ||
indigoRdfHeader(buffer); | ||
|
||
while (indigoHasNext(reac_it)) | ||
{ | ||
const auto reac_obj = indigoNext(reac_it); | ||
const auto reac = indigoClone(reac_obj); | ||
indigoRdfAppend(buffer, reac); | ||
} | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("molfile saver: i2AmPr cannot be written in MDL Molfile format.", e.what()); | ||
} | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_rdf_v2000_unknown_reaction) | ||
{ | ||
try | ||
{ | ||
int reaction = -1; | ||
reaction = indigoLoadReactionFromFile(dataPath("molecules/basic/unknown_reaction.ket").c_str()); | ||
indigoSetOption("molfile-saving-mode", "2000"); | ||
|
||
auto buffer = indigoWriteBuffer(); | ||
auto reac_it = indigoIterateReactions(reaction); | ||
indigoRdfHeader(buffer); | ||
|
||
while (indigoHasNext(reac_it)) | ||
{ | ||
const auto reac_obj = indigoNext(reac_it); | ||
const auto reac = indigoClone(reac_obj); | ||
indigoRdfAppend(buffer, reac); | ||
} | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("molfile saver: i2AmPr cannot be written in MDL Molfile format.", e.what()); | ||
} | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_canonical_smarts_unknown_monomers) | ||
{ | ||
try | ||
{ | ||
int molecule = -1; | ||
molecule = indigoLoadMoleculeFromFile(dataPath("molecules/basic/unknown_monomers.ket").c_str()); | ||
|
||
auto buffer = indigoWriteBuffer(); | ||
|
||
indigoCanonicalSmarts(molecule); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("SMILES saver: i2AmPr cannot be written in SMILES/SMARTS format.", e.what()); | ||
} | ||
} | ||
|
||
TEST_F(IndigoApiFormatsTest, ket_to_smarts_unknown_monomers) | ||
{ | ||
try | ||
{ | ||
int molecule = -1; | ||
molecule = indigoLoadMoleculeFromFile(dataPath("molecules/basic/unknown_monomers.ket").c_str()); | ||
|
||
auto buffer = indigoWriteBuffer(); | ||
|
||
indigoSmarts(molecule); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
ASSERT_STREQ("core: <KetDocument> can not be converted to SMARTS", e.what()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This message looks wrong.
just to be sure that exception thrown There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exception is thrown in
In this case, do I still need to write code in the way you suggest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Beacuse after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've checked. Yes, it is not throwing an exception. In
At the end of those calls The first and the second ones have different behavior:
Could you tell, please, which behavior is expected and which one is not? Maybe you have any other suggestions to fix the bug due to my lack of understanding of how the things are working. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
{ | ||
"root": { | ||
"nodes": [ | ||
{ | ||
"$ref": "monomer0" | ||
} | ||
], | ||
"connections": [], | ||
"templates": [ | ||
{ | ||
"$ref": "monomerTemplate-unknown_monomer_with_idt_alias_i2AmPr" | ||
} | ||
] | ||
}, | ||
"monomer0": { | ||
"type": "monomer", | ||
"id": "0", | ||
"position": { | ||
"x": 1.25, | ||
"y": -1.25 | ||
}, | ||
"alias": "i2AmPr", | ||
"templateId": "unknown_monomer_with_idt_alias_i2AmPr", | ||
"seqid": 0 | ||
}, | ||
"monomerTemplate-unknown_monomer_with_idt_alias_i2AmPr": { | ||
"type": "monomerTemplate", | ||
"atoms": [ | ||
{ | ||
"label": "C", | ||
"location": [ | ||
0, | ||
0, | ||
0 | ||
] | ||
}, | ||
{ | ||
"label": "C", | ||
"location": [ | ||
1, | ||
1, | ||
1 | ||
] | ||
}, | ||
{ | ||
"label": "C", | ||
"location": [ | ||
2, | ||
2, | ||
2 | ||
] | ||
}, | ||
{ | ||
"label": "C", | ||
"location": [ | ||
3, | ||
3, | ||
3 | ||
] | ||
} | ||
], | ||
"bonds": [ | ||
{ | ||
"type": 1, | ||
"atoms": [ | ||
0, | ||
1 | ||
] | ||
}, | ||
{ | ||
"type": 1, | ||
"atoms": [ | ||
1, | ||
2 | ||
] | ||
}, | ||
{ | ||
"type": 1, | ||
"atoms": [ | ||
2, | ||
3 | ||
] | ||
}, | ||
{ | ||
"type": 1, | ||
"atoms": [ | ||
0, | ||
3 | ||
] | ||
} | ||
], | ||
"class": "CHEM", | ||
"id": "unknown_monomer_with_idt_alias_i2AmPr", | ||
"fullName": "i2AmPr", | ||
"alias": "i2AmPr", | ||
"attachmentPoints": [ | ||
{ | ||
"attachmentAtom": 0, | ||
"leavingGroup": { | ||
"atoms": [] | ||
} | ||
}, | ||
{ | ||
"attachmentAtom": 1, | ||
"leavingGroup": { | ||
"atoms": [] | ||
} | ||
}, | ||
{ | ||
"attachmentAtom": 2, | ||
"leavingGroup": { | ||
"atoms": [] | ||
} | ||
}, | ||
{ | ||
"attachmentAtom": 3, | ||
"leavingGroup": { | ||
"atoms": [] | ||
} | ||
} | ||
], | ||
"idtAliases": { | ||
"base": "i2AmPr" | ||
}, | ||
"unresolved": true, | ||
"naturalAnalogShort": "" | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.