@Test public void testInterruption() { fbot.setInterrupted(false); Assert.assertFalse(fbot.isInterrupted()); fbot.setInterrupted(true); Assert.assertTrue(fbot.isInterrupted()); fbot.setInterrupted(false); }
/** * Just to ensure it doesn't throw exceptions * * @throws Exception */ @Test(timeout = 1000) public void testAcyclic() throws Exception { String smiles = "CCCCCCC"; SmilesParser smilesParser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer molecule = smilesParser.parseSmiles(smiles); molecule = fbot.kekuliseAromaticRings(molecule); Assert.assertNotNull(molecule); }
/** @cdk.inchi InChI=1/C4H5N/c1-2-4-5-3-1/h1-5H */ @Test public void xtestPyrrole() throws Exception { IAtomContainer enol = new AtomContainer(); // atom block IAtom atom1 = new Atom(Elements.CARBON); atom1.setHybridization(Hybridization.SP2); IAtom atom2 = new Atom(Elements.CARBON); atom2.setHybridization(Hybridization.SP2); IAtom atom3 = new Atom(Elements.CARBON); atom3.setHybridization(Hybridization.SP2); IAtom atom4 = new Atom(Elements.CARBON); atom4.setHybridization(Hybridization.SP2); IAtom atom5 = new Atom(Elements.NITROGEN); atom5.setHybridization(Hybridization.SP2); atom5.setImplicitHydrogenCount(1); // bond block IBond bond1 = new Bond(atom1, atom2); IBond bond2 = new Bond(atom2, atom3); IBond bond3 = new Bond(atom3, atom4); IBond bond4 = new Bond(atom4, atom5); IBond bond5 = new Bond(atom5, atom1); enol.addAtom(atom1); enol.addAtom(atom2); enol.addAtom(atom3); enol.addAtom(atom4); enol.addAtom(atom5); enol.addBond(bond1); enol.addBond(bond2); enol.addBond(bond3); enol.addBond(bond4); enol.addBond(bond5); // perceive atom types AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(enol); // now have the algorithm have a go at it enol = fbot.kekuliseAromaticRings(enol); Assert.assertNotNull(enol); // Assert.assertTrue(fbot.isOK(enol)); // now check whether it did the right thing Assert.assertEquals(CDKConstants.BONDORDER_DOUBLE, enol.getBond(0).getOrder()); ; Assert.assertEquals(CDKConstants.BONDORDER_SINGLE, enol.getBond(1).getOrder()); ; Assert.assertEquals(CDKConstants.BONDORDER_DOUBLE, enol.getBond(2).getOrder()); ; Assert.assertEquals(CDKConstants.BONDORDER_SINGLE, enol.getBond(3).getOrder()); ; Assert.assertEquals(CDKConstants.BONDORDER_SINGLE, enol.getBond(4).getOrder()); ; }
@Test(timeout = 1000) public void testPyrrole_Silent() throws Exception { String smiles = "c2ccc3n([H])c1ccccc1c3(c2)"; SmilesParser smilesParser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer molecule = smilesParser.parseSmiles(smiles); molecule = fbot.kekuliseAromaticRings(molecule); Assert.assertNotNull(molecule); molecule = (IAtomContainer) AtomContainerManipulator.removeHydrogens(molecule); int doubleBondCount = 0; for (int i = 0; i < molecule.getBondCount(); i++) { IBond bond = molecule.getBond(i); Assert.assertTrue(bond.getFlag(CDKConstants.ISAROMATIC)); if (bond.getOrder() == Order.DOUBLE) doubleBondCount++; } Assert.assertEquals(6, doubleBondCount); }
@Test public void testLargeRingSystem() throws Exception { String smiles = "O=C1Oc6ccccc6(C(O)C1C5c2ccccc2CC(c3ccc(cc3)c4ccccc4)C5)"; SmilesParser smilesParser = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer molecule = smilesParser.parseSmiles(smiles); molecule = fbot.kekuliseAromaticRings(molecule); Assert.assertNotNull(molecule); molecule = (IAtomContainer) AtomContainerManipulator.removeHydrogens(molecule); Assert.assertEquals(34, molecule.getAtomCount()); // we should have 14 double bonds int doubleBondCount = 0; for (int i = 0; i < molecule.getBondCount(); i++) { IBond bond = molecule.getBond(i); if (bond.getOrder() == Order.DOUBLE) doubleBondCount++; } Assert.assertEquals(13, doubleBondCount); }
/** @cdk.bug 3506770 */ @Test public void testLargeBioclipseUseCase() throws Exception { String smiles = "COc1ccc2[C@@H]3[C@H](COc2c1)C(C)(C)OC4=C3C(=O)C(=O)C5=C4OC(C)(C)[C@@H]6COc7cc(OC)ccc7[C@H]56"; SmilesParser smilesParser = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer molecule = smilesParser.parseSmiles(smiles); molecule = fbot.kekuliseAromaticRings(molecule); Assert.assertNotNull(molecule); molecule = (IAtomContainer) AtomContainerManipulator.removeHydrogens(molecule); Assert.assertEquals(40, molecule.getAtomCount()); // we should have 14 double bonds int doubleBondCount = 0; for (int i = 0; i < molecule.getBondCount(); i++) { IBond bond = molecule.getBond(i); if (bond.getOrder() == Order.DOUBLE) doubleBondCount++; } Assert.assertEquals(10, doubleBondCount); }