TopologyAnalyser fusedAromaticRings

User da00f5c453

30-03-2009 05:14:03

Hi all,





I noticed the latest functionality of TopologyAnalyser which can be very handy however when I try run the following code:





Code:



Molecule mol = MolImporter.importMol("c1ccc2ccccc2c1", "smiles");


      TopologyAnalyser tp = new TopologyAnalyser();


      tp.setMolecule(mol);


      int[][] aromRingSystems = tp.fusedAromaticRings();


      for(int[] ringSystem : aromRingSystems) {


         System.out.println(Arrays.toString(ringSystem));


      }








I get an exception





Code:
Exception in thread "main" java.lang.NullPointerException


   at chemaxon.calculations.TopologyAnalyser.fusedAromaticRings(TopologyAnalyser.java:1613)


   at chemaxon.calculations.TopologyAnalyser.fusedAromaticRings(TopologyAnalyser.java:1592)






accoring to java doc the fusedAromaticRings() function should return the atom indexes of the fused aromatic rings in the molecule and for the case above the indexes for naphthalene ring system





I am using JChem 5.2 and Java 1.6





Oleg.

ChemAxon d76e6e95eb

30-03-2009 14:53:03

I cannot reproduce the error, the code works perfectly on my computer with version 5.2. These are the results:


[1, 2, 3, 8, 9, 0]


[4, 5, 6, 7, 8, 3]





I will ask my colleague to investigate this problem further.

ChemAxon d76e6e95eb

31-03-2009 11:36:02

It seems, that the problem is caused by the static importMol function, that returns null! We will investigate the issue, until that I suggest you use something like this:





Code:



BufferedInputStream is = new BufferedInputStream(new FileInputStream(args[0]));


MolInputStream mis = new MolInputStream(is);


MolImporter imp = new chemaxon.formats.MolImporter(mis);


Molecule m;


while ((m = imp.read()) != null) {


    // your code here


}


User da00f5c453

02-04-2009 17:19:03

Hi Gyuri,





I tried your suggested code with the same naphthalene structure as before and still I get the same Exception





Code:



      BufferedInputStream is = new BufferedInputStream(new FileInputStream(args[0]));


      MolInputStream mis = new MolInputStream(is);


      MolImporter molReader = new MolImporter(mis);


      Molecule mol;


      TopologyAnalyser tp = new TopologyAnalyser();


      while((mol = molReader.read()) != null) {


         tp.setMolecule(mol);


          int[][] aromRingSystems = tp.fusedAromaticRings();


          for(int[] ringSystem : aromRingSystems) {


             System.out.println(Arrays.toString(ringSystem));


          }


      }


       molReader.close();








the exception





Code:



Exception in thread "main" java.lang.NullPointerException


   at chemaxon.calculations.TopologyAnalyser.fusedAromaticRings(TopologyAnalyser.java:1613)


   at chemaxon.calculations.TopologyAnalyser.fusedAromaticRings(TopologyAnalyser.java:1592)








the exception is thrown at code line





Code:
int[][] aromRingSystems = tp.fusedAromaticRings();






the input file (args[0]) contains





Code:



c1ccc2ccccc2c1








I tried this on windows and linux with Java 1.6 and the same results.





Oleg.


ChemAxon d76e6e95eb

07-04-2009 18:48:04

I am sorry, I do not know what I mixed, but it is really the fault of TopologyAnalyser. It will be corrected in the next bugfix version.

ChemAxon d76e6e95eb

13-04-2011 06:34:58

It has been fixed, so the upcoming new release (5.5) will contain it.