Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1258 Kekulisation fails when SDF bond order is 4

cdk-1.4.x
open
9
2015-01-27
2012-10-05
Nina Jeliazkova
No

Kekulisation (via FixBondOrderTool) fails with the structure read from SDF file with bond order 4. (doesn't assign any double bond order to the 5-membered aromatic ring).

The FixBondOrderTool works fine if the same structure is read from SMILES
c1nc(c2c(n1)n(cn2)[C@H]3C@@HO)O)N

The reason for the error is likely due to specifics of MDL reader code, which assigns different implicit H count for the atoms in the 5-membered ring, compared to what comes from the SMILES reader.

The SDF file is attached.

/
This fails
*/
@Test
public void test_3426327() throws Exception {
//rules = new SMARTCYPPlugin();
FixBondOrdersTool fbt = new FixBondOrdersTool();
InputStream in = getClass().getClassLoader().getResourceAsStream("bondorder4.sdf");
IIteratingChemObjectReader reader = new IteratingMDLReader(in,SilentChemObjectBuilder.getInstance());
SmilesGenerator g = new SmilesGenerator();
g.setUseAromaticityFlag(false);
try {
while (reader.hasNext()) {
IMolecule mol = (IMolecule)reader.next();
int aromaticAtoms = 0;
int doubleBonds = 0;
for (IAtom atom : mol.atoms()) {
if(atom.getFlag(CDKConstants.ISAROMATIC)) aromaticAtoms++;

            }
            for (IBond bond: mol.bonds()) {
                switch (bond.getOrder()) {
                case DOUBLE: {doubleBonds++; break;} 
                }
            }
            Assert.assertEquals(3,doubleBonds); 
            Assert.assertEquals(9,aromaticAtoms);
            //kekulise
            //CDKHydrogenAdder hadder = CDKHydrogenAdder.getInstance(SilentChemObjectBuilder.getInstance());

            AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(mol);
            mol = fbt.kekuliseAromaticRings(mol);
            for (IAtom atom : mol.atoms()) { 
                printAtom(atom);
            }
            aromaticAtoms = 0;
            doubleBonds = 0;
            for (IAtom atom : mol.atoms()) 
                if(atom.getFlag(CDKConstants.ISAROMATIC)) aromaticAtoms++;
            for (IBond bond: mol.bonds()) {
                switch (bond.getOrder()) {
                case DOUBLE: {doubleBonds++; break;} 
                }
            }

            System.out.println(g.createSMILES(mol));
            System.out.println(doubleBonds);
            Assert.assertTrue(doubleBonds>6);

        }
    } finally {
        reader.close();
    }
}

/
This works fine
*/
@Test
public void test_3426327_SMILES() throws Exception {
rules = new SMARTCYPPlugin();
FixBondOrdersTool fbt = new FixBondOrdersTool();

    String smiles = "c1nc(c2c(n1)n(cn2)[C@H]3[C@@H]([C@@H]([C@H](O3)CO[P@@](=O)(O)O[P@@](=O)(O)OP(=O)(O)O)O)O)N";
    SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance());

            IMolecule mol = parser.parseSmiles(smiles);
            int aromaticAtoms = 0;
            int doubleBonds = 0;
            for (IAtom atom : mol.atoms()) {
                if(atom.getFlag(CDKConstants.ISAROMATIC)) aromaticAtoms++;
                printAtom(atom);
            }
            for (IBond bond: mol.bonds()) {
                switch (bond.getOrder()) {
                case DOUBLE: {doubleBonds++; break;} 
                }
            }
            Assert.assertEquals(3,doubleBonds); 
            Assert.assertEquals(9,aromaticAtoms);
            //kekulise
            AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(mol);
            mol = fbt.kekuliseAromaticRings(mol);
            aromaticAtoms = 0;
            doubleBonds = 0;
            for (IAtom atom : mol.atoms()) 
                if(atom.getFlag(CDKConstants.ISAROMATIC)) aromaticAtoms++;
            for (IBond bond: mol.bonds()) {
                switch (bond.getOrder()) {
                case DOUBLE: {doubleBonds++; break;} 
                }
            }

            System.out.println(doubleBonds);
            Assert.assertTrue(doubleBonds>6);

}

Discussion

  • SDF file with bond order 4

     
    Attachments