简体   繁体   中英

ggtree 2.4.2 error: Error in DataMask$new(.data, caller_env) : argument "caller_env" is missing, with no default

I am trying to plot an ancestral states tree generated in RevBayes using RevGadgets 1.0.0 and ggtree 2.4.2. The call is the following, and all of the variables check out, including the tree file, in Nexus format, which I can open in FigTree etc.

pp=plot_ancestral_states(tree_file=tree_fn,
                         include_start_states=T,
                         summary_statistic="PieRange",
                         state_labels=state_labels,
                         state_colors=state_colors,
                         tip_label_size=2.5,
                         tip_label_offset=0.1,
                         node_label_size=0,
                         shoulder_label_size=0,
                         show_posterior_legend=T,
                         tip_pie_diameter=0.5,
                         node_pie_diameter=2.0,
                         pie_nudge_x=0.03,
                         pie_nudge_y=0.16,
                         alpha=1)

The error message is "Error in DataMask$new(.data, caller_env): argument "caller_env" is missing, with no default"

This seems like an rlang error, but I'm not finding a way to troubleshoot it. There's zero documentation for the RevGadgets call "plot_ancestral_states."

Thanks for any assistance.

Turns out it's a problem with the latest version of dplyr. Removing dplyr 1.0.6 and installing 1.0.5 from the archive fixed the issue.

I've had the exact same problem, but rolling back to 1.0.4 version of Dplyr did not fix it. Also, I've seen it run on other machines that are using 1.0.6 (as am I) so I'm wondering if there's any other issue you're aware of?

Cheers GMD

Here's my sessionInfo in case it helps. R version 4.0.5 (2021-03-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252

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

other attached packages: [1] ggtree_2.4.2

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 magrittr_2.0.1 tidyselect_1.1.1 aplot_0.0.6 munsell_0.5.0 colorspace_2.0-1 ape_5.5
[8] lattice_0.20-41 R6_2.5.0 rlang_0.4.11 fansi_0.4.2 dplyr_1.0.6 patchwork_1.1.1 tools_4.0.5
[15] parallel_4.0.5 grid_4.0.5 gtable_0.3.0 nlme_3.1-152 utf8_1.2.1 ellipsis_0.3.2 lazyeval_0.2.2
[22] tibble_3.1.1 lifecycle_1.0.0 crayon_1.4.1 treeio_1.14.4 tidyr_1.1.3 BiocManager_1.30.15 purrr_0.3.4
[29] ggplot2_3.3.3 vctrs_0.3.8 tidytree_0.3.3 glue_1.4.2 compiler_4.0.5 pillar_1.6.1 rvcheck_0.1.8
[36] generics_0.1.0 scales_1.1.1 jsonlite_1.7.2 pkgconfig_2.0.3

ISSUE RESOLVED

Solution as follows from the developer:

Please also update tidytree by remotes::install_github("YuLab-SMU/tidytree") . This is beacuse the mutate.tbl_tree in tidytree was not updated in old version.

I also rolled back dplyr from 1.0.6 to 1.0.5 as per his instructions. Not sure whether the tidytree change would have been suffcient,, and I'm not brave enough to try.

I had the same problem and tried first just updating tidytree and it didn't work. Also had to go back to dplyr 1.0.5.

Another option is to update ggtree from GitHub remotes::install_github("YuLab-SMU/ggtree") , which should work with dplyr 1.0.6

Building on Peter B's solution for those (like me) who haven't needed to install an archived version of a package before, this is what worked for me.

#Start a new R session
remove.packages("dplyr")
devtools::install_version("dplyr",version="1.0.5")
require(dplyr)

#Example to show ggtree is working
tmpFile=tempfile()
file<-download.file("https://4va.github.io/biodatasci/data/tree_newick.nwk",tmpFile)
tree<-read.tree(tmpFile)
ggtree::ggtree(tree)

Installing the development Github version of ggtree didn't do the trick, but the above code did.

Error in DataMask$new(.data, caller_env): argument "caller_env" is missing, with no default

Can confirm that the problem is fixed when R, ggtree, dplyr, and tidytree are all up to date:

  • R 4.1.0
  • ggtree 3.1.2.991
  • dplyr 1.07
  • tidytree 0.3.4

I had to update R to 4.1.0 as the above package configuration wouldn't work with 4.0.3 or from 4.0.5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM