/** * Tests if a template matches if just an element is non-carbon. */ @Test public void testOtherElements() throws Exception { boolean itIsInThere = false; TemplateHandler th = new TemplateHandler(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = TestMoleculeFactory.makeSteran(); itIsInThere = th.mapTemplates(mol); Assert.assertTrue(itIsInThere); mol.getAtom(0).setSymbol("N"); itIsInThere = th.mapTemplates(mol); Assert.assertTrue(itIsInThere); }
/** * Tests if a template matches if just and bond order is changed. */ @Test public void testOtherBondOrder() throws Exception { boolean itIsInThere = false; TemplateHandler th = new TemplateHandler(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = TestMoleculeFactory.makeSteran(); itIsInThere = th.mapTemplates(mol); Assert.assertTrue(itIsInThere); mol.getBond(0).setOrder(IBond.Order.DOUBLE); itIsInThere = th.mapTemplates(mol); Assert.assertTrue(itIsInThere); }
@Test public void testDetection() throws Exception { TemplateHandler th = new TemplateHandler(DefaultChemObjectBuilder.getInstance()); String smiles = "CC12C3(C6CC6)C4(C)C1C5(C(CC)C)C(C(CC)C)2C(C)3C45CC(C)C"; IAtomContainer mol = sp.parseSmiles(smiles); Assert.assertTrue(th.mapTemplates(mol)); }
@Test public void testRemoveMolecule() throws Exception { logger.debug("***TestRemoveMolecule***"); boolean itIsInThere = false; TemplateHandler th = new TemplateHandler(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = TestMoleculeFactory.makeAlphaPinene(); sdg.setMolecule(mol); sdg.generateCoordinates(); mol = sdg.getMolecule(); String smiles = "C1=C(C)C2CC(C1)C2(C)(C)"; IAtomContainer smilesMol = sp.parseSmiles(smiles); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertFalse(itIsInThere); th.addMolecule(mol); logger.debug("now adding template for alpha-Pinen and trying again."); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertTrue(itIsInThere); logger.debug("now removing template for alpha-Pinen again and trying again."); th.removeMolecule(mol); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertFalse(itIsInThere); }
@Test public void testAddMolecule() throws Exception { logger.debug("***TestAddMolecule***"); boolean itIsInThere = false; TemplateHandler th = new TemplateHandler(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = TestMoleculeFactory.makeAlphaPinene(); sdg.setMolecule(mol); sdg.generateCoordinates(); mol = sdg.getMolecule(); String smiles = "C1=C(C)C2CC(C1)C2(C)(C)"; IAtomContainer smilesMol = sp.parseSmiles(smiles); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertFalse(itIsInThere); th.addMolecule(mol); logger.debug("now adding template for alpha-Pinen and trying again."); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertTrue(itIsInThere); }