knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  message = FALSE,
  warning = FALSE,
  fig.height = 4,
  fig.width = 10
)
library(misctoolsr)
library(magrittr)
library(ggplot2)
se <- exampleSE()
sigs <- exampleSignatures()

Create a contingency table

contabs <- contingencyTable(x = se, cols = c("up", "down"), signatures = sigs)
contabs %>% 
    knitr::kable()

Perform Fisher's enrichment test on the contingency tables

enrich_results <- enrichmentTestFisher(contabs = contabs)
enrich_results %>% 
    knitr::kable()

Plot results:

plotFisherRes(enrich_results)

Perform Fisher's enrichment directly on a SummarizedExperiment

ora_results <- ora(x = se, cols = c("up", "down"), signatures = sigs, alpha = 0.05)
ora_results %>% 
    knitr::kable()

Plot results:

plotFisherRes(ora_results)
p1 <- plotFisherRes(enrich_results)


sdgamboa/misctoolsr documentation built on May 4, 2022, 12:33 p.m.