Skip to contents

Can plot barplot of NES of pathways from one GSEA result, or compare NES for chosen pathways between two GSEA results.

Usage

plot_GSEA_barplot(
  gsea_res,
  gsea_name = "GSEA",
  gsea_pws = NULL,
  n_pws = 5,
  pw_format = FALSE,
  pw_split = FALSE,
  pw_source = TRUE,
  pw_ignore = NULL,
  pw_size = 5,
  gsea2_res = NULL,
  gsea2_name = NULL,
  order2 = FALSE,
  ptrn2 = "none",
  NES_cutoff = NULL,
  sig_cutoff = NULL,
  colors = c("firebrick", "darkblue"),
  title = NULL,
  savename = NULL,
  width = 10,
  height = NULL
)

Arguments

gsea_res

df/string; (path to) GSEA results w/ pathway and NES columns

gsea_name

string; description of GSEA results

gsea_pws

char vector; pathways in GSEA results to plot

n_pws

integer; if no pathways provided, top/bottom n pathways (ordered by NES) to plot

pw_format

logical; clean up pathway names?

pw_split

logical; T to split pathway names into multiple lines

pw_source

logical; T to append pathway source in parenthesis

pw_ignore

char vector; list of terms to ignore for name formatting

pw_size

numeric; pathway name text size

gsea2_res

df/string; (path to) 2nd GSEA results w/ pathway and NES columns

gsea2_name

string; description of 2nd GSEA results

order2

logical; order pathways by NES of 2nd GSEA results?

ptrn2

string; ggpattern pattern arg: 'stripe', 'crosshatch', 'point', 'circle', 'none'

NES_cutoff

numeric; value to draw NES cutoff line at

sig_cutoff

vector; sig_cutoff[1] is colname of significance values ("pval" or "padj"), sig_cutoff[2] is numeric cutoff value: if higher than this value, alpha will be 0.5. Ex. sig_cutoff = c("pval", 0.05) or sig_cutoff = c("padj", 0.1)

colors

vector; colors[1] for positive bar color, colors[2] for negative bar color

title

string; plot title

savename

string; file path to save plot under

width

numeric; plot width

height

numeric; plot height

Value

GSEA NES barplot as ggplot object

Details

To extend margins and accomodate long pathway names, add ggplot2::theme(plot.margin = unit(c(top, right, bottom, left), units)) to the ggplot object.