public static void setAtomProperties(IAtomContainerSet set, Object propKey, Object propVal) { if (set != null) { for (int i = 0; i < set.getAtomContainerCount(); i++) { AtomContainerManipulator.setAtomProperties(set.getAtomContainer(i), propKey, propVal); } } }
/** * Test to recognize if this IAtomContainer_1 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer1() throws Exception { IAtomContainer moleculeTest = getExampleReactants().getAtomContainer(0); makeSureAtomTypesAreRecognized(moleculeTest); }
public static List<String> getAllIDs(IAtomContainerSet set) { List<String> idList = new ArrayList<String>(); if (set != null) { if (set.getID() != null) idList.add(set.getID()); for (int i = 0; i < set.getAtomContainerCount(); i++) { idList.addAll(AtomContainerManipulator.getAllIDs(set.getAtomContainer(i))); } } return idList; }
/** * Test to recognize if this IAtomContainer_2 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer2() throws Exception { IAtomContainer moleculeTest = getExpectedProducts().getAtomContainer(0); makeSureAtomTypesAreRecognized(moleculeTest); }
@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 to recognize if this IAtomContainer_1 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer1() throws Exception { IAtomContainer moleculeTest = getExampleReactants().getAtomContainer(0); makeSureAtomTypesAreRecognized(moleculeTest); }
@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 to recognize if this IAtomContainer_1 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer1() throws Exception { IAtomContainer moleculeTest = getExampleReactants().getAtomContainer(0); makeSureAtomTypesAreRecognized(moleculeTest); }
@Test public void testRemoveAtomContainer_int() { 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(0); Assert.assertEquals(1, som.getAtomContainerCount()); Assert.assertEquals(ac2, som.getAtomContainer(0)); }
/** * Test to recognize if this IAtomContainer_2 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer2() throws Exception { IAtomContainer moleculeTest = getExpectedProducts().getAtomContainer(0); makeSureAtomTypesAreRecognized(moleculeTest); }
public IAtomContainer getFirstAtomContainer(IChemFile chemFile, int chemSequenceCount, int chemModelCount, int moleculeCount) { Assert.assertNotNull(chemFile); Assert.assertEquals(chemSequenceCount, chemFile.getChemSequenceCount()); org.openscience.cdk.interfaces.IChemSequence seq = chemFile.getChemSequence(0); Assert.assertNotNull(seq); Assert.assertEquals(chemModelCount, seq.getChemModelCount()); IChemModel model = seq.getChemModel(0); Assert.assertNotNull(model); Assert.assertEquals(moleculeCount, model.getMoleculeSet().getAtomContainerCount()); return model.getMoleculeSet().getAtomContainer(0); }
/** * Test to recognize if this IAtomContainer_1 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer1() throws Exception { IAtomContainer moleculeTest = getExampleReactants().getAtomContainer(0); makeSureAtomTypesAreRecognized(moleculeTest); }
/** * Test to recognize if this IAtomContainer_2 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer2() throws Exception { IAtomContainer moleculeTest = getExpectedProducts().getAtomContainer(0); makeSureAtomTypesAreRecognized(moleculeTest); }
@Test public void testReadingSmiFile_2() throws Exception { String filename = "data/smiles/smiles.smi"; logger.info("Testing: " + filename); InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); SMILESReader reader = new SMILESReader(ins); IAtomContainerSet som = reader.read(new AtomContainerSet()); IAtomContainer thisMol = som.getAtomContainer(1); Assert.assertNull(thisMol.getProperty("SMIdbNAME")); }
/** * Test to recognize if this IAtomContainer_1 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer1() throws Exception { IAtomContainer moleculeTest = getExampleReactants().getAtomContainer(0); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(moleculeTest); makeSureAtomTypesAreRecognized(moleculeTest); }
/** * Test to recognize if this IAtomContainer_2 matches correctly into the CDKAtomTypes. */ @Test public void testAtomTypesAtomContainer2() throws Exception { IAtomContainer moleculeTest = getExpectedProducts().getAtomContainer(0); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(moleculeTest); makeSureAtomTypesAreRecognized(moleculeTest); }
@Test public void testIsLeft_IAtom_IAtom_IAtom() throws Exception { String filename = "data/mdl/testdoublebondconfig.mol"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); IAtomContainer mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0); Assert.assertFalse(BondTools.isLeft(mol.getAtom(1), mol.getAtom(0), mol.getAtom(2))); }
@Test public void testGiveAngleFromMiddle_IAtom_IAtom_IAtom() throws Exception { String filename = "data/mdl/testdoublebondconfig.mol"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); IAtomContainer mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0); Assert.assertEquals(2.0943946986086157, BondTools.giveAngleFromMiddle(mol.getAtom(0), mol.getAtom(2), mol.getAtom(3)), 0.2); }
@Test public void testIsStereo_IAtomContainer_IAtom() throws Exception { String filename = "data/mdl/trigonal_bipyramidal.mol"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); IAtomContainer mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0); Assert.assertTrue(BondTools.isStereo(mol, mol.getAtom(0))); Assert.assertFalse(BondTools.isStereo(mol, mol.getAtom(1))); }
@Test public void testGetAtomContainer_int() { IAtomContainerSet som = (IAtomContainerSet) newChemObject(); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); som.addAtomContainer(som.getBuilder().newInstance(IAtomContainer.class)); Assert.assertNotNull(som.getAtomContainer(2)); // third molecule should exist Assert.assertNull(som.getAtomContainer(3)); // fourth molecule must not exist }