microsud / dysbiosisR

The dysbiosisR package implements tools for calculating some common microbiome dysbiosis measures
https://microsud.github.io/dysbiosisR/
GNU General Public License v3.0
12 stars 0 forks source link

dysbiosisOBB error #5

Open lxsteiner opened 3 months ago

lxsteiner commented 3 months ago

Hi,

Thank you for providing a nice summary of dysbiosis indexes in one package!

I was trying it out on the test data and then mine as well, unfortunately dysbiosisOBB gives me an error. I was able to calculate all other indexes with me own data.

> dysbiosis.oob <- dysbiosisOBB(fix.rarephi,
+                               group_col = "PhageCode",
+                               case_label = "PHI",
+                               seed_value = 1235,
+                               add_tuneRF_params = list(ntreeTry=100,
+                                                        stepFactor=1.5,
+                                                        improve=0.01,
+                                                        trace=TRUE,
+                                                        dobest=FALSE),
+                               ntree = 100,
+                               plot_roc = TRUE)
The random seed of your session for reproducibility is: 1235
mtry = 61  OOB error = 20% 
Searching left ...
mtry = 41   OOB error = 20% 
0 0.01 
Searching right ...
mtry = 91   OOB error = 20% 
0 0.01 
The mtry used is : 416191
Error in mtry < 1 || mtry > p : 'length = 3' in coercion to 'logical(1)'

Could you please tell if the error says anything to you? I'm not sure where the issue could be, I used a phyloseq object with absolute counts in all other calculations. Transformed it here to relative abundance summed to 1 or 100, made no difference (since in the tutorial you mention multiple times that the test data is relative abundance, summed to 100, so I wasn't sure if that was important).

The error seems rather to be coming from the logical evalution of "||" inside an if() statement (according to Google), so I guess it has to do with https://github.com/microsud/dysbiosisR/blob/292adc8d2f078230c155b2ce0b47d2c6c55f5d12/R/dysbiosisOBB.R#L86 though not really sure πŸ˜…

Session Info ``` > sessioninfo::session_info() ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.3.3 (2024-02-29 ucrt) os Windows 10 x64 (build 19045) system x86_64, mingw32 ui RStudio language en collate German_Germany.utf8 ctype German_Germany.utf8 tz Europe/Budapest date 2024-07-03 rstudio 2024.04.1+748 Chocolate Cosmos (desktop) pandoc 3.1.11 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ! package * version date (UTC) lib source ade4 1.7-22 2023-02-06 [1] RSPM (R 4.3.0) ape 5.8 2024-04-11 [1] RSPM (R 4.3.0) backports 1.5.0 2024-05-23 [1] RSPM (R 4.3.0) P base64enc 0.1-3 2015-07-28 [?] RSPM (R 4.3.0) Biobase 2.62.0 2023-10-24 [1] Bioconductor BiocGenerics 0.48.1 2023-11-01 [1] Bioconductor P BiocManager * 1.30.23 2024-05-04 [?] RSPM biomformat 1.30.0 2023-10-24 [1] Bioconductor Biostrings 2.70.3 2024-03-13 [1] Bioconductor 3.18 (R 4.3.3) bitops 1.0-7 2021-04-24 [1] RSPM (R 4.3.0) P cachem 1.1.0 2024-05-16 [?] RSPM P callr 3.7.6 2024-03-25 [?] RSPM checkmate 2.3.1 2023-12-04 [1] RSPM (R 4.3.0) P cli 3.6.3 2024-06-21 [?] RSPM P cluster 2.1.6 2023-12-01 [?] CRAN (R 4.3.3) P codetools 0.2-19 2023-02-01 [?] CRAN (R 4.3.3) colorspace 2.1-0 2023-01-23 [1] RSPM (R 4.3.0) P crayon 1.5.3 2024-06-20 [?] RSPM P curl 5.2.1 2024-03-01 [?] RSPM (R 4.3.0) data.table 1.15.4 2024-03-30 [1] RSPM (R 4.3.0) P desc 1.4.3 2023-12-10 [?] RSPM (R 4.3.0) P devtools 2.4.5 2022-10-11 [?] RSPM (R 4.3.0) P digest 0.6.36 2024-06-23 [?] RSPM distributional 0.4.0 2024-02-07 [1] RSPM (R 4.3.0) dplyr * 1.1.4 2023-11-17 [1] RSPM (R 4.3.0) DT 0.33 2024-04-04 [1] RSPM (R 4.3.0) dysbiosisR * 1.0.4 2024-07-02 [1] Github (microsud/dysbiosisR@292adc8) P ellipsis 0.3.2 2021-04-29 [?] RSPM (R 4.3.0) P evaluate 0.24.0 2024-06-10 [?] RSPM P fansi 1.0.6 2023-12-08 [?] RSPM (R 4.3.0) farver 2.1.2 2024-05-13 [1] RSPM (R 4.3.0) P fastmap 1.2.0 2024-05-15 [?] RSPM foreach 1.5.2 2022-02-02 [1] RSPM (R 4.3.0) P foreign 0.8-86 2023-11-28 [?] CRAN (R 4.3.3) Formula 1.2-5 2023-02-24 [1] RSPM (R 4.3.0) P fs 1.6.4 2024-04-25 [?] RSPM generics 0.1.3 2022-07-05 [1] RSPM (R 4.3.0) GenomeInfoDb 1.38.8 2024-03-15 [1] Bioconductor 3.18 (R 4.3.3) GenomeInfoDbData 1.2.11 2024-07-02 [1] Bioconductor ggdist 3.3.2 2024-03-05 [1] RSPM (R 4.3.0) ggplot2 * 3.5.1 2024-04-23 [1] RSPM (R 4.3.0) P glue 1.7.0 2024-01-09 [?] RSPM (R 4.3.0) gridExtra 2.3 2017-09-09 [1] RSPM (R 4.3.0) gtable 0.3.5 2024-04-22 [1] RSPM (R 4.3.0) Hmisc 5.1-3 2024-05-28 [1] RSPM (R 4.3.0) htmlTable 2.4.2 2023-10-29 [1] RSPM (R 4.3.0) P htmltools 0.5.8.1 2024-04-04 [?] RSPM (R 4.3.0) P htmlwidgets 1.6.4 2023-12-06 [?] RSPM (R 4.3.0) P httpuv 1.6.15 2024-03-26 [?] RSPM igraph 2.0.3 2024-03-13 [1] RSPM (R 4.3.0) IRanges 2.36.0 2023-10-24 [1] Bioconductor iterators 1.0.14 2022-02-05 [1] RSPM (R 4.3.0) P jsonlite 1.8.8 2023-12-04 [?] RSPM (R 4.3.0) P knitr 1.47 2024-05-29 [?] RSPM labeling 0.4.3 2023-08-29 [1] RSPM (R 4.3.0) P later 1.3.2 2023-12-06 [?] RSPM (R 4.3.0) P lattice 0.22-5 2023-10-24 [?] CRAN (R 4.3.3) P lifecycle 1.0.4 2023-11-07 [?] RSPM (R 4.3.0) P magrittr 2.0.3 2022-03-30 [?] RSPM (R 4.3.0) P MASS 7.3-60.0.1 2024-01-13 [?] CRAN (R 4.3.3) P Matrix 1.6-5 2024-01-11 [?] CRAN (R 4.3.3) P memoise 2.0.1 2021-11-26 [?] RSPM (R 4.3.0) P mgcv 1.9-1 2023-12-21 [?] CRAN (R 4.3.3) microbiome * 1.24.0 2023-10-24 [1] Bioconductor P microViz * 0.12.4 2024-06-30 [?] https://d~ P mime 0.12 2021-09-28 [?] RSPM (R 4.3.0) P miniUI 0.1.1.1 2018-05-18 [?] RSPM (R 4.3.0) multtest 2.58.0 2023-10-24 [1] Bioconductor munsell 0.5.1 2024-04-01 [1] RSPM (R 4.3.0) NADA 1.6-1.1 2020-03-22 [1] RSPM (R 4.3.0) P nlme 3.1-164 2023-11-27 [?] CRAN (R 4.3.3) P nnet 7.3-19 2023-05-03 [?] CRAN (R 4.3.3) P patchwork * 1.2.0 2024-01-08 [?] RSPM (R 4.3.0) permute 0.9-7 2022-01-27 [1] RSPM (R 4.3.0) phyloseq * 1.46.0 2023-10-24 [1] Bioconductor P pillar 1.9.0 2023-03-22 [?] RSPM (R 4.3.0) P pkgbuild 1.4.4 2024-03-17 [?] RSPM (R 4.3.0) P pkgconfig 2.0.3 2019-09-22 [?] RSPM (R 4.3.0) P pkgload 1.4.0 2024-06-28 [?] RSPM plyr 1.8.9 2023-10-02 [1] RSPM (R 4.3.0) pROC 1.18.5 2023-11-01 [1] RSPM (R 4.3.0) P processx 3.8.4 2024-03-16 [?] RSPM (R 4.3.0) P profvis 0.3.8 2023-05-02 [?] RSPM (R 4.3.0) P promises 1.3.0 2024-04-05 [?] RSPM P ps 1.7.6 2024-01-18 [?] RSPM (R 4.3.0) P purrr 1.0.2 2023-08-10 [?] RSPM (R 4.3.0) qiime2R * 0.99.6 2024-07-02 [1] Github (jbisanz/qiime2R@d0610e1) P R6 2.5.1 2021-08-19 [?] RSPM (R 4.3.0) randomForest 4.7-1.1 2022-05-23 [1] RSPM (R 4.3.0) RColorBrewer 1.1-3 2022-04-03 [1] RSPM (R 4.3.0) P Rcpp 1.0.12 2024-01-09 [?] RSPM (R 4.3.0) RCurl 1.98-1.14 2024-01-09 [1] RSPM (R 4.3.0) P remotes 2.5.0 2024-03-17 [?] RSPM (R 4.3.0) renv 1.0.7 2024-04-11 [1] RSPM (R 4.3.0) reshape2 1.4.4 2020-04-09 [1] RSPM (R 4.3.0) rhdf5 2.46.1 2023-11-29 [1] Bioconductor D rhdf5filters 1.14.1 2023-11-06 [1] Bioconductor Rhdf5lib 1.24.2 2024-02-07 [1] Bioconductor 3.18 (R 4.3.2) P rlang 1.1.4 2024-06-04 [?] RSPM P rmarkdown 2.27 2024-05-17 [?] RSPM P rpart 4.1.23 2023-12-05 [?] CRAN (R 4.3.3) P rstudioapi 0.16.0 2024-03-24 [?] RSPM Rtsne 0.17 2023-12-07 [1] RSPM (R 4.3.0) S4Vectors 0.40.2 2023-11-23 [1] Bioconductor scales 1.3.0 2023-11-28 [1] RSPM (R 4.3.0) P sessioninfo 1.2.2 2021-12-06 [?] RSPM (R 4.3.0) P shiny 1.8.1.1 2024-04-02 [?] RSPM P stringi 1.8.4 2024-05-06 [?] RSPM P stringr 1.5.1 2023-11-14 [?] RSPM (R 4.3.0) P survival 3.5-8 2024-02-14 [?] CRAN (R 4.3.3) P tibble 3.2.1 2023-03-20 [?] RSPM (R 4.3.0) tidyr 1.3.1 2024-01-24 [1] RSPM (R 4.3.0) tidyselect 1.2.1 2024-03-11 [1] RSPM (R 4.3.0) truncnorm 1.0-9 2023-03-20 [1] RSPM (R 4.3.0) P urlchecker 1.0.1 2021-11-30 [?] RSPM (R 4.3.0) usedist 0.4.0 2020-03-01 [1] RSPM (R 4.3.0) P usethis 2.2.3 2024-02-19 [?] RSPM (R 4.3.0) P utf8 1.2.4 2023-10-22 [?] RSPM (R 4.3.0) P vctrs 0.6.5 2023-12-01 [?] RSPM (R 4.3.0) vegan 2.6-6.1 2024-05-21 [1] RSPM (R 4.3.0) P withr 3.0.0 2024-01-16 [?] RSPM (R 4.3.0) P xfun 0.45 2024-06-16 [?] RSPM P xtable 1.8-4 2019-04-21 [?] RSPM (R 4.3.0) XVector 0.42.0 2023-10-24 [1] Bioconductor P yaml 2.3.8 2023-12-11 [?] RSPM (R 4.3.0) zCompositions 1.5.0-4 2024-06-19 [1] RSPM (R 4.3.0) zlibbioc 1.48.2 2024-03-13 [1] Bioconductor 3.18 (R 4.3.3) ```

Thanks.

gutmicrobe commented 3 months ago

Thanks for using the R package and the query. My apologies for late response. I am unable to recreate the error. Is it possible that you have missing info or group column is not a 'factor'? in your sample_data?