broadinstitute / infercnv

Inferring CNV from Single-Cell RNA-Seq
Other
557 stars 164 forks source link

Error in Step 15 plot_cnv(): unable to start device PNG, occurred with output_format="pdf" #580

Open ImNotaGit opened 1 year ago

ImNotaGit commented 1 year ago

I am using the master branch version on GitHub with R 4.2.1, with analysis_mode="subclusters" and the default leiden clustering. I have read this FAQ page on png plots and I am indeed running inferCNV on a remote HPC server, but I could not get the X11 settings to work, so I tried using output_format="pdf" instead. However, I still get the following error about png plots during Step 15:

Error in .External2(C_X11, paste0("png::", filename), g$width, g$height,  :
  unable to start device PNG
Calls: run -> plot_subclusters -> plot_cnv -> png
In addition: Warning message:
In png(paste(out_dir, paste(output_filename, ".png", sep = ""),  :
  unable to open connection to X11 display ''
Execution halted

Issues #575 and #183 describe similar errors but no direct solutions were provided. Also my dataset is not too large like in #575.

Any help is much appreciated!

ImNotaGit commented 1 year ago

I would like to add that the issue only occurred when I submitted cluster jobs to run infercnv (i.e. in a non-interactive manner), and it did not seem to occur consistently. The issue did not occur if I run infercnv in an interactive R session, even if I am on the same HPC computing node (i.e. still a remote server -- maybe the description given in the above FAQ page is not entirely accurate). I do not know why the behavior is different and whether that may suggest a different fix to the png device issue.

Considering that plotting interactively works, as a temporary workaround I set output_format=NA as well as inspect_subclusters=FALSE to skip all plotting, so that all infercnv steps could be completed without error, and then manually call plot_cnv interactively to generate the figures. Regardless, the reported issue above where png-related errors occurs with output_format="pdf" seems to be a bug and should be fixed.

gabrielnegreira commented 6 months ago

Just to confirm I have exactly the same issue running it in an HPC. Setting output_format="pdf" did not fix it for me either.