/** * Returns the number of reactants in this reaction. * * @return The number of reactants in this reaction */ @Override public int getReactantCount() { return reactants.getAtomContainerCount(); }
/** * Returns the number of products in this reaction. * * @return The number of products in this reaction */ @Override public int getProductCount() { return products.getAtomContainerCount(); }
/** * Returns the number of reactants in this reaction. * * @return The number of reactants in this reaction */ @Override public int getReactantCount() { return reactants.getAtomContainerCount(); }
/** * Returns the number of products in this reaction. * * @return The number of products in this reaction */ @Override public int getProductCount() { return products.getAtomContainerCount(); }
/** * Returns the number of products in this reaction. * * @return The number of products in this reaction */ @Override public int getProductCount() { return products.getAtomContainerCount(); }
/** * Returns the number of reactants in this reaction. * * @return The number of reactants in this reaction */ @Override public int getReactantCount() { return reactants.getAtomContainerCount(); }
/** * Returns the number of products in this reaction. * * @return The number of products in this reaction */ @Override public int getProductCount() { return products.getAtomContainerCount(); }
public void writeChemModel(IAtomContainerSet som, String file, String endFix) { System.out.println("WRITE Molecules:" + som.getAtomContainerCount()); String molfile = file + endFix; try { FileOutputStream fout = new FileOutputStream(molfile); MDLV2000Writer mdlw = new MDLV2000Writer(fout); mdlw.write(som); mdlw.close(); } catch (CDKException | IOException ex2) { System.out.println("IOError:cannot write file due to:" + ex2.toString()); } }
private static void removeEmptyMolecules(IChemModel chemModel) { IAtomContainerSet moleculeSet = chemModel.getMoleculeSet(); if (moleculeSet != null && moleculeSet.getAtomContainerCount() == 0) { chemModel.setMoleculeSet(null); } }
public static void setAtomProperties(IReaction reaction, Object propKey, Object propVal) { IAtomContainerSet reactants = reaction.getReactants(); for (int j = 0; j < reactants.getAtomContainerCount(); j++) { AtomContainerManipulator.setAtomProperties(reactants.getAtomContainer(j), propKey, propVal); } IAtomContainerSet products = reaction.getProducts(); for (int j = 0; j < products.getAtomContainerCount(); j++) { AtomContainerManipulator.setAtomProperties(products.getAtomContainer(j), propKey, propVal); } }
private synchronized IBond getBondOfReactantsByRMatrix(IAtom atom1, IAtom atom2) { for (int i = 0; i < reactantSet.getAtomContainerCount(); i++) { if (reactantSet.getAtomContainer(i).getBond(atom1, atom2) != null) { return reactantSet.getAtomContainer(i).getBond(atom1, atom2); } } return null; }
public static IAtomContainerSet getAllAgents(IReaction reaction) { IAtomContainerSet moleculeSet = reaction.getBuilder().newInstance(IAtomContainerSet.class); IAtomContainerSet agents = reaction.getAgents(); for (int i = 0; i < agents.getAtomContainerCount(); i++) { moleculeSet.addAtomContainer(agents.getAtomContainer(i)); } return moleculeSet; }
@Test public void fragmentGroupingInvalid() throws InvalidSmilesException { IReaction reaction = smipar.parseReactionSmiles("CC1=NC2=C(O)C=CC=C2C=C1.CC(Cl)=O.[Al+3].[Cl-].[Cl-].[Cl-]>[O-][N+](=O)C1=CC=CC=C1>CC(=O)C1=C2C=CC(C)=NC2=C(O)C=C1 |f:2.3.4.5,4.6|"); assertThat(reaction.getReactantCount(), is(6)); assertThat(reaction.getAgents().getAtomContainerCount(), is(1)); assertThat(reaction.getProductCount(), is(1)); assertThat(reaction.getProperty(CDKConstants.TITLE, String.class), is("")); }
@Test public void fragmentGroupingProducts() throws InvalidSmilesException { IReaction reaction = smipar.parseReactionSmiles("CC1=NC2=C(O)C=CC=C2C=C1.CC(Cl)=O>[O-][N+](=O)C1=CC=CC=C1>CC(=O)C1=C2C=CC(C)=NC2=C(O)C=C1.[Al+3].[Cl-].[Cl-].[Cl-] |f:3.4.5.6|"); assertThat(reaction.getReactantCount(), is(2)); assertThat(reaction.getAgents().getAtomContainerCount(), is(1)); assertThat(reaction.getProductCount(), is(2)); assertThat(reaction.getProperty(CDKConstants.TITLE, String.class), is("")); }
@Test public void testCyclobutadiene() throws Exception { // anti-aromatic IAtomContainer molecule = TestMoleculeFactory.makeCyclobutadiene(); addExplicitHydrogens(molecule); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); lpcheck.saturate(molecule); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IAtomContainerSet setOfMolecules = gRI.getStructures(molecule); Assert.assertEquals(2, setOfMolecules.getAtomContainerCount()); }
private void checkMol(StringBuilder buf) throws Exception { StringReader sr = new StringReader(buf.toString()); Mol2Reader reader = new Mol2Reader(sr); IChemFile mol = (IChemFile) reader.read(SilentChemObjectBuilder.getInstance().newInstance(IChemFile.class)); reader.close(); Assert.assertTrue(mol.getChemSequenceCount() > 0); Assert.assertTrue(mol.getChemSequence(0).getChemModelCount() > 0); Assert.assertTrue(mol.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainerCount() > 0); Assert.assertTrue(mol.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0).getAtomCount() > 0); }
@Test public void testConnectedByRingClosure_TwoAtom() throws Exception { String methanol = "C1.O1"; IAtomContainer mol = sp.parseSmiles(methanol); Assert.assertEquals(2, mol.getAtomCount()); Assert.assertEquals(1, mol.getBondCount()); IAtomContainerSet fragments = ConnectivityChecker.partitionIntoMolecules(mol); int fragmentCount = fragments.getAtomContainerCount(); Assert.assertEquals(1, fragmentCount); IAtomContainer mol1 = fragments.getAtomContainer(0); Assert.assertEquals(2, mol1.getAtomCount()); }
@Test public void testRemoveAtomContainer_IAtomContainer() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); IAtomContainer ac1 = som.getBuilder().newInstance(IAtomContainer.class); IAtomContainer ac2 = som.getBuilder().newInstance(IAtomContainer.class); som.addAtomContainer(ac1); som.addAtomContainer(ac2); som.removeAtomContainer(ac1); Assert.assertEquals(1, som.getAtomContainerCount()); Assert.assertEquals(ac2, som.getAtomContainer(0)); }
@Test public void testGetReactants() { IReaction reaction = (IReaction) newChemObject(); IAtomContainer sodiumhydroxide = reaction.getBuilder().newInstance(IAtomContainer.class); IAtomContainer aceticAcid = reaction.getBuilder().newInstance(IAtomContainer.class); IAtomContainer water = reaction.getBuilder().newInstance(IAtomContainer.class); reaction.addReactant(sodiumhydroxide); reaction.addReactant(aceticAcid); reaction.addReactant(water); Assert.assertEquals(3, reaction.getReactants().getAtomContainerCount()); }
@Test public void testGetAllProducts_IReaction() { IReaction reaction = builder.newInstance(IReaction.class); reaction.addReactant(builder.newInstance(IAtomContainer.class)); reaction.addReactant(builder.newInstance(IAtomContainer.class)); reaction.addReactant(builder.newInstance(IAtomContainer.class)); reaction.addProduct(builder.newInstance(IAtomContainer.class)); reaction.addProduct(builder.newInstance(IAtomContainer.class)); Assert.assertEquals(3, ReactionManipulator.getAllReactants(reaction).getAtomContainerCount()); }