[英]How to link a couple of tip nodes in an inverted circular phylogenetic tree using ggtree in R
I want to create a figure of an annotated phylogenetic tree in circular layout with ggtree in R.我想用 R 中的 ggtree 创建一个带注释的系统发育树的圆形布局图。 Some tip nodes must be linked by a curve line.
一些尖端节点必须通过曲线连接。 I can achieve this with the geom_taxalink() function in the rectangular layout, but it doesn't work in the circular layout.
我可以在矩形布局中使用 geom_taxalink() function 来实现这一点,但它在圆形布局中不起作用。 This seems to be because the geom_taxalink() uses geom_curve(), which doesn't support non-linear coordinates.
这似乎是因为 geom_taxalink() 使用了 geom_curve(),它不支持非线性坐标。 I get the following message:
我收到以下消息:
"Warning message: “警告信息:
geom_curve is not implemented for non-linear coordinates" geom_curve 不适用于非线性坐标”
Below: reproducible code, the output I get, the output I want, and session info.下面:可重现的代码,我得到的 output,我想要的 output,以及 session 信息。
I'd appreciate any help to get the result I need.对于获得所需结果的任何帮助,我将不胜感激。
Thanks!谢谢!
Samuel塞缪尔
Example code:示例代码:
library(treeio)
library(ggtree)
library(ggplot2)
raxml_file <- system.file("extdata/RAxML",
"RAxML_bipartitionsBranchLabels.H3",
package="treeio")
raxml <- read.raxml(raxml_file)
raxml <- as_tibble(raxml)
raxml$label <- gsub("_.*$", "", raxml$label)
raxml <- as.treedata(raxml)
my_tree <- ggtree(raxml, layout = "circular", branch.length = "none") +
geom_tiplab2(size = 3, hjust = 1) +
geom_taxalink("EU857082",
"YGSIV1534",
color = "red") +
scale_x_reverse(limits = c(100, 0))
ggsave("my_tree.png", my_tree,
width = 10, height = 10, units = "in",
dpi = 300)
Here is a link to a sample of the result I get:这是我得到的结果示例的链接:
Here is link to an example of the desired result:以下是所需结果示例的链接:
Session info: Session 信息:
info <- sessionInfo()
toLatex(info, locale = FALSE)
# \begin{itemize}\raggedright
# \item R version 4.0.2 (2020-06-22), \verb|x86_64-pc-linux-gnu|
# \item Running under: \verb|Ubuntu 18.04.4 LTS|
# \item Matrix products: default
# \item BLAS: \verb|/usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1|
# \item LAPACK: \verb|/usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1|
# \item Base packages: base, datasets, graphics, grDevices, methods,
# stats, utils
# \item Other packages: ggplot2~3.3.2, ggtree~2.2.1, treeio~1.12.0
# \item Loaded via a namespace (and not attached): ape~5.4,
# aplot~0.0.4, assertthat~0.2.1, BiocManager~1.30.10, cli~2.0.2,
# colorspace~1.4-1, compiler~4.0.2, crayon~1.3.4, dplyr~1.0.0,
# ellipsis~0.3.1, fansi~0.4.1, farver~2.0.3, generics~0.0.2,
# glue~1.4.1, grid~4.0.2, gtable~0.3.0, jsonlite~1.7.0, labeling~0.3,
# lattice~0.20-41, lazyeval~0.2.2, lifecycle~0.2.0, magrittr~1.5,
# munsell~0.5.0, nlme~3.1-148, parallel~4.0.2, patchwork~1.0.1,
# pillar~1.4.6, pkgconfig~2.0.3, purrr~0.3.4, R6~2.4.1, Rcpp~1.0.5,
# rlang~0.4.7, rstudioapi~0.11, rvcheck~0.1.8, scales~1.1.1,
# tibble~3.0.3, tidyr~1.1.0, tidyselect~1.1.0, tidytree~0.3.3,
# tools~4.0.2, vctrs~0.3.1, withr~2.2.0
# \end{itemize}
The solution is to upgrade to the version 2.3.2 (last version as for July 15, 2020), which is hosted on github by the author of the package:解决方案是升级到2.3.2版本(最后一个版本为2020年7月15日),由package的作者托管在github上:
devtools::install_github("YuLab-SMU/ggtree") devtools::install_github("YuLab-SMU/ggtree")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.