metacoder icon indicating copy to clipboard operation
metacoder copied to clipboard

Error: could not find function "simplify" when I run metacoder::filter_taxa

Open taowis opened this issue 4 years ago • 7 comments

When I run filter_taxa, I can see the error: Error in simplify(output) : could not find function "simplify" How I can resolve this issue?

taowis avatar Jul 21 '21 05:07 taowis

Hello,

Can you show me what code caused this problem? Also, can you print the output of sessionInfo() after running it? Thanks!

zachary-foster avatar Jul 21 '21 06:07 zachary-foster

Hi,

I followed the instruction from https://grunwaldlab.github.io/metacoder_documentation/workshop--05--plotting.html

load("filtered_data.Rdata") library(metacoder) obj %>% filter_taxa(grepl(pattern = "^[a-zA-Z]+$", taxon_names)) %>% # remove "odd" taxa filter_taxa(taxon_ranks == "o", supertaxa = TRUE) %>% # subset to the order rank heat_tree(node_label = gsub(pattern = "\[|\]", replacement = "", taxon_names), node_size = n_obs, node_color = n_obs, node_color_axis_label = "OTU count", layout = "davidson-harel", initial_layout = "reingold-tilford")

It returned error: Error in simplify(output) : could not find function "simplify"

sessionInfo() R version 4.0.0 (2020-04-24) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 8 Matrix products: default BLAS/LAPACK: /opt/intel/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64_lin/libmkl_intel_lp64.so locale: [1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8 [5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8 [7] LC_PAPER=en_AU.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] metacoder_0.3.5 loaded via a namespace (and not attached): [1] Rcpp_1.0.7 fansi_0.5.0 assertthat_0.2.1 utf8_1.2.1 [5] crayon_1.4.1 dplyr_1.0.7 R6_2.5.0 DBI_1.1.1 [9] lifecycle_1.0.0 magrittr_2.0.1 taxa_0.4.0 pillar_1.6.1 [13] stringi_1.7.3 rlang_0.4.11 lazyeval_0.2.2 vctrs_0.3.8 [17] generics_0.1.0 ellipsis_0.3.2 tools_4.0.0 stringr_1.4.0 [21] glue_1.4.2 purrr_0.3.4 compiler_4.0.0 pkgconfig_2.0.3 [25] tidyselect_1.1.1 tibble_3.1.2

taowis avatar Jul 21 '21 11:07 taowis

Ahh, ok. There was an update to metacoder recently and it probably broke the example data sets for that tutorial, I will rebuild it and get back to you.

zachary-foster avatar Jul 22 '21 18:07 zachary-foster

Give it a try again. It should be fixed, but you will have to re-download or recreate the example data.

zachary-foster avatar Jul 25 '21 22:07 zachary-foster

I have tested it, it is working now. Thank you for your help.

taowis avatar Jul 26 '21 12:07 taowis

I am getting the same error when trying to run examples from the Diversity statistics section of the workshop. Any help much appreciated!

Code is:

set.seed(2) obj %>% metacoder::filter_taxa(leaf > 50) %>% # taxa:: needed because of phyloseq::filter_taxa heat_tree(node_label = taxon_names, node_size = leaf, node_color = leaf, layout = "da", initial_layout = "re", title = "Taxa in leafs")

Session info output:

R version 4.3.0 (2023-04-21 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

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] ape_5.7-1 agricolae_1.3-6 stringr_1.5.0 dplyr_1.1.3
[5] ggplot2_3.4.4 BiocManager_1.30.22 taxa_0.4.2 vctrs_0.6.4
[9] metacoder_0.3.6 vegan_2.6-4 lattice_0.21-9 permute_0.9-7
[13] readr_2.1.4

loaded via a namespace (and not attached): [1] utf8_1.2.3 generics_0.1.3 stringi_1.7.12 hms_1.1.3
[5] digest_0.6.33 magrittr_2.0.3 grid_4.3.0 fastmap_1.1.1
[9] Matrix_1.6-1.1 combinat_0.0-8 promises_1.2.1 mgcv_1.9-0
[13] fansi_1.0.5 scales_1.2.1 lazyeval_0.2.2 labelled_2.12.0
[17] cli_3.6.1 shiny_1.7.5.1 crayon_1.5.2 rlang_1.1.1
[21] ellipsis_0.3.2 munsell_0.5.0 splines_4.3.0 withr_2.5.1
[25] klaR_1.7-2 tools_4.3.0 parallel_4.3.0 AlgDesign_1.2.1
[29] tzdb_0.4.0 colorspace_2.1-0 httpuv_1.6.11 forcats_1.0.0
[33] R6_2.5.1 mime_0.12 lifecycle_1.0.3 MASS_7.3-60
[37] miniUI_0.1.1.1 cluster_2.1.4 pkgconfig_2.0.3 pillar_1.9.0
[41] later_1.3.1 gtable_0.3.4 glue_1.6.2 Rcpp_1.0.11
[45] haven_2.5.3 highr_0.10 tibble_3.2.1 tidyselect_1.2.0 [49] rstudioapi_0.15.0 xtable_1.8-4 htmltools_0.5.6.1 nlme_3.1-163
[53] compiler_4.3.0 questionr_0.7.8

Lindsey46 avatar Oct 26 '23 22:10 Lindsey46

Can you use saveRDS() on the obj that causes that error and attach it to a comment here? I'm not sure why this would be happening and I need to reproduce the error to figure out what is going on. Thanks!

zachary-foster avatar Nov 02 '23 18:11 zachary-foster