@Override public IChemObject newTestObject() { return new ReactionSet(); } });
@Test public void testReactionSet() { IReactionSet reactionSet = new ReactionSet(); Assert.assertNotNull(reactionSet); }
@BeforeClass public static void setUp() { setTestObjectBuilder(new ITestObjectBuilder() { @Override public IChemObject newTestObject() { return new ReactionSet(); } }); }
@Before public void setUp() throws Exception { String filename1 = "data/mdl/reaction-1.rxn"; InputStream ins1 = this.getClass().getClassLoader().getResourceAsStream(filename1); MDLRXNReader reader1 = new MDLRXNReader(ins1); ReactionSet set = (ReactionSet) reader1.read(new ReactionSet()); reaction = set.getReaction(0); reader1.close(); }
@Before public void setUp() throws Exception { builder = DefaultChemObjectBuilder.getInstance(); String filename1 = "data/mdl/reaction-1.rxn"; InputStream ins1 = this.getClass().getClassLoader().getResourceAsStream(filename1); MDLRXNReader reader1 = new MDLRXNReader(ins1); set = (ReactionSet) reader1.read(new ReactionSet()); reader1.close(); }
/** * This test checks of different numbering for the same mapping gives the same result. */ @Test public void testAsadExamples() throws Exception { String filename = "data/mdl/output.rxn"; logger.info("Testing: " + filename); InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLRXNReader reader = new MDLRXNReader(ins); IReactionSet reactionSet = (IReactionSet) reader.read(new ReactionSet()); reader.close(); filename = "data/mdl/output_Cleaned.rxn"; logger.info("Testing: " + filename); ins = this.getClass().getClassLoader().getResourceAsStream(filename); reader = new MDLRXNReader(ins); IReactionSet reactionSet2 = (IReactionSet) reader.read(new ReactionSet()); reader.close(); Assert.assertEquals(reactionSet.getReaction(0).getMappingCount(), reactionSet2.getReaction(0).getMappingCount()); for (int i = 0; i < reactionSet.getReaction(0).getMappingCount(); i++) { Assert.assertEquals(getAtomNumber(reactionSet, reactionSet.getReaction(0).getMapping(i).getChemObject(0)), getAtomNumber(reactionSet2, reactionSet2.getReaction(0).getMapping(i).getChemObject(0))); Assert.assertEquals(getAtomNumber(reactionSet, reactionSet.getReaction(0).getMapping(i).getChemObject(1)), getAtomNumber(reactionSet2, reactionSet2.getReaction(0).getMapping(i).getChemObject(1))); } }
/** * */ @Test public void testRDFReactioniSet() throws Exception { String filename = "data/mdl/qsar-reaction-test.rdf"; logger.info("Testing: " + filename); InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLRXNReader reader = new MDLRXNReader(ins); IReactionSet reactionSet = (IReactionSet) reader.read(new ReactionSet()); reader.close(); Assert.assertNotNull(reactionSet); Assert.assertEquals(2, reactionSet.getReactionCount()); Assert.assertEquals(2, reactionSet.getReaction(0).getReactantCount()); Assert.assertEquals(3, reactionSet.getReaction(0).getReactants().getAtomContainer(0).getAtomCount()); Assert.assertEquals(2, reactionSet.getReaction(0).getReactants().getAtomContainer(1).getAtomCount()); Assert.assertEquals(2, reactionSet.getReaction(0).getProductCount()); Assert.assertEquals(2, reactionSet.getReaction(0).getProducts().getAtomContainer(0).getAtomCount()); Assert.assertEquals(2, reactionSet.getReaction(0).getProducts().getAtomContainer(1).getAtomCount()); Assert.assertEquals(1, reactionSet.getReaction(1).getReactantCount()); Assert.assertEquals(3, reactionSet.getReaction(1).getReactants().getAtomContainer(0).getAtomCount()); Assert.assertEquals(1, reactionSet.getReaction(1).getProductCount()); Assert.assertEquals(2, reactionSet.getReaction(1).getProducts().getAtomContainer(0).getAtomCount()); }
@Before public void setUp() { molecule1 = new AtomContainer(); atomInMol1 = new Atom("Cl"); atomInMol1.setCharge(-1.0); atomInMol1.setFormalCharge(-1); atomInMol1.setImplicitHydrogenCount(1); molecule1.addAtom(atomInMol1); molecule1.addAtom(new Atom("Cl")); bondInMol1 = new Bond(atomInMol1, molecule1.getAtom(1)); molecule1.addBond(bondInMol1); molecule2 = new AtomContainer(); atomInMol2 = new Atom("O"); atomInMol2.setImplicitHydrogenCount(2); molecule2.addAtom(atomInMol2); moleculeSet = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class); moleculeSet.addAtomContainer(molecule1); moleculeSet.addAtomContainer(molecule2); reaction = new Reaction(); reaction.addReactant(molecule1); reaction.addProduct(molecule2); reactionSet = new ReactionSet(); reactionSet.addReaction(reaction); chemModel = new ChemModel(); chemModel.setMoleculeSet(moleculeSet); chemModel.setReactionSet(reactionSet); }
@Before public void setUp() { molecule1 = new AtomContainer(); atomInMol1 = new Atom("Cl"); molecule1.addAtom(atomInMol1); molecule1.addAtom(new Atom("Cl")); bondInMol1 = new Bond(atomInMol1, molecule1.getAtom(1)); molecule1.addBond(bondInMol1); molecule2 = new AtomContainer(); atomInMol2 = new Atom("O"); atomInMol2.setImplicitHydrogenCount(2); molecule2.addAtom(atomInMol2); moleculeSet = new AtomContainerSet(); moleculeSet.addAtomContainer(molecule1); moleculeSet.addAtomContainer(molecule2); reaction = new Reaction(); reaction.addReactant(molecule1); reaction.addProduct(molecule2); reactionSet = new ReactionSet(); reactionSet.addReaction(reaction); chemModel = new ChemModel(); chemModel.setMoleculeSet(moleculeSet); chemModel.setReactionSet(reactionSet); chemSequence1 = new ChemSequence(); chemSequence1.addChemModel(chemModel); chemSequence2 = new ChemSequence(); chemFile = new ChemFile(); chemFile.addChemSequence(chemSequence1); chemFile.addChemSequence(chemSequence2); }
@Before public void setUp() { molecule1 = new AtomContainer(); atomInMol1 = new Atom("Cl"); molecule1.addAtom(atomInMol1); molecule1.addAtom(new Atom("Cl")); bondInMol1 = new Bond(atomInMol1, molecule1.getAtom(1)); molecule1.addBond(bondInMol1); molecule2 = new AtomContainer(); atomInMol2 = new Atom("O"); atomInMol2.setImplicitHydrogenCount(2); molecule2.addAtom(atomInMol2); moleculeSet = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class); moleculeSet.addAtomContainer(molecule1); moleculeSet.addAtomContainer(molecule2); reaction = new Reaction(); reaction.addReactant(molecule1); reaction.addProduct(molecule2); reactionSet = new ReactionSet(); reactionSet.addReaction(reaction); chemModel1 = new ChemModel(); chemModel1.setMoleculeSet(moleculeSet); chemModel2 = new ChemModel(); chemModel2.setReactionSet(reactionSet); chemSequence = new ChemSequence(); chemSequence.addChemModel(chemModel1); chemSequence.addChemModel(chemModel2); }
@Test public void testRemoveElectronContainer_IChemModel_IElectronContainer() { IAtomContainer mol1 = new AtomContainer(); mol1.addAtom(new Atom("Cl")); mol1.addAtom(new Atom("Cl")); IBond bond1 = new Bond(mol1.getAtom(0), mol1.getAtom(1)); mol1.addBond(bond1); IAtomContainer mol2 = new AtomContainer(); mol2.addAtom(new Atom("I")); mol2.addAtom(new Atom("I")); IBond bond2 = new Bond(mol2.getAtom(0), mol2.getAtom(1)); mol2.addBond(bond2); IAtomContainerSet molSet = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class); molSet.addAtomContainer(mol1); IReaction r = new Reaction(); r.addProduct(mol2); IReactionSet rSet = new ReactionSet(); rSet.addReaction(r); IChemModel model = new ChemModel(); model.setMoleculeSet(molSet); model.setReactionSet(rSet); IBond otherBond = new Bond(); Assert.assertEquals(2, ChemModelManipulator.getBondCount(model)); ChemModelManipulator.removeElectronContainer(model, otherBond); Assert.assertEquals(2, ChemModelManipulator.getBondCount(model)); ChemModelManipulator.removeElectronContainer(model, bond1); Assert.assertEquals(1, ChemModelManipulator.getBondCount(model)); ChemModelManipulator.removeElectronContainer(model, bond2); Assert.assertEquals(0, ChemModelManipulator.getBondCount(model)); }
IReaction r = new Reaction(); r.addProduct(mol2); IReactionSet rSet = new ReactionSet(); rSet.addReaction(r); IChemModel model = new ChemModel();
IReaction react = new Reaction(); react.addReactant(mol); IReactionSet rset = new ReactionSet(); rset.addReaction(react); model1.setReactionSet(rset);