GregorySchwartz/too-many-cells

cannot open file 'Rplots.pdf'

ponomarevsy opened this issue · 13 comments

Hello,

I've converted the Docker image to Singularity and after some experimentation got this error:

» ./run.bash                                               
Counting leaves [=========================================================>......................................]  60%cell,cluster,path
GATCACACACCCTGTT-1,0,0

Painting sketches [=================================================================>............................]  70%too-many-cells: R Runtime Error: Error in (function (file = if (onefile) "Rplots.pdf" else "Rplot%03d.pdf",  :
  cannot open file 'Rplots.pdf'

where "run.bash" consists of:

» cat run.bash                                             
#!/bin/bash -e

singularity run --pwd /opt/too-many-cells \
--bind /too-many-cells/Singularity/input:/input:ro \
--bind /too-many-cells/Singularity/output:/output:rw \
too-many-cells-0.2.2.2.img \
make-tree --matrix-path /input --labels-file /input/labels.csv --draw-collection "PieRing" --output /output

I suspect this has something to do with paths but I am not sure. R version inside the container shows 3.4.4:

Singularity too-many-cells-0.2.2.2.img:/opt/too-many-cells> which R
/usr/bin/R
Singularity too-many-cells-0.2.2.2.img:/opt/too-many-cells> R

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ggplot2)
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] ggplot2_3.1.0

loaded via a namespace (and not attached):
 [1] colorspace_1.4-0 scales_1.0.0     compiler_3.4.4   plyr_1.8.4
 [5] lazyeval_0.2.1   withr_2.1.2      pillar_1.3.1     gtable_0.2.0
 [9] tibble_2.0.1     crayon_1.3.4     Rcpp_1.0.0       grid_3.4.4
[13] pkgconfig_2.0.2  rlang_0.3.1      munsell_0.5.0
>

And the "ggplot2" version is 3.1.0. If you have any ideas please let me know. Thank you very much!

What OS are you using?

Hi Gregory,

Here is what we have:

$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 7.2 (Maipo)
Release: 7.2
Codename: Maipo

Thanks!

Can you save an example plot in R in the container mounted to the host?

This is interesting... R worked just fine yesterday (see above) but today I see this:

» singularity shell --bind "/nethome,/hpcdata" too-many-cells-0.2.2.2.img
Singularity too-many-cells-0.2.2.2.img:~> R

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error in load(name, envir = .GlobalEnv) :
  bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘.RData’ has magic number 'RDX3'
  Use of save versions prior to 2 is deprecated
During startup - Warning message:
unable to restore saved data in .RData
>

What does that mean? Should I be re-creating the Singularity image or something else? Please advise.

Thank you.

I'm not familiar with singularity so I don't know, but I would ignore that for now. I think it's about a previous workspace that it may have saved. Are you able to save a plot from the container to the host?

I am not sure if I am doing this right, but there you go:

> pdf(file = "/output/MyPlot.pdf", width = 4, height = 4)
> plot(x = 1:10,
+      y = 1:10)
> abline(v = 0) # Additional low-level plotting commands
> text(x = 0, y = 1, labels = "Random text")
>
> # Step 3: Run dev.off() to create the file!
> dev.off()
null device
          1

Despite the above null device error (or, maybe, it is not an error) I DO see the file in /output folder:

-rw-r--r-- 1 user user 3611 Jul 10 14:39 MyPlot.pdf

What if you use ggsave() for a ggplot plot? It might be related to the way that package saves.

Actually, I think it just ran! The problem was with "--pwd /opt/too-many-cells" command, since the folder is not writable and that was the reason R failed. I've changed that line to "--pwd /output", a directory that I open for writing and in that case "too-many-cells" ran fine:

» singularity run --pwd /output \
--bind /too-many-cells/Singularity/input:/input:ro \
--bind /too-many-cells/Singularity/output:/output:rw \
too-many-cells-0.2.2.2.img \
make-tree --matrix-path /input --labels-file /input/labels.csv --draw-collection "PieRing" --output /output
Counting leaves [=========================================================>......................................]  60%cell,cluster,path
GATCACACACCCTGTT-1,0,0

Packing up [=====================================================================================================] 100%

Does that look like a correct output, @GregorySchwartz? Thanks for all your help.

In case other Singularity users stop on this page, here is how I converted Docker to Singularity:

singularity build too-many-cells-0.2.2.2.img docker://gregoryschwartz/too-many-cells:0.2.2.2

Other than the single barcode, yes that looks fine.

Is there a PDF report that comes up after the calculation is complete? I see a window for a few seconds, then, it is gone.

No, there should not be any GUI. Sounds like a display that R might bring up to save one of the non-tree plots (might be related to singularity, but I wouldn't worry about it).