From 65c299c4c234f9a628bcb2498e7c4fdad2f80280 Mon Sep 17 00:00:00 2001 From: Roman Porozhnetov Date: Tue, 10 Oct 2023 12:33:40 +0200 Subject: [PATCH 1/5] suffoxides --- api/tests/integration/ref/formats/smiles.py.out | 4 ++++ api/tests/integration/tests/formats/smiles.py | 11 +++++++++++ .../molecule/src/molecule_stereocenters.cpp | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/api/tests/integration/ref/formats/smiles.py.out b/api/tests/integration/ref/formats/smiles.py.out index 27d92a67c4..bf61bcba26 100644 --- a/api/tests/integration/ref/formats/smiles.py.out +++ b/api/tests/integration/ref/formats/smiles.py.out @@ -81,3 +81,7 @@ C1C(O)=C(C2C=CC(C)=CC=2N)C(C)=CC=1 |wU:3.12,wD:3.3,(-2.40,1.39,;-0.80,1.39,;-0.0 atropisomer: C1C(O)=C(C2C=CC(C)=CC=2N)C(C)=CC=1 |w:3.3,3.12| C1C(O)=C(C2C=CC(C)=CC=2N)C(C)=CC=1 |w:3.3,3.12,(-2.40,1.39,;-0.80,1.39,;-0.00,2.77,;0.00,0.00,;1.60,0.00,;2.40,1.39,;4.00,1.39,;4.80,0.00,;6.40,0.00,;4.00,-1.39,;2.40,-1.39,;1.60,-2.77,;-0.80,-1.39,;0.00,-2.77,;-2.40,-1.39,;-3.20,-0.00,)| +*** Suffoxides *** +suffoxide: +C1[S@](=O)CC(=O)C=1C +C1[S@](=O)CC(=O)C=1C diff --git a/api/tests/integration/tests/formats/smiles.py b/api/tests/integration/tests/formats/smiles.py index e650df5a2c..d3ecb7248a 100644 --- a/api/tests/integration/tests/formats/smiles.py +++ b/api/tests/integration/tests/formats/smiles.py @@ -128,3 +128,14 @@ print(mol.smiles()) mol.layout() print(mol.smiles()) + +print("*** Suffoxides ***") +mols_smiles = [ + "C1=C(C)C(=O)C[S@]1=O", +] +for sm in mols_smiles: + print("suffoxide:") + mol = indigo.loadMolecule(sm) + print(mol.smiles()) + mol.layout() + print(mol.smiles()) diff --git a/core/indigo-core/molecule/src/molecule_stereocenters.cpp b/core/indigo-core/molecule/src/molecule_stereocenters.cpp index 072751255d..10b43e391d 100644 --- a/core/indigo-core/molecule/src/molecule_stereocenters.cpp +++ b/core/indigo-core/molecule/src/molecule_stereocenters.cpp @@ -1771,7 +1771,7 @@ void MoleculeStereocenters::markBond(BaseMolecule& baseMolecule, int atom_idx) for (j = 0; j < size; j++) { edge_idx = baseMolecule.findEdgeIndex(atom_idx, pyramid[size - 1]); - if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getVertex(pyramid[size - 1]).degree() == 1) + if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondOrder(edge_idx) == BOND_SINGLE && baseMolecule.getVertex(pyramid[size - 1]).degree() == 1) break; rotatePyramid(pyramid); if (size == 4) @@ -1783,7 +1783,8 @@ void MoleculeStereocenters::markBond(BaseMolecule& baseMolecule, int atom_idx) for (j = 0; j < size; j++) { edge_idx = baseMolecule.findEdgeIndex(atom_idx, pyramid[size - 1]); - if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondTopology(edge_idx) == TOPOLOGY_CHAIN && getType(pyramid[size - 1]) == 0) + if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondOrder(edge_idx) == BOND_SINGLE && + baseMolecule.getBondTopology(edge_idx) == TOPOLOGY_CHAIN && getType(pyramid[size - 1]) == 0) break; rotatePyramid(pyramid); if (size == 4) From 0a56e18af9fe278c573dce5300cc2cbaa92f2b19 Mon Sep 17 00:00:00 2001 From: Roman Porozhnetov Date: Tue, 10 Oct 2023 12:45:27 +0200 Subject: [PATCH 2/5] suffoxides --- core/indigo-core/molecule/src/molecule_stereocenters.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/indigo-core/molecule/src/molecule_stereocenters.cpp b/core/indigo-core/molecule/src/molecule_stereocenters.cpp index 10b43e391d..a0267e66db 100644 --- a/core/indigo-core/molecule/src/molecule_stereocenters.cpp +++ b/core/indigo-core/molecule/src/molecule_stereocenters.cpp @@ -1771,7 +1771,8 @@ void MoleculeStereocenters::markBond(BaseMolecule& baseMolecule, int atom_idx) for (j = 0; j < size; j++) { edge_idx = baseMolecule.findEdgeIndex(atom_idx, pyramid[size - 1]); - if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondOrder(edge_idx) == BOND_SINGLE && baseMolecule.getVertex(pyramid[size - 1]).degree() == 1) + if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondOrder(edge_idx) == BOND_SINGLE && + baseMolecule.getVertex(pyramid[size - 1]).degree() == 1) break; rotatePyramid(pyramid); if (size == 4) From e700dd70ffc9e3cd2c6e58f4911d861b75be7add Mon Sep 17 00:00:00 2001 From: Roman Porozhnetov Date: Tue, 10 Oct 2023 13:29:07 +0200 Subject: [PATCH 3/5] suffoxides --- api/tests/integration/tests/formats/smiles.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/tests/integration/tests/formats/smiles.py b/api/tests/integration/tests/formats/smiles.py index d3ecb7248a..3a835ad191 100644 --- a/api/tests/integration/tests/formats/smiles.py +++ b/api/tests/integration/tests/formats/smiles.py @@ -139,3 +139,7 @@ print(mol.smiles()) mol.layout() print(mol.smiles()) + for i in range(mol.countBonds()): + bs = mol.getBond(i).bondStereo() + if bs > 0: + print("bond:%d stereo:%d" % (i, bs) ) From d909f49688e639feabb971f4f8e4c391e16f3743 Mon Sep 17 00:00:00 2001 From: Roman Porozhnetov Date: Tue, 10 Oct 2023 13:33:57 +0200 Subject: [PATCH 4/5] py format --- api/tests/integration/tests/formats/smiles.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/tests/integration/tests/formats/smiles.py b/api/tests/integration/tests/formats/smiles.py index 3a835ad191..c110a93bae 100644 --- a/api/tests/integration/tests/formats/smiles.py +++ b/api/tests/integration/tests/formats/smiles.py @@ -130,9 +130,7 @@ print(mol.smiles()) print("*** Suffoxides ***") -mols_smiles = [ - "C1=C(C)C(=O)C[S@]1=O", -] +mols_smiles = ["C1=C(C)C(=O)C[S@]1=O"] for sm in mols_smiles: print("suffoxide:") mol = indigo.loadMolecule(sm) @@ -142,4 +140,4 @@ for i in range(mol.countBonds()): bs = mol.getBond(i).bondStereo() if bs > 0: - print("bond:%d stereo:%d" % (i, bs) ) + print("bond:%d stereo:%d" % (i, bs)) From 231c475403e99d7e536d41c50756e684a57764ca Mon Sep 17 00:00:00 2001 From: Roman Porozhnetov Date: Tue, 10 Oct 2023 14:01:12 +0200 Subject: [PATCH 5/5] tests fixed --- api/tests/integration/ref/formats/smiles.py.out | 1 + 1 file changed, 1 insertion(+) diff --git a/api/tests/integration/ref/formats/smiles.py.out b/api/tests/integration/ref/formats/smiles.py.out index bf61bcba26..8fa030b498 100644 --- a/api/tests/integration/ref/formats/smiles.py.out +++ b/api/tests/integration/ref/formats/smiles.py.out @@ -85,3 +85,4 @@ C1C(O)=C(C2C=CC(C)=CC=2N)C(C)=CC=1 |w:3.3,3.12,(-2.40,1.39,;-0.80,1.39,;-0.00,2. suffoxide: C1[S@](=O)CC(=O)C=1C C1[S@](=O)CC(=O)C=1C +bond:5 stereo:6