plot.gsea: GSEA plotter

View source: R/plot.gsea.R

plot.gseaR Documentation

GSEA plotter

Description

Function to plot GSEA results (see clusterprofiler).

Usage

## S3 method for class 'gsea'
plot(
  gsea.results,
  geneset.id = NULL,
  enrichment.geom = "line",
  enrichment.color = "green",
  enrichment.geom.size = 1,
  enrichment.plot.zero.line = FALSE,
  enrichment.zero.line.color = "gray",
  enrichment.zero.line.width = 0.5,
  enrichment.annotations.vjust.offset = 0,
  geneset.segments.width = 0.3,
  geneset.segments.color = "black",
  rank.max.color = "indianred",
  ranking.color = "gray",
  gradient.colors = c("Reds", "Blues"),
  title.position = "center",
  title = NA,
  image.file.name = NULL,
  image.width = 7,
  image.height = 5,
  return.all.objects = FALSE
)

Arguments

gsea.results

A gseaResult object as generate by clusterprofiler.

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.

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'.

enrichment.color

String indicating any R-supported color to be used for the enrichment score plot. Default: 'green'.

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.

enrichment.annotations.vjust.offset

Numeric value to add to the vjust (vertical positioning) of the enrichment plot annotations (P, Padj, q, NES, set size). Positive values will shift-down the annotations. Default: 0 (base line).

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'.

rank.max.color

String indicating any R-supported color to be used for the max rank dotted lines and annotation. Default: 'indianred'.

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').

title.position

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

title

String indicating the title to use. Default: NA, this will automatically use the geneset name chosen. Use NULL to do not plot the title.

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: 7.

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: 5.

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).

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, rank.panel, 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.gsea(gsea_H, geneset.id = "HALLMARK_ADIPOGENESIS")
plot.gsea(gsea_H, geneset.id = 28)


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