Bandage icon indicating copy to clipboard operation
Bandage copied to clipboard

Messy error when no X11 connection

Open tseemann opened this issue 9 years ago • 4 comments

eg. when using MOSH instead of SSH

% Bandage
QXcbConnection: Could not connect to display localhost:10.0
Aborted (core dumped)

tseemann avatar Jun 13 '15 10:06 tseemann

Hhhhmm I observe the same using version 0.8.0. Want to pipeline some graphs into graphics on an host not gui capable. Using a remote ssh without X11 forwarding capability returns: (Bandage:14389): Gtk-WARNING **: cannot open display: localhost:11.0

If I use a host that has x11 forwarding capabilities the tool runs just fine in cmd line mode. Why is command line mode still checking for a graphical display?

alexbossers avatar Jun 07 '16 09:06 alexbossers

Alex, what is the exact Bandage command you're using? Specifically I'm curious if you're using Bandage image and including some labels. E.g. Bandage image graph.fastg image.jpg --names

I ran into a frustrating issue with command line image output that isn't fully solved. If Bandage is being used on the command line without a GUI, then I'd prefer to use the Qt 'minimal' platform, as that shouldn't require stuff like X11 connections. That seems to work fine, but I found that if you ran Bandage image with some sort of label on the graph, the text was not rendering (was just black rectangles). When I use the regular GUI-requiring Qt platform, then the text comes out fine (even though a GUI never actually opens).

I've reluctantly concluded that the Qt 'minimal' platform lacks the ability to do font stuff and the GUI mode is required when using Bandage image with labels. So when you run Bandage from the command line, it looks to see if you've asked for labels, and if so, it uses the GUI mode. I'd love to find a way around this, but no luck so far.

In short, if you're using labels on the images, removing them should remove your need for a GUI connection. But if you need labels, then you need GUI capabilities. However, if you're not using labels on your images and still having this issue, then I'm not sure and further investigation is warranted.

rrwick avatar Jun 09 '16 01:06 rrwick

Ryan, thanks for the follow-up. Indeed I try to use labels. But also when I issue the command with soley the option --help or --helpall it fails with the same error.

My pipeline command looks something like: /opt/bandage/Bandage image $dir/assembly_graph.fastg $dir/assembly_graph.fastg.nodes123.png --names --lengths --depth --fontsize 2 --scope aroundnodes --nodes 1,2,3 So I do need the labels else it doesn't make sense.

I am not so into the graphics business but it seems you try to solve things we ourseleves have seen in the past with some tools on our headless server running R scripts that generate PNG etc. pdf was no issue. I checked and it was solved by either of the two systems xvfb (a virtual Xserver (frame buffer)) or by using Cairo (https://www.cairographics.org/). The Cairo might be something to look at (maybe you already considered it...).

alexbossers avatar Jun 09 '16 08:06 alexbossers

I've put a small fix into the development branch of Bandage to not require a GUI when --help or --helpall is used, but that doesn't fix your main problem. And I just double-checked that the behaviour I described (needing a GUI platform to produce text in an image) applies to Linux as well as OS X, and unfortunately it does. The workaround (which you already seem to have discovered) is to use -X or -Y when you ssh. Though I'll make a note to check out Xvfb and Cairo and see if there's a better solution to be had there. Thanks!

rrwick avatar Jun 10 '16 03:06 rrwick