Menu

#938 SDFWriter does not accept IAtomContainerSet, which IRingSet

cdk-1.2.x
closed
nobody
5
2012-11-03
2009-07-27
Peter Maas
No

When running the code below the following error is thrown:
"Only supported is writing of ChemFile, MoleculeSet, AtomContainer and Molecule objects."

mwrings = new MDLWriter(new FileWriter(this.outputDir + File.separatorChar + "allRingSystems.sdf"));
List <IRingSet> rings = gf.getRingFragments();
for (int i =0;i<rings.size();i++){
IAtomContainer ringw = RingPartitioner.convertToAtomContainer(rings.get(i));
mwrings.write(ringw);
}

Discussion

  • Egon Willighagen

    Two patches attached. One adding a general unit test that tests that accepted IChemObjects indeed can be written by write(). The second patch fixes the SDFWriter to also allow writing IAtomContainer and IAtomContainerSet as accepts() actually promises.

     
  • Egon Willighagen

    One senior reviewer needed.

     
  • Rajarshi Guha

    Rajarshi Guha - 2009-07-30

    Applied to cdk-1.2.x on github