Skip to contents

A plotly counterpart to clustering_dendrogram(): the branch geometry is derived from the same hclust() tree, and the leaves are placed as markers colored by an experimental variable. Sample names sit on the x-axis (rotated, with plotly reserving the label margin), and hovering a leaf reveals the sample name and its group value.

Usage

interactive_clustering_dendrogram(
  plotmatrix,
  experiment,
  colorby = NULL,
  cor_method = "pearson",
  cluster_method = "ward.D",
  plot_title = "",
  palette = NULL,
  palette_name = COLORBLIND_PALETTE_NAME,
  hidden_groups = character(0),
  source = NULL
)

Arguments

plotmatrix

Expression/ other data matrix

experiment

Annotation for the columns of plotmatrix

colorby

Column name in experiment specifying how leaves should be colored

cor_method

Correlation method, passed to cor() (default: pearson).

cluster_method

Clustering method, passed to hclust() (default: ward.D).

plot_title

Plot title

palette

Palette of colors, one for each unique value derived from colorby.

palette_name

Valid R color palette name

hidden_groups

Values of colorby to exclude: their samples are dropped and the tree is recomputed on the remainder, while the groups stay in the legend (as legendonly) so they can be toggled back on.

source

A plotly event source string, used to route legend-click (plotly_restyle) events back to a Shiny session.

Value

output A plotly plot object

Examples

data(airway, package = "airway")
mymatrix <- assays(airway)[[1]]
mymatrix <- mymatrix[order(apply(mymatrix, 1, var), decreasing = TRUE)[1:1000], ]
interactive_clustering_dendrogram(mymatrix, data.frame(colData(airway)), colorby = "dex")