Package org.openscience.cdk

Examples of org.openscience.cdk.ChemFile


   * @return The CDK molecule.
   * @throws Exception
   */
  public static IMolecule cmlToMolecule(Element cmlMol) throws Exception {
    ByteArrayInputStream bais = new ByteArrayInputStream(cmlMol.toXML().getBytes());
    IChemFile cf = (IChemFile) new CMLReader(bais).read(new ChemFile());
    IMolecule mol = cf.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
    configureMolecule(mol);
    return mol;
  }
View Full Code Here


    configureMolecule(mol);
    return mol;
  }
 
  static IMolecule cmlToMolecule(InputStream is) throws Exception {
    IChemFile cf = (IChemFile) new CMLReader(is).read(new ChemFile());
    IMolecule mol = cf.getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0);
    configureMolecule(mol);
    return mol;   
  }
View Full Code Here

        ChemModel chemModel = null;
        IChemFile chemFile = null;
        if (cor.accepts(IChemFile.class) && chemModel==null) {
            // try to read a ChemFile
            try {
                chemFile = (IChemFile) cor.read((IChemObject) new ChemFile());
                if (chemFile == null) {
                    error = "The object chemFile was empty unexpectedly!";
                }
            } catch (Exception exception) {
                error = "Error while reading file: " + exception.getMessage();
View Full Code Here

                try {
                    if (reader.accepts(IAtomContainer.class)) {
                        toPaste = (IAtomContainer) reader.read(readMolecule);
                    } else if (reader.accepts(ChemFile.class)) {
                        toPaste = readMolecule;
                        IChemFile file = (IChemFile) reader.read(new ChemFile());
                        for (IAtomContainer ac :
                            ChemFileManipulator.getAllAtomContainers(file)) {
                            toPaste.add(ac);

                        }
View Full Code Here

          text.setText(file.toString());
          JButtonFixture okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Open")));
          okbutton.click();
              ins = this.getClass().getClassLoader().getResourceAsStream(filename);
              MDLV2000Reader reader = new MDLV2000Reader(ins, Mode.STRICT);
              ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
              Assert.assertNotNull(chemFile);
              List<IAtomContainer> containersList = ChemFileManipulator.getAllAtomContainers(chemFile);
              JPanelFixture jcppanel=applet.panel("appletframe");
              JChemPaintPanel panel = (JChemPaintPanel)jcppanel.target;
              Assert.assertEquals(1, containersList.size());
View Full Code Here

              DialogFixture coordsdialog = new DialogFixture(applet.robot, applet.robot.finder().find(new DialogTitleComponentMatcher("No 2D coordinates")));
              JButtonFixture okbuttoncoordsdialog = new JButtonFixture(coordsdialog.robot, coordsdialog.robot.finder().find(new ButtonTextComponentMatcher("Yes")));
              okbuttoncoordsdialog.click();
                  ins = this.getClass().getClassLoader().getResourceAsStream(filename);
                  SMILESReader reader = new SMILESReader(ins);
                  ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
                  Assert.assertNotNull(chemFile);
                  List<IAtomContainer> containersList = ChemFileManipulator.getAllAtomContainers(chemFile);
                  JPanelFixture jcppanel=applet.panel("appletframe");
                  JChemPaintPanel panel = (JChemPaintPanel)jcppanel.target;
                  Assert.assertEquals(containersList.size(), containersList.size());
View Full Code Here

            }

            //From Molfile to Atom container -----------------------------------
            InputStream ins = new FileInputStream(tmpMolFile);
            MDLV2000Reader reader = new MDLV2000Reader(ins);
            ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
            atc= ChemFileManipulator.getAllAtomContainers(chemFile).get(0);
            atc.setProperty(CDKConstants.TITLE, null);

            // Generate coordinates for the atom container
            StructureDiagramGenerator sdg =
View Full Code Here

TOP

Related Classes of org.openscience.cdk.ChemFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.