microbiome / miaViz

Microbiome Analysis Plotting and Visualization
https://microbiome.github.io/miaViz
Artistic License 2.0
10 stars 11 forks source link

Error in .merge_tree_vis_data(tree_data, feature_info) : . #123

Closed RiboRings closed 4 months ago

RiboRings commented 4 months ago

Spotted an error with Tengeler2020 dataset. To reproduce:

library(mia)
library(miaViz)

data("Tengeler2020", package = "mia")
plotRowTree(Tengeler2020, edge_colour_by = "Kingdom")

> Error in .merge_tree_vis_data(tree_data, feature_info) : .
RiboRings commented 4 months ago

Session info:

sessionInfo() R Under development (unstable) (2024-03-20 r86162) Platform: x86_64-apple-darwin20 Running under: macOS Big Sur 11.7.10

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Asia/Jerusalem tzcode source: internal

attached base packages: [1] stats4 stats graphics grDevices utils datasets [7] methods base

other attached packages: [1] miaViz_1.13.0 ggraph_2.2.1
[3] ggplot2_3.5.1 iSEEtree_0.1.3
[5] shiny_1.8.1.1 MultiAssayExperiment_1.29.1
[7] TreeSummarizedExperiment_2.11.0 Biostrings_2.71.6
[9] XVector_0.43.1 testthat_3.2.1.1
[11] iSEE_2.15.1 SingleCellExperiment_1.25.1
[13] SummarizedExperiment_1.33.3 Biobase_2.63.1
[15] GenomicRanges_1.55.4 GenomeInfoDb_1.39.14
[17] IRanges_2.37.1 S4Vectors_0.41.7
[19] BiocGenerics_0.49.1 MatrixGenerics_1.15.1
[21] matrixStats_1.3.0

loaded via a namespace (and not attached): [1] fs_1.6.4 bitops_1.0-7
[3] DirichletMultinomial_1.45.0 fontawesome_0.5.2
[5] devtools_2.4.5 httr_1.4.7
[7] RColorBrewer_1.1-3 doParallel_1.0.17
[9] profvis_0.3.8 tools_4.4.0
[11] backports_1.4.1 utf8_1.2.4
[13] R6_2.5.1 DT_0.33
[15] vegan_2.6-6 lazyeval_0.2.2
[17] mgcv_1.9-1 GetoptLong_1.0.5
[19] permute_0.9-7 urlchecker_1.0.1
[21] withr_3.0.0 gridExtra_2.3
[23] textshaping_0.3.7 cli_3.6.2
[25] Cairo_1.6-2 shinyjs_2.1.0
[27] sandwich_3.1-0 labeling_0.4.3
[29] sass_0.4.9 mvtnorm_1.2-4
[31] systemfonts_1.0.6 yulab.utils_0.1.4
[33] foreign_0.8-86 scater_1.31.2
[35] decontam_1.23.0 sessioninfo_1.2.2
[37] rstudioapi_0.16.0 generics_0.1.3
[39] gridGraphics_0.5-1 shape_1.4.6.1
[41] crosstalk_1.2.1 dplyr_1.1.4
[43] Matrix_1.7-0 ggbeeswarm_0.7.2
[45] fansi_1.0.6 DECIPHER_2.99.1
[47] abind_1.4-5 lifecycle_1.0.4
[49] yaml_2.3.8 SparseArray_1.3.5
[51] grid_4.4.0 promises_1.3.0
[53] crayon_1.5.2 shinydashboard_0.7.2
[55] pwalign_0.99.1 miniUI_0.1.1.1
[57] lattice_0.22-6 beachmat_2.19.4
[59] pillar_1.9.0 knitr_1.46
[61] ComplexHeatmap_2.19.0 rjson_0.2.21
[63] boot_1.3-30 lpSolve_5.6.20
[65] codetools_0.2-20 glue_1.7.0
[67] ggfun_0.1.4 data.table_1.15.4
[69] remotes_2.5.0 vctrs_0.6.5
[71] png_0.1-8 treeio_1.27.1
[73] gtable_0.3.5 cachem_1.0.8
[75] xfun_0.44 S4Arrays_1.3.7
[77] mime_0.12 tidygraph_1.3.1
[79] iterators_1.0.14 bluster_1.13.0
[81] ellipsis_0.3.2 nlme_3.1-164
[83] ggtree_3.11.2 usethis_2.2.3
[85] rprojroot_2.0.4 bslib_0.7.0
[87] irlba_2.3.5.1 vipor_0.4.7
[89] rpart_4.1.23 colorspace_2.1-0
[91] DBI_1.2.2 Hmisc_5.1-2
[93] nnet_7.3-19 processx_3.8.4
[95] tidyselect_1.2.1 curl_5.2.1
[97] compiler_4.4.0 htmlTable_2.4.2
[99] BiocNeighbors_1.21.2 desc_1.4.3
[101] DelayedArray_0.29.9 colourpicker_1.3.0
[103] checkmate_2.3.1 scales_1.3.0
[105] callr_3.7.6 stringr_1.5.1
[107] digest_0.6.35 minqa_1.2.6
[109] rmarkdown_2.26 htmltools_0.5.8.1
[111] pkgconfig_2.0.3 base64enc_0.1-3
[113] lme4_1.1-35.3 sparseMatrixStats_1.15.1
[115] listviewer_4.0.0 fastmap_1.1.1
[117] rlang_1.1.3 GlobalOptions_0.1.2
[119] htmlwidgets_1.6.4 UCSC.utils_0.99.7
[121] DelayedMatrixStats_1.25.4 farver_2.1.2
[123] jquerylib_0.1.4 zoo_1.8-12
[125] jsonlite_1.8.8 BiocParallel_1.37.1
[127] BiocSingular_1.19.0 RCurl_1.98-1.14
[129] magrittr_2.0.3 Formula_1.2-5
[131] scuttle_1.13.1 GenomeInfoDbData_1.2.12
[133] ggplotify_0.1.2 patchwork_1.2.0
[135] munsell_0.5.1 Rcpp_1.0.12
[137] ape_5.8 ggnewscale_0.4.10
[139] viridis_0.6.5 stringi_1.8.4
[141] rintrojs_0.3.4 brio_1.1.5
[143] zlibbioc_1.49.3 MASS_7.3-60.2
[145] plyr_1.8.9 mediation_4.5.0
[147] pkgbuild_1.4.4 parallel_4.4.0
[149] ggrepel_0.9.5 graphlayouts_1.1.1
[151] splines_4.4.0 circlize_0.4.16
[153] ps_1.7.6 igraph_2.0.3
[155] reshape2_1.4.4 ScaledMatrix_1.11.1
[157] pkgload_1.3.4 evaluate_0.23
[159] nloptr_2.0.3 foreach_1.5.2
[161] tweenr_2.0.3 httpuv_1.6.15
[163] tidyr_1.3.1 purrr_1.0.2
[165] polyclip_1.10-6 clue_0.3-65
[167] ggforce_0.4.2 rsvd_1.0.5
[169] xtable_1.8-4 tidytree_0.4.6
[171] later_1.3.2 ragg_1.3.2
[173] viridisLite_0.4.2 tibble_3.2.1
[175] aplot_0.2.2 memoise_2.0.1
[177] beeswarm_0.4.0 cluster_2.1.6
[179] shinyWidgets_0.8.6 shinyAce_0.4.2

TuomasBorman commented 4 months ago

Thanks!

This is caused because node labels of tree are not unique.

data("Tengeler2020", package = "mia")

tse <- Tengeler2020
tree <- rowTree(tse)
tree$node.label
duplicated(tree$node.label)

rowTree(tse)$node.label <- paste0("node_", seq_len(length(rowTree(tse)$node.label)))
plotRowTree(tse, edge_colour_by = "Phylum")

I check if it is safe to modify node labels (and give warning), or if that mess up something

RiboRings commented 4 months ago

Cool! I think a meaningful warning would be enough. I'm updating Tengeler2020 in a PR to mia anyway, so I could fix that