MyersResearchGroup / iBioSim

iBioSim is a computer-aided design (CAD) tool aimed for the modeling, analysis, and design of genetic circuits. It is capable of importing and exporting models specified using the Systems Biology Markup Language (SBML). iBioSim also supports the Synthetic Biology Open Language (SBOL), an emerging standard for information exchange in synthetic biology.
http://www.async.ece.utah.edu/ibiosim
Apache License 2.0
54 stars 21 forks source link

Null pointer exception on ReactionNode.setInitPropensity on all Java SSA simulators #279

Closed zgzn closed 7 years ago

zgzn commented 7 years ago

TCA_Cycle.xml in the attached project generates the null pointer exception shown below on all stochastic simulators. It also generates an error on reb2sac giellespie. I am not sure of the reason. I tried to remove both events, and set initial concentrations directly on the three species, but still could not fix this issue. This model does not, however, fail ODE simulation (rkf45 in reb2sac).

java.lang.NullPointerException at backend.analysis.dynamicsim.hierarchical.math.ReactionNode.setInitPropensity(ReactionNode.java:227) at backend.analysis.dynamicsim.hierarchical.HierarchicalSimulation.setInitialPropensity(HierarchicalSimulation.java:977) at backend.analysis.dynamicsim.hierarchical.methods.HierarchicalSSADirectSimulator.initialize(HierarchicalSSADirectSimulator.java:91) at backend.analysis.dynamicsim.hierarchical.methods.HierarchicalSSADirectSimulator.simulate(HierarchicalSSADirectSimulator.java:156) at backend.analysis.dynamicsim.DynamicSimulation.simulate(DynamicSimulation.java:158) at frontend.analysis.Run.execute(Run.java:1373) at frontend.analysis.AnalysisView.run(AnalysisView.java:1142) at frontend.analysis.AnalysisThread.run(AnalysisThread.java:43)

Executing: reb2sac.mac64 --target.encoding=gillespie /Users/zhangz/Desktop//classCircuit/TCA_analysis/TCA_Cycle.xml

Errors: : : method cannot be applied to the model

Total Simulation Time: 0.041376916 seconds for TCA_analysis

Class circuit.zip

leandrohw commented 7 years ago

This looks like a bug in the java libraries. However, the reb2sac is failing because you have a reversible reaction that cannot be split into two for stochastic simulations. For reversible reactions in stochastic simulation, they need to be in the form: kfX - krY. If your kinetic is in the form kf*X for some arbitrary species then you should mark it as reversible=false. The ODE simulation does not have this problem because it doesn't need to split reversible reactions.

zgzn commented 7 years ago

Thanks for the explanation. Is there a way to let the simulator (potentially both C and Java) return this issue to the user? The error messages we got from gillespie (rab2sac) and the Java SSA simulators seem to be vague, and are hard for us to figure out what the problem is.

leandrohw commented 7 years ago

I created a new issue for the reb2sac. The Java one treats the reverse reaction as 0 so it should've simulated. I will take a look at the bug and see why there is a null pointer.

leandrohw commented 7 years ago

Hierarchical simulator is not throwing the exception anymore. Closing.