Skip to contents

This function is used plot the NES barplot, to represent GSEA results, using ggplot2.

Usage

plot_gsea_barplot(
  gsea_result,
  group1 = NULL,
  group2 = NULL,
  color_column = NULL,
  nb_char_max = 80,
  K_column = NULL,
  with_label_k_on_K = FALSE,
  show_legend = TRUE
)

Arguments

gsea_result

DATAFRAME : for instance, the one stored in @results slot, in the output from clusterProfiler::GSEA function (no default). It must contains at least the following columns (between parenthesis means optional) :

  • ID : gene set name

  • NES : normalized enrichment score

  • p.adjust : adjusted p-value

  • (setSize) : number of genes from the gene sets, provided in input

group1

CHARACTER : group 1 name, to be print in subtitle (default to NULL, no print)

group2

CHARACTER : group 2 name, to be print in subtitle (default to NULL, no print)

color_column

CHARACTER : a column name in gsea_result to color gene set names by (default to NULL, no colors)

nb_char_max

NUMERIC : maximum number of characters in the gene set names to display in the axis. Long names are cut to this threshold and "..." is added in the end. Set to NULL to print the full names (default to 80)

K_column

CHARACTER : a column name in gsea_result containing gene set size (default to NULL)

with_label_k_on_K

LOGICAL : whether to add a label with k/K on each bar. If TRUE, K_column must not be NULL (default to FALSE)

show_legend

LOGICAL : whether to show the legend or not (default to TRUE)

Value

A ggplot2 object