User dfeb81947d
10-10-2012 15:11:07
Dear support,
I have found, while running through a database, a molecule for which the method MoleculeGraph.getChirality(int) has a problem with NullPointerException
I'm using this code on a 3 millions compounds and found this error on two compounds (I attached one of the compound in SDFile)
According to the documentation of the database source, it says the molecules are drawn using Marvin Sketch (But I have the feeling that it's not the case for many of them).
I'm using JChem API 5.11.1 with jdk1.6 under eclipse Indigo release 2 on Windows XP
ResultSet rs = connection.getStatement().executeQuery("SELECT MOLFILE FROM TABLE");
if(rs.next()) {
Molecule m = (new MolImporter(new MolInputStream(new ByteArrayInputStream(DatabaseTools.readBytes(rs, index))))).read();
MolAtom[] tabAtoms = m.getAtomArray();
for(int j=0; j<tabAtoms.length; j++) {
MolAtom molAtom = tabAtoms[j];
int chirality = m.getChirality(j);
...
}
}
rs.close();
The error is as follow:
java.lang.NullPointerException
at chemaxon.core.calculations.Parity.orderCIPConstitutional(Unknown Source)
at chemaxon.core.calculations.Parity.calculateTHChirality(Unknown Source)
at chemaxon.core.calculations.Parity.stereogenicCenterCalculation(Unknown Source)
at chemaxon.core.calculations.Parity.getChirality(Unknown Source)
at chemaxon.struc.MoleculeGraph.getChirality(Unknown Source)
When I open the sdf (attached in this post) using Marvin View 5.11.1, the GUI seems like to freeze, and not being thread safe (as if graphical thread is freezing). The GUI is printed with the application in background, in my case a web browser on JChem API Javadoc (see attached picture).
The fact is, if I remove all the SGroupData (of MDL Extended Molfile representation), the line starting with "M..." (but "M END"), the molecule open fine and is computed perfectly.
As it is two or three molecules over several millions, it's not blocking. But I wanted to check with you where the problem could be. It's helpful for me to understand.
Thank you for your helps,
Kind Regards
Jacques