#33 FileConvertor question

closed
None
5
2012-10-08
2002-10-08
No

I have problems using the FileConvertor.
I want to convert a cml file to a mol file. The mol file is
created without the bonds.
I made a TestFileConvertor that converts a molecule.cml
to a molecule.mol.

import org.openscience.cdk.applications.FileConvertor;

public class TestFileConvertor {
public TestFileConvertor() {}
public static void main(String[] args) {
FileConvertor convertor = new FileConvertor
("CML", "MOL");
boolean success = convertor.convert
("molecule.cml", "molecule.mol");
if (success) {
System.out.println("Conversion succeeded!");
}
else {
System.out.println("Conversion failed!");
}
}
}

The result is a molecule.mol -> 0 KB
and molecule.mol.1 -> 1 KB
This is the molecule.mol.1:

11 0 0 0 0 0 0 0 0 0 1 V2000
74.3110 113.1112 0.0000 C 0 0 0 0 0 0 0 0
0 0 0 0
90.2001 82.3400 0.0000 C 0 0 0 0 0 0 0 0
0 0 0 0
93.6475 142.5366 0.0000 C 0 0 0 0 0 0 0 0
0 0 0 0
39.2512 115.2129 0.0000 C 0 0 0 0 0 0 0 0
0 0 0 0
124.7528 80.2384 0.0000 C 0 0 0 0 0 0 0 0
0 0 0 0
71.1147 53.0000 0.0000 Cl 0 0 0 0 0 0 0 0 0
0 0 0
128.1173 140.6861 0.0000 C 0 0 0 0 0 0 0 0
0 0 0 0
23.6157 146.6570 0.0000 O 0 0 0 0 0 0 0 0
0 0 0 0
20.0000 86.2093 0.0000 Cl 0 0 0 0 0 0 0 0 0
0 0 0
144.0064 109.2444 0.0000 C 0 0 0 0 0 0 0 0
0 0 0 0
179.0638 107.2257 0.0000 Cl 0 0 0 0 0 0 0 0
0 0 0 0
M END

I added xerces-1.3.0.jar and gnujaxp.jar to the classpath.
I upload the molecule.cml

Discussion

  • Hans Vanderzijl

    Hans Vanderzijl - 2002-10-08

    FileConvertor question

     
  • Egon Willighagen

    Logged In: YES
    user_id=25678

    I've had a look at the content of the CML file. And it
    turnes out that CDK's did not read the bond orders as they
    are given in invalid CML code, i.e.
    <float buildin="order"> does not exist in the CML DTD, and
    is should be
    <string buildin="order">. I've added reading the of the
    former one for compatibility and fixed CDK's CMLWriter that
    produced the invalid CML code.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks