Hi Vincent,

On Wed, Apr 22, 2009 at 5:24 PM, Vincent Le Guilloux
<vincent.le-guill...@univ-orleans.fr> wrote:
> I'm currenty using CDK to read SDF files using an IteratingMDLReader,
> and I've many errors of the same type during the execution. The
> exception message is the following:
> org.openscience.cdk.exception.CDKException: IAtom is not typed! O

This exception means that you are trying to have the CDK do things
which requires knowledge about the structure which can not be derived
from the data.

More practically, the CDK did not recognize the atom type of the
oxygen... this can, for example, be the results of it being negative
and have three neighbors...

<snip>

>         // Configure the molecule
>         AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(m);

This is the place where you should check that the atom types of all
atoms are detected, and then decide on what to do next...

>         // Now add hydrogens
>         CDKHydrogenAdder hAdder = 
> CDKHydrogenAdder.getInstance(m.getBuilder());

I think you can reuse the instance; there is no need to instantiate a
new hAdder for each molecule.

>         hAdder.addImplicitHydrogens(m);

One option here, is to only add implicit hydrogens for atoms of which
the atom type is recognized, and just ignore unrecognized atom types,
reflecting the fact that the CDK simply does not know how many
hydrogens to add.

One could argue that it is more user friendly to have it add zero
implicit hydrogens when unrecognized chemistry is passed, but forcing
to have to pass clean data to it (i.e. atoms for which it is known how
many hydrogens it can get) encourages the user to deal with unknowns
at the right moment... being, not at the end off the pipeline in bad
property prediction, but on input.

You could use the code:

for (IAtom atom : m.atoms()) {
  hAdder.addImplicitHydrogens(m, atom);
}

Does this help?

Egon

-- 
Post-doc @ Uppsala University
http://chem-bla-ics.blogspot.com/

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to