draeger-lab / EscherConverter

A standalone program that reads files created with the graphical network editor Escher and converts them to files in community standard formats.
https://draeger-lab.github.io/EscherConverter/
MIT License
15 stars 10 forks source link

WARNING: java.lang.IllegalArgumentException: Invalid label bounds #33

Closed anusurendra closed 5 years ago

anusurendra commented 5 years ago

Hi, I get a WARNING: java.lang.IllegalArgumentException: Invalid label bounds error when I am trying to convert my SBML file to a map JSON file. I used KeggTranslator to convert a KGML file to SBML_L3V1. Then am using the EscherConverter to convert it to JSON map file to put into Escher. Yet I get the following error:

11-Jan-2019 10:44:38 AM edu.ucsd.sbrg.escher.gui.SBMLLayoutViewPanel lambda$setSBMLLayout$19 --- WARNING: java.lang.IllegalArgumentException: Invalid label bounds: y.A.I.L[anchorX=NaN;anchorY=NaN;width=160.0;height=20.0;upX=0.0;upY=-1.0]
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Invalid label bounds: y.A.I.L[anchorX=NaN;anchorY=NaN;width=160.0;height=20.0;upX=0.0;upY=-1.0]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at javax.swing.SwingWorker.get(SwingWorker.java:602)
    at edu.ucsd.sbrg.escher.gui.SBMLLayoutViewPanel.lambda$setSBMLLayout$19(SBMLLayoutViewPanel.java:85)
    at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
    at javax.swing.SwingWorker$SwingWorkerPropertyChangeSupport.firePropertyChange(SwingWorker.java:854)
    at javax.swing.SwingWorker$SwingWorkerPropertyChangeSupport$1.run(SwingWorker.java:860)
    at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
    at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
    at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
    at javax.swing.Timer.fireActionPerformed(Timer.java:313)
    at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.IllegalArgumentException: Invalid label bounds: y.A.I.L[anchorX=NaN;anchorY=NaN;width=160.0;height=20.0;upX=0.0;upY=-1.0]
    at y.A.F.h.A(Unknown Source)
    at y.A.H.w.D(Unknown Source)
    at de.zbit.sbml.layout.y.M.A(YLayoutBuilder.java:595)
    at de.zbit.sbml.layout.y.M.builderEnd(YLayoutBuilder.java:760)
    at de.zbit.sbml.layout.LayoutDirector.buildLayout(LayoutDirector.java:441)
    at de.zbit.sbml.layout.LayoutDirector.run(LayoutDirector.java:795)
    at de.zbit.sbml.layout.y.LayoutDirectionTask.doInBackground(LayoutDirectionTask.java:72)
    at de.zbit.sbml.layout.y.LayoutDirectionTask.doInBackground(LayoutDirectionTask.java:34)
    at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at javax.swing.SwingWorker.run(SwingWorker.java:334)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

I have also attached my output from KeggTranslator.

hsa00630.sbml.zip

Any help is much appreciated.

draeger commented 5 years ago

The problem is that KEGG's layouts omit many details for the sake of a better arrangement of their maps. KEGGtranslator complements KEGG's maps with missing components. For instance, it often fills in missing side-substrates and side-products such as ATP or ADP, etc. However, when doing so, it doesn't have any meaningful coordinates for the added compounds. KEGGtranslator therefore often writes incomplete layout information into the SBML file that is intended to be completed by another program or the user.

EscherConverter, on the other hand, does not have the capability to complement incomplete layout information with meaningful coordinates. What you are observing here results from the KEGG source file that lacks information.

Now, how to best solve this?

  1. You could either run KEGGtranslator with the option not to complement KEGG maps. Then you should obtain a map that is closer to what KEGG presents. However, you should check if then also the core model is going to be incomplete. (Maybe KEGGtranslator still creates a full core model and just omits graphical information, but maybe it does not; I need to check myself.)
  2. Or you could load the map into another 3rd-party app or write a script yourself to set missing coordinate values to some value. The easiest solution could be to open the SBML file in a text editor and to use search and replace to change every NaN value with 0.0 or similar.
anusurendra commented 5 years ago

@draeger, Where is the option not to complement KEGG maps? I do not see the option in Preferences menu. Also, I got the following error when I use EscherConverter:

14-Jan-2019 11:08:31 AM edu.ucsd.sbrg.escher.converter.SBML2Escher lambda$null$4 --- INFO: adding segments: rg: glyph_rnR00235_1, srg: glyph_Acetate_3, reaction: 177898851
14-Jan-2019 11:08:31 AM edu.ucsd.sbrg.escher.converter.SBML2Escher lambda$null$4 --- INFO: srg(glyph_Acetate_1) set to primary node
14-Jan-2019 11:08:31 AM edu.ucsd.sbrg.escher.converter.SBML2Escher lambda$null$4 --- INFO: adding segments: rg: glyph_rnR00235_1, srg: glyph_ACSS_3, reaction: 177898851
Exception in thread "main" java.lang.NullPointerException
    at edu.ucsd.sbrg.escher.EscherConverter.writeEscherJson(EscherConverter.java:697)
    at edu.ucsd.sbrg.escher.EscherConverter.convert(EscherConverter.java:478)
    at edu.ucsd.sbrg.escher.EscherConverter.batchProcess(EscherConverter.java:333)
    at edu.ucsd.sbrg.escher.EscherConverter.commandLineMode(EscherConverter.java:385)
    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:264)
    at edu.ucsd.sbrg.escher.EscherConverter.main(EscherConverter.java:254)

I am running the following command java -jar EscherConverter-1.2.0.jar --input=hsa00630.sbml --output=hsa00630.json --format=Escher --log-level=ALL --gui=FALSE

anusurendra commented 5 years ago

@draeger I was able to fix the above error by setting the label-height and label-width parameters.

Thanks for the help.

draeger commented 5 years ago

Well done!