... | ... |
@@ -2,12 +2,12 @@ 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.15.3 |
|
5 |
+Version: 1.15.4 |
|
6 | 6 |
Authors@R: c( |
7 | 7 |
person("Guangchuang", "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-6485-8781")), |
8 | 8 |
person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com", role = c("aut", "ths")), |
9 | 9 |
person("Justin", "Silverman", email = "jsilve24@gmail.com", role = "ctb"), |
10 |
- person("Bradley", "Jones", email = "brj1@sfu.ca", role = "ctb"), |
|
10 |
+ person("Bradley", "Jones", email = "brj1@sfu.ca", role = "ctb"), |
|
11 | 11 |
person("Watal M.", "Iwasaki", email = "heavy.watal@gmail.com", role = "ctb") |
12 | 12 |
) |
13 | 13 |
Maintainer: Guangchuang Yu <guangchuangyu@gmail.com> |
... | ... |
@@ -39,7 +39,6 @@ Suggests: |
39 | 39 |
emojifont, |
40 | 40 |
ggimage, |
41 | 41 |
knitr, |
42 |
- prettydoc, |
|
43 | 42 |
rmarkdown, |
44 | 43 |
testthat |
45 | 44 |
Remotes: |
... | ... |
@@ -4,20 +4,15 @@ author: "Guangchuang Yu\\ |
4 | 4 |
|
5 | 5 |
School of Basic Medical Sciences, Southern Medical University" |
6 | 6 |
date: "`r Sys.Date()`" |
7 |
-bibliography: ggtree.bib |
|
8 |
-biblio-style: apalike |
|
9 | 7 |
output: |
10 |
- prettydoc::html_pretty: |
|
8 |
+ html_document: |
|
11 | 9 |
toc: true |
12 |
- theme: cayman |
|
13 |
- highlight: github |
|
14 | 10 |
pdf_document: |
15 | 11 |
toc: true |
16 | 12 |
vignette: > |
17 |
- %\VignetteIndexEntry{01 ggtree Introduction} |
|
13 |
+ %\VignetteIndexEntry{ggtree} |
|
18 | 14 |
%\VignetteEngine{knitr::rmarkdown} |
19 | 15 |
%\usepackage[utf8]{inputenc} |
20 |
- %\VignetteEncoding{UTF-8} |
|
21 | 16 |
--- |
22 | 17 |
|
23 | 18 |
```{r style, echo=FALSE, results="asis", message=FALSE} |
... | ... |
@@ -39,11 +34,9 @@ Biocpkg <- function (pkg) { |
39 | 34 |
|
40 | 35 |
``` |
41 | 36 |
|
42 |
-> You can't even begin to understand biology, you can't understand life, unless |
|
43 |
-> you understand what it's all there for, how it arose - and that means |
|
44 |
-> evolution. |
|
45 |
-> |
|
46 |
-> --- Richard Dawkins |
|
37 |
+# Vignette |
|
38 |
+ |
|
39 |
+Please go to <https://yulab-smu.github.io/treedata-book/> for the full vignette. |
|
47 | 40 |
|
48 | 41 |
|
49 | 42 |
# Citation |
... | ... |
@@ -59,6 +52,8 @@ doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194). |
59 | 52 |
|
60 | 53 |
|
61 | 54 |
|
55 |
+<!-- |
|
56 |
+ |
|
62 | 57 |
# Introduction |
63 | 58 |
|
64 | 59 |
This project arose from our needs to annotate nucleotide substitutions in the |
... | ... |
@@ -232,13 +227,18 @@ the [Tree Annotation](treeAnnotation.html) vignette. |
232 | 227 |
information about the package, more documentation, a gallery of beautiful |
233 | 228 |
published images and links to related resources). |
234 | 229 |
|
230 |
+--> |
|
231 |
+ |
|
235 | 232 |
|
236 | 233 |
# Need helps? |
237 | 234 |
|
238 | 235 |
|
239 | 236 |
If you have questions/issues, please visit |
240 | 237 |
[ggtree homepage](https://guangchuangyu.github.io/software/ggtree/) first. |
241 |
-Your problems are mostly documented. If you think you found a bug, please follow |
|
238 |
+Your problems are mostly documented. |
|
239 |
+ |
|
240 |
+ |
|
241 |
+If you think you found a bug, please follow |
|
242 | 242 |
[the guide](https://guangchuangyu.github.io/2016/07/how-to-bug-author/) and |
243 | 243 |
provide a reproducible example to be posted |
244 | 244 |
on |
... | ... |
@@ -248,14 +248,3 @@ to [google group](https://groups.google.com/forum/#!forum/bioc-ggtree). Users |
248 | 248 |
are highly recommended to subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bioc-ggtree). |
249 | 249 |
|
250 | 250 |
|
251 |
- |
|
252 |
-# Session info |
|
253 |
- |
|
254 |
-Here is the output of `sessionInfo()` on the system on which this document was compiled: |
|
255 |
- |
|
256 |
-```{r echo=FALSE} |
|
257 |
-sessionInfo() |
|
258 |
-``` |
|
259 |
- |
|
260 |
- |
|
261 |
-# References |
262 | 251 |
deleted file mode 100644 |
... | ... |
@@ -1,285 +0,0 @@ |
1 |
- |
|
2 |
-@article{schliep_phangorn_2011, |
|
3 |
- title = {phangorn: phylogenetic analysis in R}, |
|
4 |
- volume = {27}, |
|
5 |
- url = {http://bioinformatics.oxfordjournals.org/content/27/4/592.abstract}, |
|
6 |
- doi = {10.1093/bioinformatics/btq706}, |
|
7 |
- shorttitle = {phangorn}, |
|
8 |
- abstract = {Summary: phangorn is a package for phylogenetic reconstruction and analysis in the R language. Previously it was only possible to estimate phylogenetic trees with distance methods in R. phangorn, now offers the possibility of reconstructing phylogenies with distance based methods, maximum parsimony or maximum likelihood ({ML}) and performing Hadamard conjugation. Extending the general {ML} framework, this package provides the possibility of estimating mixture and partition models. Furthermore, phangorn offers several functions for comparing trees, phylogenetic models or splits, simulating character data and performing congruence analyses.Availability: phangorn can be obtained through the {CRAN} homepage http://cran.r-project.org/web/packages/phangorn/index.html. phangorn is licensed under {GPL} 2.Contact: klaus.kschliep@snv.jussieu.{frSupplementary} information: Supplementary data are available at Bioinformatics online.}, |
|
9 |
- pages = {592--593}, |
|
10 |
- number = {4}, |
|
11 |
- journaltitle = {Bioinformatics}, |
|
12 |
- author = {Schliep, Klaus Peter}, |
|
13 |
- urldate = {2011-03-05}, |
|
14 |
- date = {2011-02-15} |
|
15 |
-} |
|
16 |
- |
|
17 |
-@article{hohna_probabilistic_2014, |
|
18 |
- title = {Probabilistic Graphical Model Representation in Phylogenetics}, |
|
19 |
- volume = {63}, |
|
20 |
- issn = {1063-5157, 1076-836X}, |
|
21 |
- url = {http://sysbio.oxfordjournals.org/content/63/5/753}, |
|
22 |
- doi = {10.1093/sysbio/syu039}, |
|
23 |
- abstract = {Recent years have seen a rapid expansion of the model space explored in statistical phylogenetics, emphasizing the need for new approaches to statistical model representation and software development. Clear communication and representation of the chosen model is crucial for: (i) reproducibility of an analysis, (ii) model development, and (iii) software design. Moreover, a unified, clear and understandable framework for model representation lowers the barrier for beginners and nonspecialists to grasp complex phylogenetic models, including their assumptions and parameter/variable dependencies. Graphical modeling is a unifying framework that has gained in popularity in the statistical literature in recent years. The core idea is to break complex models into conditionally independent distributions. The strength lies in the comprehensibility, flexibility, and adaptability of this formalism, and the large body of computational work based on it. Graphical models are well-suited to teach statistical models, to facilitate communication among phylogeneticists and in the development of generic software for simulation and statistical inference. Here, we provide an introduction to graphical models for phylogeneticists and extend the standard graphical model representation to the realm of phylogenetics. We introduce a new graphical model component, tree plates, to capture the changing structure of the subgraph corresponding to a phylogenetic tree. We describe a range of phylogenetic models using the graphical model framework and introduce modules to simplify the representation of standard components in large and complex models. Phylogenetic model graphs can be readily used in simulation, maximum likelihood inference, and Bayesian inference using, for example, Metropolis–Hastings or Gibbs sampling of the posterior distribution. [Computation; graphical models; inference; modularization; statistical phylogenetics; tree plate.]}, |
|
24 |
- pages = {753--771}, |
|
25 |
- number = {5}, |
|
26 |
- journaltitle = {Systematic Biology}, |
|
27 |
- shortjournal = {Syst Biol}, |
|
28 |
- author = {Höhna, Sebastian and Heath, Tracy A. and Boussau, Bastien and Landis, Michael J. and Ronquist, Fredrik and Huelsenbeck, John P.}, |
|
29 |
- urldate = {2015-11-17}, |
|
30 |
- date = {2014-09-01}, |
|
31 |
- langid = {english}, |
|
32 |
- pmid = {24951559} |
|
33 |
-} |
|
34 |
- |
|
35 |
-@article{boussau_genome-scale_2013, |
|
36 |
- title = {Genome-scale coestimation of species and gene trees}, |
|
37 |
- volume = {23}, |
|
38 |
- issn = {1088-9051, 1549-5469}, |
|
39 |
- url = {http://genome.cshlp.org/content/23/2/323}, |
|
40 |
- doi = {10.1101/gr.141978.112}, |
|
41 |
- abstract = {Comparisons of gene trees and species trees are key to understanding major processes of genome evolution such as gene duplication and loss. Because current methods to reconstruct phylogenies fail to model the two-way dependency between gene trees and the species tree, they often misrepresent gene and species histories. We present a new probabilistic model to jointly infer rooted species and gene trees for dozens of genomes and thousands of gene families. We use simulations to show that this method accurately infers the species tree and gene trees, is robust to misspecification of the models of sequence and gene family evolution, and provides a precise historic record of gene duplications and losses throughout genome evolution. We simultaneously reconstruct the history of mammalian species and their genes based on 36 completely sequenced genomes, and use the reconstructed gene trees to infer the gene content and organization of ancestral mammalian genomes. We show that our method yields a more accurate picture of ancestral genomes than the trees available in the authoritative database Ensembl.}, |
|
42 |
- pages = {323--330}, |
|
43 |
- number = {2}, |
|
44 |
- journaltitle = {Genome Research}, |
|
45 |
- shortjournal = {Genome Res.}, |
|
46 |
- author = {Boussau, Bastien and Szöllősi, Gergely J. and Duret, Laurent and Gouy, Manolo and Tannier, Eric and Daubin, Vincent}, |
|
47 |
- urldate = {2015-11-17}, |
|
48 |
- date = {2013-02-01}, |
|
49 |
- langid = {english}, |
|
50 |
- pmid = {23132911} |
|
51 |
-} |
|
52 |
- |
|
53 |
-@book{felsenstein_inferring_2003, |
|
54 |
- address = {Sunderland, Mass}, |
|
55 |
- edition = {2 edition}, |
|
56 |
- title = {Inferring Phylogenies}, |
|
57 |
- isbn = {9780878931774}, |
|
58 |
- abstract = {Phylogenies (evolutionary trees) are basic to thinking about and analyzing differences between species. Statistical, computational, and algorithmic work on them has been ongoing for four decades, with great advances in understanding. Yet no book has summarized this work until now. Inferring Phylogenies explains clearly the assumptions and logic of making inferences about phylogenies, and using them to make inferences about evolutionary processes. It is an essential text and reference for anyone who wants to understand how phylogenies are reconstructed and how they are used. As phylogenies are inferred with various kinds of data, this book concentrates on some of the central ones: discretely coded characters, molecular sequences, gene frequencies, and quantitative traits. Also covered are restriction sites, {RAPDs}, and microsatellites. Inferring Phylogenies is intended for graduate-level courses, assuming some knowledge of statistics, mathematics (calculus and fundamental matrix algebra), molecular sequences, and quantitative genetics.}, |
|
59 |
- language = {English}, |
|
60 |
- publisher = {Sinauer Associates}, |
|
61 |
- author = {Felsenstein, Joseph}, |
|
62 |
- month = sep, |
|
63 |
- year = {2003} |
|
64 |
-} |
|
65 |
- |
|
66 |
-@book{wickham_ggplot2_2009, |
|
67 |
- edition = {1}, |
|
68 |
- title = {ggplot2: Elegant Graphics for Data Analysis}, |
|
69 |
- isbn = {0387981403}, |
|
70 |
- shorttitle = {ggplot2}, |
|
71 |
- publisher = {Springer}, |
|
72 |
- author = {Wickham, Hadley}, |
|
73 |
- month = aug, |
|
74 |
- year = {2009} |
|
75 |
-} |
|
76 |
- |
|
77 |
-@article{paradis_ape_2004, |
|
78 |
- title = {{APE}: Analyses of Phylogenetics and Evolution in R language}, |
|
79 |
- volume = {20}, |
|
80 |
- shorttitle = {{APE}}, |
|
81 |
- url = {http://bioinformatics.oxfordjournals.org/content/20/2/289.abstract}, |
|
82 |
- doi = {10.1093/bioinformatics/btg412}, |
|
83 |
- abstract = {Summary: Analysis of Phylogenetics and Evolution ({APE}) is a package written in the R language for use in molecular evolution and phylogenetics. {APE} provides both utility functions for reading and writing data and manipulating phylogenetic trees, as well as several advanced methods for phylogenetic and evolutionary analysis (e.g. comparative and population genetic methods). {APE} takes advantage of the many R functions for statistics and graphics, and also provides a flexible framework for developing and implementing further statistical methods for the analysis of evolutionary processes.Availability: The program is free and available from the official R package archive at http://cran.r-project.org/src/contrib/{PACKAGES}.html\#ape. {APE} is licensed under the {GNU} General Public License.}, |
|
84 |
- number = {2}, |
|
85 |
- urldate = {2011-03-04}, |
|
86 |
- journal = {Bioinformatics}, |
|
87 |
- author = {Paradis, Emmanuel and Claude, Julien and Strimmer, Korbinian}, |
|
88 |
- month = jan, |
|
89 |
- year = {2004}, |
|
90 |
- pages = {289--290} |
|
91 |
-} |
|
92 |
- |
|
93 |
-@article{matsen_pplacer_2010, |
|
94 |
- title = {pplacer: linear time maximum-likelihood and Bayesian phylogenetic placement of sequences onto a fixed reference tree}, |
|
95 |
- volume = {11}, |
|
96 |
- issn = {1471-2105}, |
|
97 |
- shorttitle = {pplacer}, |
|
98 |
- url = {http://www.biomedcentral.com.eproxy1.lib.hku.hk/1471-2105/11/538}, |
|
99 |
- doi = {10.1186/1471-2105-11-538}, |
|
100 |
- language = {en}, |
|
101 |
- number = {1}, |
|
102 |
- urldate = {2015-01-05}, |
|
103 |
- journal = {{BMC} Bioinformatics}, |
|
104 |
- author = {Matsen, Frederick A and Kodner, Robin B and Armbrust, E Virginia}, |
|
105 |
- year = {2010}, |
|
106 |
- pages = {538} |
|
107 |
-} |
|
108 |
- |
|
109 |
-@article{matsen_format_2012, |
|
110 |
- title = {A Format for Phylogenetic Placements}, |
|
111 |
- volume = {7}, |
|
112 |
- url = {http://dx.doi.org/10.1371/journal.pone.0031009}, |
|
113 |
- doi = {10.1371/journal.pone.0031009}, |
|
114 |
- abstract = {We have developed a unified format for phylogenetic placements, that is, mappings of environmental sequence data (e.g., short reads) into a phylogenetic tree. We are motivated to do so by the growing number of tools for computing and post-processing phylogenetic placements, and the lack of an established standard for storing them. The format is lightweight, versatile, extensible, and is based on the {JSON} format, which can be parsed by most modern programming languages. Our format is already implemented in several tools for computing and post-processing parsimony- and likelihood-based phylogenetic placements and has worked well in practice. We believe that establishing a standard format for analyzing read placements at this early stage will lead to a more efficient development of powerful and portable post-analysis tools for the growing applications of phylogenetic placement.}, |
|
115 |
- number = {2}, |
|
116 |
- urldate = {2015-01-05}, |
|
117 |
- journal = {{PLoS} {ONE}}, |
|
118 |
- author = {Matsen, Frederick A. and Hoffman, Noah G. and Gallagher, Aaron and Stamatakis, Alexandros}, |
|
119 |
- month = feb, |
|
120 |
- year = {2012}, |
|
121 |
- pages = {e31009} |
|
122 |
-} |
|
123 |
- |
|
124 |
-@article{berger_EPA_2011, |
|
125 |
- title = {Performance, accuracy, and Web server for evolutionary placement of short sequence reads under maximum likelihood}, |
|
126 |
- volume = {60}, |
|
127 |
- issn = {1076-836X}, |
|
128 |
- doi = {10.1093/sysbio/syr010}, |
|
129 |
- abstract = {We present an evolutionary placement algorithm ({EPA}) and a Web server for the rapid assignment of sequence fragments (short reads) to edges of a given phylogenetic tree under the maximum-likelihood model. The accuracy of the algorithm is evaluated on several real-world data sets and compared with placement by pair-wise sequence comparison, using edit distances and {BLAST}. We introduce a slow and accurate as well as a fast and less accurate placement algorithm. For the slow algorithm, we develop additional heuristic techniques that yield almost the same run times as the fast version with only a small loss of accuracy. When those additional heuristics are employed, the run time of the more accurate algorithm is comparable with that of a simple {BLAST} search for data sets with a high number of short query sequences. Moreover, the accuracy of the {EPA} is significantly higher, in particular when the sample of taxa in the reference topology is sparse or inadequate. Our algorithm, which has been integrated into {RAxML}, therefore provides an equally fast but more accurate alternative to {BLAST} for tree-based inference of the evolutionary origin and composition of short sequence reads. We are also actively developing a Web server that offers a freely available service for computing read placements on trees using the {EPA}.}, |
|
130 |
- language = {eng}, |
|
131 |
- number = {3}, |
|
132 |
- journal = {Systematic Biology}, |
|
133 |
- author = {Berger, Simon A. and Krompass, Denis and Stamatakis, Alexandros}, |
|
134 |
- month = may, |
|
135 |
- year = {2011}, |
|
136 |
- pmid = {21436105}, |
|
137 |
- pmcid = {PMC3078422}, |
|
138 |
- keywords = {Algorithms, Amino Acid Sequence, Base Sequence, Computer Simulation, Evolution, Molecular, Internet, Likelihood Functions, Phylogeny, Sequence Alignment, Sequence Analysis, {DNA}, Sequence Analysis, Protein, Sequence Analysis, {RNA}, Software}, |
|
139 |
- pages = {291--302} |
|
140 |
-} |
|
141 |
- |
|
142 |
-@article{stamatakis_raxml_2014, |
|
143 |
- title = {{RAxML} Version 8: A tool for Phylogenetic Analysis and Post-Analysis of Large Phylogenies}, |
|
144 |
- issn = {1367-4803, 1460-2059}, |
|
145 |
- url = {http://bioinformatics.oxfordjournals.org.eproxy2.lib.hku.hk/content/early/2014/01/21/bioinformatics.btu033}, |
|
146 |
- doi = {10.1093/bioinformatics/btu033}, |
|
147 |
- shorttitle = {{RAxML} Version 8}, |
|
148 |
- abstract = {Motivation: Phylogenies are increasingly used in all fields of medical and biological research. Moreover, because of the next generation sequencing revolution, datasets used for conducting phylogenetic analyses grow at an unprecedented pace. {RAxML} (Randomized Axelerated Maximum Likelihood) is a popular program for phylogenetic analyses of large datasets under maximum likelihood. Since the last {RAxML} paper in 2006, it has been continuously maintained and extended to accommodate the increasingly growing input datasets and to serve the needs of the user community. |
|
149 |
-Results: I present some of the most notable new features and extensions of {RAxML}, such as, a substantial extension of substitution models and supported data types, the introduction of {SSE}3, {AVX}, and {AVX}2 vector intrinsics, techniques for reducing the memory requirements of the code and a plethora of operations for conducting post-analyses on sets of trees. In addition, an up-to-date, 50 page user manual covering all new {RAxML} options is available. |
|
150 |
-Availability: The code is available under {GNU} {GPL} at https://github.com/stamatak/standard-{RAxML}. |
|
151 |
-Contact: Alexandros.Stamatakis@h-its.org}, |
|
152 |
- pages = {btu033}, |
|
153 |
- journaltitle = {Bioinformatics}, |
|
154 |
- shortjournal = {Bioinformatics}, |
|
155 |
- author = {Stamatakis, Alexandros}, |
|
156 |
- urldate = {2015-12-28}, |
|
157 |
- date = {2014-01-21}, |
|
158 |
- langid = {english}, |
|
159 |
- pmid = {24451623} |
|
160 |
-} |
|
161 |
- |
|
162 |
-@article{mcmurdie_phyloseq_2013, |
|
163 |
- title = {phyloseq: An R Package for Reproducible Interactive Analysis and Graphics of Microbiome Census Data}, |
|
164 |
- volume = {8}, |
|
165 |
- shorttitle = {phyloseq}, |
|
166 |
- url = {http://dx.doi.org/10.1371/journal.pone.0061217}, |
|
167 |
- doi = {10.1371/journal.pone.0061217}, |
|
168 |
- abstract = {{BackgroundThe} analysis of microbial communities through {DNA} sequencing brings many challenges: the integration of different types of data with methods from ecology, genetics, phylogenetics, multivariate statistics, visualization and testing. With the increased breadth of experimental designs now being pursued, project-specific statistical analyses are often needed, and these analyses are often difficult (or impossible) for peer researchers to independently reproduce. The vast majority of the requisite tools for performing these analyses reproducibly are already implemented in R and its extensions (packages), but with limited support for high throughput microbiome census data.{ResultsHere} we describe a software project, phyloseq, dedicated to the object-oriented representation and analysis of microbiome census data in R. It supports importing data from a variety of common formats, as well as many analysis techniques. These include calibration, filtering, subsetting, agglomeration, multi-table comparisons, diversity analysis, parallelized Fast {UniFrac}, ordination methods, and production of publication-quality graphics; all in a manner that is easy to document, share, and modify. We show how to apply functions from other R packages to phyloseq-represented data, illustrating the availability of a large number of open source analysis techniques. We discuss the use of phyloseq with tools for reproducible research, a practice common in other fields but still rare in the analysis of highly parallel microbiome census data. We have made available all of the materials necessary to completely reproduce the analysis and figures included in this article, an example of best practices for reproducible research.{ConclusionsThe} phyloseq project for R is a new open-source software package, freely available on the web from both {GitHub} and Bioconductor.}, |
|
169 |
- number = {4}, |
|
170 |
- urldate = {2015-01-05}, |
|
171 |
- journal = {{PLoS} {ONE}}, |
|
172 |
- author = {McMurdie, Paul J. and Holmes, Susan}, |
|
173 |
- month = apr, |
|
174 |
- year = {2013}, |
|
175 |
- pages = {e61217} |
|
176 |
-} |
|
177 |
- |
|
178 |
-@article{marazzi_locating_2012, |
|
179 |
- title = {Locating Evolutionary Precursors on a Phylogenetic Tree}, |
|
180 |
- volume = {66}, |
|
181 |
- rights = {© 2012 The Author(s). Evolution© 2012 The Society for the Study of Evolution.}, |
|
182 |
- issn = {1558-5646}, |
|
183 |
- url = {http://onlinelibrary.wiley.com.eproxy2.lib.hku.hk/doi/10.1111/j.1558-5646.2012.01720.x/abstract}, |
|
184 |
- doi = {10.1111/j.1558-5646.2012.01720.x}, |
|
185 |
- abstract = {Conspicuous innovations in the history of life are often preceded by more cryptic genetic and developmental precursors. In many cases, these appear to be associated with recurring origins of very similar traits in close relatives (parallelisms) or striking convergences separated by deep time (deep homologies). Although the phylogenetic distribution of gain and loss of traits hints strongly at the existence of such precursors, no models of trait evolution currently permit inference about their location on a tree. Here we develop a new stochastic model, which explicitly captures the dependency implied by a precursor and permits estimation of precursor locations. We apply it to the evolution of extrafloral nectaries ({EFNs}), an ecologically significant trait mediating a widespread mutualism between plants and ants. In legumes, a species-rich clade with morphologically diverse {EFNs}, the precursor model fits the data on {EFN} occurrences significantly better than conventional models. The model generates explicit hypotheses about the phylogenetic location of hypothetical precursors, which may help guide future studies of molecular genetic pathways underlying nectary position, development, and function.}, |
|
186 |
- pages = {3918--3930}, |
|
187 |
- number = {12}, |
|
188 |
- journaltitle = {Evolution}, |
|
189 |
- author = {Marazzi, Brigitte and Ané, Cécile and Simon, Marcelo F. and Delgado-Salinas, Alfonso and Luckow, Melissa and Sanderson, Michael J.}, |
|
190 |
- urldate = {2015-12-28}, |
|
191 |
- date = {2012-12-01}, |
|
192 |
- langid = {english}, |
|
193 |
- keywords = {Deep homology, extra-floral nectary, homoplasy, trait evolution} |
|
194 |
-} |
|
195 |
- |
|
196 |
-@article{yang_paml_2007, |
|
197 |
- title = {{PAML} 4: Phylogenetic Analysis by Maximum Likelihood}, |
|
198 |
- volume = {24}, |
|
199 |
- issn = {0737-4038, 1537-1719}, |
|
200 |
- shorttitle = {{PAML} 4}, |
|
201 |
- url = {http://mbe.oxfordjournals.org/content/24/8/1586}, |
|
202 |
- doi = {10.1093/molbev/msm088}, |
|
203 |
- abstract = {{PAML}, currently in version 4, is a package of programs for phylogenetic analyses of {DNA} and protein sequences using maximum likelihood ({ML}). The programs may be used to compare and test phylogenetic trees, but their main strengths lie in the rich repertoire of evolutionary models implemented, which can be used to estimate parameters in models of sequence evolution and to test interesting biological hypotheses. Uses of the programs include estimation of synonymous and nonsynonymous rates ({dN} and {dS}) between two protein-coding {DNA} sequences, inference of positive Darwinian selection through phylogenetic comparison of protein-coding genes, reconstruction of ancestral genes and proteins for molecular restoration studies of extinct life forms, combined analysis of heterogeneous data sets from multiple gene loci, and estimation of species divergence times incorporating uncertainties in fossil calibrations. This note discusses some of the major applications of the package, which includes example data sets to demonstrate their use. The package is written in {ANSI} C, and runs under Windows, Mac {OSX}, and {UNIX} systems. It is available at http://abacus.gene.ucl.ac.uk/software/paml.html.}, |
|
204 |
- language = {en}, |
|
205 |
- number = {8}, |
|
206 |
- urldate = {2015-01-05}, |
|
207 |
- journal = {Molecular Biology and Evolution}, |
|
208 |
- author = {Yang, Ziheng}, |
|
209 |
- month = aug, |
|
210 |
- year = {2007}, |
|
211 |
- pmid = {17483113}, |
|
212 |
- keywords = {codon models, likelihood, {PAML}, phylogenetic analysis, Software}, |
|
213 |
- pages = {1586--1591}, |
|
214 |
- file = {Full Text PDF:/home/ygc/baiduYun/Zotero/storage/53H9DMTJ/Yang - 2007 - PAML 4 Phylogenetic Analysis by Maximum Likelihoo.pdf:application/pdf;Snapshot:/home/ygc/baiduYun/Zotero/storage/7VIHDNKN/1586.html:text/html} |
|
215 |
-} |
|
216 |
- |
|
217 |
-@article{pond_hyphy_2005, |
|
218 |
- title = {{HyPhy}: hypothesis testing using phylogenies}, |
|
219 |
- volume = {21}, |
|
220 |
- issn = {1367-4803, 1460-2059}, |
|
221 |
- shorttitle = {{HyPhy}}, |
|
222 |
- url = {http://bioinformatics.oxfordjournals.org.eproxy1.lib.hku.hk/content/21/5/676}, |
|
223 |
- doi = {10.1093/bioinformatics/bti079}, |
|
224 |
- abstract = {Summary: The {HyPhypackage} is designed to provide a flexible and unified platform for carrying out likelihood-based analyses on multiple alignments of molecular sequence data, with the emphasis on studies of rates and patterns of sequence evolution. |
|
225 |
-Availability: http://www.hyphy.org |
|
226 |
-Contact: muse@stat.ncsu.edu |
|
227 |
-Supplementary information: {HyPhydocumentation} and tutorials are available at http://www.hyphy.org}, |
|
228 |
- language = {en}, |
|
229 |
- number = {5}, |
|
230 |
- urldate = {2015-01-05}, |
|
231 |
- journal = {Bioinformatics}, |
|
232 |
- author = {Pond, Sergei L. Kosakovsky and Frost, Simon D. W. and Muse, Spencer V.}, |
|
233 |
- month = mar, |
|
234 |
- year = {2005}, |
|
235 |
- pmid = {15509596}, |
|
236 |
- pages = {676--679} |
|
237 |
-} |
|
238 |
- |
|
239 |
-@article{bouckaert_beast_2014, |
|
240 |
- title = {{BEAST} 2: A Software Platform for Bayesian Evolutionary Analysis}, |
|
241 |
- volume = {10}, |
|
242 |
- shorttitle = {{BEAST} 2}, |
|
243 |
- url = {http://dx.doi.org/10.1371/journal.pcbi.1003537}, |
|
244 |
- doi = {10.1371/journal.pcbi.1003537}, |
|
245 |
- abstract = {We present a new open source, extensible and flexible software platform for Bayesian evolutionary analysis called {BEAST} 2. This software platform is a re-design of the popular {BEAST} 1 platform to correct structural deficiencies that became evident as the {BEAST} 1 software evolved. Key among those deficiencies was the lack of post-deployment extensibility. {BEAST} 2 now has a fully developed package management system that allows third party developers to write additional functionality that can be directly installed to the {BEAST} 2 analysis platform via a package manager without requiring a new software release of the platform. This package architecture is showcased with a number of recently published new models encompassing birth-death-sampling tree priors, phylodynamics and model averaging for substitution models and site partitioning. A second major improvement is the ability to read/write the entire state of the {MCMC} chain to/from disk allowing it to be easily shared between multiple instances of the {BEAST} software. This facilitates checkpointing and better support for multi-processor and high-end computing extensions. Finally, the functionality in new packages can be easily added to the user interface ({BEAUti} 2) by a simple {XML} template-based mechanism because {BEAST} 2 has been re-designed to provide greater integration between the analysis engine and the user interface so that, for example {BEAST} and {BEAUti} use exactly the same {XML} file format.}, |
|
246 |
- number = {4}, |
|
247 |
- urldate = {2015-01-05}, |
|
248 |
- journal = {{PLoS} Comput Biol}, |
|
249 |
- author = {Bouckaert, Remco and Heled, Joseph and Kühnert, Denise and Vaughan, Tim and Wu, Chieh-Hsi and Xie, Dong and Suchard, Marc A. and Rambaut, Andrew and Drummond, Alexei J.}, |
|
250 |
- month = apr, |
|
251 |
- year = {2014}, |
|
252 |
- pages = {e1003537} |
|
253 |
-} |
|
254 |
- |
|
255 |
-@article{yu_ggtree:_2017, |
|
256 |
- title = {ggtree: an r package for visualization and annotation of phylogenetic trees with their covariates and other associated data}, |
|
257 |
- volume = {8}, |
|
258 |
- issn = {2041-210X}, |
|
259 |
- shorttitle = {ggtree}, |
|
260 |
- url = {http://onlinelibrary.wiley.com.eproxy2.lib.hku.hk/doi/10.1111/2041-210X.12628/abstract}, |
|
261 |
- doi = {10.1111/2041-210X.12628}, |
|
262 |
- abstract = {* We present an r package, ggtree, which provides programmable visualization and annotation of phylogenetic trees. |
|
263 |
- |
|
264 |
- |
|
265 |
-* ggtree can read more tree file formats than other softwares, including newick, nexus, NHX, phylip and jplace formats, and support visualization of phylo, multiphylo, phylo4, phylo4d, obkdata and phyloseq tree objects defined in other r packages. It can also extract the tree/branch/node-specific and other data from the analysis outputs of beast, epa, hyphy, paml, phylodog, pplacer, r8s, raxml and revbayes software, and allows using these data to annotate the tree. |
|
266 |
- |
|
267 |
- |
|
268 |
-* The package allows colouring and annotation of a tree by numerical/categorical node attributes, manipulating a tree by rotating, collapsing and zooming out clades, highlighting user selected clades or operational taxonomic units and exploration of a large tree by zooming into a selected portion. |
|
269 |
- |
|
270 |
- |
|
271 |
-* A two-dimensional tree can be drawn by scaling the tree width based on an attribute of the nodes. A tree can be annotated with an associated numerical matrix (as a heat map), multiple sequence alignment, subplots or silhouette images. |
|
272 |
- |
|
273 |
- |
|
274 |
-* The package ggtree is released under the artistic-2.0 license. The source code and documents are freely available through bioconductor (http://www.bioconductor.org/packages/ggtree).}, |
|
275 |
- language = {en}, |
|
276 |
- number = {1}, |
|
277 |
- urldate = {2017-03-07}, |
|
278 |
- journal = {Methods in Ecology and Evolution}, |
|
279 |
- author = {Yu, Guangchuang and Smith, David K. and Zhu, Huachen and Guan, Yi and Lam, Tommy Tsan-Yuk}, |
|
280 |
- month = jan, |
|
281 |
- year = {2017}, |
|
282 |
- keywords = {annotation, bioconductor, Evolution, Phylogeny, r package, visualization}, |
|
283 |
- pages = {28--36}, |
|
284 |
- file = {Full Text PDF:/Volumes/HOME/Zotero/storage/S3H2KHCZ/Yu et al. - 2017 - ggtree an r package for visualization and annotat.pdf:application/pdf;Snapshot:/Volumes/HOME/Zotero/storage/F5SF96WG/abstract.html:text/html} |
|
285 |
-} |
286 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,343 +0,0 @@ |
1 |
-title: "Tree Annotation" |
|
2 |
-author: "Guangchuang Yu\\ |
|
3 |
- |
|
4 |
- School of Basic Medical Sciences, Southern Medical University" |
|
5 |
-date: "`r Sys.Date()`" |
|
6 |
-bibliography: ggtree.bib |
|
7 |
-biblio-style: apalike |
|
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{04 Tree Annotation} |
|
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("cowplot") |
|
30 |
-library("treeio") |
|
31 |
-library("ggtree") |
|
32 |
- |
|
33 |
-CRANpkg <- function (pkg) { |
|
34 |
- cran <- "https://CRAN.R-project.org/package" |
|
35 |
- fmt <- "[%s](%s=%s)" |
|
36 |
- sprintf(fmt, pkg, cran, pkg) |
|
37 |
-} |
|
38 |
- |
|
39 |
-Biocpkg <- function (pkg) { |
|
40 |
- sprintf("[%s](http://bioconductor.org/packages/%s)", pkg, pkg) |
|
41 |
-} |
|
42 |
- |
|
43 |
-inset <- ggtree::inset |
|
44 |
-``` |
|
45 |
- |
|
46 |
- |
|
47 |
- |
|
48 |
-# Annotate clades |
|
49 |
- |
|
50 |
-`r Biocpkg("ggtree")` [@yu_ggtree:_2017] implements _`geom_cladelabel`_ layer to annotate a selected clade with a bar indicating the clade with a corresponding label. |
|
51 |
- |
|
52 |
-The _`geom_cladelabel`_ layer accepts a selected internal node number. To get the internal node number, please refer to [Tree Manipulation](treeManipulation.html#internal-node-number) vignette. |
|
53 |
- |
|
54 |
- |
|
55 |
-```{r} |
|
56 |
-set.seed(2015-12-21) |
|
57 |
-tree <- rtree(30) |
|
58 |
-p <- ggtree(tree) + xlim(NA, 6) |
|
59 |
- |
|
60 |
-p + geom_cladelabel(node=45, label="test label") + |
|
61 |
- geom_cladelabel(node=34, label="another clade") |
|
62 |
-``` |
|
63 |
- |
|
64 |
-Users can set the parameter, `align = TRUE`, to align the clade label, and use the parameter, `offset`, to adjust the position. |
|
65 |
- |
|
66 |
-```{r} |
|
67 |
-p + geom_cladelabel(node=45, label="test label", align=TRUE, offset=.5) + |
|
68 |
- geom_cladelabel(node=34, label="another clade", align=TRUE, offset=.5) |
|
69 |
-``` |
|
70 |
- |
|
71 |
-Users can change the color of the clade label via the parameter `color`. |
|
72 |
- |
|
73 |
-```{r} |
|
74 |
-p + geom_cladelabel(node=45, label="test label", align=T, color='red') + |
|
75 |
- geom_cladelabel(node=34, label="another clade", align=T, color='blue') |
|
76 |
-``` |
|
77 |
- |
|
78 |
-Users can change the `angle` of the clade label text and relative position from text to bar via the parameter `offset.text`. |
|
79 |
- |
|
80 |
-```{r} |
|
81 |
-p + geom_cladelabel(node=45, label="test label", align=T, angle=270, hjust='center', offset.text=.5) + |
|
82 |
- geom_cladelabel(node=34, label="another clade", align=T, angle=45) |
|
83 |
-``` |
|
84 |
- |
|
85 |
-The size of the bar and text can be changed via the parameters `barsize` and `fontsize` respectively. |
|
86 |
- |
|
87 |
-```{r} |
|
88 |
-p + geom_cladelabel(node=45, label="test label", align=T, angle=270, hjust='center', offset.text=.5, barsize=1.5) + |
|
89 |
- geom_cladelabel(node=34, label="another clade", align=T, angle=45, fontsize=8) |
|
90 |
-``` |
|
91 |
- |
|
92 |
-Users can also use `geom_label` to label the text. |
|
93 |
- |
|
94 |
-```{r} |
|
95 |
-p + geom_cladelabel(node=34, label="another clade", align=T, geom='label', fill='lightblue') |
|
96 |
-``` |
|
97 |
- |
|
98 |
-## Annotate clades for unrooted tree |
|
99 |
- |
|
100 |
-`r Biocpkg("ggtree")` provides `geom_clade2` for labeling clades of unrooted |
|
101 |
-layout trees. |
|
102 |
- |
|
103 |
- |
|
104 |
-```{r fig.wdith=7, fig.height=7, fig.align='center', warning=FALSE, message=FALSE} |
|
105 |
-pg <- ggtree(tree, layout="daylight") |
|
106 |
-pg + geom_cladelabel2(node=45, label="test label", angle=10) + |
|
107 |
- geom_cladelabel2(node=34, label="another clade", angle=305) |
|
108 |
-``` |
|
109 |
- |
|
110 |
-# Labelling associated taxa (Monophyletic, Polyphyletic or Paraphyletic) |
|
111 |
- |
|
112 |
-`geom_cladelabel` is designed for labelling Monophyletic (Clade) while there are related taxa that are not form a clade. `ggtree` provides `geom_strip` to add a strip/bar to indicate the association with optional label (see [the issue](https://github.com/GuangchuangYu/ggtree/issues/52)). |
|
113 |
- |
|
114 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
115 |
-nwk <- system.file("extdata", "sample.nwk", package="treeio") |
|
116 |
-tree <- read.tree(nwk) |
|
117 |
-ggtree(tree) + geom_tiplab() + |
|
118 |
- geom_strip(5, 7, barsize=2, color='red') + |
|
119 |
- geom_strip(6, 12, barsize=2, color='blue') |
|
120 |
-``` |
|
121 |
- |
|
122 |
- |
|
123 |
-# Highlight clades |
|
124 |
- |
|
125 |
-`ggtree` implements _`geom_hilight`_ layer, that accepts an internal node number and add a layer of rectangle to highlight the selected clade. |
|
126 |
- |
|
127 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
128 |
-ggtree(tree) + geom_hilight(node=21, fill="steelblue", alpha=.6) + |
|
129 |
- geom_hilight(node=17, fill="darkgreen", alpha=.6) |
|
130 |
-``` |
|
131 |
- |
|
132 |
- |
|
133 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
134 |
-ggtree(tree, layout="circular") + geom_hilight(node=21, fill="steelblue", alpha=.6) + |
|
135 |
- geom_hilight(node=23, fill="darkgreen", alpha=.6) |
|
136 |
-``` |
|
137 |
- |
|
138 |
-Another way to highlight selected clades is setting the clades with different colors and/or line types as demonstrated in [Tree Manipulation](treeManipulation.html#groupclade) vignette. |
|
139 |
- |
|
140 |
-## Highlight balances |
|
141 |
- |
|
142 |
-In addition to _`geom_hilight`_, `ggtree` also implements _`geom_balance`_ |
|
143 |
-which is designed to highlight neighboring subclades of a given internal node. |
|
144 |
- |
|
145 |
-```{r fig.width=4, fig.height=5, fig.align='center', warning=FALSE} |
|
146 |
-ggtree(tree) + |
|
147 |
- geom_balance(node=16, fill='steelblue', color='white', alpha=0.6, extend=1) + |
|
148 |
- geom_balance(node=19, fill='darkgreen', color='white', alpha=0.6, extend=1) |
|
149 |
-``` |
|
150 |
- |
|
151 |
-## Highlight clades for unrooted tree |
|
152 |
- |
|
153 |
-`r Biocpkg("ggtree")` provides `geom_hilight_encircle` to support highlight |
|
154 |
-clades for unrooted layout trees. |
|
155 |
- |
|
156 |
- |
|
157 |
-```{r fig.width=5, fig.height=5, fig.align='center', warning=FALSE, message=FALSE} |
|
158 |
-pg + geom_hilight_encircle(node=45) + geom_hilight_encircle(node=34, fill='darkgreen') |
|
159 |
-``` |
|
160 |
- |
|
161 |
- |
|
162 |
-# Taxa connection |
|
163 |
- |
|
164 |
-Some evolutionary events (e.g. reassortment, horizontal gene transfer) can be modeled by a simple tree. `ggtree` provides `geom_taxalink` layer that allows drawing straight or curved lines between any of two nodes in the tree, allow it to represent evolutionary events by connecting taxa. |
|
165 |
- |
|
166 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
167 |
-ggtree(tree) + geom_tiplab() + geom_taxalink('A', 'E') + |
|
168 |
- geom_taxalink('F', 'K', color='red', arrow=grid::arrow(length=grid::unit(0.02, "npc"))) |
|
169 |
-``` |
|
170 |
- |
|
171 |
- |
|
172 |
-# Tree annotation with output from evolution software |
|
173 |
- |
|
174 |
-The `r Biocpkg("treeio")` package implemented several parser functions to parse |
|
175 |
-output from commonly used software in evolutionary biology. |
|
176 |
- |
|
177 |
-Here, we used [BEAST](http://beast2.org/) [@bouckaert_beast_2014] output as an |
|
178 |
-example. For details, please refer to the |
|
179 |
-[Importer](https://bioconductor.org/packages/devel/bioc/vignettes/treeio/inst/doc/Importer.html) vignette. |
|
180 |
- |
|
181 |
- |
|
182 |
-```{r warning=FALSE, fig.width=5, fig.height=5, fig.align='center'} |
|
183 |
-file <- system.file("extdata/BEAST", "beast_mcc.tree", package="treeio") |
|
184 |
-beast <- read.beast(file) |
|
185 |
-ggtree(beast, aes(color=rate)) + |
|
186 |
- geom_range(range='length_0.95_HPD', color='red', alpha=.6, size=2) + |
|
187 |
- geom_nodelab(aes(x=branch, label=round(posterior, 2)), vjust=-.5, size=3) + |
|
188 |
- scale_color_continuous(low="darkgreen", high="red") + |
|
189 |
- theme(legend.position=c(.1, .8)) |
|
190 |
-``` |
|
191 |
- |
|
192 |
- |
|
193 |
-# Tree annotation with user specified annotation |
|
194 |
- |
|
195 |
-Integrating user data to annotate phylogenetic tree can be done at different |
|
196 |
-levels. The `r Biocpkg("treeio")` package implements `full_join` methods to |
|
197 |
-[combine tree data to phylogenetic tree object](https://bioconductor.org/packages/devel/bioc/vignettes/treeio/inst/doc/Importer.html). |
|
198 |
-The `r CRANpkg("tidytree")` package supports [linking tree data to phylogeny |
|
199 |
-using tidyverse verbs](https://cran.r-project.org/web/packages/tidytree/vignette/tiytree.html). |
|
200 |
-`r Biocpkg("ggtree")` supports mapping external data to phylogeny for |
|
201 |
-visualization and annotation on the fly. |
|
202 |
- |
|
203 |
- |
|
204 |
-## The `%<+%` operator |
|
205 |
- |
|
206 |
-Suppose we have the following data that associate with the tree and would like to attach the data in the tree. |
|
207 |
- |
|
208 |
-```{r} |
|
209 |
-nwk <- system.file("extdata", "sample.nwk", package="treeio") |
|
210 |
-tree <- read.tree(nwk) |
|
211 |
-p <- ggtree(tree) |
|
212 |
- |
|
213 |
-dd <- data.frame(taxa = LETTERS[1:13], |
|
214 |
- place = c(rep("GZ", 5), rep("HK", 3), rep("CZ", 4), NA), |
|
215 |
- value = round(abs(rnorm(13, mean=70, sd=10)), digits=1)) |
|
216 |
-## you don't need to order the data |
|
217 |
-## data was reshuffled just for demonstration |
|
218 |
-dd <- dd[sample(1:13, 13), ] |
|
219 |
-row.names(dd) <- NULL |
|
220 |
-``` |
|
221 |
- |
|
222 |
-```{r eval=FALSE} |
|
223 |
-print(dd) |
|
224 |
-``` |
|
225 |
- |
|
226 |
-```{r echo=FALSE, results='asis'} |
|
227 |
-knitr::kable(dd) |
|
228 |
-``` |
|
229 |
- |
|
230 |
-We can imaging that the _place_ column stores the location that we isolated the |
|
231 |
-species and _value_ column stores numerical values (*e.g.* bootstrap values). |
|
232 |
- |
|
233 |
-We have demonstrated using the operator, `%<%`, to update a tree view with a new |
|
234 |
-tree. Here, we will introduce another operator, `%<+%`, that attaches annotation |
|
235 |
-data to a tree view. The only requirement of the input data is that its first |
|
236 |
-column should be matched with the node/tip labels of the tree. |
|
237 |
- |
|
238 |
-After attaching the annotation data to the tree by `%<+%`, all the columns in |
|
239 |
-the data are visible to `r Biocpkg("ggtree")`. As an example, here we attach the |
|
240 |
-above annotation data to the tree view, `p`, and add a layer that showing the |
|
241 |
-tip labels and colored them by the isolation site stored in _place_ column. |
|
242 |
- |
|
243 |
-```{r fig.width=6, fig.height=5, warning=FALSE, fig.align="center"} |
|
244 |
-p <- p %<+% dd + geom_tiplab(aes(color=place)) + |
|
245 |
- geom_tippoint(aes(size=value, shape=place, color=place), alpha=0.25) |
|
246 |
-p + theme(legend.position="right") |
|
247 |
-``` |
|
248 |
- |
|
249 |
-Once the data was attached, it is always attached. So that we can add other layers to display these information easily. |
|
250 |
- |
|
251 |
-```{r fig.width=6, fig.height=5, warning=FALSE, fig.align="center"} |
|
252 |
-p + geom_text(aes(color=place, label=place), hjust=1, vjust=-0.4, size=3) + |
|
253 |
- geom_text(aes(color=place, label=value), hjust=1, vjust=1.4, size=3) |
|
254 |
-``` |
|
255 |
- |
|
256 |
- |
|
257 |
-# Visualize tree with associated matrix |
|
258 |
- |
|
259 |
-<!-- |
|
260 |
-At first we implemented `gplot` function to visualize tree with heatmap but it has [an issue](https://github.com/GuangchuangYu/ggtree/issues/3) that it can't always guarantee the heatmap aligning to the tree properly, since the line up is between two figures and it's currently not supported internally by ggplot2. I have implemented another function `gheatmap` that can do the line up properly by creating a new layer above the tree. |
|
261 |
- |
|
262 |
-The `gheatmap` function is designed to visualize phylogenetic tree with heatmap of associated matrix. |
|
263 |
- |
|
264 |
-In the following example, we visualized a tree of H3 influenza viruses with their associated genotype. |
|
265 |
- |
|
266 |
-```{r fig.width=8, fig.height=6, fig.align="center", warning=FALSE, message=FALSE} |
|
267 |
-beast_file <- system.file("examples/MCC_FluA_H3.tree", package="ggtree") |
|
268 |
-beast_tree <- read.beast(beast_file) |
|
269 |
- |
|
270 |
-genotype_file <- system.file("examples/Genotype.txt", package="ggtree") |
|
271 |
-genotype <- read.table(genotype_file, sep="\t", stringsAsFactor=F) |
|
272 |
-colnames(genotype) <- sub("\\.$", "", colnames(genotype)) |
|
273 |
-p <- ggtree(beast_tree, mrsd="2013-01-01") + geom_treescale(x=2008, y=1, offset=2) |
|
274 |
-p <- p + geom_tiplab(size=2) |
|
275 |
-gheatmap(p, genotype, offset=5, width=0.5, font.size=3, colnames_angle=-45, hjust=0) + |
|
276 |
- scale_fill_manual(breaks=c("HuH3N2", "pdm", "trig"), values=c("steelblue", "firebrick", "darkgreen")) |
|
277 |
-``` |
|
278 |
- |
|
279 |
-The _width_ parameter is to control the width of the heatmap. It supports another parameter _offset_ for controlling the distance between the tree and the heatmap, for instance to allocate space for tip labels. |
|
280 |
- |
|
281 |
- |
|
282 |
-For time-scaled tree, as in this example, it's more often to use `x` axis by using `theme_tree2`. But with this solution, the heatmap is just another layer and will change the `x` axis. To overcome this issue, we implemented `scale_x_ggtree` to set the x axis more reasonable. |
|
283 |
- |
|
284 |
-<!-- User can also use `gplot` and tweak the positions of two plot to align properly. --> |
|
285 |
- |
|
286 |
- |
|
287 |
- |
|
288 |
-```{r fig.width=8, fig.height=6, fig.align="center", warning=FALSE} |
|
289 |
-p <- ggtree(beast_tree, mrsd="2013-01-01") + geom_tiplab(size=2, align=TRUE, linesize=.5) + theme_tree2() |
|
290 |
-pp <- (p + scale_y_continuous(expand=c(0, 0.3))) %>% |
|
291 |
- gheatmap(genotype, offset=8, width=0.6, colnames=FALSE) %>% |
|
292 |
- scale_x_ggtree() |
|
293 |
-pp + theme(legend.position="right") |
|
294 |
-``` |
|
295 |
- |
|
296 |
- |
|
297 |
-# Visualize tree with multiple sequence alignment |
|
298 |
- |
|
299 |
-With `msaplot` function, user can visualize multiple sequence alignment with phylogenetic tree, as demonstrated below: |
|
300 |
-```{r fig.width=8, fig.height=6, fig.align='center', warning=FALSE} |
|
301 |
-fasta <- system.file("examples/FluA_H3_AA.fas", package="ggtree") |
|
302 |
-msaplot(ggtree(beast_tree), fasta) |
|
303 |
-``` |
|
304 |
- |
|
305 |
-A specific slice of the alignment can also be displayed by specific _window_ parameter. |
|
306 |
- |
|
307 |
-```{r fig.width=7, fig.height=7, fig.align='center', warning=FALSE} |
|
308 |
-msaplot(ggtree(beast_tree), fasta, window=c(150, 200)) + coord_polar(theta='y') |
|
309 |
-``` |
|
310 |
- |
|
311 |
- |
|
312 |
-# Plot tree with associated data |
|
313 |
- |
|
314 |
-For associating phylogenetic tree with different type of plot produced by user's data, `ggtree` provides `facet_plot` function which accepts an input `data.frame` and a `geom` function to draw the input data. The data will be displayed in an additional panel of the plot. |
|
315 |
- |
|
316 |
-```{r warning=F, fig.width=10, fig.height=6} |
|
317 |
-tr <- rtree(30) |
|
318 |
- |
|
319 |
-d1 <- data.frame(id=tr$tip.label, val=rnorm(30, sd=3)) |
|
320 |
-p <- ggtree(tr) |
|
321 |
- |
|
322 |
-p2 <- facet_plot(p, panel="dot", data=d1, geom=geom_point, aes(x=val), color='firebrick') |
|
323 |
-d2 <- data.frame(id=tr$tip.label, value=abs(rnorm(30, mean=100, sd=50))) |
|
324 |
- |
|
325 |
-facet_plot(p2, panel='bar', data=d2, geom=geom_segment, aes(x=0, xend=value, y=y, yend=y), size=3, color='steelblue') + theme_tree2() |
|
326 |
-``` |
|
327 |
- |
|
328 |
- |
|
329 |
-# Plot tree with images and suplots |
|
330 |
- |
|
331 |
-Please refer to the following vignettes: |
|
332 |
- |
|
333 |
-+ [Annotating phylogenetic tree with images](https://guangchuangyu.github.io/software/ggtree/vignettes/ggtree-ggimage.html) |
|
334 |
-+ [Annotate a phylogenetic tree with insets](https://guangchuangyu.github.io/software/ggtree/vignettes/ggtree-inset.html) |
|
335 |
- |
|
336 |
- |
|
337 |
- |
|
338 |
-# References |
|
339 |
- |
|
340 |
- |
341 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,282 +0,0 @@ |
1 |
-title: "Tree Manipulation" |
|
2 |
-author: "Guangchuang Yu\\ |
|
3 |
- |
|
4 |
- School of Basic Medical Sciences, Southern Medical University" |
|
5 |
-date: "`r Sys.Date()`" |
|
6 |
-bibliography: ggtree.bib |
|
7 |
-biblio-style: apalike |
|
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{03 Tree Manipulation} |
|
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("cowplot") |
|
30 |
-library("ggtree") |
|
31 |
-expand <- ggtree::expand |
|
32 |
-rotate <- ggtree::rotate |
|
33 |
-flip <- ggtree::flip |
|
34 |
-collapse <- ggtree:::collapse.ggtree |
|
35 |
-``` |
|
36 |
- |
|
37 |
-# Internal node number |
|
38 |
- |
|
39 |
-Some of the functions in `ggtree` work with clade and accept a parameter of internal node number. To get the internal node number, user can use `geom_text2` to display it: |
|
40 |
- |
|
41 |
-```{r} |
|
42 |
-nwk <- system.file("extdata", "sample.nwk", package="treeio") |
|
43 |
-tree <- read.tree(nwk) |
|
44 |
-ggtree(tree) + geom_text2(aes(subset=!isTip, label=node), hjust=-.3) + geom_tiplab() |
|
45 |
-``` |
|
46 |
- |
|
47 |
-Another way to get the internal node number is using `MRCA()` function by providing a vector of taxa names. The function will return node number of input taxa's most recent commond ancestor (MRCA). It works with tree and graphic object. |
|
48 |
- |
|
49 |
- |
|
50 |
-```{r} |
|
51 |
-MRCA(tree, tip=c('A', 'E')) |
|
52 |
-MRCA(tree, tip=c('H', 'G')) |
|
53 |
- |
|
54 |
-p <- ggtree(tree) |
|
55 |
-MRCA(p, tip=c('A', 'E')) |
|
56 |
-``` |
|
57 |
- |
|
58 |
-# View Clade |
|
59 |
- |
|
60 |
-`ggtree` provides a function `viewClade` to visualize a clade of a phylogenetic tree. |
|
61 |
- |
|
62 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
63 |
-viewClade(p+geom_tiplab(), node=21) |
|
64 |
-``` |
|
65 |
- |
|
66 |
- |
|
67 |
-# Group Clades |
|
68 |
- |
|
69 |
-The `ggtree` package defined several functions to manipulate tree view. _`groupClade`_ and _`groupOTU`_ methods were designed for clustering clades or related OTUs. _`groupClade`_ accepts an internal node or a vector of internal nodes to cluster clade/clades. |
|
70 |
- |
|
71 |
-Both _`groupClade`_ and _`groupOTU`_ work fine with tree and graphic object. |
|
72 |
- |
|
73 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
74 |
-tree <- groupClade(tree, .node=21) |
|
75 |
-ggtree(tree, aes(color=group, linetype=group)) |
|
76 |
-``` |
|
77 |
- |
|
78 |
-The following command will produce the same figure. |
|
79 |
- |
|
80 |
-```{r eval=FALSE} |
|
81 |
-ggtree(read.tree(nwk)) %>% groupClade(.node=21) + aes(color=group, linetype=group) |
|
82 |
-``` |
|
83 |
- |
|
84 |
- |
|
85 |
-With `groupClade` and `groupOTU`, it's easy to highlight selected taxa and easy to select taxa to display related features. |
|
86 |
- |
|
87 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
88 |
-tree <- groupClade(tree, .node=c(21, 17)) |
|
89 |
-ggtree(tree, aes(color=group, linetype=group)) + geom_tiplab(aes(subset=(group==2))) |
|
90 |
-``` |
|
91 |
- |
|
92 |
- |
|
93 |
-# Group OTUs |
|
94 |
-_`groupOTU`_ accepts a vector of OTUs (taxa name) or a list of OTUs. _`groupOTU`_ will trace back from OTUs to their most recent common ancestor and cluster them together. Related OTUs are not necessarily within a clade, they can be monophyletic (clade), polyphyletic or paraphyletic. |
|
95 |
- |
|
96 |
- |
|
97 |
-```{r} |
|
98 |
-tree <- groupOTU(tree, .node=c("D", "E", "F", "G")) |
|
99 |
-``` |
|
100 |
- |
|
101 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
102 |
-ggtree(tree, aes(color=group)) + geom_tiplab() |
|
103 |
-``` |
|
104 |
- |
|
105 |
-_`groupOTU`_ can also input a list of tip groups. |
|
106 |
- |
|
107 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
108 |
-cls <- list(c1=c("A", "B", "C", "D", "E"), |
|
109 |
- c2=c("F", "G", "H"), |
|
110 |
- c3=c("L", "K", "I", "J"), |
|
111 |
- c4="M") |
|
112 |
- |
|
113 |
-tree <- groupOTU(tree, cls) |
|
114 |
-library("colorspace") |
|
115 |
-ggtree(tree, aes(color=group, linetype=group)) + geom_tiplab() + |
|
116 |
- scale_color_manual(values=c("black", rainbow_hcl(4))) + theme(legend.position="right") |
|
117 |
-``` |
|
118 |
- |
|
119 |
- |
|
120 |
-_`groupOTU`_ also works with graphic object. |
|
121 |
- |
|
122 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
123 |
-p <- ggtree(tree) |
|
124 |
-groupOTU(p, LETTERS[1:5]) + aes(color=group) + geom_tiplab() + scale_color_manual(values=c("black", "firebrick")) |
|
125 |
-``` |
|
126 |
- |
|
127 |
-The following example use `groupOTU` to display taxa classification. |
|
128 |
- |
|
129 |
-```{r fig.width=6, fig.height=6} |
|
130 |
-library("ape") |
|
131 |
-data(chiroptera) |
|
132 |
-groupInfo <- split(chiroptera$tip.label, gsub("_\\w+", "", chiroptera$tip.label)) |
|
133 |
-chiroptera <- groupOTU(chiroptera, groupInfo) |
|
134 |
-ggtree(chiroptera, aes(color=group), layout='circular') + geom_tiplab(size=1, aes(angle=angle)) |
|
135 |
-``` |
|
136 |
- |
|
137 |
-<!-- |
|
138 |
-## iris example |
|
139 |
- |
|
140 |
-In this example, we first build a tree based on the iris data, then grouping the tree based on different spacies. |
|
141 |
- |
|
142 |
-#```{r fig.width=20, fig.height=20, fig.align="center", warning=FALSE} |
|
143 |
-data(iris) |
|
144 |
-rn <- paste0(iris[,5], "_", 1:150) |
|
145 |
-rownames(iris) <- rn |
|
146 |
-d_iris <- dist(iris[,-5], method="man") |
|
147 |
- |
|
148 |
-tree_iris <- bionj(d_iris) |
|
149 |
-tree_iris <- groupOTU(tree_iris, list(setosa = rn[1:50], |
|
150 |
- versicolor = rn[51:100], |
|
151 |
- virginica_145 = rn[101:150])) |
|
152 |
-cols <- rainbow_hcl(4) |
|
153 |
-ggtree(tree_iris, aes(color=group)) + |
|
154 |
- geom_text(aes(label=label), hjust=-.1) + |
|
155 |
- scale_color_manual(values=cols, breaks=1:3, |
|
156 |
- labels=c("Setosa", "Versicolor", "Virginica")) + |
|
157 |
- theme(legend.position="right") |
|
158 |
-#``` |
|
159 |
- |
|
160 |
- |
|
161 |
- |
|
162 |
-# Collapse clade |
|
163 |
- |
|
164 |
-With _`collapse`_ function, user can collapse a selected clade. |
|
165 |
- |
|
166 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
167 |
-cp <- collapse(p, node=21) |
|
168 |
-cp + geom_point2(aes(subset=(node == 21)), size=5, shape=23, fill="steelblue") |
|
169 |
-``` |
|
170 |
- |
|
171 |
-# Expand collapsed clade |
|
172 |
- |
|
173 |
-The collapsed clade can be expanded via _`expand`_ function. |
|
174 |
- |
|
175 |
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE} |
|
176 |
-cp %>% expand(node=21) |
|
177 |
-``` |
|
178 |
- |
|
179 |
-```{r fig.width=15, fig.height=3, warning=FALSE} |
|
180 |
-p1 <- ggtree(tree) |
|
181 |
-p2 <- collapse(p1, 21) + geom_point2(aes(subset=(node==21)), size=5, shape=23, fill="blue") |
|
182 |
-p3 <- collapse(p2, 17) + geom_point2(aes(subset=(node==17)), size=5, shape=23, fill="red") |
|
183 |
-p4 <- expand(p3, 17) |
|
184 |
-p5 <- expand(p4, 21) |
|
185 |
- |
|
186 |
-library(cowplot) |
|
187 |
-plot_grid(p1, p2, p3, p4, p5, ncol=5) |
|
188 |
-``` |
|
189 |
- |
|
190 |
-# Scale clade |
|
191 |
- |
|
192 |
- |
|
193 |
-Collpase selected clades can save some space, another approach is to zoom out clade to a small scale. |
|
194 |
- |
|
195 |
-```{r fig.width=12, fig.height=6, warning=F} |
|
196 |
-plot_grid(ggtree(tree) + geom_hilight(21, "steelblue"), |
|
197 |
- ggtree(tree) %>% scaleClade(21, scale=0.3) + geom_hilight(21, "steelblue"), |
|
198 |
- ncol=2) |
|
199 |
-``` |
|
200 |
- |
|
201 |
-Of course, _`scaleClade`_ can accept `scale` larger than 1 and zoom in the selected portion. |
|
202 |
- |
|
203 |
-```{r fig.width=12, fig.height=6, warning=F} |
|
204 |
-plot_grid(ggtree(tree) + geom_hilight(17, fill="steelblue") + |
|
205 |
- geom_hilight(21, fill="darkgreen"), |
|
206 |
- ggtree(tree) %>% scaleClade(17, scale=2) %>% scaleClade(21, scale=0.3) + |
|
207 |
- geom_hilight(17, "steelblue") + geom_hilight(21, fill="darkgreen"), |
|
208 |
- ncol=2) |
|
209 |
-``` |
|
210 |
- |
|
211 |
-# Rotate clade |
|
212 |
- |
|
213 |
-A selected clade can be rotated by 180 degree using __`rotate`__ function. |
|
214 |
- |
|
215 |
- |
|
216 |
-```{r fig.width=8, fig.height=4} |
|
217 |
-tree <- groupClade(tree, c(21, 17)) |
|
218 |
-p <- ggtree(tree, aes(color=group)) + scale_color_manual(values=c("black", "firebrick", "steelblue")) |
|
219 |
-p2 <- rotate(p, 21) %>% rotate(17) |
|
220 |
-plot_grid(p, p2, ncol=2) |
|
221 |
-``` |
|
222 |
- |
|
223 |
-```{r eval=F} |
|
224 |
-set.seed(2016-05-29) |
|
225 |
-p <- ggtree(tree <- rtree(50)) + geom_tiplab() |
|
226 |
-for (n in reorder(tree, 'postorder')$edge[,1] %>% unique) { |
|
227 |
- p <- rotate(p, n) |
|
228 |
- print(p + geom_point2(aes(subset=(node == n)), color='red')) |
|
229 |
-} |
|
230 |
-``` |
|
231 |
- |
|
232 |
- |
|
233 |
- |
|
234 |
- |
|
235 |
- |
|
236 |
-# Flip clade |
|
237 |
- |
|
238 |
-The positions of two selected clades (should share a same parent) can be flip over using __`flip`__ function. |
|
239 |
- |
|
240 |
-```{r fig.width=8, fig.height=4} |
|
241 |
-plot_grid(p, flip(p, 17, 21), ncol=2) |
|
242 |
-``` |
|
243 |
- |
|
244 |
- |
|
245 |
-# Open tree |
|
246 |
- |
|
247 |
-`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. |
|
248 |
- |
|
249 |
-```{r eval=FALSE} |
|
250 |
-set.seed(123) |
|
251 |
-tr <- rtree(50) |
|
252 |
- |
|
253 |
-p <- ggtree(tr, layout='circular') + geom_tiplab2() |
|
254 |
- |
|
255 |
-for (angle in seq(0, 270, 10)) { |
|
256 |
- print(open_tree(p, angle=angle) + ggtitle(paste("open angle:", angle))) |
|
257 |
-} |
|
258 |
-``` |
|
259 |
- |
|
260 |
- |
|
261 |
- |
|
262 |
- |
|
263 |
-# Rotate tree |
|
264 |
- |
|
265 |
-Rotating a `circular` tree is supported by `rotate_tree` function. |
|
266 |
- |
|
267 |
-```{r eval=FALSE} |
|
268 |
-for (angle in seq(0, 270, 10)) { |
|
269 |
- print(rotate_tree(p, angle) + ggtitle(paste("rotate angle:", angle))) |
|
270 |
-} |
|
271 |
-``` |
|
272 |
- |
|
273 |
- |
|
274 |
- |
|
275 |
- |
|
276 |
-# Interactive tree manipulation |
|
277 |
- |
|
278 |
-Interactive tree manipulation is also possible, please refer to <https://guangchuangyu.github.io/2016/06/identify-method-for-ggtree>. |
|
279 |
- |
280 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,436 +0,0 @@ |
1 |
-title: "Tree Visualization" |
|
2 |
-author: "Guangchuang Yu and Tommy Tsan-Yuk Lam\\ |
|
3 |
- |
|
4 |
- School of Basic Medical Sciences, Southern Medical University" |
|
5 |
-date: "`r Sys.Date()`" |
|
6 |
-bibliography: ggtree.bib |
|
7 |
-biblio-style: apalike |
|
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{02 Tree Visualization} |
|
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("grid") |
|
29 |
-library("ggplot2") |
|
30 |
-library("cowplot") |
|
31 |
-library("treeio") |
|
32 |
-library("ggtree") |
|
33 |
- |
|
34 |
- |
|
35 |
-CRANpkg <- function (pkg) { |
|
36 |
- cran <- "https://CRAN.R-project.org/package" |
|
37 |
- fmt <- "[%s](%s=%s)" |
|
38 |
- sprintf(fmt, pkg, cran, pkg) |
|
39 |
-} |
|
40 |
- |
|
41 |
-Biocpkg <- function (pkg) { |
|
42 |
- sprintf("[%s](http://bioconductor.org/packages/%s)", pkg, pkg) |
|
43 |
-} |
|
44 |
-``` |
|
45 |
- |
|
46 |
- |
|
47 |
-To view a phylogenetic tree, we first need to parse the tree file into *R*. The |
|
48 |
-`r Biocpkg('ggtree')` [@yu_ggtree:_2017] package supports many file formats via the `r Biocpkg('treeio')` package, including output files of commonly used software |
|
49 |
-packages in evolutionary biology. For more details, plase refer to |
|
50 |
-the [treeio vignette](https://bioconductor.org/packages/devel/bioc/vignettes/treeio/inst/doc/Importer.html). |
|
51 |
- |
|
52 |
-```{r} |
|
53 |
-library("treeio") |
|
54 |
-library("ggtree") |
|
55 |
- |
|
56 |
-nwk <- system.file("extdata", "sample.nwk", package="treeio") |
|
57 |
-tree <- read.tree(nwk) |
|
58 |
-``` |
|
59 |
- |
|
60 |
-# Viewing a phylogenetic tree with *ggtree* |
|
61 |
- |
|
62 |
-The `r Biocpkg('ggtree')` package extends `r CRANpkg('ggplot2')` [@wickham_ggplot2_2009] package to support viewing phylogenetic tree. |
|
63 |
-It implements `geom_tree` layer for displaying phylogenetic tree, as shown below: |
|
64 |
- |
|
65 |
- |
|
66 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
67 |
-ggplot(tree, aes(x, y)) + geom_tree() + theme_tree() |
|
68 |
-``` |
|
69 |
- |
|
70 |
-The function, `ggtree`, was implemented as a short cut to visualize a tree, and it works exactly the same as shown above. |
|
71 |
- |
|
72 |
-`r Biocpkg('ggtree')` takes all the advantages of `r CRANpkg('ggplot2')`. For example, we can change the color, size and type of the lines as we do with `r CRANpkg('ggplot2')`. |
|
73 |
- |
|
74 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
75 |
-ggtree(tree, color="firebrick", size=1, linetype="dotted") |
|
76 |
-``` |
|
77 |
- |
|
78 |
-By default, the tree is viewed in ladderize form, user can set the parameter *ladderize = FALSE* to disable it. |
|
79 |
- |
|
80 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
81 |
-ggtree(tree, ladderize=FALSE) |
|
82 |
-``` |
|
83 |
- |
|
84 |
-The *branch.length* is used to scale the edge, user can set the parameter *branch.length = "none"* to only view the tree topology (cladogram) or other numerical variable to scale the tree (*e.g.* _d~N~/d~S~_, see also in [Tree Annotation](treeAnnotation.html) vignette). |
|
85 |
- |
|
86 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
87 |
-ggtree(tree, branch.length="none") |
|
88 |
-``` |
|
89 |
- |
|
90 |
-# Layout |
|
91 |
- |
|
92 |
-Currently, `r Biocpkg('ggtree')` supports several layouts, including: |
|
93 |
- |
|
94 |
-+ rectangular (by default) |
|
95 |
-+ slanted |
|
96 |
-+ circular |
|
97 |
-+ fan |
|
98 |
- |
|
99 |
-for *phylogram* (by default) and *cladogram* if user explicitly setting |
|
100 |
-*branch.length='none'*. Unrooted (equal angle and daylight methods), time-scaled |
|
101 |
-and 2-dimensional layouts are also supported. |
|
102 |
- |
|
103 |
- |
|
104 |
-## Phylogram and Cladogram |
|
105 |
- |
|
106 |
- |
|
107 |
-```{r eval=F} |
|
108 |
-library(ggtree) |
|
109 |
-set.seed(2017-02-16) |
|
110 |
-tr <- rtree(50) |
|
111 |
-ggtree(tr) |
|
112 |
-ggtree(tr, layout="slanted") |
|
113 |
-ggtree(tr, layout="circular") |
|
114 |
-ggtree(tr, layout="fan", open.angle=120) |
|
115 |
-ggtree(tr, layout="equal_angle") |
|
116 |
-ggtree(tr, layout="daylight") |
|
117 |
-ggtree(tr, branch.length='none') |
|
118 |
-ggtree(tr, branch.length='none', layout='circular') |
|
119 |
-ggtree(tr, layout="daylight", branch.length='none') |
|
120 |
-``` |
|
121 |
- |
|
122 |
-```{r echo=F, fig.width=8, fig.height=8, message=FALSE} |
|
123 |
-library(ggtree) |
|
124 |
-set.seed(2017-02-16) |
|
125 |
-tr <- rtree(50) |
|
126 |
-library(cowplot) |
|
127 |
-theme_layout <- theme(plot.title=element_text(hjust=0.5)) |
|
128 |
-plot_grid( |
|
129 |
- ggtree(tr) + ggtitle("rectangular (phylogram)")+ theme_layout, |
|
130 |
- ggtree(tr, layout="slanted") + ggtitle("slanted (phylogram)")+theme_layout, |
|
131 |
- ggtree(tr, layout="circular") + ggtitle("circular (phylogram)")+theme_layout, |
|
132 |
- ggtree(tr, layout="fan", open.angle=120) + ggtitle("fan (phylogram)")+theme_layout, |
|
133 |
- ggtree(tr, layout="equal_angle")+ ggtitle("equal angle (unrooted)")+theme_layout, |
|
134 |
- ggtree(tr, layout="daylight")+ ggtitle("daylight (unrooted)")+theme_layout, |
|
135 |
- ggtree(tr, branch.length='none')+ ggtitle("rectangular (cladogram)")+theme_layout, |
|
136 |
- ggtree(tr, branch.length='none', layout='circular')+ ggtitle("circular (cladogram)")+theme_layout, |
|
137 |
- ggtree(tr, layout="daylight", branch.length='none')+ ggtitle("daylight (cladogram)")+theme_layout, |
|
138 |
- ncol=3) |
|
139 |
-``` |
|
140 |
- |
|
141 |
- |
|
142 |
-There are also other possible layouts that can be drawn by modifying |
|
143 |
-scales/coordination, for examples, [reverse label of time |
|
144 |
-scale](https://github.com/GuangchuangYu/ggtree/issues/87), [repropotion |
|
145 |
-circular/fan tree]( |
|
146 |
-https://groups.google.com/d/msgid/bioc-ggtree/6db25ec7-ffb1-4776-bfe4-4a1ba239c8e8%40googlegroups.com), *etc.*. |
|
147 |
- |
|
148 |
-```{r eval=FALSE} |
|
149 |
-ggtree(tr) + scale_x_reverse() |
|
150 |
-ggtree(tr) + coord_flip() |
|
151 |
-ggtree(tr) + scale_x_reverse() + coord_flip() |
|
152 |
-print(ggtree(tr), newpage=TRUE, vp=grid::viewport(angle=-30, width=.9, height=.9)) |
|
153 |
-ggtree(tr, layout='slanted') + coord_flip() |
|
154 |
-ggtree(tr, layout='slanted', branch.length='none') + |
|
155 |
- coord_flip() + scale_y_reverse() +scale_x_reverse() |
|
156 |
-ggtree(tr, layout='circular') + xlim(-10, NA) |
|
157 |
-ggtree(tr) + scale_x_reverse() + coord_polar(theta='y') |
|
158 |
-ggtree(tr) + scale_x_reverse(limits=c(10, 0)) + coord_polar(theta='y') |
|
159 |
-``` |
|
160 |
- |
|
161 |
-```{r fig.keep='none', echo=FALSE, warning=FALSE} |
|
162 |
-tree_angle <- grid::grid.grabExpr(print(ggtree(tr), newpage=TRUE, vp = grid::viewport(angle=-30, width=.9, height=.9))) |
|
163 |
-``` |
|
164 |
- |
|
165 |
-```{r fig.width=8, fig.height = 8, echo=FALSE, warning=FALSE} |
|
166 |
-plot_grid( |
|
167 |
- ggtree(tr) + scale_x_reverse(), |
|
168 |
- ggtree(tr) + coord_flip(), |
|
169 |
- ggtree(tr) + scale_x_reverse() + coord_flip(), |
|
170 |
- tree_angle, |
|
171 |
- ggtree(tr, layout='slanted') + coord_flip(), |
|
172 |
- ggtree(tr, layout='slanted', branch.length='none') + coord_flip() + scale_y_reverse() +scale_x_reverse(), |
|
173 |
- ggtree(tr, layout='circular') + xlim(-10, NA), |
|
174 |
- ggtree(tr) + scale_x_reverse() + coord_polar(theta='y'), |
|
175 |
- ggtree(tr) + scale_x_reverse(limits=c(15, 0)) + coord_polar(theta='y'), |
|
176 |
- ncol=3, labels=LETTERS[1:9]) |
|
177 |
-``` |
|
178 |
- |
|
179 |
- |
|
180 |
- |
|
181 |
-## Time-scaled tree |
|
182 |
- |
|
183 |
-A phylogenetic tree can be scaled by time (time-scaled tree) by specifying the parameter, *mrsd* (most recent sampling date). |
|
184 |
- |
|
185 |
-```{r fig.width=8, fig.height=4, fig.align="center"} |
|
186 |
-tree2d <- read.beast(system.file("extdata", "twoD.tree", package="treeio")) |
|
187 |
-ggtree(tree2d, mrsd="2014-05-01") + theme_tree2() |
|
188 |
-``` |
|
189 |
- |
|
190 |
-## Two dimensional tree |
|
191 |
- |
|
192 |
-`r Biocpkg('ggtree')` implemented two dimensional tree. It accepts parameter *yscale* to scale the y-axis based on the selected tree attribute. The attribute should be numerical variable. If it is *character*/*category* variable, user should provides a name vector of mapping the variable to numeric by passing it to parameter *yscale_mapping*. |
|
193 |
- |
|
194 |
- |
|
195 |
-```{r fig.width=9, fig.height=4, fig.align="center"} |
|
196 |
-ggtree(tree2d, mrsd="2014-05-01", |
|
197 |
- yscale="NGS", yscale_mapping=c(N2=2, N3=3, N4=4, N5=5, N6=6, N7=7)) + |
|
198 |
- theme_classic() + theme(axis.line.x=element_line(), axis.line.y=element_line()) + |
|
199 |
- theme(panel.grid.major.x=element_line(color="grey20", linetype="dotted", size=.3), |
|
200 |
- panel.grid.major.y=element_blank()) + |
|
201 |
- scale_y_continuous(labels=paste0("N", 2:7)) |
|
202 |
-``` |
|
203 |
- |
|
204 |
-In this example, the figure demonstrates the quantity of __*y*__ increase along the trunk. User can highlight the trunk with different line size or color using the functions described in [Tree Manipulation](treeManipulation.html) vignette. |
|
205 |
- |
|
206 |
- |
|
207 |
-# Displaying tree scale (evolution distance) |
|
208 |
- |
|
209 |
-To show tree scale, user can use `geom_treescale()` layer. |
|
210 |
- |
|
211 |
-```{r fig.width=4, fig.height=4, fig.align="center"} |
|
212 |
-ggtree(tree) + geom_treescale() |
|
213 |
-``` |
|
214 |
- |
|
215 |
-`geom_treescale()` supports the following parameters: |
|
216 |
- |
|
217 |
-+ *x* and *y* for tree scale position |
|
218 |
-+ *width* for the length of the tree scale |
|
219 |
-+ *fontsize* for the size of the text |
|
220 |
-+ *linesize* for the size of the line |
|
221 |
-+ *offset* for relative position of the line and the text |
|
222 |
-+ *color* for color of the tree scale |
|
223 |
- |
|
224 |
- |
|
225 |
-```{r eval=F} |
|
226 |
-ggtree(tree) + geom_treescale(x=0, y=12, width=6, color='red') |
|
227 |
-ggtree(tree) + geom_treescale(fontsize=8, linesize=2, offset=-1) |
|
228 |
-``` |
|
229 |
- |
|
230 |
-```{r fig.width=8, fig.height=4, fig.align="center", echo=F} |
|
231 |
-plot_grid( |
|
232 |
- ggtree(tree)+geom_treescale(x=0, y=12, width=6, color='red'), |
|
233 |
- ggtree(tree)+geom_treescale(fontsize=8, linesize=2, offset=-1), |
|
234 |
- ncol=2, labels=LETTERS[1:2]) |
|
235 |
-``` |
|
236 |
- |
|
237 |
- |
|
238 |
-We can also use `theme_tree2()` to display the tree scale by adding *x axis*. |
|
239 |
- |
|
240 |
- |
|
241 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
242 |
-ggtree(tree) + theme_tree2() |
|
243 |
-``` |
|
244 |
- |
|
245 |
- |
|
246 |
-Tree scale is not restricted to evolution distance, `r Biocpkg('ggtree')` can re-scale the tree with other numerical variable. More details can be found in the [Tree Annotation](treeAnnotation.html) vignette. |
|
247 |
- |
|
248 |
- |
|
249 |
-# Displaying nodes/tips |
|
250 |
- |
|
251 |
-Showing all the internal nodes and tips in the tree can be done by adding a layer of points using `geom_nodepoint`, `geom_tippoint` or `geom_point`. |
|
252 |
- |
|
253 |
- |
|
254 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
255 |
-ggtree(tree) + geom_point(aes(shape=isTip, color=isTip), size=3) |
|
256 |
-``` |
|
257 |
- |
|
258 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
259 |
-p <- ggtree(tree) + geom_nodepoint(color="#b5e521", alpha=1/4, size=10) |
|
260 |
-p + geom_tippoint(color="#FDAC4F", shape=8, size=3) |
|
261 |
-``` |
|
262 |
- |
|
263 |
-## Displaying labels |
|
264 |
- |
|
265 |
-Users can use `geom_text` or `geom_label` to display the node (if available) and tip labels simultaneously or `geom_tiplab` to only display tip labels: |
|
266 |
- |
|
267 |
- |
|
268 |
-```{r fig.width=3, fig.height=3, warning=FALSE, fig.align="center"} |
|
269 |
-p + geom_tiplab(size=3, color="purple") |
|
270 |
-``` |
|
271 |
- |
|
272 |
-`geom_tiplab` not only supports using *text* or *label* geom to display labels, |
|
273 |
-it also supports *image* geom to label tip with image files. A corresponding |
|
274 |
-geom, `geom_nodelab` is also provided for displaying node labels. For details of |
|
275 |
-label nodes with images, please refer to |
|
276 |
-the vignette, |
|
277 |
-[Annotating phylogenetic tree with images](https://guangchuangyu.github.io/software/ggtree/vignettes/ggtree-ggimage.html). |
|
278 |
- |
|
279 |
- |
|
280 |
- |
|
281 |
-For *circular* and *unrooted* layout, `r Biocpkg('ggtree')` supports rotating node labels according to the angles of the branches. |
|
282 |
- |
|
283 |
- |
|
284 |
-```{r fig.width=6, fig.height=6, warning=FALSE, fig.align="center"} |
|
285 |
-ggtree(tree, layout="circular") + geom_tiplab(aes(angle=angle), color='blue') |
|
286 |
-``` |
|
287 |
- |
|
288 |
- |
|
289 |
-To make it more readable for human eye, `r Biocpkg('ggtree')` provides a `geom_tiplab2` for `circular` layout (see post [1](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/bioc-ggtree/o35PV3iHO-0) and [2](https://groups.google.com/forum/#!topic/bioc-ggtree/p42R5l8J-14)). |
|
290 |
- |
|
291 |
- |
|
292 |
-```{r fig.width=6, fig.height=6, warning=FALSE, fig.align="center"} |
|
293 |
-ggtree(tree, layout="circular") + geom_tiplab2(color='blue') |
|
294 |
-``` |
|
295 |
- |
|
296 |
-By default, the positions are based on the node positions, we can change them to based on the middle of the branch/edge. |
|
297 |
- |
|
298 |
- |
|
299 |
-```{r fig.width=4, fig.height=3, warning=FALSE, fig.align="center"} |
|
300 |
-p + geom_tiplab(aes(x=branch), size=3, color="purple", vjust=-0.3) |
|
301 |
-``` |
|
302 |
- |
|
303 |
- |
|
304 |
-Based on the middle of branch is very useful when annotating transition from parent node to child node. |
|
305 |
- |
|
306 |
- |
|
307 |
-# Update tree view with a new tree |
|
308 |
- |
|
309 |
-In previous example, we have a _`p`_ object that stored the tree viewing of 13 tips and internal nodes highlighted with specific colored big dots. If users want to apply this pattern (we can imaging a more complex one) to a new tree, you don't need to build the tree step by step. `ggtree` provides an operator, _`%<%`_, for applying the visualization pattern to a new tree. |
|
310 |
- |
|
311 |
-For example, the pattern in the _`p`_ object will be applied to a new tree with 50 tips as shown below: |
|
312 |
-```{r fig.width=3, fig.height=3, fig.align="center"} |
|
313 |
-p %<% rtree(50) |
|
314 |
-``` |
|
315 |
- |
|
316 |
-# Theme |
|
317 |
- |
|
318 |
-`theme_tree()` defined a totally blank canvas, while _`theme_tree2()`_ adds |
|
319 |
-phylogenetic distance (via x-axis). These two themes all accept a parameter of |
|
320 |
-_`bgcolor`_ that defined the background color. Users can pass |
|
321 |
-any [theme components](http://ggplot2.tidyverse.org/reference/theme.html) to the |
|
322 |
-`theme_tree()` function to modify them. |
|
323 |
- |
|
324 |
- |
|
325 |
-```{r eval=F} |
|
326 |
-ggtree(rtree(30), color="red") + theme_tree("steelblue") |
|
327 |
-ggtree(rtree(20), color="white") + theme_tree("black") |
|
328 |
-``` |
|
329 |
- |
|
330 |
-```{r fig.width=8, fig.height=3, fig.align="center", echo=F} |
|
331 |
-cowplot::plot_grid( |
|
332 |
- ggtree(rtree(30), color="red") + theme_tree("steelblue"), |
|
333 |
- ggtree(rtree(20), color="purple") + theme_tree("black"), |
|
334 |
- ncol=2) |
|
335 |
-``` |
|
336 |
- |
|
337 |
- |
|