FrederickHuangLin / ANCOMBC

Differential abundance (DA) and correlation analyses for microbial absolute abundance data
https://www.nature.com/articles/s41467-020-17041-7
104 stars 27 forks source link

R session aborted while running ANCOMBC2 #249

Open dana-binyamin opened 7 months ago

dana-binyamin commented 7 months ago

Hi, I attempted to run the ancombc2 function using the example provided in ?ancombc, but it resulted in an aborted R session. Could you please help me with fixing this issue?

Thanks, Dana.

nhenry50 commented 7 months ago

Hi,

Thanks a lot for this great package!

I have the same issue when I run the example from the help of ancombc2. The ancombc2 function returns me this:

Obtaining initial estimates ...
ML iteration = 1, epsilon = 3.9
Estimating sample-specific biases ...
Le chargement a nécessité le package : foreach
Le chargement a nécessité le package : rngtools
Sensitivity analysis for pseudo-count addition to 0s: ...
ANCOM-BC2 primary results ...
ANCOM-BC2 global test ...
ANCOM-BC2 multiple pairwise comparisons ...
ANCOM-BC2 multiple pairwise comparisons against the reference group ...
ANCOM-BC2 pattern analysis ...

*** caught segfault ***
address 0x1, cause 'memory not mapped'

Traceback:
 1: t(X_coeff)
 2: t(X_coeff)
 3: matrix(t(X_coeff), nrow = nrow(coeffs[[1]]), byrow = TRUE)
 4: reduction_format_constr(object, problem, cons, exp_cone_order)
 5: reduction_format_constr(object, problem, cons, exp_cone_order)
 6: group_coeff_offset(object, problem, neq_constr, ECOS()@exp_cone_order)
 7: group_coeff_offset(object, problem, neq_constr, ECOS()@exp_cone_order)
 8: perform(r, problem)
 9: perform(r, problem)
10: perform(object@.solving_chain, object@.intermediate_problem)
11: perform(object@.solving_chain, object@.intermediate_problem)
12: psolve(a, ...)
13: psolve(a, ...)
14: CVXR::solve(problem, solver = solver)
15: CVXR::solve(problem, solver = solver)
16: doTryCatch(return(expr), name, parentenv, handler)
17: tryCatchOne(expr, names, parentenv, handlers[[1L]])
18: tryCatchList(expr, classes, parentenv, handlers)
19: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
20: try(CVXR::solve(problem, solver = solver), silent = TRUE)
21: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
22: suppressMessages(result <- try(CVXR::solve(problem, solver = solver),     silent = TRUE))
23: FUN(X[[i]], ...)
24: lapply(X = contrast, FUN = fun_list[[1]], beta_hat = beta_hat_sub[i,     ], vcov_hat = vcov_hat_sub[[i]], solver = solver)
25: unlist(lapply(X = contrast, FUN = fun_list[[1]], beta_hat = beta_hat_sub[i,     ], vcov_hat = vcov_hat_sub[[i]], solver = solver))
26: eval(xpr, envir = envir)
27: eval(xpr, envir = envir)
28: doTryCatch(return(expr), name, parentenv, handler)
29: tryCatchOne(expr, names, parentenv, handlers[[1L]])
30: tryCatchList(expr, classes, parentenv, handlers)
31: tryCatch(eval(xpr, envir = envir), error = function(e) e)
32: doTryCatch(return(expr), name, parentenv, handler)
33: tryCatchOne(expr, names, parentenv, handlers[[1L]])
34: tryCatchList(expr, classes, parentenv, handlers)
35: tryCatch({    repeat {        args <- nextElem(it)        if (obj$verbose) {            cat(sprintf("evaluation # %d:\n", i))            print(args)        }        for (a in names(args)) assign(a, args[[a]], pos = envir,             inherits = FALSE)        r <- tryCatch(eval(xpr, envir = envir), error = function(e) e)        if (obj$verbose) {            cat("result of evaluating expression:\n")            print(r)        }        tryCatch(accumulator(list(r), i), error = function(e) {            cat("error calling combine function:\n")            print(e)            NULL        })        i <- i + 1    }}, error = function(e) {    if (!identical(conditionMessage(e), "StopIteration"))         stop(simpleError(conditionMessage(e), expr))})
36: e$fun(obj, substitute(ex), parent.frame(), e$data)
37: (function (obj, ex) {    e <- getDoPar()    e$fun(obj, substitute(ex), parent.frame(), e$data)})(list(args = seq_len(n_tax)(.doRNG.stream = list(c(10407L, 2065493122L, -89260517L, -1856578912L, -1505283551L, -156249746L, 1239108375L), c(10407L, 1134170993L, -366534976L, -1952316947L, -1544256773L, -493282195L, 550079468L), c(10407L, 1568093054L, 772568389L, -54726601L, 1966827634L, -723992270L, -701559637L), c(10407L, 1097329108L, 25352133L, 1122433235L, 37457753L, -763252219L, 241246645L), c(10407L, -321322163L, -573957246L, -1772300094L, -1968781714L, -2058900039L, -1593125685L), c(10407L, 491526067L, 468994105L, -1157175011L, -765375177L, -1622626902L, -1049214349L))), argnames = c("i", ".doRNG.stream"), evalenv = <environment>,     specified = character(0), combineInfo = list(fun = function (...,         deparse.level = 1)     .Internal(rbind(deparse.level, ...)), in.order = TRUE, has.init = FALSE,         init = NULL, final = NULL, multi.combine = TRUE, max.combine = 100),     errorHandling = "stop", packages = "doRNG", export = NULL,     noexport = NULL, options = list(), verbose = FALSE), {    {        rngtools::RNGseed(.doRNG.stream)    }    {        beta_hat_opt = unlist(lapply(X = contrast, FUN = fun_list[[1]],             beta_hat = beta_hat_sub[i, ], vcov_hat = vcov_hat_sub[[i]],             solver = solver))    }})
38: do.call(`%dopar%`, list(obj, ex), envir = parent.frame())
39: foreach(i = seq_len(n_tax), .combine = rbind) %dorng% {    beta_hat_opt = unlist(lapply(X = contrast, FUN = fun_list[[1]],         beta_hat = beta_hat_sub[i, ], vcov_hat = vcov_hat_sub[[i]],         solver = solver))}
40: .ancombc_trend(x = x, group = group, beta_hat = beta_hat, var_hat = var_hat,     vcov_hat = vcov_hat, p_adj_method = p_adj_method, alpha = alpha,     trend_control = trend_control)
41: ancombc2(data = tse, assay_name = "counts", tax_level = "Phylum",     fix_formula = "nationality + timepoint + bmi_group", rand_formula = NULL,     p_adj_method = "holm", pseudo_sens = TRUE, prv_cut = 0.1,     lib_cut = 1000, s0_perc = 0.05, group = "bmi_group", struc_zero = TRUE,     neg_lb = TRUE, alpha = 0.05, n_cl = 1, verbose = TRUE, global = TRUE,     pairwise = TRUE, dunnet = TRUE, trend = TRUE, iter_control = list(tol = 0.01,         max_iter = 1, verbose = TRUE), em_control = list(tol = 1e-05,         max_iter = 1), lme_control = lme4::lmerControl(), mdfdr_control = list(fwer_ctrl_method = "holm",         B = 1), trend_control = list(contrast = list(matrix(c(1,         0, -1, 1), nrow = 2, byrow = TRUE)), node = list(2),         solver = "ECOS", B = 1))

I am using ANCOMBC 2.2.2:

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

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

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8       
 [4] LC_COLLATE=fr_FR.UTF-8     LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8   
 [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Ljubljana
tzcode source: system (glibc)

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
 [4] Biostrings_2.68.1              XVector_0.40.0                 SingleCellExperiment_1.22.0   
 [7] SummarizedExperiment_1.30.2    Biobase_2.60.0                 GenomicRanges_1.52.0          
[10] GenomeInfoDb_1.36.1            IRanges_2.34.1                 S4Vectors_0.38.1              
[13] BiocGenerics_0.46.0            MatrixGenerics_1.12.3          matrixStats_1.0.0             
[16] ANCOMBC_2.2.2                 

loaded via a namespace (and not attached):
  [1] rstudioapi_0.15.0           jsonlite_1.8.7              magrittr_2.0.3             
  [4] TH.data_1.1-2               ggbeeswarm_0.7.2            nloptr_2.0.3               
  [7] rmarkdown_2.23              zlibbioc_1.46.0             vctrs_0.6.3                
 [10] memoise_2.0.1               minqa_1.2.5                 DelayedMatrixStats_1.22.1  
 [13] RCurl_1.98-1.12             base64enc_0.1-3             htmltools_0.5.5            
 [16] S4Arrays_1.0.5              energy_1.7-11               BiocNeighbors_1.18.0       
 [19] cellranger_1.1.0            Formula_1.2-5               htmlwidgets_1.6.2          
 [22] sandwich_3.0-2              plyr_1.8.8                  DECIPHER_2.28.0            
 [25] zoo_1.8-12                  cachem_1.0.8                rootSolve_1.8.2.3          
 [28] lifecycle_1.0.3             iterators_1.0.14            pkgconfig_2.0.3            
 [31] rsvd_1.0.5                  Matrix_1.6-3                R6_2.5.1                   
 [34] fastmap_1.1.1               GenomeInfoDbData_1.2.10     rbibutils_2.2.14           
 [37] digest_0.6.33               Exact_3.2                   numDeriv_2016.8-1.1        
 [40] colorspace_2.1-0            scater_1.28.0               irlba_2.3.5.1              
 [43] RSQLite_2.3.1               Hmisc_5.1-0                 vegan_2.6-4                
 [46] beachmat_2.16.0             fansi_1.0.4                 mgcv_1.9-1                 
 [49] httr_1.4.6                  abind_1.4-5                 compiler_4.3.2             
 [52] rngtools_1.5.2              proxy_0.4-27                bit64_4.0.5                
 [55] withr_2.5.0                 doParallel_1.0.17           gsl_2.1-8                  
 [58] htmlTable_2.4.1             backports_1.4.1             BiocParallel_1.34.2        
 [61] DBI_1.1.3                   viridis_0.6.4               MASS_7.3-60                
 [64] DelayedArray_0.26.7         permute_0.9-7               gtools_3.9.4               
 [67] CVXR_1.0-11                 gld_2.6.6                   tools_4.3.2                
 [70] vipor_0.4.5                 foreign_0.8-86              beeswarm_0.4.0             
 [73] ape_5.7-1                   nnet_7.3-19                 glue_1.6.2                 
 [76] nlme_3.1-163                grid_4.3.2                  checkmate_2.2.0            
 [79] reshape2_1.4.4              cluster_2.1.6               generics_0.1.3             
 [82] gtable_0.3.3                class_7.3-22                tidyr_1.3.0                
 [85] data.table_1.14.8           lmom_2.9                    BiocSingular_1.16.0        
 [88] ScaledMatrix_1.8.1          utf8_1.2.3                  ggrepel_0.9.3              
 [91] foreach_1.5.2               pillar_1.9.0                stringr_1.5.0              
 [94] yulab.utils_0.0.6           splines_4.3.2               dplyr_1.1.2                
 [97] treeio_1.24.3               lattice_0.22-5              survival_3.5-7             
[100] gmp_0.7-2                   bit_4.0.5                   DirichletMultinomial_1.42.0
[103] tidyselect_1.2.0            scuttle_1.10.2              knitr_1.43                 
[106] gridExtra_2.3               xfun_0.39                   expm_0.999-7               
[109] stringi_1.7.12              lazyeval_0.2.2              boot_1.3-28                
[112] evaluate_0.21               codetools_0.2-19            tibble_3.2.1               
[115] cli_3.6.1                   rpart_4.1.23                DescTools_0.99.49          
[118] Rdpack_2.4                  munsell_0.5.0               Rcpp_1.0.11                
[121] readxl_1.4.3                parallel_4.3.2              blob_1.2.4                 
[124] ggplot2_3.4.2               doRNG_1.8.6                 sparseMatrixStats_1.12.2   
[127] bitops_1.0-7                lme4_1.1-35.1               Rmpfr_0.9-2                
[130] decontam_1.20.0             viridisLite_0.4.2           mvtnorm_1.2-2              
[133] tidytree_0.4.4              lmerTest_3.1-3              scales_1.2.1               
[136] e1071_1.7-13                purrr_1.0.1                 crayon_1.5.2               
[139] rlang_1.1.1                 multcomp_1.4-25    

Any clue about what could cause this error?

Thanks!

Nico

Maggie8888 commented 3 months ago

Please try to update all the required packages and restart R studio.