From: rich a. <che...@ya...> - 2004-05-05 02:35:26
|
Hello All, As per a discussion Egon, Joerg, and I had on the qsar-devel list, I have put together a package that illustrates the use of CDK with Octet. It is called "cdktools-0.0.1.zip" and can be downloaded from sourceforge: http://sourceforge.net/project/showfiles.php?group_id=96108 This code implements two basic ideas: (1) Conversion back and forth between a CDK Molecule to an Octet Molecule through the use of static methods (CDKKit). (2) Use of a hybrid Molecule that extends org.openscience.cdk.Molecule _and_ inherits the net.sourceforge.octet.molecule.Molecule interface (BasicCDKMolecule). This class is at home either in the CDK environment, or in the Octet environment with no conversion necessary by virtue of Java's support for multiple inheritance. This provides a useful "abstraction layer" that shields clients from having to worry about what kind of a Molecule they have a reference to. It also simplifies debugging somewhat because conversion takes place at the time the Molecule is created. One of the problems I came up against in using option (2) was that the CDK IO classes create their own instance of org.openscience.cdk.Molecule, rather than allow for one to be passed in and operated on. If this could be enabled, then clients could go: BasicCDKMolecule cyclohexane = new BasicCDKMolecule(); SMILESReader reader = new SMILESReader(new StringReader("C1CCCCC1")); reader.read(cyclohexane); // or possibly reader.read(chemobject, cyclohexane); // now do something with cyclohexane // we now have cyclohexane that can be used in either Octet or CDK - and the beauty is that CDK knew nothing about what just happened! Of course, there are other strategies for CDK-Octet interoperability that could be followed, and variants on the above two, but I think this give a feel for what might be possible. Of course, this discussion is equally applicable to JOELib, just replace org.openscience.cdk.Molecule with joelib.molecule.Molecule. cheers, rich --------------------------------- Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs |