tidytree icon indicating copy to clipboard operation
tidytree copied to clipboard

Tidytree update has impacted ggtree functions

Open meghanmshea opened this issue 1 year ago • 11 comments

I have code for making a phylogenetic tree that relies on ggtree, ggtreeExtra, and tidytree. It was working perfectly for many months, up until several days ago, when geom_hilight and geom_cladelab from ggtree stopped working. From my GitHub commits, I identified that the only change in my environment was an update to tidytree 0.4.4; when I reverted back to tidytree 0.4.2, the code ran perfectly again.

At least one other person has reported having this issue (https://support.bioconductor.org/p/9153297/#9153321), and it's related to #40 (I received a similar error message when using geom_cladelab).

meghanmshea avatar Jul 20 '23 19:07 meghanmshea

How to restore 0.4.4 to 0.4.2 that I tried and couldn't

Leekate11 avatar Jul 23 '23 07:07 Leekate11

LEfse %>% 
+   ggdiffclade(obj=.,
+               alpha=0.3, linewd=0.2, 
+               skpointsize=0.6,
+               taxlevel=3,
+               settheme=FALSE, 
+               setColors=FALSE,
+               cladetext=1.5, removeUnknown = F) +
+   guides(color = guide_legend(keywidth = 0.1,
+                               keyheight = 0.6,
+                               order = 3, 
+                               ncol=1)) + 
+   scale_fill_manual(values=c("#008B45FF","#EE0000FF","purple")) +
+   
+   guides(fill=guide_legend(order = 1,reverse = T,keyheight = 0.1,keywidth = 0.6))+
+   theme(panel.background=element_rect(fill=NA),
+         legend.position="right",
+         plot.margin=margin(0,0,0,0),
+         legend.spacing.x = unit(0.02, "cm"),
+         legend.title=element_text(size=7),
+         legend.text=element_text(size=6),
+         legend.box.spacing=unit(0.02,"cm"))
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
Error in offspring.tbl_tree_item(.data = .data, .node = .node, tiponly = tiponly,  : 
  could not find function "offspring.tbl_tree_item"

I also made an error in drawing the tree

Leekate11 avatar Jul 23 '23 07:07 Leekate11

Please make sure the tidytree is >=0.4.4 after loading it using library('tidytree')

> library("tidytree")
> library("treeio")
> library("ggtree")
> sessionInfo()

xiangpin avatar Jul 24 '23 02:07 xiangpin

If you are using ggtree on the windows or mac. Please re-install it using BiocManager::install("ggtree", force=T, type = 'source'). Because the windows or mac binary of ggtree on bioconductor was built with old tidytree.

xiangpin avatar Jul 24 '23 03:07 xiangpin

Thank you, I will try and feedback as soon as possible. Thanks again!

Leekate11 avatar Jul 24 '23 03:07 Leekate11

I can't find an older version of tidytree0.4.2. I removed it, and the following code "! # Invaild edge matrix for . A <tbl_df> is returned. ! # Invaild edge matrix for . A <tbl_df> is returned. ! # Invaild edge matrix for . A <tbl_df> is returned. ! # Invaild edge matrix for . A <tbl_df> is returned. Scale for fill is already present. Adding another scale for fill, which will replace the existing scale." appeared, but it worked fine

Leekate11 avatar Jul 24 '23 05:07 Leekate11

If you are using ggtree on the windows or mac. Please re-install it using BiocManager::install("ggtree", force=T, type = 'source'). Because the windows or mac binary of ggtree on bioconductor was built with old tidytree.

I am using ggtree on mac, which I install via ggtreeExtra.

When I install ggtreeExtra as described--BiocManager::install("ggtreeExtra", force=T, type = 'source')--once again geom_hilight does not highlight anything on my tree and geom_cladelab also no longer works and throws the following error:

Error in offspring.tbl_tree_item(.data = .data, .node = .node, tiponly = tiponly,  : 
  could not find function "offspring.tbl_tree_item"

My sessionInfo() is:

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.0.1

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.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.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: America/Los_Angeles
tzcode source: internal

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

other attached packages:
 [1] ggtreeExtra_1.10.0       phyloseq_1.44.0          ampvis2_2.8.1            styler_1.10.1            devtools_2.4.5          
 [6] usethis_2.2.2            chunkhooks_0.0.1         ggh4x_0.2.5              ggbeeswarm_0.7.2         mapview_2.11.0          
[11] rgbif_3.7.7              mregions_0.1.8           spocc_1.2.2              pals_1.7                 Polychrome_1.5.1        
[16] taxize_0.9.100           chisq.posthoc.test_0.1.2 vegan_2.6-4              lattice_0.21-8           cluster_2.1.4           
[21] indicspecies_1.7.14      permute_0.9-7            eulerr_7.0.0             remotes_2.4.2.1          BiocManager_1.30.21.1   
[26] patchwork_1.1.2          sf_1.0-14                forcats_1.0.0            stringr_1.5.0            dplyr_1.1.2             
[31] purrr_1.0.1              readr_2.1.4              tidyr_1.3.0              tibble_3.2.1             ggplot2_3.4.2           
[36] tidyverse_2.0.0          lubridate_1.9.2         

loaded via a namespace (and not attached):
  [1] fs_1.6.3                bitops_1.0-7            bold_1.3.0              oai_0.4.0               httr_1.4.6             
  [6] webshot_0.5.5           RColorBrewer_1.1-3      profvis_0.3.8           tools_4.3.1             utf8_1.2.3             
 [11] R6_2.5.1                lazyeval_0.2.2          mgcv_1.9-0              measurements_1.5.1      rhdf5filters_1.12.1    
 [16] urlchecker_1.0.1        withr_2.5.0             sp_2.0-0                prettyunits_1.1.1       gridExtra_2.3          
 [21] leaflet_2.1.2           leafem_0.2.0            cli_3.6.1               Biobase_2.60.0          labeling_0.4.2         
 [26] proxy_0.4-27            yulab.utils_0.0.6       R.utils_2.12.2          dichromat_2.0-0.1       sessioninfo_1.2.2      
 [31] maps_3.4.1              rstudioapi_0.15.0       httpcode_0.3.0          generics_0.1.3          gridGraphics_0.5-1     
 [36] crosstalk_1.2.0         Matrix_1.6-0            biomformat_1.28.0       fansi_1.0.4             S4Vectors_0.38.1       
 [41] R.methodsS3_1.8.2       terra_1.7-39            lifecycle_1.0.3         whisker_0.4.1           scatterplot3d_0.3-44   
 [46] yaml_2.3.7              rvertnet_0.8.2          rhdf5_2.44.0            promises_1.2.0.1        crayon_1.5.2           
 [51] miniUI_0.1.1.1          conditionz_0.1.0        mapproj_1.2.11          pillar_1.9.0            knitr_1.43             
 [56] codetools_0.2-19        fastmatch_1.1-3         wk_0.7.3                glue_1.6.2              rebird_1.3.0           
 [61] ggfun_0.1.1             data.table_1.14.8       urltools_1.7.3          vctrs_0.6.3             png_0.1-8              
 [66] treeio_1.24.2           gtable_0.3.3            assertthat_0.2.1        cachem_1.0.8            xfun_0.39              
 [71] mime_0.12               survival_3.5-5          iterators_1.0.14        units_0.8-2             ellipsis_0.3.2         
 [76] nlme_3.1-162            ggtree_3.8.0            satellite_1.0.4         GenomeInfoDb_1.36.1     R.cache_0.16.0         
 [81] vipor_0.4.5             KernSmooth_2.23-22      colorspace_2.1-0        BiocGenerics_0.46.0     DBI_1.1.3              
 [86] raster_3.6-23           ade4_1.7-22             phangorn_2.11.1         tidyselect_1.2.0        processx_3.8.2         
 [91] compiler_4.3.1          curl_5.0.1              xml2_1.3.5              plotly_4.10.2           triebeard_0.4.1        
 [96] scales_1.2.1            classInt_0.4-9          quadprog_1.5-8          callr_3.7.3             digest_0.6.33          
[101] rmarkdown_2.23          XVector_0.40.0          htmltools_0.5.5         pkgconfig_2.0.3         base64enc_0.1-3        
[106] fastmap_1.1.1           rlang_1.1.1             htmlwidgets_1.6.2       shiny_1.7.4.1           farver_2.1.1           
[111] zoo_1.8-12              jsonlite_1.8.7          R.oo_1.25.0             RCurl_1.98-1.12         magrittr_2.0.3         
[116] GenomeInfoDbData_1.2.10 ggplotify_0.1.1         s2_1.1.4                Rhdf5lib_1.22.0         munsell_0.5.0          
[121] Rcpp_1.0.11             ape_5.7-1               ggnewscale_0.4.9        viridis_0.6.4           stringi_1.7.12         
[126] zlibbioc_1.46.0         MASS_7.3-60             plyr_1.8.8              pkgbuild_1.4.2          parallel_4.3.1         
[131] ggrepel_0.9.3           Biostrings_2.68.1       splines_4.3.1           multtest_2.56.0         hms_1.1.3              
[136] ps_1.7.5                igraph_1.5.0            uuid_1.1-0              reshape2_1.4.4          stats4_4.3.1           
[141] pkgload_1.3.2.1         crul_1.4.0              ridigbio_0.3.6          evaluate_0.21           tzdb_0.4.0             
[146] foreach_1.5.2           httpuv_1.6.11           xtable_1.8-4            e1071_1.7-13            tidytree_0.4.4         
[151] later_1.3.1             viridisLite_0.4.2       class_7.3-22            aplot_0.1.10            memoise_2.0.1          
[156] beeswarm_0.4.0          IRanges_2.34.1          timechange_0.2.0    

meghanmshea avatar Jul 24 '23 20:07 meghanmshea

Please re-install ggtree using BiocManager::install("ggtree", force=T, type = 'source'). The geom_hilight and geom_cladelab are from ggtree.

xiangpin avatar Jul 26 '23 08:07 xiangpin

Installing ggtree separately alongside ggtreeExtra, rather than relying on ggtreeExtra's install of ggtree, now seems to work.

meghanmshea avatar Jul 26 '23 22:07 meghanmshea

I'm still running into this problem: https://github.com/YuLab-SMU/ggtree/issues/588#issuecomment-1769290936

It would be great to fix in next version of tidytree.

ewallace avatar Oct 18 '23 20:10 ewallace

Yeah, I had to roll back tidytree to 0.4.2 prior to installing ggtree. The current bioconda release of ggtree has tidytree=0.4.6 as a dependency, and the error still occurs there. Not a problem for me to roll back, but using BiocManager::install("ggtree", force=T, type = 'source') did not work for me--the installation failed.

gerverska avatar Aug 17 '24 22:08 gerverska