NullPointerException on simple reaction transformations

User 22cecfe2f7

16-05-2016 22:08:06

Chemaxon version: 15.10.26.0


Java version: 1.8.0_65


Summary: I am getting NullPointerException errors when a reactor has a "Nitrogen doubled bonded to a ring structure" in the products side of the reactant. The does not happen when the nitrogen double bonded structure is not in the products side (ie reactor.setReactionString("N=C1CC=CC=C1>>N=C"); works).


Here is a table of when the null pointer exception happens:






























Substrate Products Fail?
N=C1CC=CC=C1 N=C No
N=C N=C1CC=CC=C1 Yes
N=C1CC=CC=C1 N=C1CC=CC=C1 Yes
N=C N=C No


Context
: We came up with the minimal chemical structure (the nitrogen bonded to a cycle) that did not work based on an actual chemical we had the exact same issue with.


 


Code:


import chemaxon.formats.MolExporter;


import chemaxon.formats.MolImporter;


import chemaxon.reaction.Reactor;


import chemaxon.struc.Molecule;


 


public class Test {


  public static void main(String[] args) throws Exception {


    // Create reactor


    Reactor reactor = new Reactor();


    reactor.setReactionString("N=C1CC=CC=C1>>N=C1CC=CC=C1");


 


    // Create substarte that is exactly equal to the left side of the reaction


    Molecule[] test = new Molecule[1];


    test[0] = MolImporter.importMol("N=C1CC=CC=C1");


 


    // Expect the product to be the same as the right side of the reaction


    reactor.setReactants(test);


    Molecule[] products = reactor.react();


 


    // Fail at this point..


    String inchi = MolExporter.exportToFormat(products[0], "inchi");


  }


}


 


Stacktrace:


Exception in thread "main" chemaxon.marvin.io.MolExportException


at chemaxon.marvin.io.formats.inchi.InchiExport.convert(InchiExport.java:152)


at chemaxon.formats.MolExporter.exportToObject(MolExporter.java:1348)


at chemaxon.formats.MolExporter.exportToObject(MolExporter.java:1292)


at chemaxon.formats.MolExporter.exportToFormat(MolExporter.java:1178)


at com.Test.main(Test.java:23)


Caused by: java.lang.NullPointerException


at chemaxon.struc.MoleculeGraph.indexOf(MoleculeGraph.java:5425)


at chemaxon.marvin.io.formats.inchi.InchiExport.convertStructure(InchiExport.java:416)


at chemaxon.marvin.io.formats.inchi.InchiExport.convert(InchiExport.java:87)

ChemAxon 044c6721bc

17-05-2016 09:25:11

Hi,


There was a bug in our inchi export. We have fixed it and it will be available in the next release.


Till then, you can use mrv file format if the inchi is not important for you.


Janos

User 22cecfe2f7

17-05-2016 17:50:02

Hi Janos,


a) When is the next release scheduled to happen?


b) The inchi is important to us, is there anyway to recover it, maybe by exporting to MRV and then converting that to inchi? Will information be lost through this process?


 


Regards,


Vijay 

ChemAxon 044c6721bc

18-05-2016 06:47:58

Hi,


Next week, I can inform you when it's available.


This can work, I think there won't be any information loss.


Janos

ChemAxon 044c6721bc

25-05-2016 13:24:45

Hi,


The new release (16.5.23.0) is available on the website.


Please let me know if you still have issues.


Janos