Hi Nina,

On Wed, 2009-09-02 at 12:26 +0300, Nina Jeliazkova wrote:

> Hi Tobias,
> 
> Descriptor engine relies on introspection to find classes implementing
> certain (descriptor) interfaces.  Since  Java  Web Start mechanism for
> loading classes is a bit different , this behaviour is not quite
> unexpected. 
> 
> Although I am not an author of it, I've struggled before with trying
> to make Descriptor engine load classess from jars other than CDK / on
> the default class path.  A (rough) workaround is to explicitly define
> the descriptor class names in a list, but that's far from elegant. 


I've been thinking of that workaround, too. And I tried it yesterday
with a single descriptor. It seems calculating a single descriptor with
descriptor.calculate(ac) inside the Java Webstart seems to work. The
following example printed out the values fine:

BCUTDescriptor descriptor = new BCUTDescriptor();
Object[] par = { new Integer(3), new Integer(3) , true};
descriptor.setParameters(par);
DescriptorValue retval = descriptor.calculate(ac);
IDescriptorResult val = (IDescriptorResult) retval.getValue();
String[] names = retval.getNames();
if (val instanceof DoubleArrayResult){
    DoubleArrayResult ret = (DoubleArrayResult) val;
    for (int i = 0; i < ret.length(); i++){
        System.out.println(ret.get(0));
    }
}


But the engine approach is a much more elegant one...

Regards,
Tobias

> Regards,
> Nina 
> 
> Tobias Girschick wrote: 
> 
> > Hello,
> > 
> > I have come across a  weird behaviour (or at least for me it seems
> > weird) of the DescriptorEngine when I use it to calculate all
> > available molecular descriptors for a set of Molecules.
> > It normally works perfectly fine, but when I tried to use it within
> > Java Webstart, it seems that it did not do anything.
> > 
> > My code:
> > DescriptorEngine engine = new
> > DescriptorEngine(DescriptorEngine.MOLECULAR);
> > // as long as we have molecules in the set
> > while (it.hasNext()){
> >     IAtomContainer ac = (IAtomContainer) it.next();
> >     try{
> >         engine.process(ac);
> >     } catch (CDKException c)
> >         c.printStackTrace();
> >         logger.warning("problem with descriptor engine");
> >     }
> >         
> >         Map<Object, Object> props = ac.getProperties();  
> >         Iterator<Object> iter = props.keySet().iterator();
> >         
> >         // for all calculated descriptors 
> >         while (iter.hasNext()){
> >             Object obj_key = iter.next();
> >             // for debugging 
> >             System.err.println("c"+ props.get(obj_key));
> >         }
> > ...
> > }
> > 
> > Normally the line System.err.println() in the end of the code
> > snippet gives a lot of different stuff, e.g. References .... 
> > But if I wrap it in Java Webstart, the only property that is there
> > is:
> > 
> >     cCopyright Ak Gasteiger, University of Erlangen-Nuernberg,
> > Germany
> > 
> > Any idea what might be the problem? Shouldn't the engine tell me
> > somehow if something didn't work?
> > 
> > Thanks for your help in advance
> > Regards,
> > Tobias
> > 
> > 
> > -- 
> > Dipl.-Bioinf. Tobias Girschick
> > 
> > Technische Universität München
> > Institut für Informatik
> > Lehrstuhl I12 - Bioinformatik
> > Bolzmannstr. 3
> > 85748 Garching b. München, Germany
> > 
> > Room: MI 01.09.042
> > Phone: +49 (89) 289-18002
> > Email: [email protected]
> > Web: http://wwwkramer.in.tum.de/people/girschic
> >         
> > 
> > 
> > ____________________________________________________________________
> > 
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> > trial. Simplify your report design, integration and deployment - and focus 
> > on 
> > what you do best, core application coding. Discover what's new with 
> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > 
> > ____________________________________________________________________
> > 
> > _______________________________________________
> > Cdk-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/cdk-user
> >   
> 
> 

-- 
Dipl.-Bioinf. Tobias Girschick

Technische Universität München
Institut für Informatik
Lehrstuhl I12 - Bioinformatik
Bolzmannstr. 3
85748 Garching b. München, Germany

Room: MI 01.09.042
Phone: +49 (89) 289-18002
Email: [email protected]
Web: http://wwwkramer.in.tum.de/people/girschic
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to