Daa-meganizer error: Can't connect to X11 window server

Hi,

I am trying to run daa-meganizer (from MEGAN Ultimate Edition, version 6.17.0, built 7 Aug 2019) on the cluster because I have many files to process; so, running them one by one on a laptop is not an option.

I get this java error that I have not seen before with earlier versions of MEGAN6. How come it is trying to connect to an X11 window server?

daa-meganizer -i USBR01_GGCATTCT-CTAGCTTG_L001_001_align.daa -a2t prot.accession2taxid-May-2019.abin -a2interpro2go acc2interpro-June2018X.abin -a2seed acc2seed-May2015XX.abin -a2kegg acc2kegg-Dec2017X1-ue.abin -a2eggnog acc2eggnog-Oct2016X.abin -a2vfdb acc2vfdb-Feb2019.map -v

Meganizer - Prepares (‘meganizes’) a DIAMOND .daa file for use with MEGAN
Options:
Files
–in: USBR01_GGCATTCT-CTAGCTTG_L001_001_align.daa
Reads
–paired: false
–pairedSuffixLength: 0
Parameters
–longReads: false
–classify: true
–minScore: 50.0
–maxExpected: 0.01
–minPercentIdentity: 0.0
–topPercent: 10.0
–minSupportPercent: 0.05
–minSupport: 0
–minPercentReadCover: 0.0
–minPercentReferenceCover: 0.0
–lcaAlgorithm: naive
–lcaCoveragePercent: 100.0
–readAssignmentMode: readCount
Classification support:
–parseTaxonNames: true
–acc2taxa: prot.accession2taxid-May-2019.abin
–acc2eggnog: acc2eggnog-Oct2016X.abin
–acc2interpro2go: acc2interpro-June2018X.abin
–acc2kegg: acc2kegg-Dec2017X1-ue.abin
–acc2seed: acc2seed-May2015XX.abin
–acc2vfdb: acc2vfdb-Feb2019.map
Other:
–firstWordIsAccession: true
–accessionTags: gb| ref|
–verbose: true
Version MEGAN Ultimate Edition (version 6.17.0, built 7 Aug 2019)
Copyright © 2019 Daniel H. Huson. This program comes with ABSOLUTELY NO WARRANTY.
Exception in thread “main” java.awt.AWTError: Can’t connect to X11 window server using ‘localhost:14.0’ as the value of the DISPLAY variable.
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:61)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.(GraphicsEnvironment.java:83)
at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.desktop/sun.awt.X11.XToolkit.(XToolkit.java:232)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.desktop/java.awt.Component.getToolkitImpl(Component.java:1249)
at java.desktop/java.awt.Component.getToolkit(Component.java:1237)
at java.desktop/java.awt.Component.checkImage(Component.java:3835)
at java.desktop/java.awt.ImageMediaEntry.getStatus(MediaTracker.java:953)
at java.desktop/java.awt.MediaTracker.statusID(MediaTracker.java:717)
at java.desktop/java.awt.MediaTracker.waitForID(MediaTracker.java:665)
at java.desktop/javax.swing.ImageIcon.loadImage(ImageIcon.java:314)
at java.desktop/javax.swing.ImageIcon.(ImageIcon.java:244)
at jloda/jloda.swing.util.ResourceManager.getIcon(ResourceManager.java:62)
at megan/megan.main.MeganProperties.initializeProperties(MeganProperties.java:102)
at megan/megan.tools.DAAMeganizer.run(DAAMeganizer.java:164)
at megan/megan.tools.DAAMeganizer.main(DAAMeganizer.java:60)
at megan6u/megan6u.tools.DAAMeganizer.main(Unknown Source)

Unfortunately, the MEGAN command line programs require an X11 window server even if they don’t open any windows. You can run the program using run-xvfb, which provides a “virtual window”:

xvfb-run --auto-servernum --server-num=1 daa-meganizer -i …

Or perhaps try logging into the server using the option -Y like this: ssh -Y <server>

1 Like

Hi Daniel,

Thank you for your reply.
I tried them both and the option with the virtual window worked for me.
However, I still see weird issues when I try to run several concurrent jobs.
When there are several concurrent jobs running on the same compute node and sharing /scratch; then it happens that when one of them finishes; the remaining jobs get killed.
It is as if all instance of the virtual machine get killed when the first one finishes.

Have you seen such behavior?
Is there a way to fix it; I mean, other than by running jobs sequentially rather than concurrently?

BTW. These are more details of my environment.

The job scheduler is SLURM

$ cat /etc/os-release
NAME=“CentOS Linux”
VERSION=“7 (Core)”
ID=“centos”
ID_LIKE=“rhel fedora”
VERSION_ID=“7”
PRETTY_NAME=“CentOS Linux 7 (Core)”
ANSI_COLOR=“0;31”
CPE_NAME=“cpe:/o:centos:centos:7”
HOME_URL=“https://www.centos.org/
BUG_REPORT_URL=“https://bugs.centos.org/

CENTOS_MANTISBT_PROJECT=“CentOS-7”
CENTOS_MANTISBT_PROJECT_VERSION=“7”
REDHAT_SUPPORT_PRODUCT=“centos”
REDHAT_SUPPORT_PRODUCT_VERSION=“7”

$ uname -r
3.10.0-957.5.1.el7.x86_64

$ cat /proc/version
Linux version 3.10.0-957.5.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Fri Feb 1 14:54:57 UTC 2019

My guess that this might be connected with how you are using the run-xvfdb command. Please check the documentation of that command to see whether this might be the cause of the problem and if it, how to fix it.

Hi,

I’m encountering this error as well, but with daa2rma. I’m running this on Ubuntu 16.04LTS. It seems like things run perfectly fine and then it throws that same error message. I’ve previously run daa-meganizer on this same computer (and, actually on the same input files) without issue.

Here’s my script to run the program:

#!/bin/bash

# Script to run MEGAN6 daa2rma on DIAMOND DAA files from
# 20200103_cbai_diamond_blastx Mox job.

# Requires MEGAN mapping files from:
# http://ab.inf.uni-tuebingen.de/data/software/megan6/download/

# Exit script if any command fails
set -e

# Program path
meganizer=/home/sam/programs/megan/tools/daa2rma

# MEGAN mapping files
prot_acc2tax=/home/sam/data/databases/MEGAN/prot_acc2tax-Jul2019X1.abin
acc2interpro=/home/sam/data/databases/MEGAN/acc2interpro-Jul2019X.abin
acc2eggnog=/home/sam/data/databases/MEGAN/acc2eggnog-Jul2019X.abin


## Inititalize arrays
daa_array_R1=()
daa_array_R2=()


# Create array of DAA R1 files
for daa in *R1*.daa
do
  daa_array_R1+=("${daa}")
done

# Create array of DAA R2 files
for daa in *R2*.daa
do
  daa_array_R2+=("${daa}")
done


## Run daa2rma

# Capture start "time"
start=${SECONDS}
for index in "${!daa_array_R1[@]}"
do
  sample_name=$(echo "${daa_array_R1[index]}" | awk -F "_" '{print $1}')

  # Run daa2rma with paired option
  ${meganizer} \
  --paired \
  --in "${daa_array_R1[index]}" "${daa_array_R2[index]}" \
	--acc2taxa ${prot_acc2tax} \
	--acc2interpro2go ${acc2interpro} \
	--acc2eggnog ${acc2eggnog} \
  --out "${sample_name}".daa2rma.rma6 \
  2>&1 | tee --append daa2rma_log.txt
done

# Caputure end "time"
end=${SECONDS}

runtime=$((end-start))

# Print MEGANIZER runtime, in seconds

{
  echo ""
  echo "---------------------"
  echo ""
  echo "Total runtime was: ${runtime} seconds"
} >> daa2rm_log.txt

And here’re the resulting log/error messages:

Version   MEGAN Community Edition (version 6.18.3, built 17 Dec 2019)
Copyright (C) 2019 Daniel H. Huson. This program comes with ABSOLUTELY NO WARRANTY.
Functional classifications to use: EGGNOG, INTERPRO2GO
Loading ncbi.map: 2,175,506
Loading ncbi.tre: 2,175,510
Opening file: /home/sam/data/databases/MEGAN/prot_acc2tax-Jul2019X1.abin
Loading eggnog.map:    30,875
Loading eggnog.tre:    30,986
Opening file: /home/sam/data/databases/MEGAN/acc2eggnog-Jul2019X.abin
Loading interpro2go.map:    13,501
Loading interpro2go.tre:    29,204
Opening file: /home/sam/data/databases/MEGAN/acc2interpro-Jul2019X.abin
In DAA files: 304428_S1_L001_R1_001.blastx.daa, 304428_S1_L001_R2_001.blastx.daa
Output file:  304428.daa2rma.rma6
Classifications: Taxonomy, EGGNOG, INTERPRO2GO
Annotating RMA6 file using EXTENDED mode
Parsing file: 304428_S1_L001_R1_001.blastx.daa
10% 20% 30% 40% 50% 60% 70% 80% 90% Parsing file: 304428_S1_L001_R2_001.blastx.daa
10% 20% 30% 40% 50% 60% 70% 80% 90% 100% (15185.5s)
Total reads:        14,024,469
Alignments:        415,509,683
100% (0.0s)
100% (0.2s)
100% (0.1s)
Linking paired reads
Number of pairs:     5,582,393
Binning reads: Initializing...
Initializing binning...
Using paired reads in taxonomic assignment...
Using 'Naive LCA' algorithm for binning: Taxonomy
Using Best-Hit algorithm for binning: EGGNOG
Using Best-Hit algorithm for binning: INTERPRO2GO
Binning reads...
Binning reads: Analyzing alignments
Total reads:       14,024,469
With hits:          14,024,469 
Alignments:        415,509,683
Assig. Taxonomy:    14,001,560
Assig. EGGNOG:       4,036,766
Assig. INTERPRO2GO:  9,134,067
Tax. ass. by mate:      13,638
MinSupport set to: 7012
Binning reads: Applying min-support & disabled filter to Taxonomy...
Min-supp. changes:       3,256
Binning reads: Writing classification tables
Numb. Tax. classes:        138
Numb. EGG. classes:      2,005
Numb. INT. classes:      6,398
Binning reads: Syncing
Class. Taxonomy:           138
Class. EGGNOG:           2,005
Class. INTERPRO2GO:      6,398
100% (42954.5s)
Total time:  58153s
Peak memory: 19.7 of 52.4G
Version   MEGAN Community Edition (version 6.18.3, built 17 Dec 2019)
Copyright (C) 2019 Daniel H. Huson. This program comes with ABSOLUTELY NO WARRANTY.
Functional classifications to use: EGGNOG, INTERPRO2GO
Loading ncbi.map: 2,175,506
Loading ncbi.tre: 2,175,510
Opening file: /home/sam/data/databases/MEGAN/prot_acc2tax-Jul2019X1.abin
Loading eggnog.map:    30,875
Loading eggnog.tre:    30,986
Opening file: /home/sam/data/databases/MEGAN/acc2eggnog-Jul2019X.abin
Loading interpro2go.map:    13,501
Loading interpro2go.tre:    29,204
Opening file: /home/sam/data/databases/MEGAN/acc2interpro-Jul2019X.abin
In DAA files: 304428_S1_L002_R1_001.blastx.daa, 304428_S1_L002_R2_001.blastx.daa
Output file:  304428.daa2rma.rma6
Classifications: Taxonomy, EGGNOG, INTERPRO2GO
Annotating RMA6 file using EXTENDED mode
Parsing file: 304428_S1_L002_R1_001.blastx.daa
10% 20% 30% 40% 50% 60% 70% 80% 90% Parsing file: 304428_S1_L002_R2_001.blastx.daa
10% 20% 30% 40% 50% 60% 70% 80% 90% 100% (15334.9s)
Total reads:        13,559,260
Alignments:        402,164,513
100% (0.0s)
100% (0.1s)
100% (0.1s)
Linking paired reads
Number of pairs:     5,391,268
Binning reads: Initializing...
Initializing binning...
Using paired reads in taxonomic assignment...
Using 'Naive LCA' algorithm for binning: Taxonomy
Using Best-Hit algorithm for binning: EGGNOG
Using Best-Hit algorithm for binning: INTERPRO2GO
Binning reads...
Binning reads: Analyzing alignments
Version   MEGAN Community Edition (version 6.18.3, built 17 Dec 2019)
Copyright (C) 2019 Daniel H. Huson. This program comes with ABSOLUTELY NO WARRANTY.
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
	at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
	at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
	at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
	at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
	at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:232)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
	at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
	at java.desktop/java.awt.Component.getToolkitImpl(Component.java:1249)
	at java.desktop/java.awt.Component.getToolkit(Component.java:1237)
	at java.desktop/java.awt.Component.checkImage(Component.java:3835)
	at java.desktop/java.awt.ImageMediaEntry.getStatus(MediaTracker.java:953)
	at java.desktop/java.awt.MediaTracker.statusID(MediaTracker.java:717)
	at java.desktop/java.awt.MediaTracker.waitForID(MediaTracker.java:665)
	at java.desktop/javax.swing.ImageIcon.loadImage(ImageIcon.java:314)
	at java.desktop/javax.swing.ImageIcon.<init>(ImageIcon.java:244)
	at jloda/jloda.swing.util.ResourceManager.getIcon(ResourceManager.java:62)
	at jloda/jloda.swing.util.ResourceManager.getIcons(ResourceManager.java:81)
	at megan/megan.main.MeganProperties.initializeProperties(MeganProperties.java:101)
	at megan/megan.tools.DAA2RMA6.run(DAA2RMA6.java:175)
	at megan/megan.tools.DAA2RMA6.main(DAA2RMA6.java:67)

I managed to “resolve” the error, but not entirely sure how.

My guess is that the error was related due to low available memory, as I had a few RMA files already loaded in MEGAN6, while I was running daa2rma. After closing MEGAN6 (and restarting my computer to install some other updates), I successfully ran daa2rma with the script I posted above.

It looks like you were not connected via X-forwarding (logged in some other way than usual)?
Using ssh to remotely log into a machine running MEGAN, you should use the -Y option, e.g.

ssh -Y you@remote…

Dear Kubu4,

Have you already solved your problem?
I’ve difficulty for access data base from megan download page. I’ve download it and unziped in my directory.
Do you have an advice for me to run .daa file to .rma file in order to annotate my sample?
I have contigs sample from soil.

Here is my command that I used:

daa2rma -i alignment/IB_result.daa -o megan/IB_result.rma megan-map-Oct2019.db --mapDB

and here is the output responses:

jloda.util.UsageException: Invalid, unknown or duplicate option: --mapDB megan-map-Oct2019.db
, use option ‘-h’ for help
at jloda.util.ArgsOptions.done(ArgsOptions.java:210)
at megan.tools.DAA2RMA6.run(DAA2RMA6.java:167)
at megan.tools.DAA2RMA6.main(DAA2RMA6.java:64)

Actually I don’t know how the command line that I have to used for annotation. I’ve followed The Generic Pipeline for Using DIAMOND and MEGAN6 posted by Dr. Daniel http://megan.informatik.uni-tuebingen.de/t/generic-pipeline-using-diamond-and-megan6/50?u=lulunisrna, but it doesn’t work in me.

Thank you for your help.

Regards,
Lulu

Thanks for the follow up and info. I can’t remember exactly how I set up the job to run, but I think I started it locally and then checked on the job’s status later that evening via ssh/tmux.

I’ll keep this in mind during future runs.

Your issue isn’t related to the topic at hand ("Can’t connect to X11 window server).

I’d recommend starting a new thread.

Thank you for your reply Kubu4

Regards,
Lulu

Error “Can’t connect to X11 window” means that you are running the program remotely without an X-session (i.e. no graphics output).
See posts related to the run-xvfb commanded, which is executed like shown below and allows programs the require graphics to run without graphics (unfortunately, all MEGAN tools require graphics to be present, even if graphics are not used ;-( )

xvfb-run --auto-servernum --server-num=1 daa-meganizer -i …

Datenschutzerklärung