sbmlteam / online-sbml-validator

The Online SBML Validator is an SBML validation service offered at SBML.org.
2 stars 0 forks source link

inconsistent results sbml validation #4

Open Karrenbelt opened 5 years ago

Karrenbelt commented 5 years ago

When I submit a model for validation online (http://sbml.org/Facilities/Validator/) using drag and drop, it verifies ok, with some warnings (fbc model; no initial value assignments for species).

When I submit the same file through command line using curl, as follows: curl -F file=@model.xml -F output=text -F offcheck=u http://sbml.org/validator/ It does not verify as valid SBML. Errors returned are of the same type:

Error:  Line 5755: (SBML Validation Rule #fbc-21201) A <GeneProduct> object may have the optional SBML Level 3 Core attributes 'metaid' and 'sboTerm'. No other attributes from the SBML Level 3 Core namespace are permitted on a <GeneProduct>. 
Reference: L3V1 Core Section 3.2
  Attribute 'sbml:metaid' is not part of the definition of an SBML Level 3 Version 1 Package fbc Version 2 <geneProduct> element.

Apparently something else is happening, whereas I would expect it do the same. Apart from raising this issue, it would be nice to have the online validator code available for offline usage on local machines; is there a way to obtain the code of the online validator?

skeating commented 5 years ago

Hi Yes it really should give you the same results. I'll look into that. Thanks for the report.

Note that the attributes that are in the core namespace do not need to be prefixed.

fbergmann commented 5 years ago

@Karrenbelt do you think you could attach the model so we could have a detailed look as what is going on?

The code for the online validator is indeed available from SVN:

https://sourceforge.net/p/sbml/code/HEAD/tree/trunk/sbmlvalidator/

you basically just need the libsbml java bindings, from there the sbmlvalidator project would validate from commandline. The servlet is the web application that is running, the ui one was never really finished. Let us know if you need more help.

Karrenbelt commented 5 years ago

Hi Frank,

What I want to be able to do is run the validator from command line. I downloaded the validator, but I have no experience using java. The readme.md does not contain information in the installation section ("Information forthcoming ...."). So, I tried entered the folder sbmlvalidator/validator/src/org/sbml/validator and tried to compile and run Validate.java and Main.java, but without success. Then I figured I might need to use the sbmlvalidator/build.xml first, so I installed ant and ran "ant -f sbmlvalidator/build.xml" -> BUILD SUCCESSFUL. However, after this I still cannot compile (javac) or run (java) the scripts.

Also, I'd like to inquire what the options specified in the comments are used for: [ -D | -d opt1[,opt2,...] | -e opt1[,opt2,...] ] [-s] [-T timeout] filename.xml [results.xml]

I have attached the model that validates here http://sbml.org/Facilities/Validator/index.jsp, but not through command line, curl -F file=@model.xml -F output=text -F offcheck=u http://sbml.org/validator/ returning the following error

Error: Line 20273: (SBML Validation Rule #fbc-21201) A object may have the optional SBML Level 3 Core attributes 'metaid' and 'sboTerm'. No other attributes from the SBML Level 3 Core namespace are permitted on a . Reference: L3V1 Core Section 3.2 Attribute 'sbml:metaid' is not part of the definition of an SBML Level 3 Version 1 Package fbc Version 2 element.

note that I had to change the extension to txt to be able to upload the file here model.txt

fbergmann commented 5 years ago

Thanks again for the follow up. First the instructions for running it locally:

to compile

simply run ant in the sbmlvalidator folder. This will create the validator.jar for the next step. Next you download the libsbml java bindings. and place the files next to the validator.jar. For me those files were sbmlj.dll and libsbmlj.jar.

to run

Now you should be fine to run the local file. you would do that by running:

  java -jar validator.jar <sbml file>

When i tried your file, i used;

  java -jar validator.jar -d u  "\Downloads\model.txt"

here the u option disables the unit check.

the options

the following options can either be explicitly disabled (-d) or enabled (-e). possible values are:

inconsistencies

Finally, i figured out what was causing the issues and deployed an updated version of the online validator. (the strip package option was by default turned on when using a post using curl, but it is turned off by default on the online validator).

Karrenbelt commented 5 years ago

I'm glad to hear you found the inconsistency.

I cannot seem to find the java bindings online; I installed libsbml through pip (pip install python-libsbml), and would rather download solely the missing java bindings, instead of installing libsbml anew through the installer GUI.

I ran ant in the sbmlvalidator folder, created validator.jar and found libsbmlj.jar under sbmlvalidator/validator/lib/. I don't know how to obtain the sbmlj.dylib file though (I'm on macOS). When I then run java -jar validator.jar model.xml I get the java.lang.UnsatisfiedLinkError, as described here: http://sbml.org/Special/Software/libSBML/docs/java-api/libsbml-import-for-java.html

however, running java -Djava.library.path=/usr/local/lib/ -cp /Users/me/repositories/sbmlvalidator/libsbmlj.jar does that same as typing java; just give me a list of available options, meaning there is likely some syntactic error, so I tried with a white space in between D and java.library.path, which returns

Error: Could not find or load main class java.library.path=.usr.local.lib.

I'm not sure what the highlighted 'APPLICATION' is supposed to be either.

fbergmann commented 5 years ago

I've created a binary for you, if you grab the tar.gz from here:

https://heibox.uni-heidelberg.de/f/c3c9b64d92/

then you should be able to validate the files locally like so:

  tar zxf validator_macos.tar.gz
  cd validator_macos
  ./validate.sh model.xml

cheers Frank

Karrenbelt commented 5 years ago

Hi Frank,

Would it be possible to get a binary for Linux as well? The CI server I'm using doesn't work with the macos binary.

best, Michiel

fbergmann commented 5 years ago

Hello,

you only needed to replace the libsbmlj.jar and libsbmlj.jnilib file with the ones from the latest release. I've taken them from:

https://sourceforge.net/projects/sbml/files/libsbml/5.18.0/stable/

In any case, here the version for linux 64bit:

https://heibox.uni-heidelberg.de/f/902ea863c5/

it should work like before:

tar zxf validator_linux64.tar.gz
cd validator_linux64
./validate.sh model.xml