ArchR icon indicating copy to clipboard operation
ArchR copied to clipboard

GGplot Errors for Fragment Size Distribution and DoubletScores

Open shamer3 opened this issue 1 year ago • 9 comments

I am getting errors with anything related to ggplot. I have done as suggested in previous thread by reinstalling Cairo, Quartz and ggrastr, however this has not fixed the problem. The issue is observed firstly, in Arrow file generation:

Continuing through after error ggplot for TSS by Frags

And then again during doublet scoring ggplot generation:

RROR Found in ggplot for Untreated (4 of 5) :  
LogFile = ArchRLogs/ArchR-addDoubletScores...

<simpleError in g$grobs[[legend]]: no such index at level 2
>

In each case pdf files are generated for the specific plot hone when I try and access them I am met with an error message that the file is broken or damaged as shown below ( also tried opening is two different pdf viewers and was met with similar issues) : Screenshot 2024-03-10 at 12 00 10

Screenshot 2024-03-10 at 12 00 47

Session information is as follows:

R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

Random number generation:
 RNG:     L'Ecuyer-CMRG 
 Normal:  Inversion 
 Sample:  Rejection 
 
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

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

other attached packages:
 [1] Seurat_5.0.2                      SeuratObject_5.0.1               
 [3] sp_2.1-3                          BSgenome.Hsapiens.UCSC.hg38_1.4.5
 [5] BSgenome_1.70.2                   rtracklayer_1.62.0               
 [7] BiocIO_1.12.0                     Biostrings_2.70.2                
 [9] XVector_0.42.0                    ggrastr_1.0.2                    
[11] harmony_1.2.0                     Cairo_1.6-2                      
[13] rhdf5_2.46.1                      SummarizedExperiment_1.32.0      
[15] Biobase_2.62.0                    MatrixGenerics_1.14.0            
[17] Rcpp_1.0.12                       Matrix_1.6-5                     
[19] GenomicRanges_1.54.1              GenomeInfoDb_1.38.7              
[21] IRanges_2.36.0                    S4Vectors_0.40.2                 
[23] BiocGenerics_0.48.1               matrixStats_1.2.0                
[25] data.table_1.15.2                 stringr_1.5.1                    
[27] plyr_1.8.9                        magrittr_2.0.3                   
[29] ggplot2_3.5.0                     gtable_0.3.4                     
[31] gtools_3.9.5                      gridExtra_2.3                    
[33] ArchR_1.0.2                       devtools_2.4.5                   
[35] usethis_2.2.3                     reticulate_1.35.0                

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.22         shinythemes_1.2.0        splines_4.3.2           
  [4] later_1.3.2              bitops_1.0-7             tibble_3.2.1            
  [7] polyclip_1.10-6          XML_3.99-0.16.1          fastDummies_1.7.3       
 [10] lifecycle_1.0.4          doParallel_1.0.17        rprojroot_2.0.4         
 [13] globals_0.16.3           processx_3.8.3           lattice_0.22-5          
 [16] MASS_7.3-60              plotly_4.10.4            yaml_2.3.8              
 [19] remotes_2.4.2.1          httpuv_1.6.14            sctransform_0.4.1       
 [22] spam_2.10-0              spatstat.sparse_3.0-3    sessioninfo_1.2.2       
 [25] pkgbuild_1.4.3           cowplot_1.1.3            pbapply_1.7-2           
 [28] RColorBrewer_1.1-3       abind_1.4-5              pkgload_1.3.4           
 [31] zlibbioc_1.48.0          Rtsne_0.17               presto_1.0.0            
 [34] purrr_1.0.2              RCurl_1.98-1.14          rappdirs_0.3.3          
 [37] circlize_0.4.16          GenomeInfoDbData_1.2.11  ggrepel_0.9.5           
 [40] irlba_2.3.5.1            spatstat.utils_3.0-4     listenv_0.9.1           
 [43] pheatmap_1.0.12          goftest_1.2-3            RSpectra_0.16-1         
 [46] spatstat.random_3.2-3    fitdistrplus_1.1-11      parallelly_1.37.1       
 [49] leiden_0.4.3.1           codetools_0.2-19         DelayedArray_0.28.0     
 [52] tidyselect_1.2.0         shape_1.4.6.1            rhandsontable_0.3.8     
 [55] spatstat.explore_3.2-6   GenomicAlignments_1.38.2 jsonlite_1.8.8          
 [58] GetoptLong_1.0.5         ellipsis_0.3.2           progressr_0.14.0        
 [61] ggridges_0.5.6           survival_3.5-7           iterators_1.0.14        
 [64] foreach_1.5.2            tools_4.3.2              ica_1.0-3               
 [67] glue_1.7.0               SparseArray_1.2.4        here_1.0.1              
 [70] dplyr_1.1.4              withr_3.0.0              BiocManager_1.30.22     
 [73] fastmap_1.1.1            rhdf5filters_1.14.1      fansi_1.0.6             
 [76] callr_3.7.5              digest_0.6.34            R6_2.5.1                
 [79] mime_0.12                colorspace_2.1-0         scattermore_1.2         
 [82] tensor_1.5               spatstat.data_3.0-4      utf8_1.2.4              
 [85] tidyr_1.3.1              generics_0.1.3           httr_1.4.7              
 [88] htmlwidgets_1.6.4        S4Arrays_1.2.1           uwot_0.1.16             
 [91] pkgconfig_2.0.3          ComplexHeatmap_2.18.0    lmtest_0.9-40           
 [94] htmltools_0.5.7          profvis_0.3.8            dotCall64_1.1-1         
 [97] clue_0.3-65              scales_1.3.0             png_0.1-8               
[100] rstudioapi_0.15.0        reshape2_1.4.4           rjson_0.2.21            
[103] nlme_3.1-164             curl_5.2.1               cachem_1.0.8            
[106] zoo_1.8-12               GlobalOptions_0.1.2      KernSmooth_2.23-22      
[109] vipor_0.4.7              miniUI_0.1.1.1           restfulr_0.0.15         
[112] desc_1.4.3               pillar_1.9.0             vctrs_0.6.5             
[115] RANN_2.6.1               urlchecker_1.0.1         promises_1.2.1          
[118] xtable_1.8-4             cluster_2.1.6            beeswarm_0.4.0          
[121] Rsamtools_2.18.0         cli_3.6.2                compiler_4.3.2          
[124] rlang_1.1.3              crayon_1.5.2             future.apply_1.11.1     
[127] ps_1.7.6                 ggbeeswarm_0.7.2         fs_1.6.3                
[130] stringi_1.8.3            BiocParallel_1.36.0      deldir_2.0-4            
[133] viridisLite_0.4.2        munsell_0.5.0            lazyeval_0.2.2          
[136] spatstat.geom_3.2-9      RcppHNSW_0.6.0           patchwork_1.2.0         
[139] future_1.33.1            Rhdf5lib_1.24.2          shiny_1.8.0             
[142] ROCR_1.0-11              igraph_2.0.2             memoise_2.0.1 

shamer3 avatar Mar 10 '24 12:03 shamer3

Hi @shamer3! Thanks for using ArchR! Lately, it has been very challenging for me to keep up with maintenance of this package and all of my other responsibilities as a PI. I have not been responding to issue posts and I have not been pushing updates to the software. We are actively searching to hire a computational biologist to continue to develop and maintain ArchR and related tools. If you know someone who might be a good fit, please let us know! In the meantime, your issue will likely go without a reply. Most issues with ArchR right not relate to compatibility. Try reverting to R 4.1 and Bioconductor 3.15. Newer versions of Seurat and Matrix also are causing issues. Sorry for not being able to provide active support for this package at this time.

rcorces avatar Mar 10 '24 12:03 rcorces

For me, downgrading specifically ggplot fixed this. This worked for me: conda install conda-forge::r-ggplot2=3.3

juliabelk avatar Mar 11 '24 08:03 juliabelk

Hi Julia, thanks so much I can confirm downgrading to ggplot 3.3.0 has solved the plotting issue. Something with ggplot 3.5.0 is bugging all the plots out. Thanks!!

shamer3 avatar Mar 12 '24 22:03 shamer3

@rcorces

It is an incredible set of tools that you have built and would indeed be a shame if it cannot be updated. For this specific issue with ggplot2, it is even more crucial as almost all packages use it and to keep it downgraded for a long time could be a challenge. Over time this indeed could force people to not use ArchR. Hopefully you are able to get a comp-biologist to work on it. Good luck :-).

I am going to try downgrading now the ggplot2. Hopefully it doesn't bother other packages. Will keep this thread posted Thanks again for ArchR!

saeedfc avatar Jun 12 '24 09:06 saeedfc

@saeedfc - I know this is frustrating and I do apologize. The good news is that we have a full-time developer joining the team in a month and then we will be working to push a new stable release of ArchR. More to come on that in a month.

rcorces avatar Jun 12 '24 13:06 rcorces

@rcorces Looking forwward!

@shamer3 @juliabelk Thanks. I tried this. But then I cannot load Seurat. Because then says ggplot 3.4.0 is required even though Seurat CRAN webpage only says ggplot2 3.3.0 is required . Same if I try to downgrade Seurat as well to 4.0.4.

So I looked through the dependencies of Seurat which requires ggplot2 3.4.0 ggridges and cowplot.

For anyone having a similar issue; Try to use renv so you have a project specific iosolated library for R packges.

Install Seurat

install.packages('Seurat')

Then start downgrading the below 3 packages;

ggplot_url <- "https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_3.3.0.tar.gz"
install.packages(ggplot_url, repos=NULL, type="source")
packageurl <- "https://cran.r-project.org/src/contrib/Archive/cowplot/cowplot_1.1.1.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
packageurl <- "https://cran.r-project.org/src/contrib/Archive/ggridges/ggridges_0.5.4.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Beware when you install tidyverse blindly as only upto tidyverse 1.3.0 that you can go with ggplot 3.3.0

saeedfc avatar Jun 17 '24 09:06 saeedfc

@saeedfc I am encountering a persistent problem when trying to downgrade ggplot, Have exactly the same problems as @shamer3

> ggplot_url <- "https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_3.3.0.tar.gz"
install.packages(ggplot_url, repos=NULL, type="source")> install.packages(ggplot_url, repos=NULL, type="source")
trying URL 'https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_3.3.0.tar.gz'
Content type 'application/x-gzip' length 3031461 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) : 
  invalid non-character version specification 'x' (type: double)
Error: unable to load R code in package ‘ggplot2’
Execution halted
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/ggplot2’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/ggplot2’
Warning message:
In install.packages(ggplot_url, repos = NULL, type = "source") :
  installation of package ‘/var/folders/m6/m906tt814lq_623x1t616g2h0000gq/T//Rtmpc3zoAb/downloaded_packages/ggplot2_3.3.0.tar.gz’ had non-zero exit status
> 

alekseybelikov avatar Jul 15 '24 18:07 alekseybelikov

Solved by downgrading R to version 4.3.2 (2023-10-31) -- "Eye Holes"

Solved matrix errors by downgrading to version 1.6-5 and then installing irlba from source

install.packages("https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.6-5.tar.gz", repos = NULL, type = "source")

install.packages("irlba", type = "source")

Finally solved ggplot errors by downgrading to version 3.4.0

ggplot_url <- "https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_3.4.0.tar.gz"
install.packages(ggplot_url, repos=NULL, type="source")

alekseybelikov avatar Jul 16 '24 17:07 alekseybelikov

@alekseybelikov can confirm that this solves the issues.

Also found r-rig as a useful R installer on Linux platforms https://github.com/r-lib/rig?tab=readme-ov-file#id-linux (especially when you need to quickly downgrade)

connorrogerson avatar Sep 18 '24 13:09 connorrogerson