Plots a sample dissimilarity matrix, stored in metadata(x), as a heatmap. Samples are ordered by hierarchical clustering so that similar samples are next to each other.

plotDissimilarity(x, ...)

# S4 method for class 'SummarizedExperiment'
plotDissimilarity(x, name, col.var = NULL, ...)

Arguments

x

A SummarizedExperiment.

...

Additional arguments passed to the facetting, for example scales and space (both default "free").

name

Character scalar. Name of the dissimilarity matrix in metadata(x). The matrix must be a dist object, as returned by addDissimilarity, with one row per sample of x.

col.var

NULL or character vector. Variables from colData(x) used for facetting. Because both axes are samples, the same variables split both the rows and the columns. (Default: NULL)

Value

A ggplot2 object.

See also

Examples

data(GlobalPatterns)
tse <- GlobalPatterns
tse <- transformAssay(tse, method = "relabundance")

# Calculate Bray-Curtis dissimilarity and store it in metadata
tse <- addDissimilarity(tse, method = "bray", assay.type = "relabundance")

plotDissimilarity(tse, "bray")


# Split rows and columns by sample type
plotDissimilarity(tse, "bray", col.var = "SampleType")