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

MolfileSaver add Data S-Groups to molecule at saveMolecule() #1200

Closed
AliaksandrDziarkach opened this issue Jul 26, 2023 · 0 comments · Fixed by #1208
Closed

MolfileSaver add Data S-Groups to molecule at saveMolecule() #1200

AliaksandrDziarkach opened this issue Jul 26, 2023 · 0 comments · Fixed by #1208
Assignees
Labels
Projects

Comments

@AliaksandrDziarkach
Copy link
Collaborator

Create next UT in indigo-core-unit-tests:

TEST_F(IndigoCoreFormatsTest,mol_saver_issue)
{
    Molecule t_mol;

    loadMolecule(R"(
  -INDIGO-07262316452D

  6  6  0  0  0  0  0  0  0  0999 V2000
   -1.4617   -0.6508    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.3856   -0.8000    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    2.5747    0.2706    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    1.9239    1.7323    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.3327    1.5650    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0  0  0  0
  2  3  4  0  0  0  0
  3  4  4  0  0  0  0
  4  5  4  0  0  0  0
  5  6  4  0  0  0  0
  6  2  4  0  0  0  0
M  STY  4   1 DAT   2 DAT   3 DAT   4 DAT
M  SLB  4   1   1   2   2   3   3   4   4
M  SAL   1  1   3
M  SDT   1 MRV_IMPLICIT_H                                                       
M  SDD   1     0.0000    0.0000    DA    ALL  1       1  
M  SED   1 IMPL_H1
M  SAL   2  1   4
M  SDT   2 MRV_IMPLICIT_H                                                       
M  SDD   2     0.0000    0.0000    DA    ALL  1       1  
M  SED   2 IMPL_H1
M  SAL   3  1   3
M  SDT   3 MRV_IMPLICIT_H                                                       
M  SDD   3     0.0000    0.0000    DA    ALL  1       1  
M  SED   3 IMPL_H1
M  SAL   4  1   4
M  SDT   4 MRV_IMPLICIT_H                                                       
M  SDD   4     0.0000    0.0000    DA    ALL  1       1  
M  SED   4 IMPL_H1
M  END
)", t_mol);
    ASSERT_EQ(t_mol.sgroups.getSGroupCount(), 0);
    Array<char> out;
    ArrayOutput std_out(out);
    MolfileSaver saver(std_out);
    ASSERT_EQ(t_mol.sgroups.getSGroupCount(), 0);
    saver.saveMolecule(t_mol);
    ASSERT_EQ(t_mol.sgroups.getSGroupCount(), 2);
    saver.saveMolecule(t_mol);
    ASSERT_EQ(t_mol.sgroups.getSGroupCount(), 4);
    saver.saveMolecule(t_mol);
    ASSERT_EQ(t_mol.sgroups.getSGroupCount(), 6);
}

This test passed which is wrong - Sgroup count should not increase after saveMolecule() and should keep value 0.
This is result of MolfileSaver option add_implicit_h incorect processing in saveMolecule().

        bool add_implicit_h;  // If true then MRV_IMPLICIT_H Data S-groups will be added for saving
                              // the number of implicit H for aromatic atoms
                              // (if it is required for correct de-aromatization) (default value is true)

Instead of adding Sgroups to molecule temporary MoleculeSGroups variable should be used.

@AliaksandrDziarkach AliaksandrDziarkach self-assigned this Aug 1, 2023
@AliaksandrDziarkach AliaksandrDziarkach added this to the Indigo-1.14.0-rc.1 milestone Aug 1, 2023
@AliaksandrDziarkach AliaksandrDziarkach added this to Product Backlog in Indigo via automation Aug 1, 2023
@AliaksandrDziarkach AliaksandrDziarkach moved this from Product Backlog to In progress in Indigo Aug 1, 2023
@even1024 even1024 moved this from In progress to Done in Indigo Aug 8, 2023
@even1024 even1024 closed this as completed Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Indigo
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants