run_gsea_one_factor: Run gsea separately for all cell types of one specified...

View source: R/run_gsea.R

run_gsea_one_factorR Documentation

Run gsea separately for all cell types of one specified factor and plot results

Description

Run gsea separately for all cell types of one specified factor and plot results

Usage

run_gsea_one_factor(
  container,
  factor_select,
  method = "fgsea",
  thresh = 0.05,
  db_use = "GO",
  signed = TRUE,
  min_gs_size = 15,
  max_gs_size = 500,
  reset_other_factor_plots = FALSE,
  draw_plot = TRUE,
  ncores = container$experiment_params$ncores
)

Arguments

container

environment Project container that stores sub-containers for each cell type as well as results and plots from all analyses

factor_select

numeric The factor of interest

method

character The method of gsea to use. Can either be "fgsea", "fgsea_special or "hypergeometric". (default="fgsea")

thresh

numeric Pvalue significance threshold to use. Will include gene sets in resulting heatmap if pvalue is below this threshold for at least one cell type. (default=0.05)

db_use

character The database of gene sets to use. Database options include "GO", "Reactome", "KEGG", and "BioCarta". More than one database can be used. (default="GO")

signed

logical If TRUE, uses signed gsea. If FALSE, uses unsigned gsea. Currently only works with fgsea method (default=TRUE)

min_gs_size

numeric Minimum gene set size (default=15)

max_gs_size

numeric Maximum gene set size (default=500)

reset_other_factor_plots

logical Set to TRUE to set all other gsea plots to NULL (default=FALSE)

draw_plot

logical Set to TRUE to show the plot. Plot is stored regardless. (default=TRUE)

ncores

numeric The number of cores to use (default=container$experiment_params$ncores)

Value

A stacked heatmap plot of the gsea results in the slot container$plots$gsea$<Factor#>. The heatmaps show adjusted p-values for the enrichment of each gene set in each cell type for the selected factor. The top heatmap shows enriched gene sets among the positive loading genes and the bottom heatmap shows enriched gene sets among the negative loading genes for the factor.

Examples

test_container <- run_gsea_one_factor(test_container, factor_select=1,
method="fgsea", thresh=0.05, db_use="Hallmark", signed=TRUE)

scITD documentation built on Sept. 8, 2023, 5:11 p.m.