> I would prefer a simpler way such as:
>
> IMolecule molecule = (IMolecule) mol2Reader.read(
> DefaultChemObjectBuilder.getInstance().newMolecule());
as a "simple way" for accessing all molecules in an SD-File, I use a
simple extension of IteratingMDLReader:
--
public class SDFReader extends IteratingMDLReader
implements Iterable<Molecule> {
public SDFReader(String filename) throws FileNotFoundException {
super(new FileReader(filename),
DefaultChemObjectBuilder.getInstance());
}
public Iterator<Molecule> iterator() {
return this;
}
}
--
All what remains in my final code is this:
--
SDFReader sdfile = new SDFReader("/path/to/file.sdf");
for (Molecule m : sdfile) {
// do something
}
--
just my 2ct ;-)
Thomas
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user