PCRuniversum / PCRedux

quantitative PCR machine learning helper tool
Other
8 stars 9 forks source link

PCRedux::run_PCRedux() does not open a functional shiny app #11

Closed jaybee84 closed 2 years ago

jaybee84 commented 2 years ago

As a part of the review I tried to test the above command. It opened a new window with a shinyapp but the app was not functional.

sessionInfo()

R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

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

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

other attached packages:
 [1] shiny_1.7.1                 PCRedux_1.1-2               pheatmap_1.0.12            
 [4] DESeq2_1.26.0               SummarizedExperiment_1.16.1 DelayedArray_0.12.3        
 [7] BiocParallel_1.20.1         matrixStats_0.62.0          Biobase_2.46.0             
[10] GenomicRanges_1.38.0        GenomeInfoDb_1.22.1         IRanges_2.20.2             
[13] DT_0.23                     forcats_0.5.0               stringr_1.4.0              
[16] dplyr_1.0.9                 purrr_0.3.4                 readr_1.3.1                
[19] tidyr_1.1.0                 tibble_3.1.7                ggplot2_3.3.6              
[22] tidyverse_1.3.0             gprofiler2_0.2.1            gProfileR_0.7.0            
[25] BiocManager_1.30.10         reticulate_1.25             synapserutils_0.1.6        
[28] synapser_0.7.64             edgeR_3.28.1                limma_3.42.2               
[31] S4Vectors_0.24.4            BiocGenerics_0.32.0        
devSJR commented 2 years ago

Hallo @jaybee84,

thanks for the reported issue.

I just tested it in my environment where it works. The package passed all CRAN checks (https://cran.r-project.org/web/packages/PCRedux/index.html) and CI. So it seems a bit harder to diagnose. To diagnose what is going on it would be great if

Kind regards Stefan

devSJR commented 2 years ago

@jaybee84 , your sessionInfo() gives some hints.

This is how it should look after PCRedux::run_PCRedux()

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

other attached packages: [1] RDML_1.0 PCRedux_1.1-2 DT_0.23 shiny_1.7.1

loaded via a namespace (and not attached): [1] segmented_1.6-0 nlme_3.1-158 bitops_1.0-7 lubridate_1.8.0
[5] doParallel_1.0.17 ecp_3.1.3 tools_4.1.2 backports_1.4.1
[9] bslib_0.3.1 R6_2.5.1 KernSmooth_2.23-20 mgcv_1.8-40
[13] colorspace_2.0-3 bcp_4.0.3 withr_2.5.0 compiler_4.1.2
[17] cli_3.3.0 quantreg_5.93 SparseM_1.81 xml2_1.3.3
[21] sass_0.4.1 RcppDE_0.1.6 checkmate_2.1.0 lmtest_0.9-40
[25] DEoptimR_1.0-11 mvtnorm_1.1-3 robustbase_0.95-0 pbapply_1.5-0
[29] stringr_1.4.0 digest_0.6.29 Rfit_0.24.2 rainbow_3.6
[33] fda.usc_2.0.2 pipeR_0.6.1.3 base64enc_0.1-3 htmltools_0.5.2
[37] changepoint_2.2.3 fastmap_1.1.0 readxl_1.4.0 htmlwidgets_1.5.4 [41] rlang_1.0.2 qpcR_1.4-1 MBmca_1.0.1-3 jquerylib_0.1.4
[45] generics_0.1.2 zoo_1.8-10 jsonlite_1.8.0 mclust_5.4.10
[49] RCurl_1.98-1.7 magrittr_2.0.3 rlist_0.4.6.2 Matrix_1.4-1
[53] Rcpp_1.0.8.3 lifecycle_1.0.1 stringi_1.7.6 MASS_7.3-57
[57] grid_4.1.2 parallel_4.1.2 promises_1.2.0.1 lattice_0.20-45
[61] splines_4.1.2 knitr_1.39 markdown_1.1 fda_6.0.4
[65] codetools_0.2-18 outliers_0.15 data.table_1.14.2 deSolve_1.32
[69] httpuv_1.6.5 foreach_1.5.2 cellranger_1.1.0 MatrixModels_0.5-0 [73] ks_1.13.5 cachem_1.0.6 xfun_0.31 mime_0.12
[77] chipPCR_1.0-2 xtable_1.8-4 fds_1.8 pracma_2.3.8
[81] later_1.3.0 survival_3.3-1 pcaPP_2.0-1 signal_0.7-7
[85] minpack.lm_1.2-2 iterators_1.0.14 ptw_1.9-16 cluster_2.1.3
[89] rgl_0.109.2 ellipsis_0.3.2 hdrcde_3.4

Most of the packages are missing in your situation. Moreover, BioC packages should not be loaded at all.

Can please make sure that the package is installed properly. And can you start a clean session please?

jaybee84 commented 2 years ago

you could provide the output from the R console.

I started a fresh R session and this time the output looks like this which suggests the shiny app is running:

Loading required package: shiny

Listening on http://127.0.0.1:3212

This is different than last time where the app had terminated spontaneously.

tell us how it was opened (in a browser or did you use it in an IDE like RKWard?)

I am running it on an Rstudio IDE launched in an AWS instance. The app is opening in a separate browser tab but looks unresponsive:

Screen Shot 2022-06-29 at 2 40 53 PM

Is there an js/adblocker preventing it from working?

Ad blocker was disabled

New sessionInfo() after clean session

R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

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

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

other attached packages:
[1] DT_0.23 shiny_1.7.1   PCRedux_1.1-2

loaded via a namespace (and not attached):
  [1] segmented_1.6-0    nlme_3.1-147       bitops_1.0-7       doParallel_1.0.17  ecp_3.1.3         
  [6] httr_1.4.1         bslib_0.3.1        tools_3.6.3        utf8_1.2.2         R6_2.5.1          
 [11] DT_0.23            KernSmooth_2.23-17 DBI_1.1.3          lazyeval_0.2.2     mgcv_1.8-31       
 [16] colorspace_2.0-3   withr_2.5.0        bcp_4.0.3          tidyselect_1.1.2   compiler_3.6.3    
 [21] cli_3.3.0          quantreg_5.93      SparseM_1.81       plotly_4.10.0      sass_0.4.1        
 [26] RcppDE_0.1.6       scales_1.1.1       lmtest_0.9-40      DEoptimR_1.0-11    mvtnorm_1.1-3     
 [31] robustbase_0.95-0  pbapply_1.5-0      digest_0.6.29      Rfit_0.24.2        rainbow_3.6       
 [36] fda.usc_2.0.2      base64enc_0.1-3    pkgconfig_2.0.3    htmltools_0.5.2    changepoint_2.2.3 
 [41] fastmap_1.1.0      qpcR_1.4-1         htmlwidgets_1.5.4  rlang_1.0.2        MBmca_1.0.1-3     
 [46] jquerylib_0.1.4    generics_0.1.2     zoo_1.8-10         jsonlite_1.8.0     crosstalk_1.1.0.1 
 [51] mclust_5.4.10      dplyr_1.0.9        RCurl_1.98-1.7     magrittr_2.0.3     Matrix_1.2-18     
 [56] Rcpp_1.0.8.3       munsell_0.5.0      fansi_1.0.3        lifecycle_1.0.1    MASS_7.3-51.6     
 [61] grid_3.6.3         blob_1.2.1         promises_1.2.0.1   crayon_1.5.1       lattice_0.20-41   
 [66] splines_3.6.3      locfit_1.5-9.4     knitr_1.39         pillar_1.7.0       fda_6.0.4         
 [71] codetools_0.2-16   glue_1.6.2         gprofiler2_0.2.1   outliers_0.15      data.table_1.14.2 
 [76] deSolve_1.31       vctrs_0.4.1        httpuv_1.6.5       foreach_1.5.2      MatrixModels_0.5-0
 [81] gtable_0.3.0       purrr_0.3.4        tidyr_1.1.0        assertthat_0.2.1   cachem_1.0.6      
 [86] ks_1.13.5          ggplot2_3.3.6      xfun_0.31          mime_0.12          chipPCR_1.0-2     
 [91] xtable_1.8-4       fds_1.8            pracma_2.3.8       later_1.3.0        survival_3.1-12   
 [96] pcaPP_2.0-1        viridisLite_0.4.0  minpack.lm_1.2-2   signal_0.7-7       tibble_3.1.7      
[101] iterators_1.0.14   ptw_1.9-16         cluster_2.1.0      rgl_0.109.2        ellipsis_0.3.2    
[106] hdrcde_3.4       
jaybee84 commented 2 years ago

Can please make sure that the package is installed properly.

The installation looks fine since I see the following output:

> data <- PCRedux::data_sample[data_sample$dataset == "RAS002", ]
> head(data)
     dataset decision                     runs  cpD1  cpD2 cpD2_approx cpD2_ratio      eff   sliwin
2823  RAS002        y A01_gDNA.._unkn_B.Globin 28.14 25.95    26.02491  0.9971218 1.023438 1.041165
2824  RAS002        n    A01_gDNA.._unkn_HPRT1  1.00 40.00    28.83824  1.3870471 1.006435 0.000000
2825  RAS002        y A02_gDNA.._unkn_B.Globin 27.80 25.52    25.89846  0.9853867 1.023980 1.046957
2826  RAS002        n    A02_gDNA.._unkn_HPRT1  1.00 40.00    27.44907  1.4572445 1.005838 0.000000
2827  RAS002        y A03_gDNA.._unkn_B.Globin 28.31 25.99    26.22267  0.9911272 1.024470 0.000000
2828  RAS002        n    A03_gDNA.._unkn_HPRT1  1.00 40.00    28.53827  1.4016268 1.005504 0.000000
jaybee84 commented 2 years ago

Looks like I am missing RDML_1.0 even though it seems like the installation of PCRedux completed

michbur commented 2 years ago

@jaybee84 have you installed the package using the following command

install.packages("PCRedux", dependencies = TRUE)
jaybee84 commented 2 years ago

I installed it with

install.packages("PCRedux")

The default of dependencies is NA which should also add all dependencies.

From the function description :

The default, NA, means c("Depends", "Imports", "LinkingTo").

TRUE means to use c("Depends", "Imports", "LinkingTo", "Suggests") for pkgs and c("Depends", "Imports", "LinkingTo") for added dependencies: this installs all the packages needed to run pkgs, their examples, tests and vignettes (if the package author specified them correctly).
jaybee84 commented 2 years ago

Also, in case it is a requirement, it may be helpful to the users if this

install.packages("PCRedux", dependencies = TRUE)

is added to the installation instructions here

devSJR commented 2 years ago

@jaybee84 does

install.packages("PCRedux", dependencies = TRUE)

solve the issue for you?

jaybee84 commented 2 years ago

@devSJR I uninstalled the package, reinstalled with dependencies = TRUE. but still seeing the same unresponsive ShinyApp UI.

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

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

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

other attached packages:
[1] shiny_1.7.1   PCRedux_1.1-2

loaded via a namespace (and not attached):
 [1] sass_0.4.1         jsonlite_1.8.0     splines_3.6.3      foreach_1.5.2      rainbow_3.6       
 [6] bslib_0.3.1        hdrcde_3.4         Rfit_0.24.2        chipPCR_1.0-2      outliers_0.15     
[11] robustbase_0.95-0  ecp_3.1.3          lattice_0.20-41    quantreg_5.93      digest_0.6.29     
[16] promises_1.2.0.1   colorspace_2.0-3   htmltools_0.5.2    httpuv_1.6.5       Matrix_1.2-18     
[21] pcaPP_2.0-1        SparseM_1.81       fda_6.0.4          xtable_1.8-4       mvtnorm_1.1-3     
[26] ptw_1.9-16         MBmca_1.0.1-3      later_1.3.0        fda.usc_2.0.2      pracma_2.3.8      
[31] MatrixModels_0.5-0 mgcv_1.8-31        ellipsis_0.3.2     cachem_1.0.6       withr_2.5.0       
[36] pbapply_1.5-0      cli_3.3.0          survival_3.1-12    magrittr_2.0.3     mime_0.12         
[41] mclust_5.4.10      fds_1.8            ks_1.13.5          doParallel_1.0.17  nlme_3.1-147      
[46] MASS_7.3-51.6      segmented_1.6-0    changepoint_2.2.3  tools_3.6.3        minpack.lm_1.2-2  
[51] lifecycle_1.0.1    bcp_4.0.3          cluster_2.1.0      qpcR_1.4-1         jquerylib_0.1.4   
[56] compiler_3.6.3     signal_0.7-7       rlang_1.0.2        grid_3.6.3         RCurl_1.98-1.7    
[61] iterators_1.0.14   htmlwidgets_1.5.4  RcppDE_0.1.6       bitops_1.0-7       base64enc_0.1-3   
[66] codetools_0.2-16   deSolve_1.31       R6_2.5.1           zoo_1.8-10         knitr_1.39        
[71] fastmap_1.1.0      KernSmooth_2.23-17 parallel_3.6.3     Rcpp_1.0.8.3       rgl_0.109.2       
[76] DEoptimR_1.0-11    xfun_0.31          lmtest_0.9-40    
jaybee84 commented 2 years ago

To test whether loading this package in a cloud instance is causing the error, I also tried to install this package in one of my local machines. But this time I got an installation error:

> install.packages("PCRedux", dependencies = TRUE)

Installing package into ‘/Users/Library/R/4.0/library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘misc3d’, ‘ash’, ‘FNN’, ‘multicool’, ‘plot3D’, ‘pcaPP’, ‘hdrcde’, ‘ks’, ‘rainbow’, ‘RcppDE’, ‘fds’, ‘deSolve’, ‘lmtest’, ‘outliers’, ‘ptw’, ‘Rfit’, ‘signal’, ‘fda’, ‘minpack.lm’, ‘rgl’, ‘pipeR’, ‘rlist’, ‘bcp’, ‘changepoint’, ‘chipPCR’, ‘ecp’, ‘fda.usc’, ‘MBmca’, ‘pbapply’, ‘pracma’, ‘qpcR’, ‘segmented’, ‘RDML’, ‘spelling’

  There are binary versions available but the source
  versions are later:
            binary  source needs_compilation
FNN          1.1.3 1.1.3.1              TRUE
pcaPP       1.9-74   2.0-1              TRUE
ks          1.13.4  1.13.5              TRUE
deSolve       1.31    1.32              TRUE
fda          5.5.1   6.0.4             FALSE
minpack.lm   1.2-1   1.2-2              TRUE
rgl        0.108.3 0.109.2              TRUE
segmented    1.4-1   1.6-0             FALSE
PCRedux        1.1   1.1-2             FALSE

Do you want to install from sources the packages which need compilation? (Yes/no/cancel) Yes
trying URL 'http://cran.rstudio.com/bin/macosx/contrib/4.0/misc3d_0.9-1.tgz'
Content type 'application/x-gzip' length 237723 bytes (232 KB)
==================================================
.
.
.

* installing *source* package ‘pcaPP’ ...
** package ‘pcaPP’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
.
.
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pcaPP.so] Error 1
ERROR: compilation failed for package ‘pcaPP’
* removing ‘/Users/Library/R/4.0/library/pcaPP’
Warning in install.packages :
  installation of package ‘pcaPP’ had non-zero exit status
.
.
Warning in install.packages :
  installation of package ‘deSolve’ had non-zero exit status
.
.
Warning in install.packages :
  installation of package ‘minpack.lm’ had non-zero exit status
.
.
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘fda’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package ‘PCRedux’
* removing ‘/Users/Library/R/4.0/library/PCRedux’
Warning in install.packages :
  installation of package ‘PCRedux’ had non-zero exit status
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS  12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        pillar_1.6.4      compiler_4.0.3    tools_4.0.3      
 [5] digest_0.6.29     evaluate_0.15     lifecycle_1.0.1   tibble_3.1.6     
 [9] gtable_0.3.0      pkgconfig_2.0.3   rlang_1.0.2       ggsci_2.9        
[13] DBI_1.1.1         cli_3.3.0         ggrepel_0.9.1     yaml_2.2.1       
[17] xfun_0.31         fastmap_1.1.0     dplyr_1.0.9       knitr_1.39       
[21] generics_0.1.0    vctrs_0.4.1       htmlwidgets_1.5.4 grid_4.0.3       
[25] DT_0.17           tidyselect_1.1.2  glue_1.6.2        R6_2.5.1         
[29] fansi_0.5.0       rmarkdown_2.14    pacman_0.5.1      ggplot2_3.3.5    
[33] purrr_0.3.4       magrittr_2.0.3    scales_1.1.1      ellipsis_0.3.2   
[37] htmltools_0.5.2   assertthat_0.2.1  colorspace_2.0-2  utf8_1.2.2       
[41] munsell_0.5.0     crayon_1.4.2 
michbur commented 2 years ago

@jaybee84 I think this error is stemming from the clang issue. For example, in your error message you have:

ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)

We are positive that this error is not related to our package, but rather to one of the dependencies in R. See here that there was a similar problem for others in 2013: https://stackoverflow.com/questions/15590169/ld-library-not-found-for-lgfortran-mac-symlink-issue.

Our package passes the CI on CRAN and on GitHub Actions (including several distros of MacOS).

csoneson commented 2 years ago

(Adding my 2 cents as the JOSS editor handling this submission)

@jaybee84 - it looks like the R versions you are using above are quite old. I just tried to install PCRedux in R 4.2 (with install.packages("PCRedux") and it worked without problems. Running PCRedux::run_PCRedux() also opened a shiny app (after additionally installing RDML). Is there a way you could try with a newer version of R? The problem on the local machine indeed seems to come from compilation issues - you may still be able to install the packages if you don't attempt to build from source (i.e., say 'No' when asked).

@devSJR - I see that you have a dependency on R (>=3.5.0) (the manual says R > 3.3.3). I'm wondering if there's a way you can still check whether this is a reasonable version requirement (given the issues above), or whether it's worth thinking about requiring a newer version. Perhaps setting up a test on GitHub Actions with an old version of R would be helpful to see whether it's a general issue (you mentioned GitHub Actions, but I can't see an Action that actually builds and tests the package in this repository - am I missing something?).

michbur commented 2 years ago

@csoneson Sorry for the mistake on our side, 3.5 is required because the serialization of the files changed (save(), serialize(), saveRDS(), compiler::cmpfile()). We have forgotten to update the manual and will do it soon.

devSJR commented 2 years ago

@csoneson ''I see that you have a dependency on R (>=3.5.0) (the manual says R > 3.3.3 )''

This was hard coded and is fixed now.

https://github.com/PCRuniversum/PCRedux-supplements/commit/9334ead31436a193a6bb26d6019709316064aee4

jaybee84 commented 2 years ago

Thanks @csoneson for the helpful pointers, and @michbur and @devSJR for your patience.

I updated my R version to 4.2, but I am still getting the installation error.

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin21.5.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /usr/local/Cellar/r/4.2.1/lib/R/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1 
install.packages("PCRedux", dependencies = TRUE)

.
.
.
ERROR: dependencies ‘chipPCR’, ‘fda.usc’, ‘MBmca’, ‘qpcR’, ‘robustbase’ are not available for package ‘PCRedux’
* removing ‘/usr/local/lib/R/4.2/site-library/PCRedux’
Warning in install.packages :
  installation of package ‘PCRedux’ had non-zero exit status

install.packages("PCRedux") also gives the same error.

It seems like the installation error is mostly coming up on my local setup and has not been an issue for others. It would be great to resolve this but in everyone's interest I am okay to unblock this review citing @csoneson's instance of successful installation. @csoneson please let me know if this approach would be acceptable.

jaybee84 commented 2 years ago

I was able to troubleshoot the above error. It seems like the error stemmed from my Mac OSx version being beyond Big Sur. The most recent installation error showed

clang: error: invalid version number in '-mmacosx-version-min=12.4' 

After this error, all dependencies failed to install.

The instructions in the answer here helped me troubleshoot the problem.

The installation went through successfully this time and I was able to open and test out the Shiny app too.

jaybee84 commented 2 years ago

I have left the issue to open in case you would like to add any of the information above to the manual for this software. Please feel free to close the issue as needed.