#1258 Kekulisation fails when SDF bond order is 4

cdk-1.4.x
closed
nobody
9
2016-08-11
2012-10-05
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

  • Nina Jeliazkova

    Nina Jeliazkova - 2012-10-05

    SDF file with bond order 4

     
  • Egon Willighagen

    • assigned_to: Egon Willighagen --> nobody
     
  • Egon Willighagen

    Probably the new code should be tried to see if this bug still applies... but I don't have a code example yet.

     
  • John May

    John May - 2016-08-11
    • status: open --> closed
     
  • John May

    John May - 2016-08-11

    It works now providing you have hydrogen counts.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks