Skip to contents

This function generates a heatmap of signature scores. You should do this after score_signature().

Usage

plot_score_signature_heatmap(
  sc_obj,
  signature_list,
  group,
  group_prefix = NULL,
  scale = "none",
  signature_cat,
  signature_cat_col,
  heatmap_title = NULL,
  save_path = "./signature.pdf",
  width = 6,
  height = 6
)

Arguments

sc_obj

A Seurat object.

signature_list

list. A list of gene sets, where each element is a character vector of gene names.

group

A character string specifying the metadata column to group by. (e.g., group = "RNA_snn_res.0.6")

group_prefix

A character string to prefix the column names in the heatmap. Default is NULL.

scale

Whether to scale the matrix. Options are "none", "row", or "column". Default is "none".

signature_cat

Named vector. c("rowname1" = "category1", "rowname2" = "category2"). Provide to each row a category.

signature_cat_col

Named vector. c("category1" = "color1", "category2" = "color2"). Provide to each category a color.

heatmap_title

Character. Title for the heatmap. Default: NULL.

save_path

Path to save the heatmap PDF (Only support pdf). Default is "./signature.pdf".

width

Width of the saved heatmap PDF. Default is 6.

height

Height of the saved heatmap PDF. Default is 6.

Value

heatmap obj.

Examples

if (FALSE) { # \dontrun{
signature_category <- c("Naive"                        = "Differentiation",
"Activation/Effector function" = "Differentiation",
"Exhaustion"                   = "Differentiation",
"TCR Signaling"                = "Function",
"Cytotoxicity"                 = "Function",
"Cytokine/Cytokine receptor"   = "Function",
"Chemokine/Chemokine receptor" = "Function",
"Senescence"                   = "Function",
"Anergy"                       = "Function",
"NFKB Signaling"               = "Function",
"Stress response"              = "Function",
"MAPK Signaling"               = "Function",
"Adhesion"                     = "Function",
"IFN Response"                 = "Function",
"Oxidative phosphorylation"    = "Metabolism",
"Glycolysis"                   = "Metabolism",
"Fatty acid metabolism"        = "Metabolism",
"Pro-apoptosis"                = "Apoptosis",
"Anti-apoptosis"               = "Apoptosis")
signature_category_color <- c("Differentiation" = "#E49446",
                              "Function"        = "#4BA5DB",
                              "Metabolism"      = "#815F43",
                              "Apoptosis"       = "#B12F3A")
plot_score_signature_heatmap(cd8, cd8_signature, group = "RNA_snn_res.0.6",
                             group_prefix = "CD8_c", scale = "row",
                             signature_cat = signature_category,
                             signature_cat_col = signature_category_color,
                             save_path = "./figure/sc/annotation/tnk/cd8/demo.signature.pdf",
                             width = 6, height = 6)
} # }