plot_heatmap: Plot a Heatmap with Feature and Sample Covariate Bars

Description Usage Arguments Examples

View source: R/plot.R

Description

This function plots a heatmap of expression/alteration values. In addition, samples' tumor types and categories are plotted as row covariate bars, and features' weights are plotted as a column covariate bar.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
plot_heatmap(
  mat_value,
  name = "Value",
  discrete = FALSE,
  df_sample = NULL,
  df_weight = NULL,
  order_features = TRUE,
  trim_zero_features = TRUE,
  n_top_features = NULL,
  df_tcga_color = NULL,
  df_ccl_color = NULL,
  df_category_color = NULL,
  category_name = NULL,
  cluster_rows = FALSE,
  cluster_columns = FALSE,
  show_row_names = TRUE,
  show_column_names = TRUE
)

Arguments

mat_value

A matrix of expression/alteration values with samples as rows and features as columns.

name

A string that is the name of the legend. Default 'Value'.

discrete

A logical value. If mat_value is discrete, set it as TRUE. Default FALSE.

df_sample

A data frame of sample annotations. It contains columns: SampleID, TumorType (optional), Category (optional). If NULL, no row covariate bar is plotted.

df_weight

A data frame of feature weights. It must contain columns: Feature, Weight. If NULL, no column covariate bar is plotted.

order_features

A logical value indicating whether features are ordered according to weights. Default TRUE.

trim_zero_features

A logical value indicating whether the zero features are removed. Default TRUE.

n_top_features

An integer showing how many top features are displayed. If NULL, all features are displayed.

df_tcga_color

A data frame of TCGA tumor type colors. It must contain columns: TumorType, Color. If NULL, colors are automatically generated.

df_ccl_color

A data frame of cell line tumor type colors. It must contain columns: TumorType, Color. If NULL, colors are automatically generated.

df_category_color

A data frame of category colors. It must contain columns: Category, Color. If NULL, colors are automatically generated.

category_name

A string that is displayed as the name of the category covariate bar. If NULL, the displayed name is "Category".

cluster_rows

A dendrogram or a logical value. If a dendrogram is provided, rows will be clustered according to it. If FALSE, rows are not to be clustered. If TRUE, rows will be clustered by standard hierarchical clustering.

cluster_columns

A dendrogram or a logical value. If a dendrogram is provided, columns will be clustered according to it. If FALSE, columns are ordered with descreasing weigths. If TRUE, rows will be clustered by standard hierarchical clustering.

show_row_names

A logical value indicating whether row names are displayed. Default TRUE.

show_column_names

A logical value indicating whether column names are displayed. Default TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(reflect)
mat_value <- egfr_data$mat_value
df_sample <- egfr_data$df_sample
df_weight <- data.frame(Feature = names(egfr_result$shc$weight),
                        Weight = egfr_result$shc$weight)
cluster_rows <- as.dendrogram(egfr_result$shc$hc)
df_tcga_color <- reflect_color$df_tcga_color
df_ccl_color <- reflect_color$df_ccl_color
df_category_color <- reflect_color$df_category_color
plot_heatmap(mat_value,
             df_sample = df_sample,
             df_weight = df_weight,
             cluster_rows = cluster_rows,
             df_tcga_color = df_tcga_color,
             df_ccl_color = df_ccl_color,
             df_category_color = df_category_color,
             category_name = "Variants",
             show_row_names = FALSE)

korkutlab/reflect documentation built on July 5, 2021, 7:38 a.m.