Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand_formula = not null is crashing R and RStudio since R upgrade to 4.3.1 #217

Open
RachBioHaz opened this issue Oct 7, 2023 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@RachBioHaz
Copy link

Hi,
I am having the same issue as closed issue #205 with rand_formula = not null crashing R and RStudio since I upgraded to 4.3.1.
I have done a forced reinstall of phyloseq as suggested in #205, but it does it even when not using phyloseq and phyloseq is not loaded.

I tested it with my own data and with your example (5.2 Run ancombc2 function) and it crashes in both cases.
Any idea what the issue is and if there is anything I can do to fix it? I'm unable to go back to an earlier version of R as my other work needs the most current version of R.

Cheers

##Session Info
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.utf8 LC_CTYPE=English_Australia.utf8
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Australia.utf8

time zone: Australia/Sydney
tzcode source: internal

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

other attached packages:
[1] lubridate_1.9.3 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.3 purrr_1.0.2
[6] readr_2.1.4 tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.3 tidyverse_2.0.0
[11] ANCOMBC_2.2.2

loaded via a namespace (and not attached):
[1] splines_4.3.1 bitops_1.0-7 cellranger_1.1.0
[4] DirichletMultinomial_1.42.0 rpart_4.1.19 lifecycle_1.0.3
[7] Rdpack_2.5 doParallel_1.0.17 lattice_0.21-9
[10] MASS_7.3-60 MultiAssayExperiment_1.26.0 backports_1.4.1
[13] magrittr_2.0.3 Hmisc_5.1-1 rmarkdown_2.25
[16] yaml_2.3.7 doRNG_1.8.6 gld_2.6.6
[19] DBI_1.1.3 minqa_1.2.6 ade4_1.7-22
[22] multcomp_1.4-25 abind_1.4-5 zlibbioc_1.46.0
[25] expm_0.999-7 GenomicRanges_1.52.0 BiocGenerics_0.46.0
[28] RCurl_1.98-1.12 TH.data_1.1-2 phyloseq_1.44.0
[31] yulab.utils_0.1.0 nnet_7.3-19 sandwich_3.0-2
[34] GenomeInfoDbData_1.2.10 IRanges_2.34.1 S4Vectors_0.38.2
[37] ggrepel_0.9.3 irlba_2.3.5.1 tidytree_0.4.5
[40] vegan_2.6-4 permute_0.9-7 DelayedMatrixStats_1.22.6
[43] codetools_0.2-19 DelayedArray_0.26.7 scuttle_1.10.2
[46] energy_1.7-11 tidyselect_1.2.0 lme4_1.1-34
[49] gmp_0.7-2 ScaledMatrix_1.8.1 viridis_0.6.4
[52] matrixStats_1.0.0 stats4_4.3.1 base64enc_0.1-3
[55] jsonlite_1.8.7 BiocNeighbors_1.18.0 multtest_2.56.0
[58] e1071_1.7-13 decontam_1.20.0 mia_1.8.0
[61] Formula_1.2-5 survival_3.5-7 scater_1.28.0
[64] iterators_1.0.14 foreach_1.5.2 tools_4.3.1
[67] treeio_1.24.3 DescTools_0.99.50 Rcpp_1.0.11
[70] glue_1.6.2 gridExtra_2.3 xfun_0.40
[73] mgcv_1.9-0 MatrixGenerics_1.12.3 GenomeInfoDb_1.36.4
[76] TreeSummarizedExperiment_2.8.0 withr_2.5.1 numDeriv_2016.8-1.1
[79] BiocManager_1.30.22 fastmap_1.1.1 boot_1.3-28.1
[82] rhdf5filters_1.12.1 fansi_1.0.4 digest_0.6.33
[85] rsvd_1.0.5 timechange_0.2.0 R6_2.5.1
[88] colorspace_2.1-0 gtools_3.9.4 RSQLite_2.3.1
[91] utf8_1.2.3 generics_0.1.3 data.table_1.14.8
[94] DECIPHER_2.28.0 class_7.3-22 CVXR_1.0-11
[97] httr_1.4.7 htmlwidgets_1.6.2 S4Arrays_1.0.6
[100] pkgconfig_2.0.3 gtable_0.3.4 Exact_3.2
[103] blob_1.2.4 Rmpfr_0.9-3 SingleCellExperiment_1.22.0
[106] XVector_0.40.0 htmltools_0.5.6.1 biomformat_1.28.0
[109] scales_1.2.1 Biobase_2.60.0 lmom_3.0
[112] knitr_1.44 rstudioapi_0.15.0 tzdb_0.4.0
[115] reshape2_1.4.4 checkmate_2.2.0 nlme_3.1-163
[118] nloptr_2.0.3 zoo_1.8-12 proxy_0.4-27
[121] cachem_1.0.8 rhdf5_2.44.0 rootSolve_1.8.2.4
[124] parallel_4.3.1 vipor_0.4.5 foreign_0.8-85
[127] pillar_1.9.0 grid_4.3.1 vctrs_0.6.3
[130] BiocSingular_1.16.0 beachmat_2.16.0 cluster_2.1.4
[133] beeswarm_0.4.0 htmlTable_2.4.1 evaluate_0.22
[136] mvtnorm_1.2-3 cli_3.6.1 compiler_4.3.1
[139] rlang_1.1.1 crayon_1.5.2 rngtools_1.5.2
[142] plyr_1.8.9 fs_1.6.3 ggbeeswarm_0.7.2
[145] stringi_1.7.12 viridisLite_0.4.2 BiocParallel_1.34.2
[148] lmerTest_3.1-3 munsell_0.5.0 Biostrings_2.68.1
[151] gsl_2.1-8 lazyeval_0.2.2 pacman_0.5.1
[154] Matrix_1.6-1.1 hms_1.1.3 sparseMatrixStats_1.12.2
[157] bit64_4.0.5 Rhdf5lib_1.22.1 SummarizedExperiment_1.30.2
[160] rbibutils_2.2.15 igraph_1.5.1 memoise_2.0.1
[163] bit_4.0.5 readxl_1.4.3 ape_5.7-1

@lyanna-kessler
Copy link

Same here

@mcalgaro93
Copy link

mcalgaro93 commented Oct 13, 2023

Hi Frederick,
Same issue here. I've noticed that the error for me comes when I set n_cl=1 (it doesn't happen when n_cl>1). Here is a toy example from the vignette:

library(ANCOMBC)

data(dietswap, package = "microbiome")
tse = mia::makeTreeSummarizedExperimentFromPhyloseq(dietswap)

set.seed(123)
out = ancom(data = tse, assay_name = "counts", 
            tax_level = "Family", phyloseq = NULL, 
            p_adj_method = "holm", prv_cut = 0.10, lib_cut = 1000, 
            main_var = "group",
            adj_formula = "nationality + timepoint", 
            rand_formula = "(timepoint | subject)", 
            lme_control = lme4::lmerControl(), 
            struc_zero = TRUE, neg_lb = TRUE, alpha = 0.05, n_cl = 1)

Here is my session info:

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.6

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-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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/Rome
tzcode source: internal

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

other attached packages:
[1] ANCOMBC_2.3.2

loaded via a namespace (and not attached):
  [1] IRanges_2.35.2                 BPCells_0.1.0                  gld_2.6.6                     
  [4] nnet_7.3-19                    goftest_1.2-3                  Biostrings_2.69.2             
  [7] TH.data_1.1-2                  vctrs_0.6.3                    spatstat.random_3.1-6         
 [10] energy_1.7-11                  digest_0.6.33                  png_0.1-8                     
 [13] proxy_0.4-27                   Exact_3.2                      ggrepel_0.9.3                 
 [16] deldir_1.0-9                   parallelly_1.36.0              permute_0.9-7                 
 [19] MASS_7.3-60                    reshape2_1.4.4                 httpuv_1.6.11                 
 [22] foreach_1.5.2                  BiocGenerics_0.47.0            withr_2.5.1                   
 [25] xfun_0.40                      ellipsis_0.3.2                 survival_3.5-7                
 [28] doRNG_1.8.6                    memoise_2.0.1                  ggbeeswarm_0.7.2              
 [31] gmp_0.7-2                      tidytree_0.4.5                 zoo_1.8-12                    
 [34] gtools_3.9.4                   pbapply_1.7-2                  Formula_1.2-5                 
 [37] promises_1.2.1                 httr_1.4.7                     globals_0.16.2                
 [40] fitdistrplus_1.1-11            rhdf5filters_1.13.5            rhdf5_2.45.1                  
 [43] rstudioapi_0.15.0              miniUI_0.1.1.1                 generics_0.1.3                
 [46] base64enc_0.1-3                S4Vectors_0.39.2               zlibbioc_1.47.0               
 [49] ScaledMatrix_1.9.1             polyclip_1.10-6                statip_0.2.3                  
 [52] GenomeInfoDbData_1.2.10        SparseArray_1.1.12             xtable_1.8-4                  
 [55] stringr_1.5.0                  ade4_1.7-22                    doParallel_1.0.17             
 [58] evaluate_0.22                  S4Arrays_1.1.6                 GenomicRanges_1.53.2          
 [61] irlba_2.3.5.1                  colorspace_2.1-0               ROCR_1.0-11                   
 [64] reticulate_1.32.0              readxl_1.4.3                   spatstat.data_3.0-1           
 [67] magrittr_2.0.3                 lmtest_0.9-40                  later_1.3.1                   
 [70] viridis_0.6.4                  lattice_0.21-9                 spatstat.geom_3.2-5           
 [73] future.apply_1.11.0            DECIPHER_2.29.2                scattermore_1.2               
 [76] scuttle_1.11.3                 cowplot_1.1.1                  matrixStats_1.0.0             
 [79] RcppAnnoy_0.0.21               class_7.3-22                   Hmisc_5.1-1                   
 [82] pillar_1.9.0                   nlme_3.1-163                   decontam_1.21.0               
 [85] iterators_1.0.14               compiler_4.3.1                 beachmat_2.17.16              
 [88] RSpectra_0.16-1                stringi_1.7.12                 biomformat_1.29.1             
 [91] DescTools_0.99.50              tensor_1.5                     stabledist_0.7-1              
 [94] minqa_1.2.6                    SummarizedExperiment_1.31.1    plyr_1.8.9                    
 [97] crayon_1.5.2                   abind_1.4-5                    scater_1.29.4                 
[100] timeSeries_4031.107            locfit_1.5-9.8                 sp_2.1-0                      
[103] bit_4.0.5                      sandwich_3.0-2                 mia_1.9.18                    
[106] rootSolve_1.8.2.4              dplyr_1.1.3                    multcomp_1.4-25               
[109] codetools_0.2-19               BiocSingular_1.17.1            e1071_1.7-13                  
[112] lmom_3.0                       phyloseq_1.45.0                plotly_4.10.2                 
[115] MultiAssayExperiment_1.27.5    multtest_2.57.0                mime_0.12                     
[118] splines_4.3.1                  Rcpp_1.0.11                    fastDummies_1.7.3             
[121] sparseMatrixStats_1.13.4       cellranger_1.1.0               knitr_1.44                    
[124] blob_1.2.4                     utf8_1.2.3                     clue_0.3-65                   
[127] lme4_1.1-34                    fBasics_4031.95                fs_1.6.3                      
[130] listenv_0.9.0                  checkmate_2.2.0                DelayedMatrixStats_1.23.4     
[133] Rdpack_2.5                     expm_0.999-7                   gsl_2.1-8                     
[136] tibble_3.2.1                   Matrix_1.6-1.1                 statmod_1.5.0                 
[139] pkgconfig_2.0.3                tools_4.3.1                    cachem_1.0.8                  
[142] rbibutils_2.2.15               RSQLite_2.3.1                  viridisLite_0.4.2             
[145] DBI_1.1.3                      numDeriv_2016.8-1.1            rmutil_1.1.10                 
[148] fastmap_1.1.1                  rmarkdown_2.25                 scales_1.2.1                  
[151] grid_4.3.1                     ica_1.0-3                      Seurat_4.9.9.9067             
[154] stable_1.1.6                   patchwork_1.1.3                BiocManager_1.30.22           
[157] dotCall64_1.0-2                RANN_2.6.1                     rpart_4.1.21                  
[160] mgcv_1.9-0                     yaml_2.3.7                     MatrixGenerics_1.13.1         
[163] spatial_7.3-17                 foreign_0.8-85                 cli_3.6.1                     
[166] purrr_1.0.2                    stats4_4.3.1                   leiden_0.4.3                  
[169] lifecycle_1.0.3                uwot_0.1.16                    Biobase_2.61.0                
[172] mvtnorm_1.2-3                  bluster_1.11.4                 backports_1.4.1               
[175] modeest_2.4.0                  BiocParallel_1.35.4            gtable_0.3.4                  
[178] ggridges_0.5.4                 progressr_0.14.0               parallel_4.3.1                
[181] ape_5.7-1                      CVXR_1.0-11                    jsonlite_1.8.7                
[184] RcppHNSW_0.5.0                 bitops_1.0-7                   ggplot2_3.4.3                 
[187] bit64_4.0.5                    Rtsne_0.16                     yulab.utils_0.1.0             
[190] vegan_2.6-4                    spatstat.utils_3.0-3           BiocNeighbors_1.19.0          
[193] SeuratObject_4.9.9.9091        TreeSummarizedExperiment_2.9.0 timeDate_4022.108             
[196] lazyeval_0.2.2                 shiny_1.7.5                    htmltools_0.5.6.1             
[199] sctransform_0.4.0              glue_1.6.2                     spam_2.9-1                    
[202] XVector_0.41.1                 RCurl_1.98-1.12                treeio_1.25.4                 
[205] gridExtra_2.3                  boot_1.3-28.1                  igraph_1.5.1                  
[208] R6_2.5.1                       tidyr_1.3.0                    DESeq2_1.41.12                
[211] SingleCellExperiment_1.23.0    Rmpfr_0.9-3                    cluster_2.1.4                 
[214] rngtools_1.5.2                 Rhdf5lib_1.23.2                MicrobiomeStat_1.1            
[217] GenomeInfoDb_1.37.6            DirichletMultinomial_1.43.0    nloptr_2.0.3                  
[220] DelayedArray_0.27.10           tidyselect_1.2.0               vipor_0.4.5                   
[223] htmlTable_2.4.1                future_1.33.0                  rsvd_1.0.5                    
[226] munsell_0.5.0                  KernSmooth_2.23-22             data.table_1.14.8             
[229] htmlwidgets_1.6.2              RColorBrewer_1.1-3             rlang_1.1.1                   
[232] spatstat.sparse_3.0-2          spatstat.explore_3.2-3         lmerTest_3.1-3                
[235] fansi_1.0.5                    beeswarm_0.4.0                    

Thank you in advance,
Matteo

@BlueK77
Copy link

BlueK77 commented Oct 20, 2023

Hi there, same here tested on:
Ubuntu 22.04 LTS R4.3.1
Windows 11 R4.3.1
Both crashes when rand_formula is not NULL, even with n_cl = 1

@FrederickHuangLin
Copy link
Owner

Hi @RachBioHaz, @lyanna-kessler, @mcalgaro93, and @BlueK77,

I'd like to extend my apologies for the delayed response. I recently transitioned to a new position, which entailed some settling-in time.

I suspect that the issue at hand may still be related to the compatibility between the phyloseq and lme4 packages. To further investigate, could one of you please run the following code to check if a fatal error occurs?

library(phyloseq)
library(lme4)
fm1 <- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy)

It's worth noting that even if you haven't explicitly imported the phyloseq package, it's a widely-used package for microbiome analysis, and other packages, like microbiome, may have dependencies on it.

One potential workaround is to isolate the phyloseq and ANCOMBC packages. This involves exporting your phyloseq data in tse format in a separate script and then running ancombc2 using the tse object without loading any phyloseq-related packages.

Additionally, I'd like to mention that upgrading Bioconductor to version 3.18 could be a helpful step. On my end, I've successfully run the below test code without errors, irrespective of setting n_cl = 1 or >1.

library(ANCOMBC)

data(dietswap, package = "microbiome")
tse = mia::makeTreeSummarizedExperimentFromPhyloseq(dietswap)

set.seed(123)
output = ancombc2(data = tse, assay_name = "counts", tax_level = "Family",
                  fix_formula = "nationality + timepoint + group",
                  rand_formula = "(timepoint | subject)",
                  p_adj_method = "holm", pseudo_sens = FALSE,
                  prv_cut = 0.10, lib_cut = 1000, s0_perc = 0.05,
                  group = "group", struc_zero = TRUE, neg_lb = TRUE,
                  alpha = 0.05, n_cl = 2, verbose = TRUE,
                  global = TRUE, pairwise = TRUE, dunnet = TRUE, trend = FALSE,
                  iter_control = list(tol = 1e-2, max_iter = 10, 
                                      verbose = TRUE),
                  em_control = list(tol = 1e-5, max_iter = 100),
                  lme_control = lme4::lmerControl(),
                  mdfdr_control = list(fwer_ctrl_method = "holm", B = 100),
                  trend_control = list(contrast = list(matrix(c(1, 0, -1, 1),
                                                              nrow = 2, 
                                                              byrow = TRUE)),
                                       node = list(2),
                                       solver = "ECOS",
                                       B = 10))

View(output$res)

My session info

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.0

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-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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: America/New_York
tzcode source: internal

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

other attached packages:
 [1] doRNG_1.8.6                     rngtools_1.5.2                  foreach_1.5.2                   TreeSummarizedExperiment_2.10.0
 [5] GenomicRanges_1.54.1            SummarizedExperiment_1.32.0     SingleCellExperiment_1.24.0     IRanges_2.36.0                 
 [9] S4Vectors_0.40.1                phyloseq_1.46.0                 ANCOMBC_2.4.0                  

loaded via a namespace (and not attached):
  [1] splines_4.3.1               bitops_1.0-7                tibble_3.2.1                cellranger_1.1.0            rpart_4.1.19               
  [6] DirichletMultinomial_1.44.0 lifecycle_1.0.3             Rdpack_2.6                  doParallel_1.0.17           lattice_0.21-8             
 [11] MASS_7.3-60                 MultiAssayExperiment_1.28.0 backports_1.4.1             magrittr_2.0.3              Hmisc_5.1-1                
 [16] rmarkdown_2.25              gld_2.6.6                   DBI_1.1.3                   minqa_1.2.6                 ade4_1.7-22                
 [21] multcomp_1.4-25             abind_1.4-5                 zlibbioc_1.48.0             expm_0.999-7                purrr_1.0.2                
 [26] BiocGenerics_0.48.0         RCurl_1.98-1.12             yulab.utils_0.1.0           nnet_7.3-19                 TH.data_1.1-2              
 [31] sandwich_3.0-2              GenomeInfoDbData_1.2.11     ggrepel_0.9.4               irlba_2.3.5.1               tidytree_0.4.5             
 [36] vegan_2.6-4                 permute_0.9-7               DelayedMatrixStats_1.24.0   codetools_0.2-19            DelayedArray_0.28.0        
 [41] scuttle_1.12.0              energy_1.7-11               tidyselect_1.2.0            lme4_1.1-34                 gmp_0.7-2                  
 [46] ScaledMatrix_1.10.0         viridis_0.6.4               matrixStats_1.0.0           stats4_4.3.1                base64enc_0.1-3            
 [51] jsonlite_1.8.7              multtest_2.58.0             BiocNeighbors_1.20.0        e1071_1.7-13                decontam_1.22.0            
 [56] mia_1.10.0                  Formula_1.2-5               survival_3.5-5              scater_1.30.0               iterators_1.0.14           
 [61] tools_4.3.1                 treeio_1.26.0               DescTools_0.99.50           Rcpp_1.0.11                 glue_1.6.2                 
 [66] gridExtra_2.3               SparseArray_1.2.2           xfun_0.40                   mgcv_1.8-42                 MatrixGenerics_1.14.0      
 [71] GenomeInfoDb_1.38.0         dplyr_1.1.3                 withr_2.5.1                 numDeriv_2016.8-1.1         fastmap_1.1.1              
 [76] rhdf5filters_1.13.2         boot_1.3-28.1               bluster_1.12.0              fansi_1.0.5                 digest_0.6.33              
 [81] rsvd_1.0.5                  R6_2.5.1                    colorspace_2.1-0            gtools_3.9.4                RSQLite_2.3.2              
 [86] utf8_1.2.4                  tidyr_1.3.0                 generics_0.1.3              data.table_1.14.8           DECIPHER_2.30.0            
 [91] class_7.3-22                CVXR_1.0-11                 httr_1.4.7                  htmlwidgets_1.6.2           S4Arrays_1.2.0             
 [96] pkgconfig_2.0.3             gtable_0.3.4                Exact_3.2                   Rmpfr_0.9-3                 blob_1.2.4                 
[101] XVector_0.42.0              htmltools_0.5.6.1           biomformat_1.30.0           scales_1.2.1                Biobase_2.62.0             
[106] lmom_3.0                    knitr_1.45                  rstudioapi_0.15.0           reshape2_1.4.4              checkmate_2.3.0            
[111] nlme_3.1-162                nloptr_2.0.3                rhdf5_2.46.0                proxy_0.4-27                cachem_1.0.8               
[116] zoo_1.8-12                  stringr_1.5.0               rootSolve_1.8.2.4           parallel_4.3.1              vipor_0.4.5                
[121] foreign_0.8-84              pillar_1.9.0                grid_4.3.1                  vctrs_0.6.4                 BiocSingular_1.18.0        
[126] beachmat_2.18.0             cluster_2.1.4               beeswarm_0.4.0              htmlTable_2.4.2             evaluate_0.22              
[131] mvtnorm_1.2-3               cli_3.6.1                   compiler_4.3.1              rlang_1.1.1                 crayon_1.5.2               
[136] plyr_1.8.9                  fs_1.6.3                    ggbeeswarm_0.7.2            stringi_1.7.12              viridisLite_0.4.2          
[141] BiocParallel_1.36.0         lmerTest_3.1-3              munsell_0.5.0               Biostrings_2.70.1           gsl_2.1-8                  
[146] lazyeval_0.2.2              Matrix_1.6-1.1              sparseMatrixStats_1.14.0    bit64_4.0.5                 Rhdf5lib_1.24.0            
[151] ggplot2_3.4.4               rbibutils_2.2.16            igraph_1.5.1                memoise_2.0.1               bit_4.0.5                  
[156] readxl_1.4.3                ape_5.7-1 

@RachBioHaz
Copy link
Author

It doesn't work in R Studio and crashes after I try to run the output command.

Session Info from RStudio test:
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.utf8 LC_CTYPE=English_Australia.utf8 LC_MONETARY=English_Australia.utf8
[4] LC_NUMERIC=C LC_TIME=English_Australia.utf8

time zone: Australia/Sydney
tzcode source: internal

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

other attached packages:
[1] mia_1.8.0 MultiAssayExperiment_1.26.0 TreeSummarizedExperiment_2.8.0 Biostrings_2.68.1
[5] XVector_0.40.0 SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.2 Biobase_2.60.0
[9] GenomicRanges_1.52.0 GenomeInfoDb_1.36.4 IRanges_2.34.1 S4Vectors_0.38.2
[13] BiocGenerics_0.46.0 MatrixGenerics_1.12.3 matrixStats_1.1.0 ANCOMBC_2.2.2

loaded via a namespace (and not attached):
[1] splines_4.3.1 bitops_1.0-7 tibble_3.2.1 cellranger_1.1.0
[5] DirichletMultinomial_1.42.0 rpart_4.1.19 lifecycle_1.0.4 Rdpack_2.6
[9] doParallel_1.0.17 lattice_0.21-9 MASS_7.3-60 backports_1.4.1
[13] magrittr_2.0.3 Hmisc_5.1-1 rmarkdown_2.25 yaml_2.3.7
[17] doRNG_1.8.6 gld_2.6.6 DBI_1.1.3 minqa_1.2.6
[21] ade4_1.7-22 multcomp_1.4-25 abind_1.4-5 zlibbioc_1.46.0
[25] rvest_1.0.3 expm_0.999-7 purrr_1.0.2 RCurl_1.98-1.12
[29] TH.data_1.1-2 phyloseq_1.44.0 yulab.utils_0.1.0 nnet_7.3-19
[33] sandwich_3.0-2 GenomeInfoDbData_1.2.10 ggrepel_0.9.4 irlba_2.3.5.1
[37] tidytree_0.4.5 vegan_2.6-4 svglite_2.1.2 permute_0.9-7
[41] DelayedMatrixStats_1.22.6 codetools_0.2-19 DelayedArray_0.26.7 scuttle_1.10.2
[45] xml2_1.3.5 energy_1.7-11 tidyselect_1.2.0 viridis_0.6.4
[49] lme4_1.1-34 gmp_0.7-2 ScaledMatrix_1.8.1 base64enc_0.1-3
[53] webshot_0.5.5 jsonlite_1.8.7 BiocNeighbors_1.18.0 multtest_2.56.0
[57] e1071_1.7-13 decontam_1.20.0 Formula_1.2-5 survival_3.5-7
[61] scater_1.28.0 iterators_1.0.14 systemfonts_1.0.5 foreach_1.5.2
[65] tools_4.3.1 treeio_1.24.3 DescTools_0.99.50 Rcpp_1.0.11
[69] glue_1.6.2 gridExtra_2.3 xfun_0.40 mgcv_1.9-0
[73] dplyr_1.1.3 withr_2.5.2 numDeriv_2016.8-1.1 fastmap_1.1.1
[77] boot_1.3-28.1 rhdf5filters_1.12.1 fansi_1.0.5 digest_0.6.33
[81] rsvd_1.0.5 R6_2.5.1 colorspace_2.1-0 gtools_3.9.4
[85] RSQLite_2.3.1 utf8_1.2.4 tidyr_1.3.0 generics_0.1.3
[89] DECIPHER_2.28.0 data.table_1.14.8 class_7.3-22 CVXR_1.0-11
[93] httr_1.4.7 htmlwidgets_1.6.2 S4Arrays_1.2.0 pkgconfig_2.0.3
[97] gtable_0.3.4 Exact_3.2 blob_1.2.4 Rmpfr_0.9-3
[101] htmltools_0.5.6.1 biomformat_1.28.0 scales_1.2.1 kableExtra_1.3.4
[105] lmom_3.0 knitr_1.45 rstudioapi_0.15.0 reshape2_1.4.4
[109] checkmate_2.3.0 nlme_3.1-163 nloptr_2.0.3 zoo_1.8-12
[113] proxy_0.4-27 cachem_1.0.8 rhdf5_2.44.0 stringr_1.5.0
[117] rootSolve_1.8.2.4 vipor_0.4.5 parallel_4.3.1 foreign_0.8-85
[121] pillar_1.9.0 grid_4.3.1 vctrs_0.6.4 BiocSingular_1.16.0
[125] beachmat_2.16.0 cluster_2.1.4 beeswarm_0.4.0 htmlTable_2.4.2
[129] evaluate_0.23 mvtnorm_1.2-3 cli_3.6.1 compiler_4.3.1
[133] rlang_1.1.1 crayon_1.5.2 rngtools_1.5.2 ggbeeswarm_0.7.2
[137] plyr_1.8.9 fs_1.6.3 stringi_1.7.12 viridisLite_0.4.2
[141] BiocParallel_1.34.2 lmerTest_3.1-3 munsell_0.5.0 gsl_2.1-8
[145] lazyeval_0.2.2 Matrix_1.6-2 sparseMatrixStats_1.12.2 bit64_4.0.5
[149] ggplot2_3.4.4 Rhdf5lib_1.22.1 rbibutils_2.2.16 igraph_1.5.1
[153] memoise_2.0.1 bit_4.0.5 readxl_1.4.3 ape_5.7-1


It crashes when running it directly in R directly as well. So it's not an RStudio-specific issue.

Session info from R:

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.utf8 LC_CTYPE=English_Australia.utf8
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Australia.utf8

time zone: Australia/Sydney
tzcode source: internal

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

other attached packages:
[1] phyloseq_1.44.0 mia_1.8.0
[3] MultiAssayExperiment_1.26.0 TreeSummarizedExperiment_2.8.0
[5] Biostrings_2.68.1 XVector_0.40.0
[7] SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.2
[9] Biobase_2.60.0 GenomicRanges_1.52.0
[11] GenomeInfoDb_1.36.4 IRanges_2.34.1
[13] S4Vectors_0.38.2 BiocGenerics_0.46.0
[15] MatrixGenerics_1.12.3 matrixStats_1.1.0
[17] ANCOMBC_2.2.2

loaded via a namespace (and not attached):
[1] splines_4.3.1 bitops_1.0-7
[3] tibble_3.2.1 cellranger_1.1.0
[5] rpart_4.1.19 DirichletMultinomial_1.42.0
[7] lifecycle_1.0.4 Rdpack_2.6
[9] doParallel_1.0.17 lattice_0.21-9
[11] MASS_7.3-60 backports_1.4.1
[13] magrittr_2.0.3 Hmisc_5.1-1
[15] rmarkdown_2.25 doRNG_1.8.6
[17] gld_2.6.6 DBI_1.1.3
[19] minqa_1.2.6 ade4_1.7-22
[21] multcomp_1.4-25 abind_1.4-5
[23] zlibbioc_1.46.0 expm_0.999-7
[25] purrr_1.0.2 RCurl_1.98-1.12
[27] yulab.utils_0.1.0 nnet_7.3-19
[29] TH.data_1.1-2 sandwich_3.0-2
[31] GenomeInfoDbData_1.2.10 ggrepel_0.9.4
[33] irlba_2.3.5.1 tidytree_0.4.5
[35] vegan_2.6-4 permute_0.9-7
[37] DelayedMatrixStats_1.22.6 codetools_0.2-19
[39] DelayedArray_0.26.7 scuttle_1.10.2
[41] energy_1.7-11 tidyselect_1.2.0
[43] lme4_1.1-34 gmp_0.7-2
[45] ScaledMatrix_1.8.1 viridis_0.6.4
[47] base64enc_0.1-3 jsonlite_1.8.7
[49] multtest_2.56.0 BiocNeighbors_1.18.0
[51] e1071_1.7-13 decontam_1.20.0
[53] Formula_1.2-5 survival_3.5-7
[55] scater_1.28.0 iterators_1.0.14
[57] foreach_1.5.2 tools_4.3.1
[59] treeio_1.24.3 DescTools_0.99.50
[61] Rcpp_1.0.11 glue_1.6.2
[63] gridExtra_2.3 xfun_0.40
[65] mgcv_1.9-0 dplyr_1.1.3
[67] withr_2.5.2 numDeriv_2016.8-1.1
[69] fastmap_1.1.1 rhdf5filters_1.12.1
[71] boot_1.3-28.1 fansi_1.0.5
[73] digest_0.6.33 rsvd_1.0.5
[75] R6_2.5.1 colorspace_2.1-0
[77] gtools_3.9.4 RSQLite_2.3.1
[79] utf8_1.2.4 tidyr_1.3.0
[81] generics_0.1.3 data.table_1.14.8
[83] DECIPHER_2.28.0 class_7.3-22
[85] CVXR_1.0-11 httr_1.4.7
[87] htmlwidgets_1.6.2 S4Arrays_1.2.0
[89] pkgconfig_2.0.3 gtable_0.3.4
[91] Exact_3.2 Rmpfr_0.9-3
[93] blob_1.2.4 htmltools_0.5.6.1
[95] biomformat_1.28.0 scales_1.2.1
[97] lmom_3.0 knitr_1.45
[99] rstudioapi_0.15.0 reshape2_1.4.4
[101] checkmate_2.3.0 nlme_3.1-163
[103] nloptr_2.0.3 proxy_0.4-27
[105] cachem_1.0.8 zoo_1.8-12
[107] rhdf5_2.44.0 stringr_1.5.0
[109] rootSolve_1.8.2.4 parallel_4.3.1
[111] vipor_0.4.5 foreign_0.8-85
[113] pillar_1.9.0 grid_4.3.1
[115] vctrs_0.6.4 BiocSingular_1.16.0
[117] beachmat_2.16.0 cluster_2.1.4
[119] beeswarm_0.4.0 htmlTable_2.4.2
[121] evaluate_0.23 mvtnorm_1.2-3
[123] cli_3.6.1 compiler_4.3.1
[125] rlang_1.1.1 crayon_1.5.2
[127] rngtools_1.5.2 plyr_1.8.9
[129] fs_1.6.3 ggbeeswarm_0.7.2
[131] stringi_1.7.12 viridisLite_0.4.2
[133] BiocParallel_1.34.2 lmerTest_3.1-3
[135] munsell_0.5.0 gsl_2.1-8
[137] lazyeval_0.2.2 Matrix_1.6-2
[139] sparseMatrixStats_1.12.2 bit64_4.0.5
[141] Rhdf5lib_1.22.1 ggplot2_3.4.4
[143] rbibutils_2.2.16 igraph_1.5.1
[145] memoise_2.0.1 bit_4.0.5
[147] readxl_1.4.3 ape_5.7-1

@mcalgaro93
Copy link

Thanks @FrederickHuangLin for your feedback. I have updated both R to 4.3.2 and Bioconductor to 3.18.
Everything works fine for me now and the following code chunk doesn't produce a fatal error:

library(phyloseq)
library(lme4)
fm1 <- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy)

@RachBioHaz, from your session info I can see that the ANCOMBC and other packages are still from Bioconductor 3.17. May that be the issue? Probably you already know how to update it:

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.18")
BiocManager::valid()

My session info:

R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.6

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-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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/Rome
tzcode source: internal

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

other attached packages:
[1] ANCOMBC_2.4.0   lme4_1.1-35.1   Matrix_1.6-1.1  phyloseq_1.46.0

loaded via a namespace (and not attached):
  [1] splines_4.3.2                   bitops_1.0-7                   
  [3] tibble_3.2.1                    cellranger_1.1.0               
  [5] DirichletMultinomial_1.44.0     rpart_4.1.21                   
  [7] lifecycle_1.0.3                 Rdpack_2.5                     
  [9] doParallel_1.0.17               lattice_0.22-5                 
 [11] MASS_7.3-60                     MultiAssayExperiment_1.28.0    
 [13] backports_1.4.1                 magrittr_2.0.3                 
 [15] Hmisc_5.1-1                     rmarkdown_2.25                 
 [17] doRNG_1.8.6                     gld_2.6.6                      
 [19] DBI_1.1.3                       minqa_1.2.6                    
 [21] ade4_1.7-22                     multcomp_1.4-25                
 [23] abind_1.4-5                     zlibbioc_1.48.0                
 [25] expm_0.999-7                    GenomicRanges_1.54.1           
 [27] purrr_1.0.2                     BiocGenerics_0.48.1            
 [29] RCurl_1.98-1.13                 TH.data_1.1-2                  
 [31] yulab.utils_0.1.0               nnet_7.3-19                    
 [33] sandwich_3.0-2                  GenomeInfoDbData_1.2.11        
 [35] IRanges_2.36.0                  S4Vectors_0.40.1               
 [37] ggrepel_0.9.4                   irlba_2.3.5.1                  
 [39] tidytree_0.4.5                  vegan_2.6-4                    
 [41] permute_0.9-7                   DelayedMatrixStats_1.24.0      
 [43] codetools_0.2-19                DelayedArray_0.28.0            
 [45] scuttle_1.12.0                  energy_1.7-11                  
 [47] tidyselect_1.2.0                gmp_0.7-2                      
 [49] ScaledMatrix_1.10.0             viridis_0.6.4                  
 [51] matrixStats_1.0.0               stats4_4.3.2                   
 [53] base64enc_0.1-3                 jsonlite_1.8.7                 
 [55] BiocNeighbors_1.20.0            multtest_2.58.0                
 [57] e1071_1.7-13                    decontam_1.22.0                
 [59] mia_1.10.0                      Formula_1.2-5                  
 [61] survival_3.5-7                  scater_1.30.0                  
 [63] iterators_1.0.14                foreach_1.5.2                  
 [65] tools_4.3.2                     treeio_1.26.0                  
 [67] DescTools_0.99.50               Rcpp_1.0.11                    
 [69] glue_1.6.2                      gridExtra_2.3                  
 [71] SparseArray_1.2.1               xfun_0.41                      
 [73] mgcv_1.9-0                      MatrixGenerics_1.14.0          
 [75] GenomeInfoDb_1.38.0             TreeSummarizedExperiment_2.10.0
 [77] dplyr_1.1.3                     withr_2.5.2                    
 [79] numDeriv_2016.8-1.1             fastmap_1.1.1                  
 [81] bluster_1.12.0                  boot_1.3-28.1                  
 [83] rhdf5filters_1.14.0             fansi_1.0.5                    
 [85] digest_0.6.33                   rsvd_1.0.5                     
 [87] R6_2.5.1                        colorspace_2.1-0               
 [89] gtools_3.9.4                    RSQLite_2.3.3                  
 [91] utf8_1.2.4                      tidyr_1.3.0                    
 [93] generics_0.1.3                  data.table_1.14.8              
 [95] DECIPHER_2.30.0                 class_7.3-22                   
 [97] CVXR_1.0-11                     httr_1.4.7                     
 [99] htmlwidgets_1.6.2               S4Arrays_1.2.0                 
[101] pkgconfig_2.0.3                 gtable_0.3.4                   
[103] Exact_3.2                       blob_1.2.4                     
[105] Rmpfr_0.9-3                     SingleCellExperiment_1.24.0    
[107] XVector_0.42.0                  htmltools_0.5.7                
[109] biomformat_1.30.0               scales_1.2.1                   
[111] Biobase_2.62.0                  lmom_3.0                       
[113] knitr_1.45                      rstudioapi_0.15.0              
[115] reshape2_1.4.4                  checkmate_2.3.0                
[117] nlme_3.1-163                    nloptr_2.0.3                   
[119] zoo_1.8-12                      proxy_0.4-27                   
[121] cachem_1.0.8                    rhdf5_2.46.0                   
[123] stringr_1.5.0                   rootSolve_1.8.2.4              
[125] parallel_4.3.2                  vipor_0.4.5                    
[127] foreign_0.8-85                  pillar_1.9.0                   
[129] grid_4.3.2                      vctrs_0.6.4                    
[131] BiocSingular_1.18.0             beachmat_2.18.0                
[133] cluster_2.1.4                   beeswarm_0.4.0                 
[135] htmlTable_2.4.2                 evaluate_0.23                  
[137] mvtnorm_1.2-3                   cli_3.6.1                      
[139] compiler_4.3.2                  rlang_1.1.2                    
[141] crayon_1.5.2                    rngtools_1.5.2                 
[143] plyr_1.8.9                      fs_1.6.3                       
[145] ggbeeswarm_0.7.2                stringi_1.7.12                 
[147] viridisLite_0.4.2               BiocParallel_1.36.0            
[149] lmerTest_3.1-3                  munsell_0.5.0                  
[151] Biostrings_2.70.1               gsl_2.1-8                      
[153] lazyeval_0.2.2                  sparseMatrixStats_1.14.0       
[155] bit64_4.0.5                     ggplot2_3.4.4                  
[157] Rhdf5lib_1.24.0                 SummarizedExperiment_1.32.0    
[159] rbibutils_2.2.16                igraph_1.5.1                   
[161] memoise_2.0.1                   bit_4.0.5                      
[163] readxl_1.4.3                    ape_5.7-1     

@mmaechler
Copy link

mmaechler commented Nov 17, 2023

Updating R and Bioconductor ... probably meant newly installing many of the 100++ packages you are using
and that solved the issue.
I'm close to 100% sure this will solve these problems for everybody here.
If we knew the culprit(s), it could well be that re-installation of just a few packages would suffice,
but such an unstable situation where you use 164 package namespaces, it's hard to pin point where the problem originates..
A few important things:

  1. Above you have quite a large set of namespaces when outside RStudio. That is very strange,
    and would suggest you run R quite differently, and probably with a saved workspace at start.
    Do remove that .RData (R session data), or use R --vanilla (if you know how to call R with command line options).
  2. The version of Matrix (recommended package, part of R) is important: When I search this page for Matrix_1.6 I see 6 matches, and about 4 are Matrix_1.6.1-1 (which is "old" and and should be updated). Current is Matrix_1.6-2 or 1.6-3 {{both are practically identical}}. Then,
  3. After updating Matrix (to at least 1.6-2), you must re-install packages which depend on Matrix (directly or indirectly); notably lme4, TMB, glmmTMB, but also others. Read this {from the R-package-devel mailing list}:
    https://stat.ethz.ch/pipermail/r-package-devel/2023q4/010054.html

@RachBioHaz
Copy link
Author

I did the reinstalls from source as recommended below. I also needed to delete the RData file. It seems to be working now. Thx

R aborts and terminates session when trying to run lmer
#757

@savvas-paragkamian
Copy link

Great points @mmaechler! My issue probably was the Matrix package that you mentioned. It would be great to reduce dependencies, a huge disadvantage of this and many other bioconductor packages. I think this great method would be used a lot more if not for this instability.

@FrederickHuangLin
Copy link
Owner

Thank you for your excellent points, @mmaechler.

I've been trying to minimize dependencies on external packages and aim to utilize as many R base functions as possible. However, I've observed that several dependencies arise from the formatting of input data, including packages like mia and SingleCellExperiment. I'm curious if you have any insights or suggestions on further reducing these dependencies?

Appreciate your input,
Frederick

@savvas-paragkamian
Copy link

@FrederickHuangLin congratulations on your ANCOM-BC2 publication!

I am not an expert in package development, but as I understand you don't need mia or the similar phyloseq. Maybe using the approach of vegan and just accept a data.frame of matrix for the input data and metadata would suffice. Most of the mia package is wrapper functions for vegan, ape, and some agglomeration tasks to make faster and easier the analysis, but because you are not an end user you don't need that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants