How to do it...

Visualizing trees of many genes quickly with ggtree can be executed using the following steps:

  1. Load the libraries and get a phylo object of the Newick tree:
library(ggplot2)
library(ggtree)
itol <-ape::read.tree(file.path(getwd(), "datasets", "ch4", "itol.nwk"))
  1.  Make a basic tree plot:
ggtree(itol)
  1. Make a circular plot:
ggtree(itol, layout = "circular")
  1. Rotate and invert the tree:
ggtree(itol) + coord_flip() + scale_x_reverse()
  1. Add labels to the tree tips:
ggtree(itol) + geom_tiplab( color = "blue", size = 2)
  1. Make a strip of color to annotate a particular clade:
ggtree(itol, layout = "circular") + geom_strip(13,14, color="red", barsize = 1)
  1. Make a blob of color to highlight a particular clade:
ggtree(itol, layout = "unrooted") + geom_hilight_encircle(node = 11, fill = "steelblue")

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.184.126