rambaut / figtree

Automatically exported from code.google.com/p/figtree
376 stars 103 forks source link

FigTree exports empty svg files #148

Open ingridole opened 4 years ago

ingridole commented 4 years ago

I have used FigTree for a long time, and everything worked fine. Recently, I would guess due to an update of one of the programs FigTree uses, it started happening. I can open tree files on FigTree, do everything within, export perfectly fine pdf and png, but when I export it as svg files, it exports absolutely empty file.

As my downstream pipeline uses this format, it is really a bit struggle. When I open png/pdf file and save it as svg - the format of 'text' inside this svg is different from the original svg format.

Would highly appreciate any thoughts of why is this happening / what is the difference between exporting to pdf/png and svg?

edit: I use Ubuntu 18.04

ERRMoody commented 4 years ago

Did you solve this? I'm struggling with the same issue

ingridole commented 4 years ago

Did you solve this? I'm struggling with the same issue No.. i suspect it might be due to some not compatible Java version? (wild guess). Other colleagues have no problem with this..

ERRMoody commented 4 years ago

Interesting, the PDF works fine so I just used that instead as it's also vector format

ingridole commented 4 years ago

I also can get PDF, so I guess our problem is the same. Though, had a workflow, where afterwards was modifying text inside .svg format.. so for me it did not solve the problem..

caroladam commented 3 years ago

Any luck? I reinstalled FigTree and I'm still having the same problem. I use Linux Mint 19.1 Tessa.

I ended up exporting in PDF and then converting online to SVG using: https://cloudconvert.com/pdf-to-svg

ingridole commented 3 years ago

many Ubuntu software updates etc later - problem is still there. I''ll check the converting thing! though, even if the format is svg - the syntax is usually quite different.. so in my workflow, I just started to annoy my colleagues to export svgs for me by hand (supper annoying; but I am not intensively analysing data at the moment).

ammaraziz commented 3 years ago

What version of java does everyone have installed? I have openjdk 11.0.9 2020-10-20 on linux mint 20 and SVG export works.

caroladam commented 3 years ago

I also have openjdk 11.0.9 2020-10-20, but Linux Mint 19.1 Tessa

ammaraziz commented 3 years ago

Can you please post an example of a failed svg? I'll try to debug the issue but I can't promise anything.

Another option is to try and run figtree via the command line:

java -jar figtree.jar -graphic SVG input.tree output.svg

and see if this works.

caroladam commented 3 years ago

Thanks for the follow-up @ammaraziz

The output for the following command: figtree -graphic SVG g10mac3dp20maf05.treefile test.svg

Creating SVG graphic: test.svg Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/batik/i18n/Localizable at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at figtree.application.FigTreeFrame.exportSVGFile(Unknown Source)... 22 more at figtree.application.FigTreeFrame.exportGraphics(Unknown Source) at figtree.application.FigTreeApplication.createGraphic(Unknown Source) at figtree.application.FigTreeApplication.main(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.apache.batik.i18n.Localizable at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 22 more

It also creates an empty .svg file.

ingridole commented 3 years ago

in my case, java -version openjdk version "11.0.9.1" 2020-11-04 OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04) OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)

and it also does create an empty .svg file; sometimes, even when I just click on 'export as svg' figtree automatically closes. the errors I get:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/batik/i18n/Localizable at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at figtree.application.FigTreeFrame.exportSVGFile(Unknown Source) at figtree.application.FigTreeFrame.exportGraphics(Unknown Source) at figtree.application.FigTreeFrame.doExportGraphic(Unknown Source) at figtree.application.FigTreeFrame$26.actionPerformed(Unknown Source) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369) at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020) at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342) at java.desktop/java.awt.Component.processEvent(Component.java:6400) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Caused by: java.lang.ClassNotFoundException: org.apache.batik.i18n.Localizable at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 59 more

I suspect it to be Java (Caused by: line)... as we both seem to have the same version of it.

ingridole commented 3 years ago

On the other hand this one: java -jar figtree.jar -graphic SVG input.tree output.svg

did work!

ammaraziz commented 3 years ago

Thanks for providing that info @ingridole @caroladam. The good news is that you both have the same problem... Batik is the library used to create the svg output but it's apparently missing. For me, I launch figtree via the .jar file. This should contain all the necessary code and external packages (such as batik).

  1. Next can you confirm you are using the latest figtree version (1.4.4)?
  2. Can you please confirm are launching figtree via figtree.jar?
  3. If so, can you try opening the .jar file with Archive Manager and navigate to: /org/apache/batik/i18n/. Do you see Localizable.class ?

On the other hand this one: java -jar figtree.jar -graphic SVG input.tree output.svg did work!

That's really interesting. This might be a working solution for you if you save your tree and then use the CLI to output svg.

By the way, I'm not a maintainer or developer on figtree, just a fellow figtree user trying to help others out.

caroladam commented 3 years ago

I updated for 1.4.4 and it worked just fine, using both command-line and GUI! But just fiy, merely launching Figtree without using the .jar file still creates an empty SVG even in v.1.4.4.

Thank you for taking interest @ammaraziz !

mjeltsch commented 11 months ago

I still have the same problem in 2023. No SVG files for me on Ubuntu 22.04 with Figtree 1.4.4. Neither via the GUI, nor via the command line invoking the jar file. Strange that this problem is still around without any real explanation. Luckily there is inkscape to convert the PDF, but I also sometimes would like to modify the SVG programmatically. However, the problem seems to be with the Ubuntu package. If I download the 1.4.4 tgz from github, the SVG export works. So with whom should I file the bug report? I have to look who is packaging this for Ubuntu...

ingridole commented 4 months ago

svgs never worked, but I adapted around using pdfs. But now pdf is also empty... (I suspect maybe due to a big tree ( up to 1500 seqs).

I tried to just export in command line (and then mark everything in inkscape...) but while running: java -jar /usr/share/java/figtree.jar -graphic PDF -width 320 -height 1320 fortree.namesback.01.tre output.pdf

even though it all is in the .pdf but I can't apply expansion - thus can't even see the tip labels of my tree.

as work-around solution to this - is there a way to specify the expansion in the command line? (2024 February)

edit: updated everything on the computer and restarted and it seems to work now (at least with not annotated tree). Maybe memory was too pre-occupied? but if i rooted or did anything else with the tree --> again: empty pdfs... tried just expansion --> all good. expansion +changed font of tip labels and rooted --> crashes.

ammaraziz commented 4 months ago

While I love figtree, it hasn't been supported in many years. I suggest moving away from using Figtree. Personally I use ggtree and recently started toytree. Far more reproducible and flexible.