CML Format & Reactions - Null pointer exception

User 6f5b13c404

15-02-2011 11:28:33

Hi,


I have had some problems getting reactions to work with CML.


If I try


 


MolImporter.importMol("CCN>>CNC").toFormat("cml")


a null pointer exception gets thrown.


 


Saving a reaction out in CML from the GUI appears to work, but loading the file back in again truncates it to just the reactant.

ChemAxon 5433b8e56b

24-02-2011 02:02:55

Hi,


First of all, sorry for the very late answer. It seems this is a double bug in our system. I am filing bug reports into our issue tracking system about the two issue found. My collague, who will deal with this issues, will notify you in this topic, when the fix is ready.


The background:
the first issue which is causing the nullpointerexception is related to smiles import, and reaction representation. That could be workarounded by the following code:


RxnMolecule mol = (RxnMolecule) MolImporter.importMol("CCN>>CNC");
mol.setReactionArrow();
String s = mol.toFormat("cml");

the second issue is related to cml import, and therefore only the first reactant is imported by MolImporter.importMol() method. Unfortunatelly this one can not be workarounded, i can only suggest to use an other format for example mrv.


We are keen on to fix the issues as soon as we can. Sorry for the inconvenience, and thank you for the report.


Best reagrds,
Istvan

User 6f5b13c404

24-02-2011 10:44:23

Ok thanks for the investigation!


Does this mean that


(a) If I were importing from, say, an MDL rxnfile then generating CML then I wouldn't see this problem?


(b) Importing reaction smiles is more generally problematic at the moment? It looks from your workaround as though reaction smiles import isn't leaving the imported molecule in a completed state, and so depending on what I did with the RxnMolecule afterwards other errors might occur?

ChemAxon 5433b8e56b

24-02-2011 12:51:34

The problem is that some of our export write out the arrow properties as property, in these cases the problem arise when the arrow is not set. Unfortunatelly it seems all method in RxnMolecule aware of the case when the arrow is null, except the one that throws the NPE.


This means that a reaction without the arrow object is valid, this is because the arrow can be generated when it is needed. So as it seems its an arrow handling issue inside RxnMolecule. The issue will be fixed in the next release, as my collagues informed me now.


 


An additional information:
The previously mentioned workaround overrides the reaction arrow in every case, regardless its exsistance. If you simply call RxnMolecule.getItsArrow() method, that will create the arrow if not exists, and after that the export can use it. So with getItsArrow method you can not override the arrow if it was set by the importer, and therefore you can use that method after every import, if you are importing from various formats at the same time.


 


Regards,
Istvan

ChemAxon 5433b8e56b

11-04-2011 08:39:52

Hi,


we have successfuly fixed these issues, and in the upcoming 5.5 release it should work as expected. The new version is planned to be released within a few weeks.


Thank you for reporting these issues.


Best regards,
Istvan