git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@117445 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,5 +1,8 @@ |
1 | 1 |
CHANGES IN VERSION 1.5.3 |
2 | 2 |
------------------------ |
3 |
+ o add examples in vignettes <2016-05-13, Fri> |
|
4 |
+ + add fan layout example in treeVisualization vignette |
|
5 |
+ + add open_tree and rotate_tree example in treeManipulation vignette |
|
3 | 6 |
o add angle in ggtree function, fan layout supported <2016-05-12, Thu> |
4 | 7 |
o rotate_tree and open_tree function <2016-05-12, Thu> |
5 | 8 |
o support reading BEAST MCC trees (multiple trees in one file) via the read.beast function <2016-05-12, Thu> |
... | ... |
@@ -222,6 +222,19 @@ p2 <- rotate(p, 21) %>% rotate(17) |
222 | 222 |
multiplot(p, p2, ncol=2) |
223 | 223 |
``` |
224 | 224 |
|
225 |
+```{r eval=F} |
|
226 |
+set.seed(2016-05-29) |
|
227 |
+p <- ggtree(tree <- rtree(50)) + geom_tiplab() |
|
228 |
+for (n in reorder(tree, 'postorder')$edge[,1] %>% unique) { |
|
229 |
+ p <- rotate(p, n) |
|
230 |
+ print(p + geom_point2(aes(subset = (node == n)), color='red')) |
|
231 |
+} |
|
232 |
+``` |
|
233 |
+ |
|
234 |
+ |
|
235 |
+ |
|
236 |
+ |
|
237 |
+ |
|
225 | 238 |
# flip clade |
226 | 239 |
|
227 | 240 |
The positions of two selected clades (should share a same parent) can be flip over using __`flip`__ function. |
... | ... |
@@ -229,3 +242,34 @@ The positions of two selected clades (should share a same parent) can be flip ov |
229 | 242 |
```{r fig.width=8, fig.height=4} |
230 | 243 |
multiplot(p, flip(p, 17, 21), ncol=2) |
231 | 244 |
``` |
245 |
+ |
|
246 |
+ |
|
247 |
+# open tree |
|
248 |
+ |
|
249 |
+`ggtree` supports `fan` layout and can also transform the `circular` layout tree to a `fan` tree by specifying an open `angle` to `open_tree` function. |
|
250 |
+ |
|
251 |
+```{r eval=FALSE} |
|
252 |
+set.seed(123) |
|
253 |
+tr = rtree(50) |
|
254 |
+ |
|
255 |
+p <- ggtree(tr, layout='circular') + geom_tiplab2() |
|
256 |
+ |
|
257 |
+for (angle in seq(0, 270, 10)) { |
|
258 |
+ print(open_tree(p, angle=angle) + ggtitle(paste("open angle:", angle))) |
|
259 |
+} |
|
260 |
+``` |
|
261 |
+ |
|
262 |
+ |
|
263 |
+ |
|
264 |
+ |
|
265 |
+# rotate tree |
|
266 |
+ |
|
267 |
+Rotating a `circular` tree is supported by `rotate_tree` function. |
|
268 |
+ |
|
269 |
+```{r eval=FALSE} |
|
270 |
+for (angle in seq(0, 270, 10)) { |
|
271 |
+ print(rotate_tree(p, angle) + ggtitle(paste("rotate angle:", angle))) |
|
272 |
+} |
|
273 |
+``` |
|
274 |
+ |
|
275 |
+ |
... | ... |
@@ -74,7 +74,8 @@ Currently, _`ggtree`_ supports several layouts, including: |
74 | 74 |
|
75 | 75 |
+ `rectangular` (by default) |
76 | 76 |
+ `slanted` |
77 |
-+ `fan` or `circular` |
|
77 |
++ `circular` |
|
78 |
++ `fan` |
|
78 | 79 |
|
79 | 80 |
for `Phylogram` (by default) and `Cladogram` if user explicitly setting `branch.length='none'`. |
80 | 81 |
`ggtree` also supports `unrooted` layout. |
... | ... |
@@ -100,6 +101,13 @@ __`circular`__ |
100 | 101 |
ggtree(tree, layout="circular") + ggtitle("(Phylogram) circular layout") |
101 | 102 |
``` |
102 | 103 |
|
104 |
+__`fan`__ |
|
105 |
+ |
|
106 |
+```{r fig.height=5, fig.width=5, fig.align="center"} |
|
107 |
+ggtree(tree, layout="fan", open.angle=180) + ggtitle("(Phylogram) circular layout") |
|
108 |
+``` |
|
109 |
+ |
|
110 |
+ |
|
103 | 111 |
## Cladogram |
104 | 112 |
|
105 | 113 |
__`rectangular`__ |
... | ... |
@@ -120,6 +128,13 @@ __`circular`__ |
120 | 128 |
ggtree(tree, layout="circular", branch.length="none") + ggtitle("(Cladogram) circular layout") |
121 | 129 |
``` |
122 | 130 |
|
131 |
+__`fan`__ |
|
132 |
+ |
|
133 |
+```{r fig.height=5, fig.width=5, fig.align="center"} |
|
134 |
+ggtree(tree, layout="fan", open.angle=180, branch.length="none") + ggtitle("(Cladogram) circular layout") |
|
135 |
+``` |
|
136 |
+ |
|
137 |
+ |
|
123 | 138 |
## Unrooted |
124 | 139 |
|
125 | 140 |
Unrooted layout was implemented by the _`equal-angle algorithm`_ that described in _Inferring Phylogenies_[@felsenstein_inferring_2003 pp.578-580]. |