On Thu, 2006-07-06 at 16:57 +0300, Nina Jeliazkova wrote:
> Hello all,
> 
> I have couple of questions about org.openscience.cdk.qsar.DescriptorEngine. 
> 
> The method process(IAtomContainer molecule) throws an exception when some
> descriptor can not be calculated, which is quite logical.  
> 
> However, if an exception is thrown for a descriptor in the middle of the list
> (in my example MomentsOfInertia can't be calculated because of missing 3D
> coordinates), this prevents from calculation the rest of descriptors, which
> may not need 3D coordinates and can otherwise be safely calculated. 
> 
> Is this an intentional behaviour? 

Hmm, I haven't looked at the code for some time, but it shouldn't be
intentional :) 

But then the problem is: if we want to continue with the rest of the
descriptors we have to maintain a list of exceptions thrown and which
descriptor/molecule they were thrown for. This becomes a little messy.

Another more elegant approach would be to provide an iterator to the
list of available descriptors. So we could write code like the
following:


DescriptorEngine de = new DescriptorEngine(DescriptorEngine.MOLECULAR);
Iterator deIter = de.getDescriptorIterator();
while (deIter.hasNext()) {
   try {
       IDescriptor desc = (IDescriptor) deIter.next();
       // do the calculation
   } catch (Exception e) {
       // do something
   }
}

The problem with this is that it requires the user to perform most of
the processing (cast return value to propery type, save value etc). But
this method could be provided in addition to what is already available.

> The next question is more about design - is there a reason for classNames,
> descriptors, specList and instantiate* functions to be private rather than
> protected?  Private means these can't be accessed in a descendant class, so
> this essentially forbids creation of a descendant class. 

Well the idea of the engine was to provide a simple automated way to get
access to all available descriptors. I did not think that anybody would
want to subclass it!

However given the above iterator based interface, maybe they don't need
to be public (since they can be gotten from the descriptor object
themselves)

-------------------------------------------------------------------
Rajarshi Guha <[EMAIL PROTECTED]> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Mathematics is a game played according to certain simple 
rules with meaningless marks on paper.
-- David Hilbert



Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to