Skip to content

Commit

Permalink
#1300 Stereobond is not preserved after pasting a SMILES structure (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
even1024 authored Oct 10, 2023
1 parent ddaf0ff commit 6e0ec85
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions api/tests/integration/ref/formats/smiles.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ 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
bond:5 stereo:6
13 changes: 13 additions & 0 deletions api/tests/integration/tests/formats/smiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,16 @@
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())
for i in range(mol.countBonds()):
bs = mol.getBond(i).bondStereo()
if bs > 0:
print("bond:%d stereo:%d" % (i, bs))
6 changes: 4 additions & 2 deletions core/indigo-core/molecule/src/molecule_stereocenters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.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)
Expand All @@ -1783,7 +1784,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)
Expand Down

0 comments on commit 6e0ec85

Please sign in to comment.