Produces a heatmap as a grid grob.
plot_heatmap(
y,
cluster_samples = FALSE,
cluster_features = TRUE,
sample_labels = NULL,
feature_labels = NULL,
baseline = NULL,
baseline_label = "row\nmean",
scale_label = "difference from\nrow mean",
n = Inf,
baseline_to = NULL,
scale_to = NULL,
show_baseline = TRUE,
show_tree = TRUE
)
A matrix of expression levels, such as a transformed counts matrix as produced by varistran::vst
.
Should samples (columns) be clustered?
Should features (rows) be clustered?
Names for each sample. If not given and y has column names, these will be used instead.
Names for each feature. If not given and y has row names, these will be used instead.
Baseline level for each row, to be subtracted when drawing the heatmap colors. If omitted, the row mean will be used. Specify baseline=0
to not subtract anything and not show a baseline bar graph.
Text description of what the baseline is.
Text description of what the heatmap colors represent (after baseline is subtracted).
Show only this many rows. Rows are selected in order of greatest span of expression level.
If provided, the scale for the row means or baseline will include this value or these values. Use this if there is some meaningful "zero" for your data.
If provided, the heatmap color scale will include this value. Use this to provide consistency of scales between heatmaps (note values larger than scale_to will cause the scale to be extended).
Show baseline barplot?
Show dendrogram tree(s)? These dendrograms arguably over-interpret the data without adding much of values, so it may be better to hide them.
A grid grob. print()-ing this value will cause it to be displayed.
Additionally $info$row_order will contain row ordering and $info$col_order will contain column ordering.
This heatmap differs from other heatmaps in R in the method of clustering used:
1. The distances used are cosine distances (i.e. the magnitude of log fold changes is not important, only the pattern).
2. hclust()
is used to produce a clustering, as normal.
3. Branches in the hierarchical clustering are flipped to minimize sharp changes between neighbours, using the seriation package's OLO (Optimal Leaf Ordering) method.