Type: Package
Title: A Self-Contained Widget for Interactive Phylogenetic Tree Visualization
Version: 0.3.1
Maintainer: Zachary Foster <zacharyfoster1989@gmail.com>
Description: Creates self-contained widgets for interactive phylogenetic tree visualization. This package wraps the 'JavaScript' 'heat-tree' package using the 'htmlwidgets' R package.
URL: https://grunwaldlab.github.io/heattree/
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.3
Depends: R (≥ 3.5)
Imports: ape, htmlwidgets
Suggests: testthat (≥ 3.0.0), knitr
Config/Needs/website: rmarkdown
NeedsCompilation: no
Packaged: 2026-04-29 17:55:45 UTC; fosterz
Author: Zachary Foster ORCID iD [aut, cre], Niklaus Grunwald ORCID iD [aut], USDA Agricultural Research Service [fnd]
Repository: CRAN
Date/Publication: 2026-05-04 11:30:08 UTC

Isolate metadata from Bansal et al. 2021

Description

Isolate metadata from Bansal et al. 2021 (doi:10.1016/j.ygeno.2021.09.021) included for use as an example data set. This is the parsed version of the included "bansal_2021_metadata.tsv" file.

Format

data.frame

Source

Bansal, K., Kumar, S., Kaur, A., Singh, A. and Patil, P.B., 2021. Deep phylo-taxono genomics reveals Xylella as a variant lineage of plant associated Xanthomonas and supports their taxonomic reunification along with Stenotrophomonas and Pseudoxanthomonas. Genomics, 113(6), pp.3989-4003.


A phylogeny from Bansal et al. 2021

Description

A core gene phylogeny from Bansal et al. 2021 (doi:10.1016/j.ygeno.2021.09.021) included for use as an example data set. This is the parsed version of the included "bansal_2021_tree.nwk" file.

Format

ape::phylo

Source

Bansal, K., Kumar, S., Kaur, A., Singh, A. and Patil, P.B., 2021. Deep phylo-taxono genomics reveals Xylella as a variant lineage of plant associated Xanthomonas and supports their taxonomic reunification along with Stenotrophomonas and Pseudoxanthomonas. Genomics, 113(6), pp.3989-4003.


Create an interactive phylogenetic tree

Description

Create an interactive phylogenetic tree using the javascript heat-tree package

Usage

heat_tree(
  tree = NULL,
  metadata = NULL,
  aesthetics = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL,
  ...
)

Arguments

tree

One or more trees to plot. Can be a raw newick-formatted string, a phylo object, or a list of such inputs. If a list is provided, its names will be used to name trees.

metadata

Metadata associated with tree. Can be a data.frame or tibble with a column containing IDs matching the tree labels. The ID column is detected automatically. If there are multiple trees (a list), then a list of tables of equal length is required. If a list is provided, its names will be used to name metadata tables.

aesthetics

A named character vector defining which metadata columns are initially used to color/size tree parts. If there are multiple trees (a list), then a list of equal length is required.

width

Width of the widget (CSS units or number).

height

Height of the widget (CSS units or number).

elementId

Optional element ID for the widget.

...

Options passed to options parameter of the underlying HeatTree.heatTree() javascript function to modify the initial state of the widget.

Value

An htmlwidget object of class heat_tree that renders an interactive phylogenetic tree visualization. The object contains:

The widget can be displayed in R Markdown, Quarto, or using and IDE like RStudio.

Examples

# Create an empty tree viewer for loading data interactively
heat_tree()

# Create a tree viewer with example data included with the package
data(weisberg_2020_metadata)
data(weisberg_2020_mlsa)
heat_tree(
  tree = weisberg_2020_mlsa,
  metadata = weisberg_2020_metadata,
  aesthetics = c(tipLabelColor = 'host_type')
)


Shiny bindings for heat_tree

Description

Output and render functions for using heat_tree within Shiny applications and interactive Rmd documents.

Usage

heat_treeOutput(outputId, width = "100%", height = "400px")

renderheat_tree(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

expr

An expression that generates a heat_tree

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

Value

heat_treeOutput() returns an output function that creates a Shiny UI element for displaying a heat_tree widget. Used in the UI definition of a Shiny app.

renderheat_tree() returns a render function that can be assigned to an output element in the server function of a Shiny app. It returns a Shiny render binding.


A BEAST phylogeny from Weisberg et al. 2020

Description

A BEAST phylogeny from Weisberg et al. 2020 (doi:10.1126/science.aba5256) included for use as an example data set. This is the parsed version of the included "weisberg_2020_beast.tre" file.

Format

ape::phylo

Source

Alexandra J. Weisberg et al., Unexpected conservation and global transmission of agrobacterial virulence plasmids.Science368,eaba5256(2020)


Isolate metadata from Weisberg et al. 2020

Description

Isolate metadata from Weisberg et al. 2020 (doi:10.1126/science.aba5256) included for use as an example data set. This is the parsed version of the included "weisberg_2020_metadata.tsv" file.

Format

data.frame

Source

Alexandra J. Weisberg et al., Unexpected conservation and global transmission of agrobacterial virulence plasmids.Science368,eaba5256(2020)


A MLSA phylogeny from Weisberg et al. 2020

Description

A MLSA phylogeny from Weisberg et al. 2020 (doi:10.1126/science.aba5256) included for use as an example data set. This is the parsed version of the included "weisberg_2020_mlsa.tre" file.

Format

ape::phylo

Source

Alexandra J. Weisberg et al., Unexpected conservation and global transmission of agrobacterial virulence plasmids.Science368,eaba5256(2020)