Skip to content
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

Conversion SBML -> Escher creates mistake in file #51

Open
MariaHei opened this issue Jul 29, 2019 · 7 comments
Open

Conversion SBML -> Escher creates mistake in file #51

MariaHei opened this issue Jul 29, 2019 · 7 comments
Labels

Comments

@MariaHei
Copy link
Member

Apparently, something goes wrong in the conversion from SBML to Escher.
Converting from SBML to Escher works:
java -jar -Xms8G -Xmx8G -Duser.language=en EscherConverter-1.2.1.jar --input=GlycolysisLayout_small.sbml.xml --format=Escher --output=glycolysis.json --gui=false
But going back doesn't work, so presumably, the converted output of the first command is wrong:
java -jar -Xms8G -Xmx8G -Duser.language=en EscherConverter-1.2.1.jar --input=glycolysis.json --format=SBML --output=glycolysis.sbml --gui=false

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:658)
        at de.zbit.sbml.util.SBMLtools.toSId(SBMLtools.java:255)
        at edu.ucsd.sbrg.escher.converter.Escher2SBML.createSpeciesReferenceGlyphs(Escher2SBML.java:681)
        at edu.ucsd.sbrg.escher.converter.Escher2SBML.convertReaction(Escher2SBML.java:278)
        at edu.ucsd.sbrg.escher.converter.Escher2SBML.convert(Escher2SBML.java:112)
        at edu.ucsd.sbrg.escher.EscherConverter.convert(EscherConverter.java:143)
        at edu.ucsd.sbrg.escher.EscherConverter.convert(EscherConverter.java:195)
        at edu.ucsd.sbrg.escher.EscherConverter.convert(EscherConverter.java:450)
        at edu.ucsd.sbrg.escher.EscherConverter.batchProcess(EscherConverter.java:327)
        at edu.ucsd.sbrg.escher.EscherConverter.commandLineMode(EscherConverter.java:384)
        at de.zbit.Launcher.launchCommandLineMode(Launcher.java:725)
        at de.zbit.Launcher.run(Launcher.java:862)
        at de.zbit.Launcher.<init>(Launcher.java:211)
        at edu.ucsd.sbrg.escher.EscherConverter.<init>(EscherConverter.java:263)
        at edu.ucsd.sbrg.escher.EscherConverter.main(EscherConverter.java:253)

The reason for this error is a mistake in a metabolite, which presumably is caused by the first conversion:
Metabolite [coefficient=NaN, id=, nodeRefId=null]

@MariaHei MariaHei added the bug label Jul 29, 2019
@MariaHei
Copy link
Member Author

This might be due to a mistake in GlycolysisLayout_small.sbml.xml, since for many species in it, a warning is given, like for example:

ERROR (SBMLCoreParser.java:179) - "Glucose-6-phosphate" is not a valid identifier for this species.
 INFO (SBMLCoreParser.java:180) - Attribute = id, value 'Glucose-6-phosphate' , element name = species
 WARN (SBMLCoreParser.java:211) - Could not recognize the attribute 'id' on the element species. Please check the specification for SBML.

and

ERROR (SBMLCoreParser.java:179) - "Glucose-6-phosphate" is not a valid identifier for this speciesReference.
 INFO (SBMLCoreParser.java:180) - Attribute = species, value 'Glucose-6-phosphate' , element name = speciesReference
 WARN (SBMLCoreParser.java:211) - Could not recognize the attribute 'species' on the element speciesReference. Please check the specification for SBML.

DEVetter pushed a commit to DEVetter/EscherConverter that referenced this issue Oct 14, 2019
Species reference glyphs without an assignd role (i.e. null) will now be set to UNDEFINED role, with a warning.
For me, issue draeger-lab#51 does not work out the same: Already going from SBML to Escher causes problems.
@DEVetter
Copy link
Contributor

DEVetter commented Oct 14, 2019

For me, the SBML->Escher direction already does not work (java -jar EscherConverter-1.2.1.jar --input=data/GlycolysisLayout_small.sbml.xml --output=out/glycolysis.sbml --format=Escher --gui=false):

Exception in thread "main" java.lang.NullPointerException
        at edu.ucsd.sbrg.escher.converter.SBML2Escher.createMultiMarkers(SBML2Escher.java:372)
        at edu.ucsd.sbrg.escher.converter.SBML2Escher.lambda$convert$2(SBML2Escher.java:140)
        ...

In the file, roles are given as numbers (1,2,3,4) instead of strings like 'product', and the call sRG.getRole() thus yields null (leading to the above exception)

@draeger
Copy link
Member

draeger commented Oct 14, 2019

@DEVetter could you please add a link to the file GlycolysisLayout_small.sbml.xml so that it is easier to find?

If the roles are given as numbers, we might be able to circumvent this problem using the enum data structure that JSBML uses to parse the file. We should check if the error comes from JSBML already or if the file is corrupt. In the latter case, the file needs to be fixed first. If the file was erroneously generated by EscherConverter, the source of this problem needs to be fixed.

@DEVetter
Copy link
Contributor

It's in the data folder, for example in line 53

@draeger
Copy link
Member

draeger commented Oct 14, 2019

This is indeed unusual. It seems when writing the model, the role attribute was incorrectly written to the file, which seems to be a JSBML problem. Could you please take a look at how JSBML writes this attribute? The file will need to be fixed before continuing with fixing this bug.

@DEVetter
Copy link
Contributor

As far as i can tell, from JSBML's end, the role attribute has to be set to a legal SpeciesReferenceRole and is then handed through via SpeciesReferenceRole.writeXMLAttributes to the LayoutParser.

@draeger
Copy link
Member

draeger commented Nov 14, 2019

Maybe it would be best to just fix the errors in this example file directly.

DEVetter added a commit to DEVetter/EscherConverter that referenced this issue Nov 15, 2019
The file GlycolysisLayout_small.sbml.xml seems entirely dysfunctional: It was missing a speciesGlyph and still backconversion (when ignoring validation) does not work, as Escher2Standard will enter into an infinite while-loop.
The program shows correct behaviour if --ignore-validation is not set (i.e. it does not even try to convert, because validation fails).
DEVetter added a commit to DEVetter/EscherConverter that referenced this issue Nov 15, 2019
Added a little warning to the ignore-validation-help-entry
DEVetter added a commit to DEVetter/EscherConverter that referenced this issue Nov 15, 2019
I redid the examplefile (with Escher; content is only approximately equal: Previously, the file contained only the malformatted layout for the first two reactions), now it does no longer cause problems.
@DEVetter DEVetter mentioned this issue Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants