add_clades_to_tree: Highlight clades over a ggtree object given a named vector of...

View source: R/ggtree_function_extensions.R

add_clades_to_treeR Documentation

Highlight clades over a ggtree object given a named vector of internal nodes and labels to draw

Description

Given a named vector of internal tree nodes and labels (e.g. cluster number / name), move through each cluster name and apply geom_hilight and geom_cladelabel from ggtree onto the tree, with alternating shades of grey from top to bottom.

Usage

add_clades_to_tree(
  drawn_tree,
  clade_labels,
  highlight_clades = TRUE,
  aligned = TRUE,
  extend_to_value = 0,
  highlight_alpha = 0.4,
  label_offset = 0,
  gradient = F,
  gradient_direction = "tr"
)

Arguments

drawn_tree

ggtree object for labels to be added to

clade_labels

Named vector of internal node and label (as names), e.g. output from micro.gen.extra::get_clade_nodes()

highlight_clades

TRUE/FALSE as to whether to include the ggtree::geom_hilight [Default = TRUE]

aligned

TRUE/FALSE as to whether the ggtree::geom_hilights should align [Default = TRUE]

extend_to_value

Value to extend the ggtree::geom_hilight to. Float. [Default = 0.0]

highlight_alpha

Value to set the alpha of the ggtree::geom_hilight. Set between 0 and 1. [Default = 0.4]

label_offset

Value to offset the labels of the clade_labels. [Default = F]

gradient

T/F for whether hilighted box should have a gradient (one of "rt" or "tr" [root-to-tip or tip-to-root]) [Default = "tr"]

gradient_drcton

Gradient direction [Default = 0.0]

Value

ggtree object with clades (corresponding to the internal nodes supplied) have been highlighted and labelled.

Examples

add_clades_to_tree(ggtree_object, clade_labels_vector)

djw533/micro.gen.extra documentation built on Nov. 8, 2024, 5:11 a.m.