Skip to content

Commit e15e50d

Browse files
authored
Backmerge: #1300 Stereobond is not preserved after pasting a SMILES structure (#1324)
1 parent 2758171 commit e15e50d

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

api/tests/integration/ref/formats/smiles.py.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
8181
atropisomer:
8282
C1C(O)=C(C2C=CC(C)=CC=2N)C(C)=CC=1 |w:3.3,3.12|
8383
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,)|
84+
*** Suffoxides ***
85+
suffoxide:
86+
C1[S@](=O)CC(=O)C=1C
87+
C1[S@](=O)CC(=O)C=1C
88+
bond:5 stereo:6

api/tests/integration/tests/formats/smiles.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,16 @@
128128
print(mol.smiles())
129129
mol.layout()
130130
print(mol.smiles())
131+
132+
print("*** Suffoxides ***")
133+
mols_smiles = ["C1=C(C)C(=O)C[S@]1=O"]
134+
for sm in mols_smiles:
135+
print("suffoxide:")
136+
mol = indigo.loadMolecule(sm)
137+
print(mol.smiles())
138+
mol.layout()
139+
print(mol.smiles())
140+
for i in range(mol.countBonds()):
141+
bs = mol.getBond(i).bondStereo()
142+
if bs > 0:
143+
print("bond:%d stereo:%d" % (i, bs))

core/indigo-core/molecule/src/molecule_stereocenters.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,8 @@ void MoleculeStereocenters::markBond(BaseMolecule& baseMolecule, int atom_idx)
17711771
for (j = 0; j < size; j++)
17721772
{
17731773
edge_idx = baseMolecule.findEdgeIndex(atom_idx, pyramid[size - 1]);
1774-
if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getVertex(pyramid[size - 1]).degree() == 1)
1774+
if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondOrder(edge_idx) == BOND_SINGLE &&
1775+
baseMolecule.getVertex(pyramid[size - 1]).degree() == 1)
17751776
break;
17761777
rotatePyramid(pyramid);
17771778
if (size == 4)
@@ -1783,7 +1784,8 @@ void MoleculeStereocenters::markBond(BaseMolecule& baseMolecule, int atom_idx)
17831784
for (j = 0; j < size; j++)
17841785
{
17851786
edge_idx = baseMolecule.findEdgeIndex(atom_idx, pyramid[size - 1]);
1786-
if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondTopology(edge_idx) == TOPOLOGY_CHAIN && getType(pyramid[size - 1]) == 0)
1787+
if (baseMolecule.getBondDirection(edge_idx) == 0 && baseMolecule.getBondOrder(edge_idx) == BOND_SINGLE &&
1788+
baseMolecule.getBondTopology(edge_idx) == TOPOLOGY_CHAIN && getType(pyramid[size - 1]) == 0)
17871789
break;
17881790
rotatePyramid(pyramid);
17891791
if (size == 4)

0 commit comments

Comments
 (0)