plot.multi.gsea: GSEA plotter

View source: R/plot.multi.gsea.R

plot.multi.gseaR Documentation

GSEA plotter

Description

Function to plot GSEA results (see clusterprofiler).

Usage

## S3 method for class 'multi.gsea'
plot(
  gsea.results,
  geneset.id.list = NULL,
  enrichment.geom = "line",
  geneset.colors = NULL,
  enrichment.geom.size = 1,
  enrichment.plot.zero.line = FALSE,
  enrichment.zero.line.color = "gray",
  enrichment.zero.line.width = 0.5,
  geneset.segments.width = 0.3,
  geneset.segments.color = "black",
  ranking.color = "gray",
  gradient.colors = c("Reds", "Blues"),
  table.font.size = 8,
  title.position = "center",
  title = NULL,
  combined.plot.height.ratios = c(1, 0.4, 0.6, 0.5),
  image.file.name = NULL,
  image.width = 9,
  image.height = 6,
  return.all.objects = FALSE
)

Arguments

gsea.results

A gseaResult object as generate by clusterprofiler.

enrichment.geom

String indicating the type of graph to use to plot the enrichment scores. Possible options: 'line', 'lines', 'dot', 'dots', 'point', 'points' (case insensitive). Default: 'line'.

geneset.colors

String vector indicating a list of any R-supported color to be used for the enrichment score plot per each dataset. Default: 'NULL' (automatic rainbow colors).

enrichment.geom.size

Numeric value indicating the size of the line, or dots, used in the enrichment score plot. Default: 1.

enrichment.plot.zero.line

Logical value to indicated whether to plot an horizontal line at 0 in the enrichment score plot. Default: FALSE.

enrichment.zero.line.color

String indicating any R-supported color to be used for the 0-line in the enrichment score plot (active when enrichment.plot.zero.line = TRUE). Default: 'gray'.

enrichment.zero.line.width

Numeric value indicating the line width of the 0-line in the enrichment score plot (active when enrichment.plot.zero.line = TRUE). Default: 0.5.

geneset.segments.width

Numeric value indicating the line width of the geneSet vertical segments. Default: 0.3.

geneset.segments.color

String indicating any R-supported color to be used for the geneSet segments. Default: 'black'.

ranking.color

String indicating any R-supported color to be used for the ranked list plot (histogram). Default: 'gray'.

gradient.colors

Two-values string vector indicating the shadows of palettes to use for the genset gradient. Possible values: 'Blues', 'Greens', 'Greys', 'Oranges', 'Purples', 'Reds'. Default: c('Reds', 'Blues').

table.font.size

Numeric value to indicate the font size to use in the stat table plot. Default: 8.

title.position

String indicating the position of the title: 'left', 'center', 'right'. Default: 'center'.

title

String indicating the title to use. Default: NULL (no title).

combined.plot.height.ratios

Numeric vector with 4 values used to define the 'real heights' of each panel. The order corresponds to: enrichment score panel, geneset panel (all together), rank panel, stat table panel. Default c(1, 0.4, 0.6, 0.5).

image.file.name

String indicating the full path for the export of a pdf file of the combined plot. Default: NULL, no plot will be exported.

image.width

Numeric value to indicate the width (in inches) to use for the exported pdf file. Active only when image.file.name is not NULL. Default: 9.

image.height

Numeric value to indicate the height (in inches) t use for the exported pdf file. Active only when image.file.name is not NULL. Default: 6.

return.all.objects

Logical value to indicate whether the function should return only the combined plot (ggplot object), or all the different panels and the combined plot in a list. Default: FALSE (only combined plot).

geneset.id

Numeric value or a string identifying the Nth geneSet (numeric) or a specific id (string) if geneSet in the result table. Default value: NULL, which returns the ordered list of available geneSets.

Value

Either a ggplot-object with the final combined plot, or a list with the three panels separated and the combined plot: list(enrichment.panel, geneset.panel.list - list with one element per geneset -, rank.panel, stat.table, combined.plot).

Examples

data(geneList, package = "DOSE")

msigdb_hallmarks =
  msigdbr::msigdbr(species = "Homo sapiens", category = "H") %>%
  dplyr::select(gs_name, human_entrez_gene)

gsea_H = clusterProfiler::GSEA(geneList = geneList,
                               TERM2GENE = msigdb_hallmarks,
                               minGSSize = 3,
                               maxGSSize = 800,
                               pAdjustMethod = "BH",
                               pvalueCutoff = 0.05,
                               verbose = T)

plot.multi.gsea(gsea_H, geneset.id = c("HALLMARK_ADIPOGENESIS", "HALLMARK_CELL_CYCLE"))
plot.multi.gsea(gsea_H, geneset.id = c(1,2,7))


sebastian-gregoricchio/Rseb documentation built on May 15, 2024, 5:45 a.m.