draeger-lab / SBSCL

The Systems Biology Simulation Core Library (SBSCL) provides an efficient and exhaustive Java implementation of methods to interpret the content of models encoded in the Systems Biology Markup Language (SBML) and its numerical solution.
https://draeger-lab.github.io/SBSCL/
GNU Lesser General Public License v3.0
20 stars 13 forks source link

Support for stochastic simulation added #54

Closed hemilpanchiwala closed 4 years ago

hemilpanchiwala commented 4 years ago

Updates from this PR:

With these updates and PR #53, stochastic simulation support is now added to SBSCL. All the updates of the project are present at my blog posts at this link.

zakharc commented 4 years ago

@hemilpanchiwala: Please clarify:

36 out of 39 tests now pass successfully (others fail as currently there is no support for rules and species with no substance units). Also, as stochastic tests can fail sometimes due to randomness, so for passing the Travis CI, seed values for all the models have been collected, and currently, tests are ran using these seed values, so tests run fast and pass successfully.

I see 5 errors (not fails) with NPE in the build log:

[[1;31mERROR[m] testBasicSEDMLExecutorForMiriamURNDefinedModel(org.simulator.sedml.SEDMLExecutorTest)  Time elapsed: 2.067 s  <<< ERROR!
java.lang.NullPointerException
    at org.simulator.sedml.SEDMLExecutorTest.testBasicSEDMLExecutorForMiriamURNDefinedModel(SEDMLExecutorTest.java:137)

[[1;31mERROR[m] testLeloupSBML(org.simulator.sedml.SEDMLExecutorTest)  Time elapsed: 1.024 s  <<< ERROR!
java.lang.NullPointerException
    at org.simulator.sedml.SEDMLExecutorTest.testSpecificationExample(SEDMLExecutorTest.java:228)
    at org.simulator.sedml.SEDMLExecutorTest.testLeloupSBML(SEDMLExecutorTest.java:153)

[[1;31mERROR[m] testRepressilator1(org.simulator.sedml.SEDMLExecutorTest)  Time elapsed: 0.138 s  <<< ERROR!
java.lang.NullPointerException
    at org.simulator.sedml.SEDMLExecutorTest.testSpecificationExample(SEDMLExecutorTest.java:228)
    at org.simulator.sedml.SEDMLExecutorTest.testRepressilator1(SEDMLExecutorTest.java:249)

[[1;31mERROR[m] testRepressilator(org.simulator.sedml.SEDMLExecutorTest)  Time elapsed: 0.057 s  <<< ERROR!
java.lang.NullPointerException
    at org.simulator.sedml.SEDMLExecutorTest.testSpecificationExample(SEDMLExecutorTest.java:228)
    at org.simulator.sedml.SEDMLExecutorTest.testRepressilator(SEDMLExecutorTest.java:200)

[[1;31mERROR[m] testIkappab(org.simulator.sedml.SEDMLExecutorTest)  Time elapsed: 0.03 s  <<< ERROR!
java.lang.NullPointerException
    at org.simulator.sedml.SEDMLExecutorTest.testSpecificationExample(SEDMLExecutorTest.java:228)
    at org.simulator.sedml.SEDMLExecutorTest.testIkappab(SEDMLExecutorTest.java:147)

Also, tons of warnings of this type:

WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.5: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.6: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation
WARNING: [VIOLATION]    (k1 < 10) && (k1 > 0) at time 6.4: 
Jul 30, 2020 3:28:58 AM org.simulator.sbml.SimpleConstraintListener processViolation

Or this:

 WARN (SBMLReader.java:1096) - Cannot find a parser for the  namespace
 WARN (SBMLReader.java:1324) - !!! event.isEndElement: there is a problem in your SBML file !!!!
 WARN (SBMLReader.java:1325) - This should never happen, there is probably a problem with the parsers used.
 Try to check if one needed parser is missing or if you are using a parser in development.
 WARN (SBMLReader.java:1096) - Cannot find a parser for the  namespace
 WARN (SBMLReader.java:1096) - Cannot find a parser for the  namespace
 WARN (SBMLReader.java:808) - Some characters cannot be read: type
 WARN (SBMLReader.java:1324) - !!! event.isEndElement: there is a problem in your SBML file !!!!
 WARN (SBMLReader.java:1325) - This should never happen, there is probably a problem with the parsers used.
 Try to check if one needed parser is missing or if you are using a parser in development.
 WARN (SBMLReader.java:808) - Some characters cannot be read:  Status report
 WARN (SBMLReader.java:1324) - !!! event.isEndElement: there is a problem in your SBML file !!!!
 WARN (SBMLReader.java:1325) - This should never happen, there is probably a problem with the parsers used.
 Try to check if one needed parser is missing or if you are using a parser in development.

Is this expected?

log.txt

hemilpanchiwala commented 4 years ago

@zakharc, the reason for Travis CI failing currently is that for the simulation of the SED-ML models, it downloads the models via a URN from biomodels. But currently, the site from which it downloads is down, so the tests are failing.

This is what gets downloaded currently as a SEDML model

<!DOCTYPE html>Apache Tomcat/8.0.24 - Error report

HTTP Status 404 - /biomodels-main/download

type Status report

message /biomodels-main/download

description The requested resource is not available.


Apache Tomcat/8.0.24

So, once the site runs fine, these tests will pass fine. Also, the SBMLReader warnings are due to this as it is interpreting the above code as a model.

hemilpanchiwala commented 4 years ago

For the tons of warnings of [VIOLATION]...., I don't have any idea about them currently as I have not worked on them. I will see that test file and try to figure out why this warnings come.

zakharc commented 4 years ago

@hemilpanchiwala:

so the tests are failing.

As I said in my previous post (and highlighted in bold text): I see 5 errors (not fails) with NPE. Fail: Our code does not meet its test criteria. That means that the test case fails due to assertions not being fulfilled. Error: We have an unexpected situation during test execution. Do we talk about the same tests?

the reason for Travis CI failing currently is that for the simulation of the SED-ML models, it downloads the models via a URN from biomodels. But currently, the site from which it downloads is down.

I am quite sure, that throwing NPE on this scenario is not the best idea. If this is the reason for the errors, we need a meaningful exception for that.

So, once the site runs fine, these tests will pass fine.

I think re-triggering the build would be a good idea. I would like to see it pass :)

For the tons of warnings of [VIOLATION]...., I don't have any idea about them currently as I have not worked on them. I will see that test file and try to figure out why these warnings come.

:thumbsup:

hemilpanchiwala commented 4 years ago

@zakharc,

As I said in my previous post (and highlighted in bold text): I see 5 errors (not fails) with NPE. Fail: Our code does not meet its test criteria. That means that the test case fails due to assertions not being fulfilled. Error: We have an unexpected situation during test execution. Do we talk about the same tests?

Yes, I am talking about these tests only. I get the model as a string which I sent in my last message. Then this model is passed to SBMLReader which reads and only gives warnings (but simulation runs further). And at a point, when any field is accessed from this, it gets a null value. This is the reason why NPE is given.

I have run the tests again but currently, also the tests are failing. But I am sure that the Travis will pass once this thing is running as the fern branch has a passing Travis in my forked repository.

hemilpanchiwala commented 4 years ago

Please update/refactor the CSVImporter and fix the smaller issues I commented on.

@matthiaskoenig, I have updated all the requested changes.

draeger commented 4 years ago

One more question about the CSVImporter: Will it automatically remove blanks between values? If not, this would be an extremely important feature. Maybe instead of using the equals method for String comparison, it would be better to check for values using regular expressions with leading and tailing blanks.

hemilpanchiwala commented 4 years ago

One more question about the CSVImporter: Will it automatically remove blanks between values? If not, this would be an extremely important feature. Maybe instead of using the equals method for String comparison, it would be better to check for values using regular expressions with leading and tailing blanks.

@draeger, I think I can trim each line so spaces get removed and then I can get the things. Something like this: s.replaceAll("\\s", "");

I didn't understand your second statement of not using the equals method. Can you please explain it once?

hemilpanchiwala commented 4 years ago

@zakharc, I have updated most of the requested changes. I have some questions in few which I have commented, once you answer that I will update that changes too.