... | ... |
@@ -2,7 +2,7 @@ Package: ggtree |
2 | 2 |
Type: Package |
3 | 3 |
Title: an R package for visualization and annotation of phylogenetic trees with |
4 | 4 |
their covariates and other associated data |
5 |
-Version: 1.9.0 |
|
5 |
+Version: 1.9.1 |
|
6 | 6 |
Authors@R: c( |
7 | 7 |
person("Guangchuang", "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph")), |
8 | 8 |
person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com", rol = c("aut", "ths")), |
... | ... |
@@ -43,4 +43,4 @@ BugReports: https://github.com/GuangchuangYu/ggtree/issues |
43 | 43 |
Packaged: 2014-12-03 08:16:14 UTC; root |
44 | 44 |
biocViews: Alignment, Annotation, Clustering, DataImport, |
45 | 45 |
MultipleSequenceAlignment, ReproducibleResearch, Software, Visualization |
46 |
-RoxygenNote: 5.0.1 |
|
46 |
+RoxygenNote: 6.0.1 |
... | ... |
@@ -69,7 +69,7 @@ geom_cladelabel <- function(node, label, offset=0, offset.text=0, |
69 | 69 |
mapping=mapping, data=data, geom=geom, hjust=hjust, |
70 | 70 |
position=position, show.legend = show.legend, |
71 | 71 |
inherit.aes = inherit.aes, na.rm=na.rm, |
72 |
- parse = parse, ...) |
|
72 |
+ parse = parse, ...) |
|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
layer_bar <- stat_cladeBar(node=node, offset=offset, align=align, |
... | ... |
@@ -84,7 +84,7 @@ geom_cladelabel <- function(node, label, offset=0, offset.text=0, |
84 | 84 |
align=align, size=fontsize, angle=angle, color=labelcolor, family=family, |
85 | 85 |
mapping=mapping, data=data, geom=geom, hjust=hjust, |
86 | 86 |
position=position, show.legend = show.legend, |
87 |
- inherit.aes = inherit.aes, na.rm=na.rm, parse=parse, ...) |
|
87 |
+ inherit.aes = inherit.aes, na.rm=na.rm, parse=parse, ...) |
|
88 | 88 |
|
89 | 89 |
} else { |
90 | 90 |
layer_text = stat_cladeText(node=node, label=label, offset=offset+offset.text, |
... | ... |
@@ -92,7 +92,7 @@ geom_cladelabel <- function(node, label, offset=0, offset.text=0, |
92 | 92 |
mapping=mapping, data=data, geom=geom, hjust=hjust, |
93 | 93 |
position=position, show.legend = show.legend, |
94 | 94 |
inherit.aes = inherit.aes, na.rm=na.rm, |
95 |
- parse = parse, ...) |
|
95 |
+ parse = parse, ...) |
|
96 | 96 |
} |
97 | 97 |
|
98 | 98 |
layer_bar <- stat_cladeBar(node=node, offset=offset, align=align, |
... | ... |
@@ -112,10 +112,10 @@ geom_cladelabel <- function(node, label, offset=0, offset.text=0, |
112 | 112 |
|
113 | 113 |
stat_cladeText <- function(mapping=NULL, data=NULL, |
114 | 114 |
geom="text", position="identity", |
115 |
- node, label, offset, align, ..., |
|
115 |
+ node, label, offset, align, ..., angle, |
|
116 | 116 |
show.legend=NA, inherit.aes=FALSE, |
117 | 117 |
na.rm=FALSE, parse=FALSE) { |
118 |
- default_aes <- aes_(x=~x, y=~y, node=~node, parent=~parent) |
|
118 |
+ default_aes <- aes_(x=~x, y=~y, node=~node, parent=~parent, angle=~angle) |
|
119 | 119 |
if (is.null(mapping)) { |
120 | 120 |
mapping <- default_aes |
121 | 121 |
} else { |
... | ... |
@@ -135,6 +135,7 @@ stat_cladeText <- function(mapping=NULL, data=NULL, |
135 | 135 |
align = align, |
136 | 136 |
na.rm = na.rm, |
137 | 137 |
parse = parse, |
138 |
+ angle_ = angle, |
|
138 | 139 |
...), |
139 | 140 |
check.aes = FALSE |
140 | 141 |
) |
... | ... |
@@ -169,38 +170,45 @@ stat_cladeBar <- function(mapping=NULL, data=NULL, |
169 | 170 |
} |
170 | 171 |
|
171 | 172 |
StatCladeText <- ggproto("StatCladeText", Stat, |
172 |
- compute_group = function(self, data, scales, params, node, label, offset, align) { |
|
173 |
- df <- get_cladelabel_position(data, node, offset, align, adjustRatio = 1.03) |
|
173 |
+ compute_group = function(self, data, scales, params, node, label, offset, align, angle_) { |
|
174 |
+ df <- get_cladelabel_position(data, node, offset, align, adjustRatio = 1.03, angle_) |
|
174 | 175 |
df$y <- mean(c(df$y, df$yend)) |
175 | 176 |
df$label <- label |
176 | 177 |
return(df) |
177 | 178 |
}, |
178 |
- required_aes = c("x", "y", "label") |
|
179 |
+ required_aes = c("x", "y", "label", "angle") |
|
179 | 180 |
) |
180 | 181 |
|
181 | 182 |
|
182 | 183 |
|
183 | 184 |
StatCladeBar <- ggproto("StatCladBar", Stat, |
184 | 185 |
compute_group = function(self, data, scales, params, node, offset, align) { |
185 |
- get_cladelabel_position(data, node, offset, align, adjustRatio=1.02) |
|
186 |
+ get_cladelabel_position(data, node, offset, align, adjustRatio=1.02, angle=0) |
|
186 | 187 |
}, |
187 | 188 |
required_aes = c("x", "y", "xend", "yend") |
188 | 189 |
) |
189 | 190 |
|
190 | 191 |
|
191 |
-get_cladelabel_position <- function(data, node, offset, align, adjustRatio) { |
|
192 |
- df <- get_cladelabel_position_(data, node) |
|
192 |
+get_cladelabel_position <- function(data, node, offset, align, adjustRatio, angle="auto") { |
|
193 |
+ df <- get_cladelabel_position_(data, node, angle) |
|
193 | 194 |
if (align) { |
194 | 195 |
mx <- max(data$x, na.rm=TRUE) |
195 | 196 |
} else { |
196 | 197 |
mx <- df$x |
197 | 198 |
} |
199 |
+ |
|
200 |
+ angle <- df$angle |
|
201 |
+ ## if (angle >= 90 & angle <=270) { |
|
202 |
+ ## angle <- angle + 180 |
|
203 |
+ ## } |
|
204 |
+ |
|
198 | 205 |
mx <- mx * adjustRatio + offset |
199 |
- data.frame(x=mx, xend=mx, y=df$y, yend=df$yend) |
|
206 |
+ |
|
207 |
+ data.frame(x=mx, xend=mx, y=df$y, yend=df$yend, angle=angle) |
|
200 | 208 |
} |
201 | 209 |
|
202 | 210 |
|
203 |
-get_cladelabel_position_ <- function(data, node) { |
|
211 |
+get_cladelabel_position_ <- function(data, node, angle="auto") { |
|
204 | 212 |
sp <- get.offspring.df(data, node) |
205 | 213 |
sp2 <- c(sp, node) |
206 | 214 |
sp.df <- data[match(sp2, data$node),] |
... | ... |
@@ -208,6 +216,16 @@ get_cladelabel_position_ <- function(data, node) { |
208 | 216 |
y <- sp.df$y |
209 | 217 |
y <- y[!is.na(y)] |
210 | 218 |
mx <- max(sp.df$x, na.rm=TRUE) |
211 |
- data.frame(x=mx, y=min(y), yend=max(y)) |
|
219 |
+ |
|
220 |
+ d <- data.frame(x=mx, y=min(y), yend=max(y)) |
|
221 |
+ if (missing(angle)) |
|
222 |
+ return(d) |
|
223 |
+ |
|
224 |
+ if (angle == "auto") { |
|
225 |
+ d$angle <- mean(range(sp.df$angle)) |
|
226 |
+ } else { |
|
227 |
+ d$angle <- angle |
|
228 |
+ } |
|
229 |
+ return(d) |
|
212 | 230 |
} |
213 | 231 |
|
... | ... |
@@ -4,9 +4,9 @@ ggtree: an R package for visualization and annotation of phylogenetic trees with |
4 | 4 |
|
5 | 5 |
<img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" /> |
6 | 6 |
|
7 |
-[](https://bioconductor.org/packages/ggtree) [](https://github.com/guangchuangyu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
7 |
+[](https://bioconductor.org/packages/ggtree) [](https://github.com/guangchuangyu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
8 | 8 |
|
9 |
-[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
9 |
+[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
10 | 10 |
|
11 | 11 |
[](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#archives) [](https://bioconductor.org/checkResults/devel/bioc-LATEST/ggtree/) [](https://travis-ci.org/GuangchuangYu/ggtree) [](https://ci.appveyor.com/project/GuangchuangYu/ggtree) |
12 | 12 |
|
... | ... |
@@ -27,7 +27,7 @@ Please cite the following article when using `ggtree`: |
27 | 27 |
|
28 | 28 |
**G Yu**, DK Smith, H Zhu, Y Guan, TTY Lam<sup>\*</sup>. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ***Methods in Ecology and Evolution***. 2017, 8(1):28-36. |
29 | 29 |
|
30 |
-[](http://dx.doi.org/10.1111/2041-210X.12628) [](https://www.altmetric.com/details/10533079) |
|
30 |
+[](http://dx.doi.org/10.1111/2041-210X.12628) [](https://www.altmetric.com/details/10533079) |
|
31 | 31 |
|
32 | 32 |
------------------------------------------------------------------------ |
33 | 33 |
|
... | ... |
@@ -53,30 +53,30 @@ Please cite the following article when using `ggtree`: |
53 | 53 |
|
54 | 54 |
### Download stats |
55 | 55 |
|
56 |
-[](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
56 |
+[](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
57 | 57 |
|
58 |
- ++-------------------+------------------+-------------------+------------------+--------------+ |
|
59 |
- 3000 + * + |
|
58 |
+ ++------------------+------------------+------------------+-----------------+-----------------+ |
|
59 |
+ 3000 + * + |
|
60 | 60 |
| | |
61 | 61 |
| | |
62 | 62 |
2500 + + |
63 | 63 |
| | |
64 | 64 |
| | |
65 | 65 |
| | |
66 |
- 2000 + + |
|
67 |
- | * * * | |
|
68 |
- | * * | |
|
66 |
+ 2000 + * + |
|
67 |
+ | * * * | |
|
68 |
+ | * * | |
|
69 | 69 |
1500 + + |
70 | 70 |
| | |
71 |
- | * | |
|
72 |
- | * * * * | |
|
73 |
- 1000 + * * + |
|
74 |
- | * * | |
|
75 |
- | * * * | |
|
76 |
- | * | |
|
77 |
- 500 + * * + |
|
78 |
- | * * | |
|
79 |
- | * | |
|
80 |
- 0 + * * * + |
|
81 |
- ++-------------------+------------------+-------------------+------------------+--------------+ |
|
82 |
- 2015 2015.5 2016 2016.5 2017 |
|
71 |
+ | * | |
|
72 |
+ | * * * * | |
|
73 |
+ 1000 + * * + |
|
74 |
+ | * * | |
|
75 |
+ | * * * | |
|
76 |
+ | * | |
|
77 |
+ 500 + * * + |
|
78 |
+ | * * | |
|
79 |
+ | * | |
|
80 |
+ 0 + * * * + |
|
81 |
+ ++------------------+------------------+------------------+-----------------+-----------------+ |
|
82 |
+ 2015 2015.5 2016 2016.5 2017 |
... | ... |
@@ -30,11 +30,10 @@ highlights the two direct descendant clades of an internal node |
30 | 30 |
Particularly useful when studying neighboring clades. Note that balances that |
31 | 31 |
correspond to multichotomies will not be displayed. |
32 | 32 |
} |
33 |
-\author{ |
|
34 |
-Justin Silverman |
|
35 |
-} |
|
36 | 33 |
\references{ |
37 | 34 |
J. Silverman, et al. \emph{A phylogenetic transform enhances |
38 | 35 |
analysis of compositional microbiota data}. (in preparation) |
39 | 36 |
} |
40 |
- |
|
37 |
+\author{ |
|
38 |
+Justin Silverman |
|
39 |
+} |
... | ... |
@@ -18,4 +18,3 @@ named list of subtrees with the root id of subtree and list of node id's making |
18 | 18 |
Get all subtrees of node, as well as remaining branches of parent (ie, rest of tree structure as subtree) |
19 | 19 |
return named list of subtrees with list name as starting node id. |
20 | 20 |
} |
21 |
- |
... | ... |
@@ -3,8 +3,9 @@ |
3 | 3 |
\docType{package} |
4 | 4 |
\name{ggtree} |
5 | 5 |
\alias{ggtree} |
6 |
-\alias{ggtree-package} |
|
7 | 6 |
\alias{package-ggtree} |
7 |
+\alias{ggtree-package} |
|
8 |
+\alias{ggtree} |
|
8 | 9 |
\title{visualizing phylogenetic tree and heterogenous associated data based on grammar of graphics |
9 | 10 |
\code{ggtree} provides functions for visualizing phylogenetic tree and its associated data in R.} |
10 | 11 |
\usage{ |
... | ... |
@@ -57,4 +58,3 @@ ggtree(tr) |
57 | 58 |
\author{ |
58 | 59 |
Yu Guangchuang |
59 | 60 |
} |
60 |
- |
... | ... |
@@ -3,12 +3,13 @@ |
3 | 3 |
\docType{methods} |
4 | 4 |
\name{gzoom} |
5 | 5 |
\alias{gzoom} |
6 |
+\alias{gzoom} |
|
7 |
+\alias{gzoom,ggtree-method} |
|
6 | 8 |
\alias{gzoom,beast-method} |
7 | 9 |
\alias{gzoom,codeml-method} |
8 |
-\alias{gzoom,ggtree-method} |
|
10 |
+\alias{gzoom,treedata-method} |
|
9 | 11 |
\alias{gzoom,paml_rst-method} |
10 | 12 |
\alias{gzoom,phylo-method} |
11 |
-\alias{gzoom,treedata-method} |
|
12 | 13 |
\title{gzoom method} |
13 | 14 |
\usage{ |
14 | 15 |
gzoom(object, focus, subtree = FALSE, widths = c(0.3, 0.7), ...) |
... | ... |
@@ -50,4 +51,3 @@ figure |
50 | 51 |
\description{ |
51 | 52 |
zoom selected subtree |
52 | 53 |
} |
53 |
- |
... | ... |
@@ -4,9 +4,9 @@ |
4 | 4 |
\name{scale_color} |
5 | 5 |
\alias{scale_color} |
6 | 6 |
\alias{scale_color,beast-method} |
7 |
+\alias{scale_color,treedata-method} |
|
7 | 8 |
\alias{scale_color,paml_rst-method} |
8 | 9 |
\alias{scale_color,phylo-method} |
9 |
-\alias{scale_color,treedata-method} |
|
10 | 10 |
\title{scale_color method} |
11 | 11 |
\usage{ |
12 | 12 |
scale_color(object, by, ...) |
... | ... |
@@ -33,4 +33,3 @@ color vector |
33 | 33 |
\description{ |
34 | 34 |
scale color by a numerical tree attribute |
35 | 35 |
} |
36 |
- |