HomolyticCleavageReaction extends ReactionEngine implements IReactionProcess { @Override public IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents) throws CDKException { logger.debug("initiate reaction: HomolyticCleavageReaction"); if (reactants.getAtomContainerCount() != 1) { throw new CDKException("HomolyticCleavageReaction only expects one reactant"); } if (agents != null) { throw new CDKException("HomolyticCleavageReaction don't expects agents"); } IReactionSet setOfReactions = reactants.getBuilder().newInstance(IReactionSet.class); IAtomContainer reactant = reactants.getAtomContainer(0); IParameterReact ipr = super.getParameterClass(SetReactionCenter.class); if (ipr != null && !ipr.isSetParameter()) setActiveCenters(reactant); Iterator<IBond> bondis = reactant.bonds().iterator(); while (bondis.hasNext()) { IBond bondi = bondis.next(); IAtom atom1 = bondi.getBegin(); IAtom atom2 = bondi.getEnd(); if (bondi.getFlag(CDKConstants.REACTIVE_CENTER) && atom1.getFlag(CDKConstants.REACTIVE_CENTER) && atom2.getFlag(CDKConstants.REACTIVE_CENTER) && (atom1.getFormalCharge() == CDKConstants.UNSET ? 0 : atom1.getFormalCharge()) == 0 && (atom2.getFormalCharge() == CDKConstants.UNSET ? 0 : atom2.getFormalCharge()) == 0 && reactant.getConnectedSingleElectronsCount(atom1) == 0 && reactant.getConnectedSingleElectronsCount(atom2) == 0) { ArrayList<IAtom> atomList = new ArrayList<IAtom>(); atomList.add(atom1); atomList.add(atom2); ArrayList<IBond> bondList = new ArrayList<IBond>(); bondList.add(bondi); IAtomContainerSet moleculeSet = reactant.getBuilder().newInstance(IAtomContainerSet.class); moleculeSet.addAtomContainer(reactant); IReaction reaction = mechanism.initiate(moleculeSet, atomList, bondList); if (reaction == null) continue; else setOfReactions.addReaction(reaction); } } return setOfReactions; } HomolyticCleavageReaction(); @Override ReactionSpecification getSpecification(); @Override IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents);  }
@Test @Override public void testInitiate_IAtomContainerSet_IAtomContainerSet() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(1, 6, IBond.Order.SINGLE); molecule.addBond(1, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); molecule.addBond(2, 9, IBond.Order.SINGLE); molecule.addBond(2, 10, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 2, IBond.Order.SINGLE); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(0, 4, IBond.Order.SINGLE); expected1.addBond(1, 5, IBond.Order.SINGLE); expected1.addBond(1, 6, IBond.Order.SINGLE);; AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); IQueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); IAtomContainer expected2 = builder.newInstance(IAtomContainer.class); expected2.addAtom(builder.newInstance(IAtom.class, "C")); expected2.addSingleElectron(builder.newInstance(ISingleElectron.class, expected2.getAtom(0))); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addBond(0, 1, IBond.Order.SINGLE); expected2.addBond(0, 2, IBond.Order.SINGLE); expected2.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2); lpcheck.saturate(expected2); IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2); Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom)); }
@Test public void testCsp2SingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(1, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addBond(0, 1, IBond.Order.DOUBLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 2, IBond.Order.SINGLE); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(1, 4, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); IQueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); IAtomContainer expected2 = builder.newInstance(IAtomContainer.class); expected2.addAtom(builder.newInstance(IAtom.class, "C")); expected2.addSingleElectron(builder.newInstance(ISingleElectron.class, expected2.getAtom(0))); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addBond(0, 1, IBond.Order.SINGLE); expected2.addBond(0, 2, IBond.Order.SINGLE); expected2.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2); lpcheck.saturate(expected2); IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2); Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom)); }
@Test public void testCspSingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.TRIPLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(2, 4, IBond.Order.SINGLE); molecule.addBond(2, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addBond(0, 1, IBond.Order.TRIPLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 2, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); IAtomContainer expected2 = builder.newInstance(IAtomContainer.class); expected2.addAtom(builder.newInstance(IAtom.class, "C")); expected2.addSingleElectron(builder.newInstance(ISingleElectron.class, expected2.getAtom(0))); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addBond(0, 1, IBond.Order.SINGLE); expected2.addBond(0, 2, IBond.Order.SINGLE); expected2.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2); lpcheck.saturate(expected2); IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2); Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom)); }
@Test public void testCsp2DoubleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(1, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(2))); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addBond(1, 2, IBond.Order.SINGLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(0, 4, IBond.Order.SINGLE); expected1.addBond(0, 5, IBond.Order.SINGLE); expected1.addBond(1, 6, IBond.Order.SINGLE); expected1.addBond(2, 7, IBond.Order.SINGLE); expected1.addBond(2, 8, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); }
@Test public void testCspDoubleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(2, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(2))); expected1.addBond(0, 1, IBond.Order.DOUBLE); expected1.addBond(1, 2, IBond.Order.SINGLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(0, 4, IBond.Order.SINGLE); expected1.addBond(2, 5, IBond.Order.SINGLE); expected1.addBond(2, 6, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); }
@Test public void testCspTripleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.TRIPLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(2))); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addBond(1, 2, IBond.Order.DOUBLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(0, 4, IBond.Order.SINGLE); expected1.addBond(0, 5, IBond.Order.SINGLE); expected1.addBond(2, 6, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); }
@Test public void testNsp3SingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(1, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); molecule.addBond(2, 9, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "N")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 2, IBond.Order.SINGLE); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(0, 4, IBond.Order.SINGLE); expected1.addBond(1, 5, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); IAtomContainer expected2 = builder.newInstance(IAtomContainer.class); expected2.addAtom(builder.newInstance(IAtom.class, "C")); expected2.addSingleElectron(builder.newInstance(ISingleElectron.class, expected2.getAtom(0))); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addBond(0, 1, IBond.Order.SINGLE); expected2.addBond(0, 2, IBond.Order.SINGLE); expected2.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2); IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2); Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom)); }
@Test public void testNsp3ChargeSingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.getAtom(1).setFormalCharge(+1); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(1, 6, IBond.Order.SINGLE); molecule.addBond(1, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); molecule.addBond(2, 9, IBond.Order.SINGLE); molecule.addBond(2, 10, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(0, setOfReactions.getReactionCount()); }
@Test public void testNsp2SingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(2, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(0))); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addBond(0, 2, IBond.Order.SINGLE); expected1.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); IAtomContainer expected2 = builder.newInstance(IAtomContainer.class); expected2.addAtom(builder.newInstance(IAtom.class, "C")); expected2.addAtom(builder.newInstance(IAtom.class, "N")); expected2.addSingleElectron(builder.newInstance(ISingleElectron.class, expected2.getAtom(1))); expected2.addBond(0, 1, IBond.Order.DOUBLE); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addBond(0, 2, IBond.Order.SINGLE); expected2.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2); lpcheck.saturate(expected2); IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2); Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom)); }
@Test public void testNsp2ChargeSingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.getAtom(1).setFormalCharge(1); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(1, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(0, setOfReactions.getReactionCount()); }
@Test public void testNsp2DoubleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "N")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(2))); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addBond(1, 2, IBond.Order.SINGLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(0, 4, IBond.Order.SINGLE); expected1.addBond(0, 5, IBond.Order.SINGLE); expected1.addBond(2, 6, IBond.Order.SINGLE); expected1.addBond(2, 7, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); }
@Test public void testNsp2ChargeDoubleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.getAtom(1).setFormalCharge(+1); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(1, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(0, setOfReactions.getReactionCount()); }
@Test public void testNspTripleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.TRIPLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(1, 2, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "N")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(0))); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addBond(0, 1, IBond.Order.DOUBLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(1, 2, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); }
@Test public void testNspChargeTripleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.getAtom(0).setFormalCharge(+1); molecule.addBond(0, 1, IBond.Order.TRIPLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 2, IBond.Order.SINGLE); molecule.addBond(1, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(0, setOfReactions.getReactionCount()); }
@Test public void testOsp2SingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(2, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addAtom(builder.newInstance(IAtom.class, "O")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(0, 2, IBond.Order.SINGLE); expected1.addBond(0, 3, IBond.Order.SINGLE); expected1.addBond(0, 4, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); IAtomContainer expected2 = builder.newInstance(IAtomContainer.class); expected2.addAtom(builder.newInstance(IAtom.class, "C")); expected2.addSingleElectron(builder.newInstance(ISingleElectron.class, expected2.getAtom(0))); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addBond(0, 1, IBond.Order.SINGLE); expected2.addBond(0, 2, IBond.Order.SINGLE); expected2.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2); IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2); Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom)); }
@Test public void testOsp2ChargeSingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.getAtom(1).setFormalCharge(+1); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 3, IBond.Order.SINGLE); molecule.addBond(0, 4, IBond.Order.SINGLE); molecule.addBond(0, 5, IBond.Order.SINGLE); molecule.addBond(1, 6, IBond.Order.SINGLE); molecule.addBond(2, 7, IBond.Order.SINGLE); molecule.addBond(2, 8, IBond.Order.SINGLE); molecule.addBond(2, 9, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(0, setOfReactions.getReactionCount()); }
@Test public void testOspDoubleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addBond(1, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); IReactionProcess type = new HomolyticCleavageReaction(); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "O")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(0))); expected1.addAtom(builder.newInstance(IAtom.class, "C")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(1))); expected1.addBond(0, 1, IBond.Order.SINGLE); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addAtom(builder.newInstance(IAtom.class, "H")); expected1.addBond(1, 2, IBond.Order.SINGLE); expected1.addBond(1, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); }
@Test public void testOspChargeDoubleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.getAtom(0).setFormalCharge(+1); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(0, 2, IBond.Order.SINGLE); molecule.addBond(1, 3, IBond.Order.SINGLE); molecule.addBond(1, 4, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(0, setOfReactions.getReactionCount()); }
@Test public void testFspSingleB() throws Exception { IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "F")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addBond(1, 3, IBond.Order.SINGLE); molecule.addBond(1, 4, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); setOfReactants.addAtomContainer(molecule); IReactionProcess type = new HomolyticCleavageReaction(); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); IAtomContainer expected1 = builder.newInstance(IAtomContainer.class); expected1.addAtom(builder.newInstance(IAtom.class, "F")); expected1.addSingleElectron(builder.newInstance(ISingleElectron.class, expected1.getAtom(0))); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1); lpcheck.saturate(expected1); IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1); Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom)); IAtomContainer expected2 = builder.newInstance(IAtomContainer.class); expected2.addAtom(builder.newInstance(IAtom.class, "C")); expected2.addSingleElectron(builder.newInstance(ISingleElectron.class, expected2.getAtom(0))); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addAtom(builder.newInstance(IAtom.class, "H")); expected2.addBond(0, 1, IBond.Order.SINGLE); expected2.addBond(0, 2, IBond.Order.SINGLE); expected2.addBond(0, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2); IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2); Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom)); }
@Test public void testCDKConstants_REACTIVE_CENTER() throws Exception { IReactionProcess type = new HomolyticCleavageReaction(); IAtomContainerSet setOfReactants = getExampleReactants(); IAtomContainer molecule = setOfReactants.getAtomContainer(0); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(1, setOfReactions.getReactionCount()); Assert.assertEquals(1, setOfReactions.getReaction(0).getProductCount()); IAtomContainer reactant = setOfReactions.getReaction(0).getReactants().getAtomContainer(0); Assert.assertTrue(molecule.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER)); Assert.assertTrue(reactant.getAtom(0).getFlag(CDKConstants.REACTIVE_CENTER)); Assert.assertTrue(molecule.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER)); Assert.assertTrue(reactant.getAtom(1).getFlag(CDKConstants.REACTIVE_CENTER)); Assert.assertTrue(molecule.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER)); Assert.assertTrue(reactant.getBond(0).getFlag(CDKConstants.REACTIVE_CENTER)); }
@Test public void testMapping() throws Exception { IReactionProcess type = new HomolyticCleavageReaction(); IAtomContainerSet setOfReactants = getExampleReactants(); IAtomContainer molecule = setOfReactants.getAtomContainer(0); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.FALSE); paramList.add(param); type.setParameterList(paramList); makeSureAtomTypesAreRecognized(molecule); IReactionSet setOfReactions = type.initiate(setOfReactants, null); IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); Assert.assertEquals(4, setOfReactions.getReaction(0).getMappingCount()); IAtom mappedProductA1 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(0)); Assert.assertEquals(mappedProductA1, product.getAtom(0)); IAtom mappedProductA2 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(1)); Assert.assertEquals(mappedProductA2, product.getAtom(1)); }
@Test public void testEthylbenzaldehydeManual() throws Exception { IReactionProcess type = new HomolyticCleavageReaction(); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 6, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addBond(6, 7, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 8, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(8, 9, IBond.Order.SINGLE); molecule.addBond(9, 2, IBond.Order.DOUBLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); LonePairElectronChecker lpcheck = new LonePairElectronChecker(); lpcheck.saturate(molecule); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); setOfReactants.addAtomContainer(molecule); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); makeSureAtomTypesAreRecognized(molecule); IReactionSet setOfReactions = type.initiate(setOfReactants, null); Assert.assertEquals(2, setOfReactions.getReactionCount()); Assert.assertEquals(2, setOfReactions.getReaction(0).getProductCount()); Assert.assertEquals(2, setOfReactions.getReaction(1).getProductCount()); IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); IAtomContainer molecule2 = builder.newInstance(IAtomContainer.class); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addAtom(builder.newInstance(IAtom.class, "H")); molecule2.addBond(0, 1, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "H")); molecule2.addBond(0, 2, IBond.Order.SINGLE); molecule2.addAtom(builder.newInstance(IAtom.class, "H")); molecule2.addBond(0, 3, IBond.Order.SINGLE); molecule2.addSingleElectron(new SingleElectron(molecule2.getAtom(0))); Assert.assertTrue(uiTester.isIsomorph(molecule2, product)); product = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); IAtomContainer molecule3 = builder.newInstance(IAtomContainer.class); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.getAtom(0).setFormalCharge(1); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(0, 1, IBond.Order.SINGLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(1, 2, IBond.Order.SINGLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(2, 3, IBond.Order.DOUBLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(3, 4, IBond.Order.SINGLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(4, 5, IBond.Order.SINGLE); molecule3.addAtom(builder.newInstance(IAtom.class, "O")); molecule3.addBond(5, 6, IBond.Order.DOUBLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(4, 7, IBond.Order.DOUBLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(7, 8, IBond.Order.SINGLE); molecule3.addBond(8, 1, IBond.Order.DOUBLE); addExplicitHydrogens(molecule3); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule3); molecule3.addSingleElectron(new SingleElectron(molecule3.getAtom(0))); molecule3.getAtom(0).setFormalCharge(0); Assert.assertTrue(uiTester.isIsomorph(molecule3, product)); product = setOfReactions.getReaction(1).getProducts().getAtomContainer(0); molecule2 = builder.newInstance(IAtomContainer.class); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addAtom(builder.newInstance(IAtom.class, "C")); molecule2.addBond(0, 1, IBond.Order.SINGLE); molecule2.getAtom(0).setFormalCharge(1); addExplicitHydrogens(molecule2); molecule2.getAtom(0).setFormalCharge(0); molecule2.addSingleElectron(new SingleElectron(molecule2.getAtom(0))); Assert.assertTrue(uiTester.isIsomorph(molecule2, product)); product = setOfReactions.getReaction(1).getProducts().getAtomContainer(1); molecule3 = builder.newInstance(IAtomContainer.class); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(0, 1, IBond.Order.SINGLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(1, 2, IBond.Order.DOUBLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(2, 3, IBond.Order.SINGLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(3, 4, IBond.Order.SINGLE); molecule3.addAtom(builder.newInstance(IAtom.class, "O")); molecule3.addBond(4, 5, IBond.Order.DOUBLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(3, 6, IBond.Order.DOUBLE); molecule3.addAtom(builder.newInstance(IAtom.class, "C")); molecule3.addBond(6, 7, IBond.Order.SINGLE); molecule3.addBond(7, 0, IBond.Order.DOUBLE); molecule3.getAtom(0).setFormalCharge(1); addExplicitHydrogens(molecule3); molecule3.getAtom(0).setFormalCharge(0); molecule3.addSingleElectron(new SingleElectron(molecule3.getAtom(0))); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule3); molecule3.addSingleElectron(new SingleElectron(molecule3.getAtom(0))); Assert.assertTrue(uiTester.isIsomorph(molecule3, product)); }
@Test public void testEthylbenzaldehydeMapping() throws Exception { IReactionProcess type = new HomolyticCleavageReaction(); IAtomContainerSet setOfReactants = builder.newInstance(IAtomContainerSet.class); IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(4, 5, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 6, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addBond(6, 7, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(5, 8, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(8, 9, IBond.Order.SINGLE); molecule.addBond(9, 2, IBond.Order.DOUBLE); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); LonePairElectronChecker lpcheck = new LonePairElectronChecker(); lpcheck.saturate(molecule); molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true); molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true); setOfReactants.addAtomContainer(molecule); List<IParameterReact> paramList = new ArrayList<IParameterReact>(); IParameterReact param = new SetReactionCenter(); param.setParameter(Boolean.TRUE); paramList.add(param); type.setParameterList(paramList); makeSureAtomTypesAreRecognized(molecule); IReactionSet setOfReactions = type.initiate(setOfReactants, null); IAtomContainer product11 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0); IAtomContainer product12 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1); Assert.assertEquals(20, setOfReactions.getReaction(0).getMappingCount()); IAtom mappedProductA1 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(0)); Assert.assertEquals(mappedProductA1, product11.getAtom(0)); IAtom mappedProductA2 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0), molecule.getAtom(1)); Assert.assertEquals(mappedProductA2, product12.getAtom(0)); IAtomContainer product21 = setOfReactions.getReaction(1).getProducts().getAtomContainer(0); IAtomContainer product22 = setOfReactions.getReaction(1).getProducts().getAtomContainer(1); Assert.assertEquals(20, setOfReactions.getReaction(0).getMappingCount()); mappedProductA1 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(1), molecule.getAtom(1)); Assert.assertEquals(mappedProductA1, product21.getAtom(1)); mappedProductA2 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(1), molecule.getAtom(2)); Assert.assertEquals(mappedProductA2, product22.getAtom(0)); }