BatchGSEA: Performs GSEA for all Hotgenes contrasts

View source: R/BatchGSEA.R

BatchGSEAR Documentation

Performs GSEA for all Hotgenes contrasts

Description

Performs GSEA for all Hotgenes contrasts

Usage

BatchGSEA(
  m_df = NULL,
  HotgenesObj = NULL,
  nTop = 10,
  cut_padj = 0.1,
  minSize = 15,
  maxSize = 1000,
  nperm = 1e+05,
  nproc = 1
)

Arguments

m_df

GeneSet generated using msigdbr function

HotgenesObj

R object generated by DEseq2_export function

nTop

number of pathways to return

cut_padj

Adjusted pvalue cut off. Default is 0.1.

minSize

Minimal size of a gene set to test. All pathways below the threshold are excluded.

maxSize

Maximal size of a gene set to test. All pathways above the threshold are excluded.

nperm

Number of permutations to do. Minimial possible nominal p-value is about 1/nperm

nproc

If not equal to zero sets BPPARAM to use nproc workers (default = 0).

Value

HotgenesObj appended with GSEA for each contrast

Examples

Example_Hotgenes_dir<-system.file("extdata",
"Example_Hotgenes.Rdata",
package = "Hotgenes", mustWork = TRUE)
load(Example_Hotgenes_dir)
library(msigdbr)

# GO annotations
m_df = msigdbr(species = "Homo sapiens", category = "C5", subcategory = "BP")

# Reactome annotations
# m_df = msigdbr(species = "Homo sapiens", category = "C2", 
# subcategory = "CP:REACTOME")  

qbat<-BatchGSEA(HotgenesObj=Example_Hotgenes,
m_df= m_df)

# View enriched pathways
lapply(qbat$OuputGSEA, function(x) head(x$fgRes$pathway))

# plot of enriched pathways
qbat$OuputGSEA$shEWS$g

# Prep for GSEA plot
m_list = qbat$m_list

# top pathways
qbat$OuputGSEA$shEWS$top$pathway
pyid<-qbat$OuputGSEA$shEWS$top$pathway[[2]]
pyid

Gene_Ranks <- qbat$OuputGSEA$shEWS$Gene_Ranks
fgsea::plotEnrichment(m_list[[pyid]], Gene_Ranks,
gseaParam = 1, ticksSize = 0.2) +
ggplot2::labs(title=stringr::str_wrap(pyid, 20))

Rvirgenslane/Hotgenes documentation built on June 15, 2024, 2:16 a.m.