plotEnrich: plotEnrich

View source: R/functions.R

plotEnrichR Documentation

plotEnrich

Description

Visualise a Enrichr output as barplot

Usage

plotEnrich(
  df,
  showTerms = 20,
  numChar = 40,
  y = "Count",
  orderBy = "P.value",
  xlab = NULL,
  ylab = NULL,
  title = NULL
)

Arguments

df

(Required). A single data.frame from a list of Enrichr output.

showTerms

(Optional). Number of terms to show. Default is 20.

numChar

(Optional). A single integer. Default is 40. Indicates the number characters to keep in the term description.

y

(Optional). A character string. Default is "Count". Indicates the variable that should be mapped to the y-axis. It can be either "Count" or "Ratio".

orderBy

(Optional). A character string. Default is "P.value". Indicates how to order the Enrichr results before subsetting to keep top N terms. It can be either "P.value" or "Combined.Score".

xlab

(Optional). A character string. Default is NULL. Indicates the x-axis label.

ylab

(Optional). A character string. Default is NULL. Indicates the y-axis label.

title

(Optional). A character string. Default is NULL Indicates the main title for the graphic.

Details

Visualise Enrichr result from a selected gene-set library as barplot.

Value

A ggplot2 plot object

Author(s)

I-Hsuan Lin i-hsuan.lin@manchester.ac.uk

See Also

ggplot

Examples

if (getOption("enrichR.live")) {
  dbs <- listEnrichrDbs()
  enrichRLive <- TRUE
  if (is.null(dbs)) enrichRLive <- FALSE
  dbs <- c("GO_Molecular_Function_2018", "GO_Cellular_Component_2018",
           "GO_Biological_Process_2018")
  enriched <- enrichr(c("Runx1", "Gfi1", "Gfi1b", "Spi1", "Gata1", "Kdr"), dbs)
  # Plot top 20 terms from "GO_Biological_Process_2018" and ordered by P-value
  if (enrichRLive) {
    plotEnrich(enriched[[3]], showTerms = 20, numChar = 50, y = "Count",
               orderBy = "P.value")
  }
}

enrichR documentation built on April 14, 2023, 5:14 p.m.