Skip to contents

This function takes the profiled gene expression data for a single signature and creates a heatmap based on the expression scores.


  name = "Signature",
  signatureColNames = NULL,
  annotationColNames = NULL,
  scale = TRUE,
  showColumnNames = TRUE,
  showRowNames = TRUE,
  colList = list(),
  colorSets = c("Set1", "Set2", "Set3", "Pastel1", "Pastel2", "Accent", "Dark2",
  choose_color = c("blue", "gray95", "red"),
  column_order = NULL,



a SummarizedExperiment object containing the profiled signature data and annotation data as columns in the colData. Required.


a character string specifying the assay to use for the gene expression data. Required.


a vector identifying the genes in the signature to use in the heatmap. For inbuilt signatures, you can use TBsignatures (e.g., TBsignatures[["ACS_COR"]]). Required.


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


a vector of the column names in the colData that contain the signature data. Required.


a vector of the column names in the colData that contain the annotation data. If NULL, no annotation bar besides those of the scoring algorithms will be drawn on the heatmap. The default is NULL.


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


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


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


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 gene signatures (i.e. sigGenes), and each element name should correspond exactly with the name of each annotation column/signature. 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/gene is continuous. By default, ColorBrewer color sets will be used. See the the parameter colorSets for additional details.


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.


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").


a vector of character strings indicating the order in which to manually arrange the heatmap columns. Default is NULL, such that column order is automatically determined via clustering.


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


A ComplexHeatmap plot.


# 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))))
# Run profiler using GSVA and ssGSEA on Zak_RISK_16
res <- runTBsigProfiler(testdataSE, useAssay = "data",
                        signatures = TBsignatures["Zak_RISK_16"],
                        algorithm = c("GSVA", "ssGSEA"), = 1,
                        combineSigAndAlgorithm = TRUE)
#> Parameter update_genes is TRUE. Gene names will be updated.
#> Running GSVA
#> Estimating GSVA scores for 1 gene sets.
#> Estimating ECDFs with Gaussian kernels
  |                                                                      |   0%
  |======================================================================| 100%
#> Running ssGSEA
#> Estimating ssGSEA scores for 1 gene sets.
#> [1] "Calculating ranks..."
#> [1] "Calculating absolute values from ranks..."
  |                                                                      |   0%
  |=======                                                               |  10%
  |==============                                                        |  20%
  |=====================                                                 |  30%
  |============================                                          |  40%
  |===================================                                   |  50%
  |==========================================                            |  60%
  |=================================================                     |  70%
  |========================================================              |  80%
  |===============================================================       |  90%
  |======================================================================| 100%
#> [1] "Normalizing..."

# Plot a heatmap of signature genes and pathway predictions
signatureGeneHeatmap(res, useAssay = "data",
                     sigGenes = TBsignatures[["Zak_RISK_16"]],
                     signatureColNames = c("GSVA_Zak_RISK_16",
                     annotationColNames = c("sample"), showColumnNames = FALSE,
                     name = "Zak_RISK_16")