Data Integration, Manipulation and Visualization of Phylogenetic Trees introduces and demonstrates data integration, manipulation and visualization of phylogenetic trees using a suite of R packages, tidytree, treeio, ggtree and ggtreeExtra. Using the most comprehensive packages for phylogenetic data integration and visualization, contains numerous examples that can be used for teaching and learning. Ideal for undergraduate readers and researchers with a working knowledge of R and ggplot2.
Key Features
Manipulating phylogenetic tree with associated data using tidy verbs
Integrating phylogenetic data from diverse sources
Visualizing phylogenetic data using grammar of graphics
Author(s): Guangchuang Yu
Series: Chapman & Hall/CRC Computational Biology Series
Publisher: CRC Press/Chapman & Hall
Year: 2022
Language: English
Pages: 276
City: Boca Raton
Cover
Half Title
Series Page
Title Page
Copyright Page
Contents
List of Figures
List of Tables
Preface
Structure of the book
Software information and conventions
Acknowledgments
About the Author
Part I: Tree data input, output, and manipulation
1. Importing Tree with Data
1.1. Overview of Phylogenetic Tree Construction
1.2. Phylogenetic Tree Formats
1.2.1. Newick tree format
1.2.2. NEXUS tree format
1.2.3. New Hampshire eXtended format
1.2.4. Jplace format
1.2.5. Software outputs
1.3. Getting Tree Data with treeio
1.3.1. Overview of treeio
1.3.2. Function demonstration
1.3.3. Converting other tree-like objects to phylo or treedata objects
1.3.4. Getting information from treedata object
1.4. Summary
2. Manipulating Tree with Data
2.1. Manipulating Tree Data Using Tidy Interface
2.1.1. The phylo object
2.1.2. The treedata object
2.1.3. Access related nodes
2.2. Data Integration
2.2.1. Combining tree data
2.2.2. Linking external data to phylogeny
2.2.3. Grouping taxa
2.3. Rerooting tree
2.4. Rescaling Tree Branches
2.5. Subsetting Tree with Data
2.5.1. Removing tips in a phylogenetic tree
2.5.2. Subsetting tree by tip label
2.5.3. Subsetting tree by internal node number
2.6. Manipulating Tree Data for Visualization
2.7. Summary
3. Exporting Tree with data
3.1. Introduction
3.2. Exporting Tree Data to BEAST Nexus Format
3.2.1. Exporting/converting software output
3.2.2. Combining tree with external data
3.2.3. Merging tree data from different sources
3.3. Exporting Tree Data to the jtree Format
3.4. Summary
Part II: Tree data visualization and annotation
4. Phylogenetic Tree Visualization
4.1. Introduction
4.2. Visualizing Phylogenetic Tree with ggtree
4.2.1. Basic Tree Visualization
4.2.2. Layouts of a phylogenetic tree
4.3. Displaying Tree Components
4.3.1. Displaying treescale (evolution distance)
4.3.2. Displaying nodes/tips
4.3.3. Displaying labels
4.3.4. Displaying root-edge
4.3.5. Color tree
4.3.6. Rescale tree
4.3.7. Modify components of a theme
4.4. Visualize a List of Trees
4.4.1. Annotate one tree with values from different variables
4.4.2. DensiTree
4.5. Summary
5. Phylogenetic Tree Annotation
5.1. Visualizing and Annotating Tree Using Grammar of Graphics
5.2. Layers for Tree Annotation
5.2.1. Colored strips
5.2.2. Highlight clades
5.2.3. Taxa connection
5.2.4. Uncertainty of evolutionary inference
5.3. Tree Annotation with Output from Evolution Software
5.3.1. Tree annotation using data from evolutionary analysis software
5.4. Summary
6. Visual Exploration of Phylogenetic Trees
6.1. Viewing Selected Clade
6.2. Scaling Selected Clade
6.3. Collapsing and Expanding Clade
6.4. Grouping Taxa
6.5. Exploring Tree Structure
6.6. Summary
7. Plotting Tree with data
7.1. Mapping Data to The tree Structure
7.2. Aligning Graph to the Tree Based on the Tree Structure
7.3. Visualize a Tree with an Associated Matrix
7.3.1. Visualize a tree with multiple associated matrices
7.4. Visualize a Tree with Multiple Sequence Alignments
7.5. Composite Plots
7.6. Summary
8. Annotating Tree with Silhouette Images and Sub-plots
8.1. Annotating Tree with Images
8.2. Annotating Tree with Phylopic
8.3. Annotating Tree with Sub-plots
8.3.1. Annotate with bar charts
8.3.2. Annotate with pie charts
8.3.3. Annotate with mixed types of charts
8.4. Have Fun with Phylomoji
8.4.1. Emoji in circular/fan layout tree
8.4.2. Emoji to label clades
8.4.3. Apple Color Emoji
8.4.4. Phylomoji in ASCII art
8.5. Summary
9. ggtree for Other Tree-like Objects
9.1. ggtree for Phylogenetic Tree Objects
9.1.1. The phylo4 and phylo4d objects
9.1.2. The phylog object
9.1.3. The phyloseq object
9.2. ggtree for Dendrograms
9.3. ggtree for Tree Graph
9.4. ggtree for Other Tree-like Structures
9.5. Summary
Part III: ggtree extensions
10. ggtreeExtra for Presenting Data on a Circular Layout
10.1. Introduction
10.2. Aligning Graphs to the Tree Based on a Tree Structure
10.3. Aligning Multiple Graphs to the Tree for Multi-dimensional Data
10.4. Examples for Population Genetics
10.5. Summary
11. Other ggtree Extensions
11.1. Taxonomy Annotation Using MicrobiotaProcess
11.2. Visualizing Phylogenetic Network Using Tanggle
11.3. Summary
Part IV: Miscellaneous topics
12. ggtree Utilities
12.1. Facet Utilities
12.1.1. facet_widths
12.1.2. facet_labeller
12.2. Geometric Layers
12.3. Layout Utilities
12.4. Scale Utilities
12.4.1. Expand x limit for a specific facet panel
12.4.2. Expand plot limit by the ratio of plot range
12.5. Tree data utilities
12.5.1. Filter tree data
12.5.2. Flatten list-column tree data
12.6. Tree Utilities
12.6.1. Extract tip order
12.6.2. Padding taxa labels
12.7. Interactive ggtree Annotation
13. Gallery of Reproducible Examples
13.1. Visualizing pairwise nucleotide sequence distance with a phylogenetic tree
13.2. Displaying Different Symbolic Points for Bootstrap Values
13.3. Highlighting Different Groups
13.4. Phylogenetic Tree with Genome Locus Structure
A. Frequently Asked Questions
A.1. Installation
A.2. Basic R Related
A.2.1. Use your local file
A.3. Aesthetic mapping
A.3.1. Inherit aesthetic mapping
A.3.2. Never use $ in aesthetic mapping
A.4. Text and Label
A.4.1. Tip label truncated
A.4.2. Modify (tip) labels
A.4.3. Formatting (tip) labels
A.4.4. Avoid overlapping text labels
A.4.5. Bootstrap values from Newick format
A.5. Branch Setting
A.5.1. Plot the same tree as in plot.phylo()
A.5.2. Specifying the order of the tips
A.5.3. Shrink outlier long branch
A.5.4. Attach a new tip to a tree
A.5.5. Change colors or line types of arbitrarily selected branches
A.5.6. Add an arbitrary point to a branch
A.6. Different X-axis Labels for Different Facet Panels
A.7. Plot Something behind the Phylogeny
A.8. Enlarge Center Space in Circular/Fan Layout Tree
A.9. Use the Most Distant Tip from the Root as the Origin of the Timescale
A.10. Remove Blank Margins for Circular Layout Tree
A.11. Edit Tree Graphic Details
B. Related Tools
B.1. MicrobiotaProcess: Convert Taxonomy Table to a treedata Object
B.2. rtol: An R Interface to Open Tree API
B.3. Print ASCII-art Rooted Tree
B.4. Zoom in on the Selected Portion
B.5. Tips for Using ggtree with ggimage
B.5.1. Example 1: Remove background of images
B.5.2. Example 2: Plot tree on a background image
B.6. Run ggtree in Jupyter Notebook
Figures and Tables
Publications of the ggtree Package Suite
References
Index