/** {@inheritDoc} */ @Override public IChemSequence getChemSequence(int number) { logger.debug("Getting chemSequence at: ", number); return super.getChemSequence(number); }
@Test public void testSDFFile4() throws Exception { String filename = "data/mdl/test4.sdf"; // a multi molecule SDF file InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); ChemFile fileContents = (ChemFile) reader.read(new ChemFile()); reader.close(); Assert.assertEquals(1, fileContents.getChemSequenceCount()); org.openscience.cdk.interfaces.IChemSequence sequence = fileContents.getChemSequence(0); Assert.assertNotNull(sequence); Assert.assertEquals(2, sequence.getChemModelCount()); for (int i = 0; i < sequence.getChemModelCount(); i++) { Assert.assertNotNull(sequence.getChemModel(i)); } }
public void visualBugPMR() throws Exception { String filename = "data/cml/SL0016a.cml"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); CMLReader reader = new CMLReader(ins); ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); IChemSequence seq = chemFile.getChemSequence(0); IChemModel model = seq.getChemModel(0); IAtomContainer mol = model.getMoleculeSet().getAtomContainer(0); //MoleculeViewer2D.display(mol, true, false, JFrame.DO_NOTHING_ON_CLOSE,""); }
@Test public void testSDFFile3() throws Exception { String filename = "data/mdl/test3.sdf"; // a multi molecule SDF file InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); ChemFile fileContents = (ChemFile) reader.read(new ChemFile()); reader.close(); Assert.assertEquals(1, fileContents.getChemSequenceCount()); org.openscience.cdk.interfaces.IChemSequence sequence = fileContents.getChemSequence(0); Assert.assertNotNull(sequence); Assert.assertEquals(2, sequence.getChemModelCount()); for (int i = 0; i < sequence.getChemModelCount(); i++) { Assert.assertNotNull(sequence.getChemModel(i)); } }
/** * @cdk.bug 2831420 */ @Test public void testBug2831420() throws Exception { String filename = "data/mdl/bug2831420.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(5))); } }
@Test public void testSDFFile() throws Exception { String filename = "data/mdl/test.sdf"; // a multi molecule SDF file InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); ChemFile fileContents = (ChemFile) reader.read(new ChemFile()); reader.close(); Assert.assertEquals(1, fileContents.getChemSequenceCount()); org.openscience.cdk.interfaces.IChemSequence sequence = fileContents.getChemSequence(0); Assert.assertNotNull(sequence); Assert.assertEquals(9, sequence.getChemModelCount()); for (int i = 0; i < sequence.getChemModelCount(); i++) { Assert.assertNotNull(sequence.getChemModel(i)); } }
@Test public void testMakeUpDownBonds_IAtomContainer() throws Exception { String filename = "data/mdl/tetrahedral_2_lazy.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); BondTools.makeUpDownBonds(mol); Assert.assertEquals(IBond.Stereo.DOWN, mol.getBond(3).getStereo()); }
@Test public void testSDFFile5() throws Exception { String filename = "data/mdl/test5.sdf"; // a multi molecule SDF file InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); ChemFile fileContents = (ChemFile) reader.read(new ChemFile()); reader.close(); Assert.assertEquals(1, fileContents.getChemSequenceCount()); org.openscience.cdk.interfaces.IChemSequence sequence = fileContents.getChemSequence(0); Assert.assertNotNull(sequence); Assert.assertEquals(2, sequence.getChemModelCount()); for (int i = 0; i < sequence.getChemModelCount(); i++) { Assert.assertNotNull(sequence.getChemModel(i)); } }
@Test public void testStereosAreOpposite_IAtomContainer_IAtom() throws Exception { String filename = "data/mdl/squareplanar.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.stereosAreOpposite(mol, mol.getAtom(0))); filename = "data/mdl/tetrahedral_with_four_wedges.mol"; ins = this.getClass().getClassLoader().getResourceAsStream(filename); reader = new MDLV2000Reader(ins); chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); mol = chemFile.getChemSequence(0).getChemModel(0).getMoleculeSet().getAtomContainer(0); Assert.assertTrue(BondTools.stereosAreOpposite(mol, mol.getAtom(0))); }
@Test public void testGiveAngle_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.giveAngle(mol.getAtom(0), mol.getAtom(2), mol.getAtom(3)), 0.2); }
@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 testIsCisTrans_IAtom_IAtom_IAtom_IAtom_IAtomContainer() 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.isCisTrans(mol.getAtom(2), mol.getAtom(0), mol.getAtom(1), mol.getAtom(4), mol)); }
@Test public void testIsTrigonalBipyramidalOrOctahedral_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.assertEquals(BondTools.isTrigonalBipyramidalOrOctahedral(mol, mol.getAtom(0)), 1); Assert.assertEquals(BondTools.isTrigonalBipyramidalOrOctahedral(mol, mol.getAtom(1)), 0); }
@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 testIsSquarePlanar_IAtomContainer_IAtom() throws Exception { String filename = "data/mdl/squareplanar.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.isSquarePlanar(mol, mol.getAtom(0))); Assert.assertFalse(BondTools.isSquarePlanar(mol, mol.getAtom(1))); }
public void visualFullMolecule2DEvaluation() throws Exception { HydrogenPlacer hydrogenPlacer = new HydrogenPlacer(); String filename = "data/mdl/reserpine.mol"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLReader reader = new MDLReader(ins, Mode.STRICT); ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); org.openscience.cdk.interfaces.IChemSequence seq = chemFile.getChemSequence(0); org.openscience.cdk.interfaces.IChemModel model = seq.getChemModel(0); IAtomContainer mol = model.getMoleculeSet().getAtomContainer(0); double bondLength = GeometryUtil.getBondLengthAverage(mol); logger.debug("Read Reserpine"); logger.debug("Starting addition of H's"); addExplicitHydrogens(mol); logger.debug("ended addition of H's"); hydrogenPlacer.placeHydrogens2D(mol, bondLength); }
@Test public void testIsStereo_IAtomContainer_IAtom_forinvalid() 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); for (int i = 1; i < 6; i++) { mol.getAtom(i).setSymbol("C"); } Assert.assertFalse(BondTools.isStereo(mol, mol.getAtom(0))); Assert.assertFalse(BondTools.isStereo(mol, mol.getAtom(1))); }
@Test public void testGiveAngleBothMethods_IAtom_IAtom_IAtom_boolean() 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.giveAngleBothMethods(mol.getAtom(0), mol.getAtom(2), mol.getAtom(3), true), 0.2); Assert.assertEquals(2.0943946986086157, BondTools.giveAngleBothMethods(mol.getAtom(0), mol.getAtom(2), mol.getAtom(3), false), 0.2); }
@Test public void testGiveAngleBothMethods_Point2d_Point2d_Point2d_boolean() 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.giveAngleBothMethods(mol.getAtom(0).getPoint2d(), mol .getAtom(2).getPoint2d(), mol.getAtom(3).getPoint2d(), true), 0.2); Assert.assertEquals(2.0943946986086157, BondTools.giveAngleBothMethods(mol.getAtom(0).getPoint2d(), mol .getAtom(2).getPoint2d(), mol.getAtom(3).getPoint2d(), false), 0.2); }