Browse code

clean up docs

Guangchuang Yu authored on 01/10/2019 15:06:57
Showing3 changed files

1 1
deleted file mode 100644
... ...
@@ -1,97 +0,0 @@
1
-title: "ggtree utilities"
2
-author: "Guangchuang Yu and Tommy Tsan-Yuk Lam\\
3
-
4
-        School of Public Health, The University of Hong Kong"
5
-date: "`r Sys.Date()`"
6
-bibliography: ggtree.bib
7
-csl: nature.csl
8
-output:
9
-  prettydoc::html_pretty:
10
-    toc: true
11
-    theme: cayman
12
-    highlight: github
13
-  pdf_document:
14
-    toc: true
15
-vignette: >
16
-  %\VignetteIndexEntry{06 ggtree utilities}
17
-  %\VignetteEngine{knitr::rmarkdown}
18
-  %\usepackage[utf8]{inputenc}
19
-
20
-```{r style, echo=FALSE, results="asis", message=FALSE}
21
-knitr::opts_chunk$set(tidy = FALSE,
22
-		   message = FALSE)
23
-```
24
-
25
-
26
-```{r echo=FALSE, results="hide", message=FALSE}
27
-library("ape")
28
-library("ggplot2")
29
-library("ggtree")
30
-```
31
-
32
-# Layers that allows subsetting
33
-
34
-`Subsetting` is not supported in layers defined in `ggplot2`, while it is quite useful in phylogenetic annotation since it allows us to annotate at specific node(s).
35
-
36
-In `ggtree`, we provides modified version of layers defined in `ggplot2` to support `subsetting`, including:
37
-
38
-+ geom_segment2
39
-+ geom_point2
40
-+ geom_text2
41
-+ geom_label2
42
-
43
-```{r fig.width=5, fig.height=5}
44
-file <- system.file("extdata/BEAST", "beast_mcc.tree", package="treeio")
45
-beast <- read.beast(file)
46
-ggtree(beast) + geom_point2(aes(subset=!is.na(posterior) & posterior > 0.75), color='firebrick')
47
-```
48
-
49
-<!--
50
-
51
-# Multiple graphs on one page
52
-
53
-To support viewing multiple plots, ggtree provides `multiplot` function that similar to `gridExtra::grid.arrange` with extra feature of labeling the plots.
54
-
55
-
56
-#``` {r fig.width=8, fig.height=4, warning=FALSE}
57
-multiplot(ggtree(rtree(30)), ggtree(rtree(40)), ncol=2, labels=c('A', 'B'))
58
-#```
59
-
60
-# subplots in ggplot object
61
-
62
-`ggtree` implemented a function, `subview`, that can add subplots on a ggplot2 object.
63
-
64
-#``` {r fig.width=8, fig.height=8, warning=F}
65
-set.seed(2016-01-04)
66
-tr <- rtree(30)
67
-tr <- groupClade(tr, node=45)
68
-p <- ggtree(tr, aes(color=group)) + geom_tippoint()
69
-p1 <- p + geom_hilight(node=45)
70
-p2 <- viewClade(p, node=45) + geom_tiplab()
71
-subview(p2, p1+theme_transparent(), x=2.3, y=28.5)
72
-#```
73
-
74
-This is the backend of the [inset](advanceTreeAnnotation.html) function.
75
-
76
-This `subview` function works with any `ggplot` objects and it had successful applied to [plot pie graphs on map](http://stackoverflow.com/questions/10368180/plotting-pie-graphs-on-map-in-ggplot/32380396#32380396).
77
-
78
-#``` {r eval=FALSE}
79
-library(ggtree)
80
-dd <- data.frame(x=LETTERS[1:3], y=1:3)
81
-pie <- ggplot(dd, aes(x=1, y, fill=x)) + geom_bar(stat="identity", width=1) + coord_polar(theta="y") + theme_inset()
82
-x <- sample(2:9)
83
-y <- sample(2:9)
84
-width <- sample(seq(0.05, 0.15, length.out=length(x)))
85
-height <- width
86
-p <- ggplot(data=data.frame(x=c(0, 10), y=c(0, 10)), aes(x, y))+geom_blank()
87
-for (i in seq_along(x)) {
88
-    p <- subview(p, pie, x[i], y[i], width[i], height[i])
89
-    print(p)
90
-}
91
-#```
92
-![](figures/subview_animation.gif)
93
-
94
-
95 0
deleted file mode 100644
... ...
@@ -1,60 +0,0 @@
1
-
2
-# Tree annotation with analysis of R packages
3
-
4
-## annotating tree with ape bootstraping analysis
5
-
6
-```{r results='hide', message=FALSE}
7
-library(ape)
8
-data(woodmouse)
9
-d <- dist.dna(woodmouse)
10
-tr <- nj(d)
11
-bp <- boot.phylo(tr, woodmouse, function(xx) nj(dist.dna(xx)))
12
-```
13
-
14
-
15
-```{r fig.width=6, fig.height=6, warning=FALSE, fig.align="center"}
16
-library(treeio)
17
-tree <- as.treedata(tr, boot = bp)
18
-ggtree(tree) + geom_label(aes(label=bootstrap)) + geom_tiplab()
19
-```
20
-
21
-## annotating tree with phangorn output
22
-
23
-```{r results='hide', message=FALSE, fig.width=12, fig.height=10, width=60, warning=FALSE, fig.align="center", eval=FALSE}
24
-library(phangorn)
25
-treefile <- system.file("extdata", "pa.nwk", package="treeio")
26
-tre <- read.tree(treefile)
27
-tipseqfile <- system.file("extdata", "pa.fas", package="treeio")
28
-tipseq <- read.phyDat(tipseqfile,format="fasta")
29
-fit <- pml(tre, tipseq, k=4)
30
-fit <- optim.pml(fit, optNni=FALSE, optBf=T, optQ=T,
31
-                 optInv=T, optGamma=T, optEdge=TRUE,
32
-                 optRooted=FALSE, model = "GTR")
33
-
34
-phangorn <- phyPML(fit, type="ml")
35
-ggtree(phangorn) + geom_text(aes(x=branch, label=AA_subs, vjust=-.5))
36
-```
37
-
38
-![](figures/phangorn_example.png)
39
-
40
-
41
-## phylo4d
42
-
43
-`phylo4d` was defined in the `phylobase` package, which can be employed to integrate user's data with phylogenetic tree. `phylo4d` was supported in `ggtree` and the data stored in the object can be used directly to annotate the tree.
44
-
45
-```{r fig.width=6, fig.height=5, warning=FALSE, fig.align="center", eval=FALSE}
46
-dd2 <- dd[, -1]
47
-rownames(dd2) <- dd[,1]
48
-require(phylobase)
49
-tr2 <- phylo4d(tree, dd2)
50
-ggtree(tr2) + geom_tiplab(aes(color=place)) +
51
-    geom_tippoint(aes(size=value, shape=place, color=place), alpha=0.25)
52
-```
53
-
54
-
55
-![](figures/phylobase_example.png)
56
-
57
-## jplace file format
58
-
59
-`ggtree` provides `write.jplace()` function to store user's own data and associated newick tree to a single `jplace` file, which can be parsed directly in `ggtree` and user's data can be used to annotate the tree directly. For more detail, please refer to the [Tree Data Import](treeImport.html#jplace-file-format) vignette.
60
-
... ...
@@ -1,5 +1,5 @@
1 1
 ---
2
-title: "ggtree: phylogenetic tree visualization and annotation"
2
+title: "ggtree: tree visualization and annotation"
3 3
 author: "Guangchuang Yu\\
4 4
 
5 5
         School of Basic Medical Sciences, Southern Medical University"
... ...
@@ -45,12 +45,34 @@ Please go to <https://yulab-smu.github.io/treedata-book/> for the full vignette.
45 45
 
46 46
 If you use `r Biocpkg('ggtree')` in published research, please cite the most appropriate paper(s) from this list:
47 47
 
48
-1. __G Yu__, DK Smith, H Zhu, Y Guan, TTY Lam^\*^. ggtree: an R package for
48
+
49
+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.
50
+doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194).
51
+2. __G Yu__, DK Smith, H Zhu, Y Guan, TTY Lam^\*^. ggtree: an R package for
49 52
 visualization and annotation of phylogenetic trees with their covariates and
50 53
 other associated data. __*Methods in Ecology and Evolution*__. 2017, 8(1):28-36.
51 54
 doi: [10.1111/2041-210X.12628](https://doi.org/10.1111/2041-210X.12628).
52
-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.
53
-doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194).
55
+
56
+
57
+
58
+
59
+# Need helps?
60
+
61
+
62
+If you have questions/issues, please visit
63
+[ggtree homepage](https://guangchuangyu.github.io/software/ggtree/) first.
64
+Your problems are mostly documented. 
65
+
66
+
67
+If you think you found a bug, please follow
68
+[the guide](https://guangchuangyu.github.io/2016/07/how-to-bug-author/) and
69
+provide a reproducible example to be posted
70
+on
71
+[github issue tracker](https://github.com/GuangchuangYu/ggtree/issues).
72
+For questions, please post
73
+to [google group](https://groups.google.com/forum/#!forum/bioc-ggtree). Users
74
+are highly recommended to subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bioc-ggtree).
75
+
54 76
 
55 77
 
56 78
 
... ...
@@ -232,21 +254,3 @@ published images and links to related resources).
232 254
 -->
233 255
 
234 256
 
235
-# Need helps?
236
-
237
-
238
-If you have questions/issues, please visit
239
-[ggtree homepage](https://guangchuangyu.github.io/software/ggtree/) first.
240
-Your problems are mostly documented. 
241
-
242
-
243
-If you think you found a bug, please follow
244
-[the guide](https://guangchuangyu.github.io/2016/07/how-to-bug-author/) and
245
-provide a reproducible example to be posted
246
-on
247
-[github issue tracker](https://github.com/GuangchuangYu/ggtree/issues).
248
-For questions, please post
249
-to [google group](https://groups.google.com/forum/#!forum/bioc-ggtree). Users
250
-are highly recommended to subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bioc-ggtree).
251
-
252
-