mcalgaro93 / benchdamic

Benchmark of differential abundance methods on microbiome data
6 stars 1 forks source link

Update DA_ALDEx2 function #1

Closed sdgamboa closed 2 years ago

sdgamboa commented 2 years ago

Hello, @mcalgaro93. I'd like to report what I think is a bug in the DA_ALDEx2 function. The "wilcox" option of the test argument throws an error. Other options, which would be valid in the original ALDEx2::aldex function, throw an error as well. Please see the reprex below.

After checking the code of the function, I assumed that the DA_ALDEx2 function only supports Welch's t and Wilcoxon tests. With that in mind, I wrote a couple of simple fixes and updated the documentation.

I hope this information is helpful and thank you for considering these fixes.

suppressMessages({
    library(benchdamic)
})

data("ps_plaque_16S")
ps <- ps_plaque_16S
ps <- norm_edgeR(ps, 'none')
#> NF.none column has been added.

## t test works
output_t <- DA_ALDEx2(
    ps, conditions = "HMP_BODY_SUBSITE", test = 't', norm = 'none',
    verbose = FALSE
)

## 'wilcox' doesn't work
output_wilcox <- DA_ALDEx2(
    ps, conditions = "HMP_BODY_SUBSITE", test = 'wilcox', norm = 'none',
    verbose = FALSE
)
#> Error in ALDEx2::aldex(reads = norm_counts, conditions = conditions, mc.samples = mc.samples, : argument 'test' not recognized

## Other valid inputs for ALDEx2 don't work either
output_kw <- DA_ALDEx2(
    ps, conditions = "HMP_BODY_SUBSITE", test = 'kw', norm = 'none',
    verbose = FALSE
)
#> Error in DA_ALDEx2(ps, conditions = "HMP_BODY_SUBSITE", test = "kw", norm = "none", : Please choose between p-values produced by Welch t-test (t) or by the Wilcoxon test (wilcox).

devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R Under development (unstable) (2022-02-28 r81833)
#>  os       Pop!_OS 21.10
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       America/New_York
#>  date     2022-03-20
#>  pandoc   2.17.1.1 @ /usr/lib/rstudio/bin/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package              * version  date (UTC) lib source
#>  abind                  1.4-5    2016-07-21 [1] CRAN (R 4.2.0)
#>  ade4                   1.7-18   2021-09-16 [1] CRAN (R 4.2.0)
#>  affy                   1.73.0   2021-10-26 [1] Bioconductor
#>  affyio                 1.65.0   2021-10-26 [1] Bioconductor
#>  ALDEx2                 1.27.0   2021-10-27 [1] Bioconductor
#>  annotate               1.73.0   2021-10-26 [1] Bioconductor
#>  AnnotationDbi          1.57.1   2021-10-29 [1] Bioconductor
#>  ape                    5.6-2    2022-03-02 [1] CRAN (R 4.2.0)
#>  askpass                1.1      2019-01-13 [1] CRAN (R 4.2.0)
#>  assertthat             0.2.1    2019-03-21 [1] CRAN (R 4.2.0)
#>  base64                 2.0      2016-05-10 [1] CRAN (R 4.2.0)
#>  beanplot               1.2      2014-09-19 [1] CRAN (R 4.2.0)
#>  benchdamic           * 1.1.0    2021-10-27 [1] Bioconductor
#>  Biobase                2.55.0   2021-10-26 [1] Bioconductor
#>  BiocFileCache          2.3.4    2022-01-20 [1] Bioconductor
#>  BiocGenerics           0.41.2   2021-11-15 [1] Bioconductor
#>  BiocIO                 1.5.0    2021-10-26 [1] Bioconductor
#>  BiocManager            1.30.16  2021-06-15 [1] CRAN (R 4.2.0)
#>  BiocParallel           1.29.17  2022-03-13 [1] Bioconductor
#>  biomaRt                2.51.3   2022-02-02 [1] Bioconductor
#>  biomformat             1.23.0   2021-10-26 [1] Bioconductor
#>  Biostrings             2.63.2   2022-03-15 [1] Bioconductor
#>  bit                    4.0.4    2020-08-04 [1] CRAN (R 4.2.0)
#>  bit64                  4.0.5    2020-08-30 [1] CRAN (R 4.2.0)
#>  bitops                 1.0-7    2021-04-24 [1] CRAN (R 4.2.0)
#>  blob                   1.2.2    2021-07-23 [1] CRAN (R 4.2.0)
#>  brio                   1.1.3    2021-11-30 [1] CRAN (R 4.2.0)
#>  bumphunter             1.37.1   2021-11-21 [1] Bioconductor
#>  cachem                 1.0.6    2021-08-19 [1] CRAN (R 4.2.0)
#>  callr                  3.7.0    2021-04-20 [1] CRAN (R 4.2.0)
#>  caTools                1.18.2   2021-03-28 [1] CRAN (R 4.2.0)
#>  cli                    3.2.0    2022-02-14 [1] CRAN (R 4.2.0)
#>  cluster                2.1.2    2021-04-17 [2] CRAN (R 4.2.0)
#>  codetools              0.2-18   2020-11-04 [2] CRAN (R 4.2.0)
#>  colorspace             2.0-3    2022-02-21 [1] CRAN (R 4.2.0)
#>  corncob                0.2.0    2021-03-11 [1] CRAN (R 4.2.0)
#>  cowplot                1.1.1    2020-12-30 [1] CRAN (R 4.2.0)
#>  crayon                 1.5.0    2022-02-14 [1] CRAN (R 4.2.0)
#>  curl                   4.3.2    2021-06-23 [1] CRAN (R 4.2.0)
#>  data.table             1.14.2   2021-09-27 [1] CRAN (R 4.2.0)
#>  DBI                    1.1.2    2021-12-20 [1] CRAN (R 4.2.0)
#>  dbplyr                 2.1.1    2021-04-06 [1] CRAN (R 4.2.0)
#>  DelayedArray           0.21.2   2021-11-16 [1] Bioconductor
#>  DelayedMatrixStats     1.17.0   2021-10-26 [1] Bioconductor
#>  deldir                 1.0-6    2021-10-23 [1] CRAN (R 4.2.0)
#>  desc                   1.4.1    2022-03-06 [1] CRAN (R 4.2.0)
#>  DESeq2                 1.35.0   2021-10-27 [1] Bioconductor
#>  devtools               2.4.3    2021-11-30 [1] CRAN (R 4.2.0)
#>  digest                 0.6.29   2021-12-01 [1] CRAN (R 4.2.0)
#>  doRNG                  1.8.2    2020-01-27 [1] CRAN (R 4.2.0)
#>  dplyr                  1.0.8    2022-02-08 [1] CRAN (R 4.2.0)
#>  edgeR                  3.37.1   2022-03-16 [1] Bioconductor
#>  ellipsis               0.3.2    2021-04-29 [1] CRAN (R 4.2.0)
#>  evaluate               0.15     2022-02-18 [1] CRAN (R 4.2.0)
#>  fansi                  1.0.2    2022-01-14 [1] CRAN (R 4.2.0)
#>  fastmap                1.1.0    2021-01-25 [1] CRAN (R 4.2.0)
#>  ffpe                   1.39.0   2021-10-27 [1] Bioconductor
#>  filelock               1.0.2    2018-10-05 [1] CRAN (R 4.2.0)
#>  fitdistrplus           1.1-8    2022-03-10 [1] CRAN (R 4.2.0)
#>  foreach                1.5.2    2022-02-02 [1] CRAN (R 4.2.0)
#>  fs                     1.5.2    2021-12-08 [1] CRAN (R 4.2.0)
#>  future                 1.24.0   2022-02-19 [1] CRAN (R 4.2.0)
#>  future.apply           1.8.1    2021-08-10 [1] CRAN (R 4.2.0)
#>  genefilter             1.77.1   2022-03-15 [1] Bioconductor
#>  geneplotter            1.73.0   2021-10-26 [1] Bioconductor
#>  generics               0.1.2    2022-01-31 [1] CRAN (R 4.2.0)
#>  GenomeInfoDb           1.31.6   2022-03-16 [1] Bioconductor
#>  GenomeInfoDbData       1.2.7    2022-03-01 [1] Bioconductor
#>  GenomicAlignments      1.31.2   2021-11-05 [1] Bioconductor
#>  GenomicFeatures        1.47.12  2022-02-25 [1] Bioconductor
#>  GenomicRanges          1.47.6   2022-01-12 [1] Bioconductor
#>  GEOquery               2.63.3   2022-01-13 [1] Bioconductor
#>  ggdendro               0.1.23   2022-02-16 [1] CRAN (R 4.2.0)
#>  ggplot2                3.3.5    2021-06-25 [1] CRAN (R 4.2.0)
#>  ggrepel                0.9.1    2021-01-15 [1] CRAN (R 4.2.0)
#>  ggridges               0.5.3    2021-01-08 [1] CRAN (R 4.2.0)
#>  glmnet                 4.1-3    2021-11-02 [1] CRAN (R 4.2.0)
#>  globals                0.14.0   2020-11-22 [1] CRAN (R 4.2.0)
#>  glue                   1.6.2    2022-02-24 [1] CRAN (R 4.2.0)
#>  goftest                1.2-3    2021-10-07 [1] CRAN (R 4.2.0)
#>  gplots                 3.1.1    2020-11-28 [1] CRAN (R 4.2.0)
#>  gridExtra              2.3      2017-09-09 [1] CRAN (R 4.2.0)
#>  gtable                 0.3.0    2019-03-25 [1] CRAN (R 4.2.0)
#>  gtools                 3.9.2    2021-06-06 [1] CRAN (R 4.2.0)
#>  HDF5Array              1.23.2   2021-11-15 [1] Bioconductor
#>  highr                  0.9      2021-04-16 [1] CRAN (R 4.2.0)
#>  hms                    1.1.1    2021-09-26 [1] CRAN (R 4.2.0)
#>  htmltools              0.5.2    2021-08-25 [1] CRAN (R 4.2.0)
#>  htmlwidgets            1.5.4    2021-09-08 [1] CRAN (R 4.2.0)
#>  httpuv                 1.6.5    2022-01-05 [1] CRAN (R 4.2.0)
#>  httr                   1.4.2    2020-07-20 [1] CRAN (R 4.2.0)
#>  ica                    1.0-2    2018-05-24 [1] CRAN (R 4.2.0)
#>  igraph                 1.2.11   2022-01-04 [1] CRAN (R 4.2.0)
#>  illuminaio             0.37.0   2021-10-26 [1] Bioconductor
#>  IRanges                2.29.1   2021-11-16 [1] Bioconductor
#>  irlba                  2.3.5    2021-12-06 [1] CRAN (R 4.2.0)
#>  iterators              1.0.14   2022-02-05 [1] CRAN (R 4.2.0)
#>  jsonlite               1.8.0    2022-02-22 [1] CRAN (R 4.2.0)
#>  KEGGREST               1.35.0   2021-10-26 [1] Bioconductor
#>  KernSmooth             2.23-20  2021-05-03 [2] CRAN (R 4.2.0)
#>  knitr                  1.37     2021-12-16 [1] CRAN (R 4.2.0)
#>  later                  1.3.0    2021-08-18 [1] CRAN (R 4.2.0)
#>  lattice                0.20-45  2021-09-22 [2] CRAN (R 4.2.0)
#>  lazyeval               0.2.2    2019-03-15 [1] CRAN (R 4.2.0)
#>  leiden                 0.3.9    2021-07-27 [1] CRAN (R 4.2.0)
#>  lifecycle              1.0.1    2021-09-24 [1] CRAN (R 4.2.0)
#>  limma                  3.51.5   2022-02-17 [1] Bioconductor
#>  listenv                0.8.0    2019-12-05 [1] CRAN (R 4.2.0)
#>  lmtest                 0.9-39   2021-11-07 [1] CRAN (R 4.2.0)
#>  locfit                 1.5-9.5  2022-03-03 [1] CRAN (R 4.2.0)
#>  lumi                   2.47.0   2021-10-27 [1] Bioconductor
#>  magrittr               2.0.2    2022-01-26 [1] CRAN (R 4.2.0)
#>  MASS                   7.3-55   2022-01-16 [2] CRAN (R 4.2.0)
#>  MAST                   1.21.3   2021-12-17 [1] Bioconductor
#>  Matrix                 1.4-0    2021-12-08 [2] CRAN (R 4.2.0)
#>  MatrixGenerics         1.7.0    2021-10-26 [1] Bioconductor
#>  matrixStats            0.61.0   2021-09-17 [1] CRAN (R 4.2.0)
#>  mclust                 5.4.9    2021-12-17 [1] CRAN (R 4.2.0)
#>  memoise                2.0.1    2021-11-26 [1] CRAN (R 4.2.0)
#>  metagenomeSeq          1.37.0   2021-10-26 [1] Bioconductor
#>  methylumi              2.41.1   2021-10-27 [1] Bioconductor
#>  mgcv                   1.8-39   2022-02-24 [2] CRAN (R 4.2.0)
#>  MGLM                   0.2.0    2018-10-19 [1] CRAN (R 4.2.0)
#>  mime                   0.12     2021-09-28 [1] CRAN (R 4.2.0)
#>  minfi                  1.41.1   2021-11-02 [1] Bioconductor
#>  miniUI                 0.1.1.1  2018-05-18 [1] CRAN (R 4.2.0)
#>  multtest               2.51.0   2021-10-26 [1] Bioconductor
#>  munsell                0.5.0    2018-06-12 [1] CRAN (R 4.2.0)
#>  NADA                   1.6-1.1  2020-03-22 [1] CRAN (R 4.2.0)
#>  nleqslv                3.3.2    2018-05-17 [1] CRAN (R 4.2.0)
#>  nlme                   3.1-155  2022-01-16 [2] CRAN (R 4.2.0)
#>  nor1mix                1.3-0    2019-06-13 [1] CRAN (R 4.2.0)
#>  openssl                2.0.0    2022-03-02 [1] CRAN (R 4.2.0)
#>  parallelly             1.30.0   2021-12-17 [1] CRAN (R 4.2.0)
#>  patchwork              1.1.1    2020-12-17 [1] CRAN (R 4.2.0)
#>  pbapply                1.5-0    2021-09-16 [1] CRAN (R 4.2.0)
#>  permute                0.9-7    2022-01-27 [1] CRAN (R 4.2.0)
#>  phyloseq               1.39.1   2021-11-29 [1] Bioconductor
#>  pillar                 1.7.0    2022-02-01 [1] CRAN (R 4.2.0)
#>  pkgbuild               1.3.1    2021-12-20 [1] CRAN (R 4.2.0)
#>  pkgconfig              2.0.3    2019-09-22 [1] CRAN (R 4.2.0)
#>  pkgload                1.2.4    2021-11-30 [1] CRAN (R 4.2.0)
#>  plotly                 4.10.0   2021-10-09 [1] CRAN (R 4.2.0)
#>  plyr                   1.8.6    2020-03-03 [1] CRAN (R 4.2.0)
#>  png                    0.1-7    2013-12-03 [1] CRAN (R 4.2.0)
#>  polyclip               1.10-0   2019-03-14 [1] CRAN (R 4.2.0)
#>  preprocessCore         1.57.0   2021-10-26 [1] Bioconductor
#>  prettyunits            1.1.1    2020-01-24 [1] CRAN (R 4.2.0)
#>  processx               3.5.2    2021-04-30 [1] CRAN (R 4.2.0)
#>  progress               1.2.2    2019-05-16 [1] CRAN (R 4.2.0)
#>  promises               1.2.0.1  2021-02-11 [1] CRAN (R 4.2.0)
#>  ps                     1.6.0    2021-02-28 [1] CRAN (R 4.2.0)
#>  purrr                  0.3.4    2020-04-17 [1] CRAN (R 4.2.0)
#>  quadprog               1.5-8    2019-11-20 [1] CRAN (R 4.2.0)
#>  R6                     2.5.1    2021-08-19 [1] CRAN (R 4.2.0)
#>  RANN                   2.6.1    2019-01-08 [1] CRAN (R 4.2.0)
#>  rappdirs               0.3.3    2021-01-31 [1] CRAN (R 4.2.0)
#>  RColorBrewer           1.1-2    2014-12-07 [1] CRAN (R 4.2.0)
#>  Rcpp                   1.0.8.3  2022-03-17 [1] CRAN (R 4.2.0)
#>  RcppAnnoy              0.0.19   2021-07-30 [1] CRAN (R 4.2.0)
#>  RcppZiggurat           0.1.6    2020-10-20 [1] CRAN (R 4.2.0)
#>  RCurl                  1.98-1.6 2022-02-08 [1] CRAN (R 4.2.0)
#>  readr                  2.1.2    2022-01-30 [1] CRAN (R 4.2.0)
#>  remotes                2.4.2    2021-11-30 [1] CRAN (R 4.2.0)
#>  reprex                 2.0.1    2021-08-05 [1] CRAN (R 4.2.0)
#>  reshape                0.8.8    2018-10-23 [1] CRAN (R 4.2.0)
#>  reshape2               1.4.4    2020-04-09 [1] CRAN (R 4.2.0)
#>  restfulr               0.0.13   2017-08-06 [1] CRAN (R 4.2.0)
#>  reticulate             1.24     2022-01-26 [1] CRAN (R 4.2.0)
#>  Rfast                  2.0.6    2022-02-16 [1] CRAN (R 4.2.0)
#>  rhdf5                  2.39.6   2022-03-09 [1] Bioconductor
#>  rhdf5filters           1.7.0    2021-10-26 [1] Bioconductor
#>  Rhdf5lib               1.17.3   2022-01-31 [1] Bioconductor
#>  rjson                  0.2.21   2022-01-09 [1] CRAN (R 4.2.0)
#>  rlang                  1.0.2    2022-03-04 [1] CRAN (R 4.2.0)
#>  rmarkdown              2.13     2022-03-10 [1] CRAN (R 4.2.0)
#>  rngtools               1.5.2    2021-09-20 [1] CRAN (R 4.2.0)
#>  ROCR                   1.0-11   2020-05-02 [1] CRAN (R 4.2.0)
#>  rpart                  4.1.16   2022-01-24 [2] CRAN (R 4.2.0)
#>  rprojroot              2.0.2    2020-11-15 [1] CRAN (R 4.2.0)
#>  Rsamtools              2.11.0   2021-10-27 [1] Bioconductor
#>  RSQLite                2.2.10   2022-02-17 [1] CRAN (R 4.2.0)
#>  rstudioapi             0.13     2020-11-12 [1] CRAN (R 4.2.0)
#>  rtracklayer            1.55.3   2021-12-08 [1] Bioconductor
#>  Rtsne                  0.15     2018-11-10 [1] CRAN (R 4.2.0)
#>  S4Vectors              0.33.11  2022-03-14 [1] Bioconductor
#>  scales                 1.1.1    2020-05-11 [1] CRAN (R 4.2.0)
#>  scattermore            0.8      2022-02-14 [1] CRAN (R 4.2.0)
#>  scrime                 1.3.5    2018-12-01 [1] CRAN (R 4.2.0)
#>  sctransform            0.3.3    2022-01-13 [1] CRAN (R 4.2.0)
#>  sessioninfo            1.2.2    2021-12-06 [1] CRAN (R 4.2.0)
#>  Seurat                 4.1.0    2022-01-14 [1] CRAN (R 4.2.0)
#>  SeuratObject           4.0.4    2021-11-23 [1] CRAN (R 4.2.0)
#>  sfsmisc                1.1-12   2021-09-14 [1] CRAN (R 4.2.0)
#>  shape                  1.4.6    2021-05-19 [1] CRAN (R 4.2.0)
#>  shiny                  1.7.1    2021-10-02 [1] CRAN (R 4.2.0)
#>  siggenes               1.69.0   2021-10-26 [1] Bioconductor
#>  SingleCellExperiment   1.17.2   2021-11-18 [1] Bioconductor
#>  softImpute             1.4-1    2021-05-09 [1] CRAN (R 4.2.0)
#>  sparseMatrixStats      1.7.0    2021-10-26 [1] Bioconductor
#>  spatstat.core          2.4-0    2022-02-15 [1] CRAN (R 4.2.0)
#>  spatstat.data          2.1-2    2021-12-17 [1] CRAN (R 4.2.0)
#>  spatstat.geom          2.3-2    2022-02-12 [1] CRAN (R 4.2.0)
#>  spatstat.random        2.1-0    2022-02-12 [1] CRAN (R 4.2.0)
#>  spatstat.sparse        2.1-0    2021-12-17 [1] CRAN (R 4.2.0)
#>  spatstat.utils         2.3-0    2021-12-12 [1] CRAN (R 4.2.0)
#>  stringi                1.7.6    2021-11-29 [1] CRAN (R 4.2.0)
#>  stringr                1.4.0    2019-02-10 [1] CRAN (R 4.2.0)
#>  SummarizedExperiment   1.25.3   2021-12-08 [1] Bioconductor
#>  survival               3.3-1    2022-03-03 [2] CRAN (R 4.2.0)
#>  tensor                 1.5      2012-05-05 [1] CRAN (R 4.2.0)
#>  testthat               3.1.2    2022-01-20 [1] CRAN (R 4.2.0)
#>  tibble                 3.1.6    2021-11-07 [1] CRAN (R 4.2.0)
#>  tidyr                  1.2.0    2022-02-01 [1] CRAN (R 4.2.0)
#>  tidyselect             1.1.2    2022-02-21 [1] CRAN (R 4.2.0)
#>  truncnorm              1.0-8    2018-02-27 [1] CRAN (R 4.2.0)
#>  TTR                    0.24.3   2021-12-12 [1] CRAN (R 4.2.0)
#>  tzdb                   0.2.0    2021-10-27 [1] CRAN (R 4.2.0)
#>  usethis                2.1.5    2021-12-09 [1] CRAN (R 4.2.0)
#>  utf8                   1.2.2    2021-07-24 [1] CRAN (R 4.2.0)
#>  uwot                   0.1.11   2021-12-02 [1] CRAN (R 4.2.0)
#>  vctrs                  0.3.8    2021-04-29 [1] CRAN (R 4.2.0)
#>  vegan                  2.5-7    2020-11-28 [1] CRAN (R 4.2.0)
#>  viridisLite            0.4.0    2021-04-13 [1] CRAN (R 4.2.0)
#>  withr                  2.5.0    2022-03-03 [1] CRAN (R 4.2.0)
#>  Wrench                 1.13.0   2021-10-26 [1] Bioconductor
#>  xfun                   0.30     2022-03-02 [1] CRAN (R 4.2.0)
#>  XML                    3.99-0.9 2022-02-24 [1] CRAN (R 4.2.0)
#>  xml2                   1.3.3    2021-11-30 [1] CRAN (R 4.2.0)
#>  xtable                 1.8-4    2019-04-21 [1] CRAN (R 4.2.0)
#>  xts                    0.12.1   2020-09-09 [1] CRAN (R 4.2.0)
#>  XVector                0.35.0   2021-10-26 [1] Bioconductor
#>  yaml                   2.3.5    2022-02-21 [1] CRAN (R 4.2.0)
#>  zCompositions          1.4.0    2022-01-13 [1] CRAN (R 4.2.0)
#>  zinbwave               1.17.0   2021-10-27 [1] Bioconductor
#>  zlibbioc               1.41.0   2021-10-26 [1] Bioconductor
#>  zoo                    1.8-9    2021-03-09 [1] CRAN (R 4.2.0)
#> 
#>  [1] /home/samuel/R/x86_64-pc-linux-gnu-library/4.2
#>  [2] /home/samuel/Apps/R-devel/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Created on 2022-03-20 by the reprex package (v2.0.1)

mcalgaro93 commented 2 years ago

Hello @sdgamboa. Yes, for now the function DA_ALDEx2 supports only t and wilcox tests. I forgot to mention it in the manual. Thank you for finding and fixing that bug.