Skip to content

Unrelated double bond stereochemistry is lost when an atom is removed #1221

@JonasSchaub

Description

@JonasSchaub

Dear all,

please consider the following code:

IAtomContainer mol = new SmilesParser(SilentChemObjectBuilder.getInstance()).parseSmiles("C[C@@H](O)CC[C@H](C)/C=C(/C)C(=O)O");
SmilesGenerator smiGen = new SmilesGenerator(SmiFlavor.Stereo);
System.out.println(smiGen.create(mol));
mol.removeAtom(0);
System.out.println(smiGen.create(mol));

Input structure:

Image

The Output:

C[C@@H](O)CC[C@H](C)/C=C(/C)\C(=O)O
[CH](O)CC[C@H](C)C=C(C)C(=O)O

Before removal:

Image

After removal of one atom (sorry for the orientation flip):

Image

This shows that even tough an atom that has nothing to do with the double bond stereochemistry "further down the line" is removed here, said stereo configuration is lost.

I think the problem is in this method:

private void updateStereochemistry(IBond removedBond) {

At the end, a double bond stereochemistry object is marked as invalidated when it has no overlap with the removed bond/atom.

What do you think about this?

I tried fixing it by simply removing these lines:

} else {
    invalidated.add(se);
}

... but that caused a test to fail (SmilesGeneratorTest.deletingBondUpdatesCisTrans2().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions