sp_tree_plot: Generate tree file

View source: R/sp_tree.R

sp_tree_plotR Documentation

Generate tree file

Description

Generate tree file

Usage

sp_tree_plot(
  treefile,
  tree_type = "iqtree",
  tree_attrib = NULL,
  tree_msa = NULL,
  color_branches = NULL,
  layout = "fan",
  ladderize = F,
  branch.length = "none",
  tip_text = "label",
  tip_text_size = 3,
  bootstrap = TRUE,
  bootstrap_variable = NULL,
  legend.position = "bottom",
  bootstrap_size = 3,
  bootstrap_color = "red",
  debug = FALSE,
  manual_color_vector = "Set3",
  ...
)

Arguments

treefile

Aphylogenetic tree file (Only tested for tree generated by iqtree)

tree_type

Currently 4 types of tree supported, normal, newick, raxml, iqtree (default).

tree_attrib

A data frame with first columns match node names of tree file.

tree_msa

A multiple-aligned fasta file used to generate the tree file. A tree with Multiple-Sequence-Alignment plot would be generated when given.

color_branches

Name of columns in tree_attrib used for color branches.

layout

one of 'rectangular', 'dendrogram', 'slanted', 'ellipse', 'roundrect', 'fan', 'circular', 'inward_circular', 'radial', 'equal_angle', 'daylight' or 'ape'

ladderize

logical (default TRUE). Should the tree be re-organized to have a 'ladder' aspect?

branch.length

variable for scaling branch, if 'none' draw cladogram

tip_text

Show branch labels or supply a name of columns in tree_attrib to be shown as branch labels, Or label to show default labels, or NULL to not show branch labels.

tip_text_size

Text size of branch labels.

bootstrap

Show bootstrap value or not.

bootstrap_variable

node to label ids for each node, or other variables in tree object. Default UFboot would be used for tree_type=iqtree.

legend.position

Position of legend, accept top, bottom, left, right, none or c(0.8,0.8).

bootstrap_size

Text size of bootstrap labels.

bootstrap_color

Text color of bootstrap labels.

manual_color_vector

Manually set colors for each geom. Default NULL, meaning using ggplot2 default. Colors like c('red', 'blue', '#6181BD') (number of colors not matter) or a RColorBrewer color set like "BrBG" "PiYG" "PRGn" "PuOr" "RdBu" "RdGy" "RdYlBu" "RdYlGn" "Spectral" "Accent" "Dark2" "Paired" "Pastel1" "Pastel2" "Set1" "Set2" "Set3" "Blues" "BuGn" "BuPu" "GnBu" "Greens" "Greys" "Oranges" "OrRd" "PuBu" "PuBuGn" "PuRd" "Purples" "RdPu" "Reds" "YlGn" "YlGnBu" "YlOrBr" "YlOrRd" (check http://www.sthda.com/english/wiki/colors-in-r for more).

...

additional parameter

some dot arguments:

  • nsplit integer, the number of branch blocks divided when 'continuous' is not "none", default is 200.

Value

A ggplot2 object

Examples


library(ggtree)
library("ggplot2")
library(ImageGP)
treefile <- "iqtree.treefile"
sp_tree_plot(treefile)

Tong-Chen/ImageGP documentation built on April 14, 2025, 12:54 p.m.