signatureHeatmap: Plot a heatmap of signature scores.

Description Usage Arguments Details Value Examples

View source: R/plot.R

Description

This function takes a dataset of scored gene expression data as an input and returns a ComplexHeatmap plot for for visual comparison of signature performance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
signatureHeatmap(
  inputData,
  annotationData = NULL,
  name = "Signatures",
  signatureColNames,
  annotationColNames = NULL,
  colList = list(),
  scale = FALSE,
  showColumnNames = TRUE,
  showRowNames = TRUE,
  colorSets = c("Set1", "Set2", "Set3", "Pastel1", "Pastel2", "Accent", "Dark2",
    "Paired"),
  choose_color = c("blue", "gray95", "red"),
  split_heatmap = "disease",
  annotationSignature = sigAnnotData,
  ...
)

Arguments

inputData

an input data object. It should either be of the class SummarizedExperiment and contain the profiled signature data and annotation data as columns in the colData, or alternatively be of the classes data.frame or matrix and contain only the gene expression data. Required.

annotationData

a data.frame or matrix of annotation data, with one column. Only required if inputData is a data.frame or matrix of signature data. The row names must equal those of the inputData column names. Default is NULL.

name

a character string with the plot title of the heatmap. The default is "Signatures".

signatureColNames

a vector of the column names in colData that contain the signature data. Only required if inputData is a SummarizedExperiment object.

annotationColNames

a vector of the column names in colData that contain the annotation data. Only required if inputData is a SummarizedExperiment. Default is NULL.

colList

a named list of named vectors specifying custom color information to pass to ComplexHeatmap::Heatmap(). The list should have as many elements as there are annotation columns, and each element name should correspond exactly with the name of each annotation column. The colors in the vector elements should be named according to the levels of the factor in that column's annotation data if the annotation is discrete, or it should be produced with circlize::colorRamp2 if the annotation is continuous. By default, ColorBrewer color sets will be used. See the the parameter colorSets for additional details.

scale

logical. Setting scale = TRUE scales the signature data. The default is FALSE.

showColumnNames

logical. Setting showColumnNames = TRUE will show the column names (i.e. sample names) on the heatmap. The default is TRUE.

showRowNames

logical. Setting showColumnNames = TRUE will show the row names (i.e. signature names) on the heatmap. The default is TRUE.

colorSets

a vector of names listing the color sets in the order that they should be used in creating the heatmap. By default, this function will use the color sets in the order listed in Usage for annotation information. You may replace the default with the same collection of sets in order that you want to use them, or provide custom color sets with the colList parameter.

choose_color

a vector of color names to be interpolated for the heatmap gradient, or a colorRamp function produced by circlize::colorRamp2. The default is c("blue", "gray95", "red").

split_heatmap

a character string either giving the column title of annotationSignature containing annotation data for which to split the heatmap rows (i.e., signatures), or "none" if no split is desired. The default is "disease".

annotationSignature

a data.frame or matrix with information to be used in splitting the heatmap. The first column should signature names. The column of annotation information should be specified in split_heatmap. Other columns will be ignored. The default is sigAnnotData.

...

Additional arguments to be passed to ComplexHeatmap::Heatmap().

Details

If both annotationData = NULL and annotationColNames = NULL, no annotation bar will be drawn on the heatmap.

Value

A ComplexHeatmap plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
library(SummarizedExperiment)
# Generate some artificial data that shows a difference in Zak_RISK_16
mat_testdata <- rbind(matrix(c(rnorm(80), rnorm(80) + 5), 16, 10,
                             dimnames = list(TBsignatures$Zak_RISK_16,
                                             paste0("sample", seq_len(10)))),
                      matrix(rnorm(1000), 100, 10,
                             dimnames = list(paste0("gene", seq_len(100)),
                                             paste0("sample", seq_len(10)))))
# Create a SummarizedExperiment object that contains the data
testdataSE <- SummarizedExperiment(assays = SimpleList(data = mat_testdata),
                                     colData = DataFrame(sample =
                                                           c(rep("down", 5),
                                                                rep("up", 5))))
res <- runTBsigProfiler(testdataSE, useAssay = "data",
                        signatures = TBsignatures["Zak_RISK_16"],
                        algorithm = c("GSVA", "ssGSEA"), parallel.sz = 1,
                        combineSigAndAlgorithm = TRUE)
signatureHeatmap(res, signatureColNames = c("GSVA_Zak_RISK_16",
                                            "ssGSEA_Zak_RISK_16"),
                 annotationColNames = "sample", scale = TRUE,
                 showColumnNames = FALSE, split_heatmap = "none")

# Example using custom colors for the annotation information
color2 <- stats::setNames(c("purple", "black"), c("down", "up"))
color.list <- list("sample" = color2)

signatureHeatmap(res, signatureColNames = c("GSVA_Zak_RISK_16",
                                            "ssGSEA_Zak_RISK_16"),
                 annotationColNames = "sample", scale = TRUE,
                 showColumnNames = FALSE,
                 colList = color.list, split_heatmap = "none")

TBSignatureProfiler documentation built on Nov. 8, 2020, 6:56 p.m.