heatmap.ggplot2 is the main function to draw and/or save the heatmap from an expression set object

heatmap.ggplot2(
  eSet,
  brewer.pal.name = "RdBu",
  brewer.pal.rev = TRUE,
  brewer.numColors = 11,
  col.legend.brewer = "",
  row.legend.brewer = "",
  col.clust = TRUE,
  row.clust = TRUE,
  col.clust.hc = NA,
  row.clust.hc = NA,
  col.lab = "",
  row.lab = "",
  heatmap.y.text = FALSE,
  heatmap.x.text = FALSE,
  heatmap.y.text.size = 7,
  heatmap.x.text.size = 6,
  heatmap.colorlegend.name = "val",
  title.text = "",
  col.legend.name = "",
  row.legend.name = "",
  legend.lab.max.char = 15,
  row.scaling = "none",
  z.norm = FALSE,
  cuttree.col = 0,
  cuttree.row = 0,
  verbose = FALSE,
  grid.heights = NA,
  grid.widths = NA,
  show = FALSE
)

Arguments

eSet

expression set object to plot

brewer.pal.name

name of colorbrewer, see options at RColorBrewer::display.brewer.all()

brewer.pal.rev

reverse colorbrewer (TRUE or FALSE)

brewer.numColors

number of colors for heatmap palette default 11

col.legend.brewer

string vector of hexdecimal values for column labels, see example p3 and p4 for how to determine annotation labels and assigning colors

row.legend.brewer

string vector of hexdecimal values for row labels

col.clust

perform column-wise hierarchical clustering (TRUE or FALSE)

row.clust

perform row-wise hierarchical clustering (TRUE or FALSE)

col.clust.hc

hc object to be passed to as.dendrogram, available when col.clust = TRUE, default NA: hc.col = hcopt(stats::dist(t(x)), method="ward.D")

row.clust.hc

hc object to be passed to as.dendrogram, available when row.clust = TRUE, default NA: hc.row = hcopt(stats::as.dist(1-cor(t(x))),method="ward.D")

col.lab

column labels to include: subset of pData colnames character vector

row.lab

row labels to include: subset of fData colnames character vector

heatmap.y.text

include y axis labels for heatmap, uses rownames(eSet) (TRUE or FALSE)

heatmap.x.text

include x axis labels for heatmap, uses colnames(eSet)) (TRUE or FALSE)

heatmap.y.text.size

text size for y axis labels

heatmap.x.text.size

text size for x axis labels

heatmap.colorlegend.name

name for heatmap color legend

title.text

main title for the plot

col.legend.name

character vector for subset of col.lab to include in color legend

row.legend.name

character vector for subset of row.lab to include in color legend

legend.lab.max.char

number of characters limit for legend labels, default = 15

row.scaling

how should rows be scaled ("none", "quantile", "z-score.all", or "z-score.capped")

z.norm

heatmap colors reflect z-scores rather than original values, can be TRUE if row.scaling is "none"

cuttree.col

number of clusters for columns, default 0: do not show cluster assignment

cuttree.row

number of clusters for rows, default 0: do not show cluster assignment

verbose

return additional clustred annotation information as well as heatmap

grid.heights

numeric vector of length 7 representing heights of subpanels, leave NA for default

grid.widths

numeric vector of length 4 represeting weights of subpanels, leave NA for default

show

prints the heatmap within execution of the function (TRUE or FALSE)

Examples

#Use example data #1, for data set information: ?eSet1 data(eSet.brca.100)
#> Warning: data set ‘eSet.brca.100’ not found
eSet1<-eSet.brca.100
#> Error in eval(expr, envir, enclos): object 'eSet.brca.100' not found
eSet1<-eSet1[1:10,1:25]
#> Error in eval(expr, envir, enclos): object 'eSet1' not found
p1<-heatmap.ggplot2(eSet=eSet1, col.clust = TRUE, row.clust = TRUE, col.clust.hc = NA, row.clust.hc = NA, col.lab = c("HER2_status", "ER_status", "PR_status", "TN_status"), row.lab = "", heatmap.y.text = TRUE, heatmap.x.text = TRUE, heatmap.colorlegend.name = "RNASeq_expression", title.text = "TCGA BRCA log2 RNA-seq expression, z-score row normalized", col.legend.name = c("HER2_status", "ER_status", "PR_status", "TN_status"), row.legend.name = "", row.scaling = "z-score.capped", z.norm = FALSE, cuttree.col = 4, cuttree.row = 3, verbose = FALSE, show = FALSE)
#> Warning: `axis.ticks.margin` is deprecated. Please set `margin` property of `axis.text` instead
#> Warning: `panel.margin` is deprecated. Please use `panel.spacing` property instead
#> Warning: `legend.margin` must be specified using `margin()`. For the old behavior use legend.spacing
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'exprs': object 'eSet1' not found
grid.arrange(p1)
#> Error in grid.arrange(p1): could not find function "grid.arrange"
x<-exprs(eSet1)
#> Error in exprs(eSet1): could not find function "exprs"
hc.row<-hcopt(stats::as.dist(1-cor(t(x))),method="ward.D")
#> Error in t(x): object 'x' not found
hc.col <- hcopt(stats::dist(t(x), method = "euclidean"), method="ward.D")
#> Error in t(x): object 'x' not found
#Adding custom hclust object in col.clust.hc and row.clust.hc p2 <- heatmap.ggplot2(eSet=eSet1, col.clust = TRUE, row.clust = TRUE, col.clust.hc = hc.col, row.clust.hc = hc.row, col.lab = c("HER2_status", "ER_status", "PR_status", "TN_status"), row.lab = "", heatmap.y.text = TRUE, heatmap.x.text = TRUE, heatmap.colorlegend.name = "RNASeq_expression", title.text = "TCGA BRCA log2 RNA-seq expression, z-score row normalized", col.legend.name = c("HER2_status", "ER_status", "PR_status", "TN_status"), row.legend.name = "", row.scaling = "z-score.capped", z.norm = FALSE, cuttree.col = 4, cuttree.row = 3, verbose = FALSE, show = FALSE)
#> Warning: `axis.ticks.margin` is deprecated. Please set `margin` property of `axis.text` instead
#> Warning: `panel.margin` is deprecated. Please use `panel.spacing` property instead
#> Warning: `legend.margin` must be specified using `margin()`. For the old behavior use legend.spacing
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'exprs': object 'eSet1' not found
grid.newpage()
#> Error in grid.newpage(): could not find function "grid.newpage"
grid.arrange(p2)
#> Error in grid.arrange(p2): could not find function "grid.arrange"
#Saving plot in verbose format p3 <- heatmap.ggplot2(eSet=eSet1, col.clust = TRUE, row.clust = TRUE, col.clust.hc = hc.col, row.clust.hc = hc.row, col.lab = c("HER2_status", "ER_status", "PR_status", "TN_status"), row.lab = "", heatmap.y.text = TRUE, heatmap.x.text = TRUE, heatmap.colorlegend.name = "RNASeq_expression", title.text = "TCGA BRCA log2 RNA-seq expression, z-score row normalized", col.legend.name = c("HER2_status", "ER_status", "PR_status", "TN_status"), row.legend.name = "", row.scaling = "z-score.capped", z.norm = FALSE, cuttree.col = 4, cuttree.row = 3, verbose = TRUE, show = FALSE)
#> Warning: `axis.ticks.margin` is deprecated. Please set `margin` property of `axis.text` instead
#> Warning: `panel.margin` is deprecated. Please use `panel.spacing` property instead
#> Warning: `legend.margin` must be specified using `margin()`. For the old behavior use legend.spacing
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'exprs': object 'eSet1' not found
grid.newpage()
#> Error in grid.newpage(): could not find function "grid.newpage"
grid.arrange(p3$heatmap)
#> Error in grid.arrange(p3$heatmap): could not find function "grid.arrange"
#Adding custom colors to column and row annotation labels print(p3$meta.c$id)
#> Error in print(p3$meta.c$id): object 'p3' not found
meta.c.color.string<-c("yellow", "khaki3", "gold", "chocolate", "darkred", "cyan") meta.c.color<-as.character(sapply(meta.c.color.string, to.hex)) names(meta.c.color)<-c("Negative", "Positive", "1", "2", "3", "4") print(p3$meta.r$id)
#> Error in print(p3$meta.r$id): object 'p3' not found
meta.r.color.string<-c("pink", "azure", "green") meta.r.color<-as.character(sapply(meta.r.color.string, to.hex)) names(meta.r.color)<-c("1", "2", "3") p4<-heatmap.ggplot2(eSet=eSet1, col.legend.brewer = meta.c.color, row.legend.brewer = meta.r.color, col.clust = TRUE, row.clust = TRUE, col.clust.hc = hc.col, row.clust.hc = hc.row, col.lab = c("HER2_status", "ER_status", "PR_status", "TN_status"), row.lab = "cluster.row", heatmap.y.text = TRUE, heatmap.x.text = TRUE, heatmap.colorlegend.name = "RNASeq_expression", title.text = "TCGA BRCA log2 RNA-seq expression, z-score row normalized", col.legend.name = c("HER2_status", "ER_status", "PR_status", "TN_status", "cluster.col"), row.legend.name = "cluster.row", row.scaling = "z-score.capped", z.norm = FALSE, cuttree.col = 4, cuttree.row = 3, verbose = FALSE, show = FALSE)
#> Warning: `axis.ticks.margin` is deprecated. Please set `margin` property of `axis.text` instead
#> Warning: `panel.margin` is deprecated. Please use `panel.spacing` property instead
#> Warning: `legend.margin` must be specified using `margin()`. For the old behavior use legend.spacing
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'exprs': object 'eSet1' not found
grid.newpage()
#> Error in grid.newpage(): could not find function "grid.newpage"
grid.arrange(p4)
#> Error in grid.arrange(p4): could not find function "grid.arrange"