-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolves issues of SBMLTestSuite and FBA #40
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general recommendation, I'd suggest making use of the templates for code style from the JSBML project at https://github.com/sbmlteam/jsbml/tree/master/dev/. They can really help to automatically insert blank spaces, curly braces, and so forth, where forgotten.
Further comments were given in the code.
* @param x | ||
* @param expected | ||
* @return maxAbsDistances the list of maximum absolute distances in the blocks | ||
*/ | ||
public ArrayList<Double> getMaxAbsDistances(MultiTable x, MultiTable expected) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not declare unnecessarily specific return types for methods and also declare variables with the least specific type. In this concrete case, please use List<Double>
to initialize the variable for the distances
and also return a List<Double>
. You can still use an ArrayList<Double>
to initialize the variable, but not as return type. This applies to other positions as well.
src/test/download_bigg_models.sh
Outdated
cd resources/bigg | ||
cd TEST_DIR | ||
mkdir -p $TEST_DIR/resources/bigg | ||
cd $TEST_DIR/resources/bigg | ||
wget https://github.com/matthiaskoenig/bigg-models-fba/raw/master/models/bigg_models_v1.5.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthiaskoenig Not clear to me why we don't download the BiGG models directly from BiGG. Doesn't this detour introduce the problem that we need to keep two places in sync with BiGG Models Database?
// compute distance | ||
QualityMeasure distance = new RelativeEuclideanDistance(); | ||
double dist = distance.distance(solution, inputData); | ||
Assert.assertTrue(dist <= 0.2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend to always indicate the data type also for literal numbers, here, for instance, 0.2d
so that the compiler knows it is a double
value. If you do it always, you will not forget it in situations where it can make a difference (e.g., when dividing integer numbers).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@draeger, this has been removed from the code now. The distance has been now updated to the MaxDivergenceTolerance.
*/ | ||
public ArrayList<Double> getColumnDistances(MultiTable x, MultiTable expected) { | ||
ArrayList<Double> distances= new ArrayList<Double>(); | ||
public HashMap<String, Double> getMaxAbsDistances(MultiTable x, MultiTable expected) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here, please do not return HashMap<String, Double>
but Map<String, Double>
to make it easier to use a different implementation later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@draeger, Updated this in the latest commit.
@draeger, I can just see their recommendations but can't add the templates as I am working on IntelliJ (even prefer), and the templates are only present for Eclipse. |
Ok; so IntelliJ doesn't have an import for such files or doesn't come with comparable functions? |
I can just format the code as per the Java code style which is provided in IntelliJ given at this link. |
.travis.yml
Outdated
# get BiGG models for testing | ||
- source ./download_bigg_models.sh | ||
# get sbml-test-case models for testing | ||
- source ./download_sbml-test-suite.sh | ||
- cd ../.. | ||
- cd ../../.. | ||
|
||
script: | ||
- mvn clean install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add newline at end of file (I even get the warning here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
INSTALL.md
Outdated
mvn clean install -DskipTests | ||
``` | ||
|
||
The tests require additional resources which have to be downloaded. These include the sbml-testsuite and the BiGG models. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add links to the project pages (i.e. the git repository for the BiGG models and for the sbml-testsuite)! We are using these resources and should be linked in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
.travis.yml
Outdated
@@ -5,12 +5,12 @@ jdk: | |||
- oraclejdk11 | |||
|
|||
install: | |||
- cd src/test | |||
- cd src/test/scripts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do the cd and back here!
Just directly call the scripts as mentioned in the installation instructions
source ./src/test/scripts/download_bigg_models.sh
source ./src/test/scripts/download_sbml-test-suite.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
INSTALL.md
Outdated
The tests require additional resources which have to be downloaded. These include the sbml-testsuite and the BiGG models. | ||
``` | ||
source ./src/test/download_bigg_models.sh | ||
source ./src/test/download_sbml-test-suite.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing the scripts
directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
INSTALL.md
Outdated
``` | ||
|
||
## SBML Test Runner | ||
The SBML Test Runner is a standalone desktop application with a graphical user interface (GUI) for controlling SBML-compatible applications and making them run test cases from the [SBML Test Suite](http://sbml.org/Software/SBML_Test_Suite). It is written in Java with the Eclipse SWT widget toolkit and can be used on macOS, Linux and Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete: It is written in Java with the Eclipse SWT widget toolkit and can be used on macOS, Linux and Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
|
||
MultiTable solution; | ||
|
||
if (model.getExtension(CompConstants.shortLabel) == null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not set the tolerances anywhere for the simulation. Please set the tolerances explicitly! Only then it is possible to check the solutions correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
* @return the epsilon value | ||
*/ | ||
public double getEpsilon() { | ||
return EPS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this lowercase and call it epsilon
or eps
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthiaskoenig is here referring to the name of the variable, not the name of the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
for (String head : header) { | ||
if (!head.equalsIgnoreCase(data.getTimeName())) { | ||
newHead[i++] = head.trim(); | ||
for (int p = 1; p < header.length; p++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment why this loop is starting at 1. What are you ignoring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthiaskoenig, the time column has to be ignored for the newHead array. So, its started at index 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the main reason why the travis ignored the SBMLTestSuiteTest file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please just add a comment. Here, it can be as simple as adding // we are starting at 1 because...
in the line over the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@draeger, this is commented above at line 100 in this file: // exclude time column
.
} | ||
|
||
/* (non-Javadoc) | ||
* @see org.sbml.simulator.math.Distance#distance(java.lang.Iterable, java.lang.Iterable, double) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document this better ! Please describe what the distance is and state the used formula in the comment. This is the core comparison function metric used. This must be documented so that others understand what is done here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the comments properly in the initial description of the class.
* @see org.sbml.simulator.math.Distance#distance(java.lang.Iterable, java.lang.Iterable, double) | ||
*/ | ||
@Override | ||
public double distance(Column x, Column y, double defaultValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also did not see any test code for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding in the next commit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the tests for MaxDivergenceTolerance
class
@matthiaskoenig, but we have given get and set methods for the eps. So, I don't think we should declare it locally in the method. |
String filePath = dirPath + File.separator + currentCase + File.separator + currentCase + "-sbml-l" + level + 'v' + version + ".xml"; | ||
String settingsPath = dirPath + File.separator + currentCase + File.separator + currentCase + "-settings.txt"; | ||
String outputFilePath = outputDirPath + File.separator + currentCase + ".csv"; | ||
String resultsPath = dirPath + File.separator + currentCase + File.separator + currentCase + "-results.csv"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did anybody test this under Windows? To my knowledge, internally Java always uses /
as separator in paths and the virtual machine translates it to the operating system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to add: I think this will work, but I also think it is not needed (without having it tested).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I just saw that when we give /
, then Java internally handles things to translate to platform-specific code. But File.separator
can be a good way to show users what will make sense in their OS, rather than what makes sense to Java.
double absolute = (!properties.getProperty("absolute").isEmpty()) ? Double.parseDouble(properties.getProperty("absolute")) : 0d; | ||
double relative = (!properties.getProperty("relative").isEmpty()) ? Double.parseDouble(properties.getProperty("relative")) : 0d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be preferable to declare String
literals in the form public static final String ABSOLUTE = "absolute"
and then to reuse these constants where needed. This reduces maintenance effort and possible errors caused by typos.
Another possibility is creating an internal enum
such as:
public enum SettingsKeywords {
absolute;
...
}
that can be uses similarly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated by adding final variables for Strings.
Major changes from this PR:
src/test/scripts
folder. Updated the scripts files.