do_TermEnrichmentPlot() | GO/pathway term enrichment

Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: generics

Attaching package: 'generics'
The following objects are masked from 'package:base':

    as.difftime, as.factor, as.ordered, intersect,
    is.element, setdiff, setequal, union

Attaching package: 'BiocGenerics'
The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':

    anyDuplicated, aperm, append, as.data.frame,
    basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, is.unsorted, lapply, Map, mapply, match,
    mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, Position, rank, rbind, Reduce,
    rownames, sapply, saveRDS, table, tapply, unique,
    unsplit, which.max, which.min
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view
    with 'browseVignettes()'. To cite Bioconductor,
    see 'citation("Biobase")', and for packages
    'citation("pkgname")'.
Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: 'S4Vectors'
The following object is masked from 'package:utils':

    findMatches
The following objects are masked from 'package:base':

    expand.grid, I, unname

Attaching package: 'IRanges'
The following object is masked from 'package:sp':

    %over%

This function visualizes enriched GO terms or pathways from over-representation analysis (e.g., using clusterProfiler). Displays terms as a dot plot with gene count and p-values.


Basic usage

First run enrichment analysis:

# Using clusterProfiler

enrichment_result <- clusterProfiler::enrichGO(
  gene = Seurat::VariableFeatures(sample)[1:100],
  OrgDb = org.Hs.eg.db,
  keyType = "SYMBOL",
  ont = "BP"
)

p <- SCpubr::do_TermEnrichmentPlot(mat = enrichment_result@result)
p


Adjust number of terms

p <- SCpubr::do_TermEnrichmentPlot(mat = enrichment_result@result,
                                   n.terms = 15)
p


Control term wrapping

p <- SCpubr::do_TermEnrichmentPlot(mat = enrichment_result@result,
                                   n.chars = 30)  # Shorter lines
p


Adjust dot size

p <- SCpubr::do_TermEnrichmentPlot(mat = enrichment_result@result,
                                   dot.scale = 6)
p


Parameter reference

Note

For parameters shared across many functions (color palettes, typography, legend styling, grid), see Shared features.

Core parameters

Parameter Description Default
mat Enrichment result (via @result)
n.terms Number of terms to show 25
n.chars Characters before wrapping 40
dot.scale Dot size multiplier 8

See also