Hi,
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
at
org.openscience.cdk.tools.CDKHydrogenAdder.addImplicitHydrogens(CDKHydrogenAdder.java:125)
at
org.openscience.cdk.tools.CDKHydrogenAdder.addImplicitHydrogens(CDKHydrogenAdder.java:110)
at sa2.gui.dbimport.ImportWorker.cleanMolecule(ImportWorker.java:157)
I've identified one of the molecule that lead to the exception. Here
is the corresponding SDF string:
-ISIS- 05220815552D
28 31 0 0 0 0 0 0 0 0999 V2000
-0.7458 1.0708 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0
-0.2708 0.7208 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.7208 2.2333 0.0000 N 0 3 0 0 0 0 0 0 0 0 0 0
-1.2708 0.7208 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2708 0.1500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.2708 0.1500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.7708 -0.1500 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-0.2333 1.3833 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2125 1.9583 0.0000 O 0 5 0 0 0 0 0 0 0 0 0 0
-1.7708 1.0208 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.2333 1.9583 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.3292 1.0708 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2125 1.3833 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.7708 -0.1500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.2708 0.1500 0.0000 C 0 0 3 0 0 0 0 0 0 0 0 0
-0.7208 2.8000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-2.2708 0.7208 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7708 1.5958 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.3292 1.6333 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.8000 0.7500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
0.2500 -0.1500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.2542 1.1000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.2542 2.2333 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.4333 -0.4167 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.8500 0.0625 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2.3375 0.9833 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.7792 1.3833 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.7792 1.9583 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2 1 1 0 0 0 0
3 9 1 0 0 0 0
4 1 1 0 0 0 0
5 4 2 0 0 0 0
6 2 2 0 0 0 0
7 5 1 0 0 0 0
1 8 1 1 0 0 0
9 13 1 0 0 0 0
10 4 1 0 0 0 0
11 8 2 0 0 0 0
12 2 1 0 0 0 0
1 13 1 6 0 0 0
14 5 1 0 0 0 0
15 17 1 0 0 0 0
16 3 2 0 0 0 0
17 10 1 0 0 0 0
18 10 2 0 0 0 0
19 12 2 0 0 0 0
20 12 1 0 0 0 0
21 6 1 0 0 0 0
22 8 1 0 0 0 0
23 11 1 0 0 0 0
24 15 1 0 0 0 0
25 15 1 0 0 0 0
26 20 1 0 0 0 0
27 22 2 0 0 0 0
28 27 1 0 0 0 0
11 3 1 0 0 0 0
6 7 1 0 0 0 0
28 23 2 0 0 0 0
14 15 1 0 0 0 0
M CHG 2 3 1 9 -1
M END
> <id> (1-0009)
1-0009
$$$$
Currently I don't understand why this error occurs and where exactly
is the problem... I just see that some molecules that (for example)
MOE reads without complaining, lead to the previously described
exception.
Just for the precision, I use the following sequence of instruction to
clean a molecule; maybe I'm doing something wrong :
private void cleanMolecule(IMolecule m)
throws CDKException
{
// Remove salts or solvents... Keep only the largest molecule
if (!ConnectivityChecker.isConnected(m)) {
IMoleculeSet fragments =
ConnectivityChecker.partitionIntoMolecules(m);
int maxID = 0 ;
int maxVal = -1 ;
for(int i = 0 ; i < fragments.getMoleculeCount() ; i++) {
if(fragments.getMolecule(i).getAtomCount() > maxVal) {
maxID = i ;
}
}
m = fragments.getMolecule(maxID) ;
}
// Configure the molecule
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(m);
// Now add hydrogens
CDKHydrogenAdder hAdder =
CDKHydrogenAdder.getInstance(m.getBuilder());
hAdder.addImplicitHydrogens(m);
// Detect aromaticity
CDKHueckelAromaticityDetector.detectAromaticity(m);
}
The exception is thrown at the addImplicitHydrogens call.
Thanks in advance for your help!
Best regards
--
Vincent Le Guilloux
Phd Student - ICOA - UMR CNRS 6005
Div. of chemoinformatic and molecular modeling.
University of Orléans
Phone: ++33 2 38 49 45 77
Fax : ++33 2 38 41 72 81
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user