FrederickHuangLin / ANCOMBC

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

Interpreting error when running ancombc2 function: Error in is.infinite(o1) : default method not implemented for type 'list' #265

Open 411an13 opened 4 months ago

411an13 commented 4 months ago

Context

I'm trying to run ANCOM-BC2 for the first time and I keep getting the same error message: Error in is.infinite(o1) : default method not implemented for type 'list'. I'm wondering if this has been reported before (to my knowledge, it hasn't been) or if there's a simple syntax error in my implementation. I've checked the documentation and ANCOM-BC2 tutorial. Briefly, I'm interested in analyzing the effects of two categorical variables: env (2 levels) and strain (3 levels). For each combination of these variables, I have three replicates, so total N = 18 (2x3x3). Initial visualizations suggest strong segregation by treatment; now I aim to quantify the effects.

Issue

I've put my data/metadata into a TreeSummarizedExperiment format, and I'm not interested in doing a trend test but I've also run the following code with the trend test lines included, which still resulted in the same error message. Is there an apparent error in how I'm using the function? If not, I suspect it could be an issue related to the TSE itself. I just can't tell what the error message is referring to.

set.seed(123)
output = ancombc2(data = tse, assay_name = "counts", tax_level = NULL,
                  fix_formula = "env + strain", rand_formula = NULL,
                  p_adj_method = "holm", pseudo_sens = FALSE,
                  prv_cut = 0.10, lib_cut = 0, s0_perc = 0.05,
                  group = "strain", struc_zero = TRUE, neg_lb = FALSE,
                  alpha = 0.05, n_cl = 1, verbose = TRUE,
                  global = TRUE, pairwise = TRUE, dunnet = TRUE, trend = FALSE,
                  iter_control = list(tol = 1e-2, max_iter = 20, 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),
                  #                                      matrix(c(-1, 0, 1, -1),
                  #                                             nrow = 2,
                  #                                             byrow = TRUE),
                  #                                      matrix(c(1, 0, 1, -1),
                  #                                             nrow = 2,
                  #                                             byrow = TRUE)),
                  #                      node = list(2, 2, 1),
                  #                      solver = "ECOS",
                  #                      B = 10)
                  )

Attempted fixes

Fix: Uncomment the trend_control parameter

Result: Same error, regardless of whether trend was set to TRUE or FALSE

Fix: Set trend to TRUE but keep trend_control commented out to see if the error is triggered before/after

Result: Error: Please specify the contrast matrices for the trend test. My interpretation is that the error occurs after arguments are read in.

Fix: Setting global, pairwise, and dunnet to FALSE individually and all together

Result: Same error

Session info

─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.3 (2024-02-29)
 os       macOS Ventura 13.6
 system   x86_64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/Los_Angeles
 date     2024-05-07
 rstudio  2023.12.1+402 Ocean Storm (desktop)
 pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────
 ! package                  * version     date (UTC) lib source
   abind                      1.4-5       2016-07-21 [1] CRAN (R 4.3.0)
   ade4                       1.7-22      2023-02-06 [1] CRAN (R 4.3.0)
   ALDEx2                   * 1.34.0      2023-10-24 [1] Bioconductor
   ANCOMBC                  * 2.4.0       2023-10-24 [1] Bioconductor
   annotate                   1.80.0      2023-10-24 [1] Bioconductor
   AnnotationDbi              1.64.1      2023-11-03 [1] Bioconductor
   ape                        5.8         2024-04-11 [1] CRAN (R 4.3.2)
   backports                  1.4.1       2021-12-13 [1] CRAN (R 4.3.0)
   base64enc                  0.1-3       2015-07-28 [1] CRAN (R 4.3.0)
   beachmat                   2.18.1      2024-02-14 [1] Bioconductor 3.18 (R 4.3.2)
   beeswarm                   0.4.0       2021-06-01 [1] CRAN (R 4.3.0)
   Biobase                  * 2.62.0      2023-10-24 [1] Bioconductor
   BiocGenerics             * 0.48.1      2023-11-01 [1] Bioconductor
   BiocManager                1.30.22     2023-08-08 [1] CRAN (R 4.3.0)
   BiocNeighbors              1.20.2      2024-01-07 [1] Bioconductor 3.18 (R 4.3.2)
   BiocParallel               1.36.0      2023-10-24 [1] Bioconductor
   BiocSingular               1.18.0      2023-10-24 [1] Bioconductor
   BiocStyle                * 2.30.0      2023-10-24 [1] Bioconductor
   biomformat                 1.30.0      2023-10-24 [1] Bioconductor
   Biostrings               * 2.70.3      2024-03-13 [1] Bioconductor 3.18 (R 4.3.3)
   bit                        4.0.5       2022-11-15 [1] CRAN (R 4.3.0)
   bit64                      4.0.5       2020-08-30 [1] CRAN (R 4.3.0)
   bitops                     1.0-7       2021-04-24 [1] CRAN (R 4.3.0)
   blob                       1.2.4       2023-03-17 [1] CRAN (R 4.3.0)
   bluster                    1.12.0      2023-10-24 [1] Bioconductor
   boot                       1.3-30      2024-02-26 [1] CRAN (R 4.3.2)
   cachem                     1.0.8       2023-05-01 [1] CRAN (R 4.3.0)
   callr                      3.7.6       2024-03-25 [1] CRAN (R 4.3.2)
   cellranger                 1.1.0       2016-07-27 [1] CRAN (R 4.3.0)
   checkmate                  2.3.1       2023-12-04 [1] CRAN (R 4.3.0)
   class                      7.3-22      2023-05-03 [1] CRAN (R 4.3.3)
   cli                        3.6.2       2023-12-11 [1] CRAN (R 4.3.0)
   cluster                    2.1.6       2023-12-01 [1] CRAN (R 4.3.3)
 V codetools                  0.2-19      2024-03-31 [1] CRAN (R 4.3.2) (on disk 0.2.20)
   colorspace                 2.1-0       2023-01-23 [1] CRAN (R 4.3.0)
   crayon                     1.5.2       2022-09-29 [1] CRAN (R 4.3.0)
   curl                       5.2.1       2024-03-01 [1] CRAN (R 4.3.2)
   CVXR                       1.0-12      2024-02-02 [1] CRAN (R 4.3.2)
   data.table                 1.15.4      2024-03-30 [1] CRAN (R 4.3.2)
   DBI                        1.2.2       2024-02-16 [1] CRAN (R 4.3.2)
   DECIPHER                   2.30.0      2023-10-24 [1] Bioconductor
   decontam                   1.22.0      2023-10-24 [1] Bioconductor
   DelayedArray               0.28.0      2023-10-24 [1] Bioconductor
   DelayedMatrixStats         1.24.0      2023-10-24 [1] Bioconductor
   deldir                     2.0-4       2024-02-28 [1] CRAN (R 4.3.2)
   desc                       1.4.3       2023-12-10 [1] CRAN (R 4.3.0)
   DescTools                  0.99.54     2024-02-03 [1] CRAN (R 4.3.2)
   DESeq2                   * 1.42.1      2024-03-06 [1] Bioconductor 3.18 (R 4.3.3)
   devtools                   2.4.5       2022-10-11 [1] CRAN (R 4.3.0)
   digest                     0.6.35      2024-03-11 [1] CRAN (R 4.3.2)
   directlabels               2024.1.21   2024-01-24 [1] CRAN (R 4.3.2)
   DirichletMultinomial       1.44.0      2023-10-24 [1] Bioconductor
   doParallel                 1.0.17      2022-02-07 [1] CRAN (R 4.3.0)
   doRNG                      1.8.6       2023-01-16 [1] CRAN (R 4.3.0)
   dplyr                    * 1.1.4       2023-11-17 [1] CRAN (R 4.3.0)
 V DT                       * 0.32        2024-04-04 [1] CRAN (R 4.3.2) (on disk 0.33)
   e1071                      1.7-14      2023-12-06 [1] CRAN (R 4.3.0)
   ellipsis                   0.3.2       2021-04-29 [1] CRAN (R 4.3.0)
   energy                     1.7-11      2022-12-22 [1] CRAN (R 4.3.0)
   evaluate                   0.23        2023-11-01 [1] CRAN (R 4.3.0)
   Exact                      3.2         2022-09-25 [1] CRAN (R 4.3.0)
   expm                       0.999-9     2024-01-11 [1] CRAN (R 4.3.0)
   fansi                      1.0.6       2023-12-08 [1] CRAN (R 4.3.0)
   farver                     2.1.1       2022-07-06 [1] CRAN (R 4.3.0)
   fastmap                    1.1.1       2023-02-24 [1] CRAN (R 4.3.0)
   forcats                  * 1.0.0       2023-01-29 [1] CRAN (R 4.3.0)
   foreach                    1.5.2       2022-02-02 [1] CRAN (R 4.3.0)
   foreign                    0.8-86      2023-11-28 [1] CRAN (R 4.3.3)
   Formula                    1.2-5       2023-02-24 [1] CRAN (R 4.3.0)
 V fs                         1.6.3       2024-04-25 [1] CRAN (R 4.3.2) (on disk 1.6.4)
   genefilter               * 1.84.0      2023-10-24 [1] Bioconductor
   generics                   0.1.3       2022-07-05 [1] CRAN (R 4.3.0)
   GenomeInfoDb             * 1.38.8      2024-03-15 [1] Bioconductor 3.18 (R 4.3.3)
   GenomeInfoDbData           1.2.11      2024-03-21 [1] Bioconductor
   GenomicRanges            * 1.54.1      2023-10-29 [1] Bioconductor
   ggbeeswarm                 0.7.2       2023-04-29 [1] CRAN (R 4.3.0)
 V ggplot2                  * 3.5.0       2024-04-23 [1] CRAN (R 4.3.2) (on disk 3.5.1)
   ggrepel                    0.9.5       2024-01-10 [1] CRAN (R 4.3.0)
   gld                        2.6.6       2022-10-23 [1] CRAN (R 4.3.0)
   glue                       1.7.0       2024-01-09 [1] CRAN (R 4.3.0)
   gmp                        0.7-4       2024-01-15 [1] CRAN (R 4.3.0)
   gridExtra                  2.3         2017-09-09 [1] CRAN (R 4.3.0)
   gsl                        2.1-8       2023-01-24 [1] CRAN (R 4.3.0)
 V gtable                     0.3.4       2024-04-22 [1] CRAN (R 4.3.2) (on disk 0.3.5)
   gtools                     3.9.5       2023-11-20 [1] CRAN (R 4.3.0)
   hexbin                     1.28.3      2023-03-21 [1] CRAN (R 4.3.0)
   Hmisc                      5.1-2       2024-03-11 [1] CRAN (R 4.3.2)
   hms                        1.1.3       2023-03-21 [1] CRAN (R 4.3.0)
   htmlTable                  2.4.2       2023-10-29 [1] CRAN (R 4.3.0)
 V htmltools                  0.5.8       2024-04-04 [1] CRAN (R 4.3.2) (on disk 0.5.8.1)
   htmlwidgets                1.6.4       2023-12-06 [1] CRAN (R 4.3.0)
   httpuv                     1.6.15      2024-03-26 [1] CRAN (R 4.3.2)
   httr                       1.4.7       2023-08-15 [1] CRAN (R 4.3.0)
   igraph                     2.0.3       2024-03-13 [1] CRAN (R 4.3.2)
   interp                     1.1-6       2024-01-26 [1] CRAN (R 4.3.2)
   IRanges                  * 2.36.0      2023-10-24 [1] Bioconductor
   irlba                      2.3.5.1     2022-10-03 [1] CRAN (R 4.3.0)
   iterators                  1.0.14      2022-02-05 [1] CRAN (R 4.3.0)
   jpeg                       0.1-10      2022-11-29 [1] CRAN (R 4.3.0)
   jsonlite                   1.8.8       2023-12-04 [1] CRAN (R 4.3.0)
   KEGGREST                   1.42.0      2023-10-24 [1] Bioconductor
   knitr                    * 1.45        2023-10-30 [1] CRAN (R 4.3.0)
   labeling                   0.4.3       2023-08-29 [1] CRAN (R 4.3.0)
   later                      1.3.2       2023-12-06 [1] CRAN (R 4.3.0)
   lattice                  * 0.22-6      2024-03-20 [1] CRAN (R 4.3.2)
   latticeExtra             * 0.6-30      2022-07-04 [1] CRAN (R 4.3.0)
   lazyeval                   0.2.2       2019-03-15 [1] CRAN (R 4.3.0)
   lifecycle                  1.0.4       2023-11-07 [1] CRAN (R 4.3.0)
   lme4                       1.1-35.3    2024-04-16 [1] CRAN (R 4.3.2)
   lmerTest                   3.1-3       2020-10-23 [1] CRAN (R 4.3.0)
   lmom                       3.0         2023-08-29 [1] CRAN (R 4.3.0)
   locfit                     1.5-9.9     2024-03-01 [1] CRAN (R 4.3.2)
   lubridate                * 1.9.3       2023-09-27 [1] CRAN (R 4.3.0)
   magrittr                   2.0.3       2022-03-30 [1] CRAN (R 4.3.0)
   MASS                     * 7.3-60.0.1  2024-01-13 [1] CRAN (R 4.3.3)
   Matrix                     1.6-5       2024-01-11 [1] CRAN (R 4.3.3)
   MatrixGenerics           * 1.14.0      2023-10-24 [1] Bioconductor
 V matrixStats              * 1.2.0       2024-04-11 [1] CRAN (R 4.3.2) (on disk 1.3.0)
   memoise                    2.0.1       2021-11-26 [1] CRAN (R 4.3.0)
   mgcv                       1.9-1       2023-12-21 [1] CRAN (R 4.3.3)
   mia                      * 1.10.0      2023-10-24 [1] Bioconductor
   mime                       0.12        2021-09-28 [1] CRAN (R 4.3.0)
   miniUI                     0.1.1.1     2018-05-18 [1] CRAN (R 4.3.0)
   minqa                      1.2.6       2023-09-11 [1] CRAN (R 4.3.0)
   multcomp                   1.4-25      2023-06-20 [1] CRAN (R 4.3.0)
   MultiAssayExperiment     * 1.28.0      2023-10-24 [1] Bioconductor
   multtest                   2.58.0      2023-10-24 [1] Bioconductor
 V munsell                    0.5.0       2024-04-01 [1] CRAN (R 4.3.2) (on disk 0.5.1)
   mvtnorm                    1.2-4       2023-11-27 [1] CRAN (R 4.3.0)
   NADA                     * 1.6-1.1     2020-03-22 [1] CRAN (R 4.3.0)
   nlme                       3.1-164     2023-11-27 [1] CRAN (R 4.3.3)
   nloptr                     2.0.3       2022-05-26 [1] CRAN (R 4.3.0)
   nnet                       7.3-19      2023-05-03 [1] CRAN (R 4.3.3)
   numDeriv                   2016.8-1.1  2019-06-06 [1] CRAN (R 4.3.0)
   permute                    0.9-7       2022-01-27 [1] CRAN (R 4.3.0)
   pheatmap                 * 1.0.12      2019-01-04 [1] CRAN (R 4.3.0)
   phyloseq                 * 1.46.0      2023-10-24 [1] Bioconductor
   pillar                     1.9.0       2023-03-22 [1] CRAN (R 4.3.0)
   pkgbuild                   1.4.4       2024-03-17 [1] CRAN (R 4.3.2)
   pkgconfig                  2.0.3       2019-09-22 [1] CRAN (R 4.3.0)
   pkgload                    1.3.4       2024-01-16 [1] CRAN (R 4.3.0)
   plyr                       1.8.9       2023-10-02 [1] CRAN (R 4.3.0)
   png                        0.1-8       2022-11-29 [1] CRAN (R 4.3.0)
   processx                   3.8.4       2024-03-16 [1] CRAN (R 4.3.2)
   profvis                    0.3.8       2023-05-02 [1] CRAN (R 4.3.0)
 V promises                   1.2.1       2024-04-05 [1] CRAN (R 4.3.2) (on disk 1.3.0)
   propr                    * 5.0.2       2024-04-30 [1] Github (tpq/propr@81cc62c)
   proxy                      0.4-27      2022-06-09 [1] CRAN (R 4.3.0)
   ps                         1.7.6       2024-01-18 [1] CRAN (R 4.3.0)
   purrr                    * 1.0.2       2023-08-10 [1] CRAN (R 4.3.0)
   quadprog                   1.5-8       2019-11-20 [1] CRAN (R 4.3.0)
   R6                         2.5.1       2021-08-19 [1] CRAN (R 4.3.0)
   rbibutils                  2.2.16      2023-10-25 [1] CRAN (R 4.3.0)
   RColorBrewer             * 1.1-3       2022-04-03 [1] CRAN (R 4.3.0)
   Rcpp                       1.0.12      2024-01-09 [1] CRAN (R 4.3.0)
   RcppParallel               5.1.7       2023-02-27 [1] CRAN (R 4.3.0)
   RcppZiggurat               0.1.6       2020-10-20 [1] CRAN (R 4.3.0)
   RCurl                      1.98-1.14   2024-01-09 [1] CRAN (R 4.3.0)
   Rdpack                     2.6         2023-11-08 [1] CRAN (R 4.3.0)
   readr                    * 2.1.5       2024-01-10 [1] CRAN (R 4.3.0)
   readxl                     1.4.3       2023-07-06 [1] CRAN (R 4.3.0)
   remotes                    2.5.0       2024-03-17 [1] CRAN (R 4.3.2)
   reshape2                   1.4.4       2020-04-09 [1] CRAN (R 4.3.0)
   Rfast                      2.1.0       2023-11-09 [1] CRAN (R 4.3.0)
   rhdf5                      2.46.1      2023-11-29 [1] Bioconductor
   rhdf5filters               1.14.1      2023-11-06 [1] Bioconductor
   Rhdf5lib                   1.24.2      2024-02-07 [1] Bioconductor 3.18 (R 4.3.2)
   rlang                      1.1.3       2024-01-10 [1] CRAN (R 4.3.0)
   rmarkdown                * 2.26        2024-03-05 [1] CRAN (R 4.3.2)
   Rmpfr                      0.9-5       2024-01-21 [1] CRAN (R 4.3.0)
   rngtools                   1.5.2       2021-09-20 [1] CRAN (R 4.3.0)
   rootSolve                  1.8.2.4     2023-09-21 [1] CRAN (R 4.3.0)
   rpart                      4.1.23      2023-12-05 [1] CRAN (R 4.3.3)
 V RSQLite                    2.3.5       2024-03-31 [1] CRAN (R 4.3.2) (on disk 2.3.6)
   rstudioapi                 0.16.0      2024-03-24 [1] CRAN (R 4.3.2)
   rsvd                       1.0.5       2021-04-16 [1] CRAN (R 4.3.0)
   S4Arrays                   1.2.1       2024-03-06 [1] Bioconductor 3.18 (R 4.3.3)
   S4Vectors                * 0.40.2      2023-11-23 [1] Bioconductor
   sandwich                   3.1-0       2023-12-11 [1] CRAN (R 4.3.0)
   ScaledMatrix               1.10.0      2023-10-24 [1] Bioconductor
   scales                     1.3.0       2023-11-28 [1] CRAN (R 4.3.0)
   scater                     1.30.1      2023-12-06 [1] Bioconductor
   scuttle                    1.12.0      2023-10-24 [1] Bioconductor
   sessioninfo                1.2.2       2021-12-06 [1] CRAN (R 4.3.0)
 V shiny                      1.8.1       2024-04-02 [1] CRAN (R 4.3.2) (on disk 1.8.1.1)
   SingleCellExperiment     * 1.24.0      2023-10-24 [1] Bioconductor
   SparseArray                1.2.4       2024-02-11 [1] Bioconductor 3.18 (R 4.3.2)
   sparseMatrixStats          1.14.0      2023-10-24 [1] Bioconductor
   stringi                    1.8.3       2023-12-11 [1] CRAN (R 4.3.0)
   stringr                  * 1.5.1       2023-11-14 [1] CRAN (R 4.3.0)
   SummarizedExperiment     * 1.32.0      2023-10-24 [1] Bioconductor
 V survival                 * 3.5-8       2024-04-24 [1] CRAN (R 4.3.2) (on disk 3.6.4)
   TH.data                    1.1-2       2023-04-17 [1] CRAN (R 4.3.0)
   tibble                   * 3.2.1       2023-03-20 [1] CRAN (R 4.3.0)
   tidyr                    * 1.3.1       2024-01-24 [1] CRAN (R 4.3.2)
   tidyselect                 1.2.1       2024-03-11 [1] CRAN (R 4.3.2)
   tidytree                   0.4.6       2023-12-12 [1] CRAN (R 4.3.0)
   tidyverse                * 2.0.0       2023-02-22 [1] CRAN (R 4.3.0)
   timechange                 0.3.0       2024-01-18 [1] CRAN (R 4.3.0)
   treeio                     1.26.0      2023-10-24 [1] Bioconductor
   TreeSummarizedExperiment * 2.10.0      2023-10-24 [1] Bioconductor
   truncnorm                * 1.0-9       2023-03-20 [1] CRAN (R 4.3.0)
   tzdb                       0.4.0       2023-05-12 [1] CRAN (R 4.3.0)
   urlchecker                 1.0.1       2021-11-30 [1] CRAN (R 4.3.0)
   usethis                    2.2.3       2024-02-19 [1] CRAN (R 4.3.2)
   utf8                       1.2.4       2023-10-22 [1] CRAN (R 4.3.0)
   vctrs                      0.6.5       2023-12-01 [1] CRAN (R 4.3.0)
   vegan                      2.6-4       2022-10-11 [1] CRAN (R 4.3.0)
   vipor                      0.4.7       2023-12-18 [1] CRAN (R 4.3.0)
   viridis                    0.6.5       2024-01-29 [1] CRAN (R 4.3.2)
   viridisLite                0.4.2       2023-05-02 [1] CRAN (R 4.3.0)
   vroom                      1.6.5       2023-12-05 [1] CRAN (R 4.3.0)
   withr                      3.0.0       2024-01-16 [1] CRAN (R 4.3.0)
   xfun                       0.43        2024-03-25 [1] CRAN (R 4.3.2)
   XML                        3.99-0.16.1 2024-01-22 [1] CRAN (R 4.3.2)
   xtable                     1.8-4       2019-04-21 [1] CRAN (R 4.3.0)
   XVector                  * 0.42.0      2023-10-24 [1] Bioconductor
   yaml                       2.3.8       2023-12-11 [1] CRAN (R 4.3.0)
   yulab.utils                0.1.4       2024-01-28 [1] CRAN (R 4.3.2)
   zCompositions            * 1.5.0-3     2024-03-13 [1] CRAN (R 4.3.2)
   zlibbioc                   1.48.2      2024-03-13 [1] Bioconductor 3.18 (R 4.3.3)
   zoo                        1.8-12      2023-04-13 [1] CRAN (R 4.3.0)

 [1] /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library

 V ── Loaded and on-disk version mismatch.