Hello all,
Having all sorts of problems with the following task. This class takes 
an IMolecule, and is supposed to calculate all Descriptors for it. 
Before calculating descriptors, it assigns 3D coordinates. Right now I 
just have it printing out the descriptor names and values until I get 
get it working properly. Here's the code:

        public class DescriptorCalculator {

            DescriptorEngine engine;
            public DescriptorCalculator()
            {}
           
            /**
             *
             * @param molecule
             * @precondition Molecule must be connected
             * @throws Exception
             */
            public void execute(IMolecule molecule)throws Exception
            {
               
        //        GENERATE 3D COORDINATES
                TemplateHandler3D template =
        TemplateHandler3D.getInstance();
                ModelBuilder3D mb3d =
        ModelBuilder3D.getInstance(template,"mm2");
                molecule = mb3d.generate3DCoordinates(molecule,true);
                 
                 
                 
                engine = new
        DescriptorEngine(DescriptorEngine.MOLECULAR);       
               
                try{
                engine.process(molecule);
                }
                catch(CDKException e)
                {System.out.println("*****CDKException:
        "+e.getMessage()); System.out.println();}
               
                /////TEST PRINTING
                Hashtable molProps = molecule.getProperties();
                Set keyList = molProps.keySet();
                Collection valList = molProps.values();
                Iterator keyItr = keyList.iterator();
                Iterator valItr = valList.iterator();
                int count = 0;
                while(keyItr.hasNext())
                {
                    Object nextKey = keyItr.next();
                    Object nextVal = valItr.next();
                   
                    if (nextKey instanceof DescriptorSpecification)
                    {
                       
        
System.out.println((((DescriptorSpecification)nextKey).getImplementationTitle()));
                       
        System.out.println(((DescriptorValue)nextVal).getValue().toString());
                        System.out.println(count);
                        count++;
                        System.out.println();
                    }
                //
                }
            }

Now, this works up to LengthOverBredthDescriptor, which throws a 
CDKException. The message for the exception says "Unrecognized 
AtomType". Examples of AtomTypes it is saying it can't recognize are 
"Csp2" and "C=". Now, as far as I can tell this is a bug... it should be 
able to recognize these AtomTypes, especially since they are entirely 
encapsulated in the underlying function and have nothing to do with what 
I've written... unless I'm missing something obvious. I've added it to 
the bug tracker as such but have received no response so far. Wondering 
if anyone can shed light on this. Also I'd appreciate any help on how to 
use this better... I think what I've done with iterators and sets is a 
messy solution.

Also, for the descriptors which require parameters, what is the most 
efficient way to set all the parameters for all the descriptors?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to