plot_enrich2: Plotting function for hypergeometric enrichment

View source: R/plot_enrich2.R

plot_enrich2R Documentation

Plotting function for hypergeometric enrichment

Description

Plotting function for hypergeometric enrichment

Usage

plot_enrich2(
  df = NULL,
  fdr_cutoff = 0.2,
  pathway_col = "pathway",
  gene_col = "genes",
  ratio_col = "k/K",
  fdr_col = "FDR",
  gssize_col = "n_pathway_genes",
  custom_genelist = NULL,
  x_grouping_method = "geneset",
  y_grouping_method = "fdr",
  prevalence_color = "none",
  prevalence_cutoff = NULL,
  chart_style = "bar",
  include_grid = TRUE,
  lollipop_fdr_colors = c(0.01, 0.05, 0.1, 0.2)
)

Arguments

df

Data frame output by SEARchways::BIGprofiler or SEARchways::flexEnrich

fdr_cutoff

Numeric. Maximum FDR to plot. Default is 0.2.

pathway_col

String. Column name for df column containing gene set names.

gene_col

String. Column name for df column containing gene lists names. Required if "include_grid == TRUE".

ratio_col

String. Column name for df column containing k/K ratios.

fdr_col

String. Column name for df column containing corrected p-values to plot.

gssize_col

String. Column name for df column containing gene set sizes.

custom_genelist

Optional vector of gene IDs to plot in the grid. Otherwise, all genes in the gene_col of input where set FDR < fdr_cutoff will be plotted.

x_grouping_method

String. Method for grouping genes along the x-axis. Options are "hclust", "prevalence", "input", "alphabetical", and "geneset". Default is "geneset".

y_grouping_method

String. Method for grouping gene sets along the y-axis. "hclust", "overlap_size", "gs_size", "ratio", "fdr", and "input". Default is "fdr".

prevalence_color

String. Modes for coloring gene x gene set grid. Options are "none", "cutoff", and "heatmap". Required if "include_grid == TRUE". Default is "none".

prevalence_cutoff

Numeric. Cutoff for coloring genes by prevalence in plotted gene sets. Required if 'prevalence_color == "cutoff"'.

chart_style

String. Options are "bar" and "lollipop". Default is "bar".

include_grid

Boolean. Whether or not to include the gene x gene set grid in the final plot. Default is TRUE.

lollipop_fdr_colors

Numeric vector. Cutoffs for binned FDR value color groups for lollipop plots. Default is c(0.01, 0.05, 0.1, 0.2).

Value

ggplot2 object

Examples

library(SEARchways)
library(dplyr)
#Run enrichment
gene_list <- list(HRV1 = names(example.gene.list[[1]]))
enrich <- BIGprofiler(gene_list, ID="ENSEMBL", category="H")

#Plot
plot_enrich2(enrich, fdr_cutoff = 0.8, gssize_col = "size_pathway")

BIGslu/BIGpicture documentation built on Oct. 14, 2024, 9:30 p.m.