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

#1300 Stereobond is not preserved after pasting a SMILES structure #1314

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading