User 677b9c22ff
21-12-2009 14:16:03
Hi,
took me some time to figure that out and reminds me that every software writer
should have a deep JUNIT testing framework applied when coding in JAVA. Well,
I never went to that class and so its my bad (that will teach me something!).
I had some 10-100 liner running in JCHEM 4.x and it worked like charm, this is
jchem.version=5.2.4 and this is a bug regarding AsymmetricAtomCount.
C:\>cxcalc AsymmetricAtomCount "CIH"
id Asymmetric atom count
1 4
and now the error, you can see with CIH (cysteinylisoleucylhistidine) it works.
and with "C" (methane) epic fail.
C:\>cxcalc AsymmetricAtomCount "C"
Error at molecule: 1 ID = 1
java.lang.NullPointerException
java.lang.NullPointerException
at chemaxon.calculations.TopologyAnalyser.asymmetricAtomCount(TopologyAnalyser.java:393)
at chemaxon.marvin.calculations.TopologyAnalyserPlugin.getAsymmetricAtomCount(TopologyAnalyserPlugin.java:1130)
at chemaxon.marvin.calculations.TopologyAnalyserPlugin.getResult(TopologyAnalyserPlugin.java:1576)
at chemaxon.marvin.plugin.CalculatorPluginOutput.getResults(CalculatorPluginOutput.java:299)
at chemaxon.marvin.plugin.CalculatorPluginOutput.getResult(CalculatorPluginOutput.java:279)
at chemaxon.marvin.plugin.CalculatorPluginOutput.getCachedResults(CalculatorPluginOutput.java:210)
at chemaxon.marvin.plugin.concurrent.DefaultPluginWorkUnit.getResult(DefaultPluginWorkUnit.java:52)
at chemaxon.marvin.plugin.concurrent.PluginWorkUnit.call(PluginWorkUnit.java:91)
at chemaxon.util.concurrent.marvin.CompositeWorkUnit.call(CompositeWorkUnit.java:70)
at chemaxon.util.concurrent.processors.WorkUnitProcessorBase.process(WorkUnitProcessorBase.java:200)
at chemaxon.util.concurrent.processors.WorkUnitProcessorBase$Worker.call(WorkUnitProcessorBase.java:403)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
id Asymmetric atom count
1
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.NullPointerException
at chemaxon.marvin.Calculator.outputOnlyPlugin(Calculator.java:1469)
at chemaxon.marvin.Calculator.consume(Calculator.java:1404)
at chemaxon.marvin.Calculator.run(Calculator.java:1134)
at chemaxon.marvin.Calculator.run(Calculator.java:1096)
at chemaxon.marvin.Calculator.main(Calculator.java:1667)
Caused by: java.lang.NullPointerException
at chemaxon.calculations.TopologyAnalyser.asymmetricAtomCount(TopologyAnalyser.java:393)
at chemaxon.marvin.calculations.TopologyAnalyserPlugin.getAsymmetricAtomCount(TopologyAnalyserPlugin.java:1130)
at chemaxon.marvin.calculations.TopologyAnalyserPlugin.getResult(TopologyAnalyserPlugin.java:1576)
at chemaxon.marvin.plugin.CalculatorPluginOutput.getResults(CalculatorPluginOutput.java:299)
at chemaxon.marvin.plugin.CalculatorPluginOutput.getResult(CalculatorPluginOutput.java:279)
at chemaxon.marvin.plugin.CalculatorPluginOutput.getCachedResults(CalculatorPluginOutput.java:210)
at chemaxon.marvin.plugin.concurrent.DefaultPluginWorkUnit.getResult(DefaultPluginWorkUnit.java:52)
at chemaxon.marvin.plugin.concurrent.PluginWorkUnit.call(PluginWorkUnit.java:91)
at chemaxon.util.concurrent.marvin.CompositeWorkUnit.call(CompositeWorkUnit.java:70)
at chemaxon.util.concurrent.processors.WorkUnitProcessorBase.process(WorkUnitProcessorBase.java:200)
at chemaxon.util.concurrent.processors.WorkUnitProcessorBase$Worker.call(WorkUnitProcessorBase.java:403)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I first thought there was some change in the API or I made some wrong assignments,
or the molhandler was deprecated or however importing "ClC1CCCCC1Br" is not OK.
package examples;
import chemaxon.formats.MolFormatException;
import chemaxon.marvin.calculations.TopologyAnalyserPlugin;
import chemaxon.marvin.plugin.PluginException;
import chemaxon.struc.Molecule;
import chemaxon.util.MolHandler;
public class AssymetricError {
public static void main(String[] args) throws PluginException, MolFormatException {
// somehow the "C" cxsmiles evokes error in getAsymmetricAtomCount
// ok: ClC1CCCCC1Br
// FAIL: C
MolHandler mh = new MolHandler("C");
Molecule target = mh.getMolecule();
// create plugins - what is faster direct or plugin?
TopologyAnalyserPlugin topologyplugin = new TopologyAnalyserPlugin();
// set the input molecule
topologyplugin.setMolecule(target);
try {
// run the calculation
topologyplugin.run();
int myAromaticRingCount = topologyplugin.getAromaticRingCount();
int myassymetricringcount = topologyplugin.getAsymmetricAtomCount();
double tempbalabanindex = topologyplugin.getBalabanIndex();
System.out.println("ARC: " + myAromaticRingCount + " AssyRC: " + myassymetricringcount + " Balaban: "+ tempbalabanindex );
} catch (PluginException e) {
e.printStackTrace();
System.exit(1);
}// end catch
}
}
Exception in thread "main" java.lang.NullPointerException
at chemaxon.calculations.TopologyAnalyser.asymmetricAtomCount(TopologyAnalyser.java:393)
at chemaxon.marvin.calculations.TopologyAnalyserPlugin.getAsymmetricAtomCount(TopologyAnalyserPlugin.java:1130)
at examples.AssymetricError.main(AssymetricError.java:30)
OH: and another problem with the CODE boxes, they somehow cut off the code,
which is not very nice...
the line above was:
chemaxon.marvin.calculations.TopologyAnalyserPlugin.getAsymmetricAtomCount(TopologyAnalyserPlugin.java:1130)
but I can only see
chemaxon.marvin.calculations.TopologyAnalyserPlugin.getAsymmetricAtomCount(TopologyAnalyserPl
But this is a browser (JAVAScript flaw) because my screen is 1920x1200 and my
DPI settings are 130%, but guess what it worked since 5 years just recently when
this new editor was introduced it started cutting off text.
Cheers
Tobias