Function to generate a correlation heatmap. Includes dendrogram and clustering of the data.

# S3 method for class 'correlation.heatmap'
plot(
  DEprot.object,
  correlation.method = "pearson",
  sample.subset = NULL,
  which.data = "imputed",
  palette = viridis::mako(100, direction = -1),
  correlation.scale.limits = c(0, 1),
  exclude.diagonal = FALSE,
  dendrogram.position = "left",
  dendrogram.color = "black",
  dendrogram.linewidth = 0.5,
  display.values = TRUE,
  values.color = NULL,
  values.decimals = 2,
  values.font.size = 2,
  values.transparency = 1,
  plot.title = paste0("**", stringr::str_to_title(correlation.method), " correlation**"),
  plot.subtitle = NULL,
  clustering.method = "complete"
)

Arguments

DEprot.object

An object of class DEprot.

correlation.method

String indicating the clustering method to use to generate the correlation matrix. Possible options: 'pearson', 'spearman', 'kendall'. Default: "pearson".

sample.subset

Vector indicating the name of the columns (column.id in the metadata table) to use/subset for the correlation. Default: NULL (no subsetting).

which.data

String indicating which type of counts should be used. One among: 'raw', 'normalized', 'norm', 'imputed', 'imp'. Default: "imputed".

palette

Vector of colors corresponding to the palette to use for the heatmap color scale. Default: viridis::mako(100, direction = -1).

correlation.scale.limits

Two-elements vector to indicate lower and higher limits, respectively, to apply to the correlation coefficient color scale. Default: c(0,1).

dendrogram.position

String indicating the position of the dendrogram. One among: "top", "bottom", "left", "right". Default: "left".

dendrogram.color

String indicating the color of the dendrogram lines. Default: "black".

dendrogram.linewidth

Numeric value indicating the line.width of the dendrogram. Default: "black".

display.values

Logical value indicating whether the correlation coefficient should be displayed for each cell. Default: TRUE.

values.color

String indicating the color to use for the correlation coefficient labels. Default: "NULL": colors will be assigned automatically depending on the background contrast, white for dark colors and black for light ones.

values.decimals

Numeric value indicating the number of decimals at which round the correlation coefficient labels. Default: 2.

values.font.size

Numeric value indicating the font size of the correlation coefficient labels. Default: 2.

values.transparency

Numeric value between 0-1 indicating the transparency (alpha) of the correlation coefficient labels. Default: 1, full color.

plot.title

String indicating the main title of the plot. Default: paste(stringr::str_to_title(correlation.method), "correlation").

plot.subtitle

String indicating the subtitle of the plot. Default: NULL.

clustering.method

String indicating the clustering method to use. The value should be (an unambiguous abbreviation of) one among: 'ward.D', 'ward.D2', 'single', 'complete', 'average' (= UPGMA), 'mcquitty' (= WPGMA), 'median' (= WPGMC) or 'centroid' (= UPGMC).

Value

A DEprot.correlation with the correlation heatmap in ggplot format.