... | ... |
@@ -240,7 +240,7 @@ get_cladelabel_position_ <- function(data, node, angle = "auto", extend = 0) { |
240 | 240 |
## sp2 <- c(sp, node) |
241 | 241 |
## sp.df <- data[match(sp2, data$node),] |
242 | 242 |
|
243 |
- sp.df <- offspring(data, node, self_include = TRUE) |
|
243 |
+ sp.df <- tidytree:::offspring.tbl_tree(data, node, self_include = TRUE) |
|
244 | 244 |
|
245 | 245 |
y <- sp.df$y |
246 | 246 |
y <- y[!is.na(y)] |
... | ... |
@@ -101,20 +101,19 @@ stat_hilight <- function(mapping=NULL, data=NULL, geom="rect", |
101 | 101 |
##' @export |
102 | 102 |
StatHilight <- ggproto("StatHilight", Stat, |
103 | 103 |
compute_group = function(self, data, scales, params, node, extend, extendto) { |
104 |
- |
|
105 |
- df <- get_clade_position_(data, node) |
|
106 |
- df$xmax <- df$xmax + extend |
|
107 |
- if (!is.null(extendto) && !is.na(extendto)) { |
|
108 |
- if (extendto < df$xmax) { |
|
109 |
- warning("extendto is too small, keep the original xmax value...") |
|
110 |
- } else { |
|
111 |
- df$xmax <- extendto |
|
104 |
+ df <- get_clade_position_(data, node) |
|
105 |
+ df$xmax <- df$xmax + extend |
|
106 |
+ if (!is.null(extendto) && !is.na(extendto)) { |
|
107 |
+ if (extendto < df$xmax) { |
|
108 |
+ warning("extendto is too small, keep the original xmax value...") |
|
109 |
+ } else { |
|
110 |
+ df$xmax <- extendto |
|
111 |
+ } |
|
112 | 112 |
} |
113 |
- } |
|
114 |
- return(df) |
|
113 |
+ return(df) |
|
115 | 114 |
}, |
116 | 115 |
required_aes = c("x", "y", "branch.length") |
117 |
-) |
|
116 |
+ ) |
|
118 | 117 |
|
119 | 118 |
|
120 | 119 |
##' get position of clade (xmin, xmax, ymin, ymax) |
... | ... |
@@ -131,8 +130,7 @@ get_clade_position <- function(treeview, node) { |
131 | 130 |
} |
132 | 131 |
|
133 | 132 |
get_clade_position_ <- function(data, node) { |
134 |
- sp <- tryCatch(offspring(data, node)$node, error=function(e) NULL) |
|
135 |
- |
|
133 |
+ sp <- tryCatch(tidytree:::offspring.tbl_tree(data, node)$node, error=function(e) NULL) |
|
136 | 134 |
i <- match(node, data$node) |
137 | 135 |
if (is.null(sp)) { |
138 | 136 |
## tip |
... | ... |
@@ -141,10 +139,10 @@ get_clade_position_ <- function(data, node) { |
141 | 139 |
sp <- c(sp, node) |
142 | 140 |
sp.df <- data[match(sp, data$node),] |
143 | 141 |
} |
144 |
- |
|
142 |
+ |
|
145 | 143 |
x <- sp.df$x |
146 | 144 |
y <- sp.df$y |
147 |
- |
|
145 |
+ |
|
148 | 146 |
if ("branch.length" %in% colnames(data)) { |
149 | 147 |
xmin <- min(x, na.rm=TRUE)-data[["branch.length"]][i]/2 |
150 | 148 |
} else { |
... | ... |
@@ -5,14 +5,15 @@ |
5 | 5 |
"For help: https://guangchuangyu.github.io/software/", pkgname, "\n\n") |
6 | 6 |
|
7 | 7 |
citation <- paste0("If you use ", pkgname, " in published research, please cite the most appropriate paper(s):\n\n", |
8 |
- '\033[36m', '-', '\033[39m ', |
|
9 |
- "Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ", |
|
10 |
- "ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ", |
|
11 |
- "Methods in Ecology and Evolution 2017, 8(1):28-36, doi:10.1111/2041-210X.12628\n\n", |
|
12 | 8 |
'\033[36m', '-', '\033[39m ', |
13 | 9 |
"Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. ", |
14 | 10 |
"Two methods for mapping and visualizing associated data on phylogeny using ggtree. ", |
15 |
- "Molecular Biology and Evolution 2018, accepted. doi: 10.1093/molbev/msy194" |
|
11 |
+ "Molecular Biology and Evolution 2018, accepted. doi: 10.1093/molbev/msy194", |
|
12 |
+ |
|
13 |
+ '\033[36m', '-', '\033[39m ', |
|
14 |
+ "Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ", |
|
15 |
+ "ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ", |
|
16 |
+ "Methods in Ecology and Evolution 2017, 8(1):28-36, doi:10.1111/2041-210X.12628\n\n" |
|
16 | 17 |
) |
17 | 18 |
|
18 | 19 |
packageStartupMessage(paste0(msg, citation)) |
... | ... |
@@ -48,7 +48,7 @@ For details, please visit our project website, <https://guangchuangyu.github.io/ |
48 | 48 |
+ [Feedback](https://guangchuangyu.github.io/software/ggtree/#feedback) |
49 | 49 |
|
50 | 50 |
|
51 |
-## Authors |
|
51 |
+## :writing_hand: Authors |
|
52 | 52 |
|
53 | 53 |
Guangchuang YU |
54 | 54 |
|
... | ... |
@@ -65,13 +65,13 @@ School of Basic Medical Sciences, Southern Medical University |
65 | 65 |
|
66 | 66 |
If you use `r Biocpkg('ggtree')` in published research, please cite the most appropriate paper(s) from this list: |
67 | 67 |
|
68 |
-1. __G Yu__, DK Smith, H Zhu, Y Guan, TTY Lam^\*^. ggtree: an R package for |
|
68 |
+1. __G Yu__^\*^, TTY Lam, H Zhu, Y Guan^\*^. Two methods for mapping and visualizing associated data on phylogeny using ggtree. __*Molecular Biology and Evolution*__, 2018, 35(2):3041-3043. |
|
69 |
+doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194). |
|
70 |
+ - [Source code to produce Supplementary Material](https://github.com/GuangchuangYu/plotting_tree_with_data) |
|
71 |
+2. __G Yu__, DK Smith, H Zhu, Y Guan, TTY Lam^\*^. ggtree: an R package for |
|
69 | 72 |
visualization and annotation of phylogenetic trees with their covariates and |
70 | 73 |
other associated data. __*Methods in Ecology and Evolution*__. 2017, 8(1):28-36. |
71 | 74 |
doi: [10.1111/2041-210X.12628](https://doi.org/10.1111/2041-210X.12628). |
72 |
-2. __G Yu__^\*^, TTY Lam, H Zhu, Y Guan^\*^. Two methods for mapping and visualizing associated data on phylogeny using ggtree. __*Molecular Biology and Evolution*__, 2018, 35(2):3041-3043. |
|
73 |
-doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194). |
|
74 |
- - [Source code to produce Supplementary Material](https://github.com/GuangchuangYu/plotting_tree_with_data) |
|
75 | 75 |
|
76 | 76 |
|
77 | 77 |
|
... | ... |
@@ -88,7 +88,7 @@ doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194). |
88 | 88 |
|
89 | 89 |
|
90 | 90 |
|
91 |
-## Contributing |
|
91 |
+## :sparkling_heart: Contributing |
|
92 | 92 |
|
93 | 93 |
We welcome any contributions! By participating in this project you agree to |
94 | 94 |
abide by the terms outlined in the [Contributor Code of Conduct](CONDUCT.md). |
... | ... |
@@ -4,8 +4,8 @@ |
4 | 4 |
|
5 | 5 |
<img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" /> |
6 | 6 |
|
7 |
-[](https://www.bioconductor.org/packages/ggtree) |
|
8 |
-[](https://github.com/guangchuangyu/ggtree) |
|
7 |
+[](https://www.bioconductor.org/packages/ggtree) |
|
8 |
+[](https://github.com/guangchuangyu/ggtree) |
|
9 | 9 |
[](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) |
10 | 10 |
[](https://awesome-r.com/#awesome-r-graphic-displays) |
11 | 11 |
|
... | ... |
@@ -14,7 +14,7 @@ |
14 | 14 |
state and is being actively |
15 | 15 |
developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) |
16 | 16 |
[](https://codecov.io/gh/GuangchuangYu/ggtree) |
17 |
-[](https://github.com/GuangchuangYu/ggtree/commits/master) |
|
17 |
+[](https://github.com/GuangchuangYu/ggtree/commits/master) |
|
18 | 18 |
|
19 | 19 |
The `ggtree` package extending the `ggplot2` package. It based on |
20 | 20 |
grammar of graphics and takes all the good parts of `ggplot2`. `ggtree` |
... | ... |
@@ -30,7 +30,7 @@ For details, please visit our project website, |
30 | 30 |
Articles](https://guangchuangyu.github.io/software/ggtree/featuredArticles/) |
31 | 31 |
- [Feedback](https://guangchuangyu.github.io/software/ggtree/#feedback) |
32 | 32 |
|
33 |
-## Authors |
|
33 |
+## :writing\_hand: Authors |
|
34 | 34 |
|
35 | 35 |
Guangchuang YU |
36 | 36 |
|
... | ... |
@@ -48,28 +48,28 @@ If you use [ggtree](http://bioconductor.org/packages/ggtree) in |
48 | 48 |
published research, please cite the most appropriate paper(s) from this |
49 | 49 |
list: |
50 | 50 |
|
51 |
-1. **G Yu**, DK Smith, H Zhu, Y Guan, TTY Lam<sup>\*</sup>. ggtree: an |
|
52 |
- R package for visualization and annotation of phylogenetic trees |
|
53 |
- with their covariates and other associated data. ***Methods in |
|
54 |
- Ecology and Evolution***. 2017, 8(1):28-36. doi: |
|
55 |
- [10.1111/2041-210X.12628](https://doi.org/10.1111/2041-210X.12628). |
|
56 |
-2. **G Yu**<sup>\*</sup>, TTY Lam, H Zhu, Y Guan<sup>\*</sup>. Two |
|
51 |
+1. **G Yu**<sup>\*</sup>, TTY Lam, H Zhu, Y Guan<sup>\*</sup>. Two |
|
57 | 52 |
methods for mapping and visualizing associated data on phylogeny |
58 | 53 |
using ggtree. ***Molecular Biology and Evolution***, 2018, |
59 | 54 |
35(2):3041-3043. doi: |
60 | 55 |
[10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194). |
61 | 56 |
- [Source code to produce Supplementary |
62 | 57 |
Material](https://github.com/GuangchuangYu/plotting_tree_with_data) |
58 |
+2. **G Yu**, DK Smith, H Zhu, Y Guan, TTY Lam<sup>\*</sup>. ggtree: an |
|
59 |
+ R package for visualization and annotation of phylogenetic trees |
|
60 |
+ with their covariates and other associated data. ***Methods in |
|
61 |
+ Ecology and Evolution***. 2017, 8(1):28-36. doi: |
|
62 |
+ [10.1111/2041-210X.12628](https://doi.org/10.1111/2041-210X.12628). |
|
63 | 63 |
|
64 | 64 |
<img src="https://guangchuangyu.github.io/software/ggtree/featured-articles/index_files/figure-html/citation-1.png" width="890"/> |
65 | 65 |
|
66 | 66 |
[](https://bioconductor.org/packages/stats/bioc/ggtree) |
67 |
-[](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
68 |
-[](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
67 |
+[](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
68 |
+[](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
69 | 69 |
|
70 | 70 |
<img src="https://guangchuangyu.github.io/software/ggtree/index_files/figure-html/dlstats-1.png" width="890"/> |
71 | 71 |
|
72 |
-## Contributing |
|
72 |
+## :sparkling\_heart: Contributing |
|
73 | 73 |
|
74 | 74 |
We welcome any contributions\! By participating in this project you |
75 | 75 |
agree to abide by the terms outlined in the [Contributor Code of |