This function computes AUC scores for multiple gene signatures and scoring methods, and generates a heatmap for each gene signature. The heatmap displays the AUC scores, with the contrasts as rows and methods as columns. The heatmaps are then arranged in a grid layout.
Arguments
- data
A data frame of gene expression data with genes as rows and samples as columns. Row names should contain gene names and column names sample identifiers.
- metadata
A data frame of sample metadata. The first column must contain sample identifiers matching those in
data
.- gene_sets
A named list of gene sets.
- method
A character string specifying the scoring method(s) (
"logmedian"
,"ssGSEA"
,"ranking"
, or"all"
).- mode
A string specifying the level of detail for contrasts. Options are:
"simple"
: Pairwise comparisons (e.g., A - B)."medium"
: Pairwise comparisons plus comparisons against the mean of other groups."extensive"
: All possible groupwise contrasts, ensuring balance in the number of terms on each side.
- variable
A string specifying the grouping variable in
metadata
used for computing AUC comparisons.- nrow
Optional. An integer specifying the number of rows in the heatmap grid. If
NULL
, the number of rows is computed automatically.- ncol
Optional. An integer specifying the number of columns in the heatmap grid. If
NULL
, the number of columns is computed automatically.- limits
Optional. A numeric vector of length 2 specifying the color scale limits (e.g.,
c(min, max)
). IfNULL
, the limits are determined from the data.- widthTitle
An integer specifying the width used for wrapping gene set signature names in the heatmap titles. Default is 22.
- titlesize
An integer specifying the text size for each of the heatmap titles. Default is 12.
- ColorValues
A character vector specifying the colors for the gradient fill in the heatmaps. Default is
c("#F9F4AE", "#B44141")
.- title
Title for the grid of plots.
Value
A list with two elements:
- plt
A combined heatmap arranged in a grid using
ggpubr::ggarrange
.- data
A list containing the AUC scores for each gene signature, as computed by
ROCAUC_Scores_Calculate
.
Details
The function first calculates AUC scores for each gene signature using ROCAUC_Scores_Calculate
. The resulting matrices are converted to a long format so that each cell in the heatmap can display the AUC value. A title for each heatmap is dynamically created.
The heatmaps are then adjusted to display axis text and ticks only for the left-most column and bottom row, and combined into a grid layout. If neither nrow
nor ncol
are specified, the layout is automatically determined to best approximate a square grid.