geneset_shifts: Visualizes geneset "activity" across a number of...

View source: R/geneset_shifts.R

geneset_shiftsR Documentation

Visualizes geneset "activity" across a number of comparisons.ks

Description

This funciton is used primarily to generate geneshift plots to compare the AppSAA model vs 5XFAD, but why not generalize ...

Usage

geneset_shifts(
  x,
  genesets,
  gsea.method = NULL,
  colors = NULL,
  ymin = 0.005,
  ymax = 0.025,
  bw.bg = 0.7,
  bw.gs = 0.9,
  ribbon_wrap_n = 18,
  legend.position = "none",
  columns = c("genesets", "results"),
  xlims = NULL,
  facet_scales = "free",
  trim = 0.02,
  with_stats = c(pval = "pvalue", padj.by.collection = "FDR"),
  ...
)

Arguments

x

A single FacileTtestFseaAnalysisResult or a named list of them.

genesets

character vector of geneset names to extract from the GeneSetDb objects from each results.

colors

aaaaarrrghhhhhhhhh

with_stats

A named character vector that specifies the gsea statistics to print in each of the results. names() correspond to the column names from the result table of the individual GSEA result, and the values are the labels you want to use for that statistic. How do you know what columns are available for printing? Look at the column names in the table returned by tidy(ffsea.resut, name = gsea.method). By default, the nominal pvalue and FDR are printed. To disable, set to NULL.

...

arbitrary number of named ffsea results

stats

the name of the gsea result to pull pvalues from

Details

We assume that the ffsea results each have a GeneSetDb that has genesets by the same name in them.

The row and column order are determined by the order in which ffsea results and genesets are provided in the respective variables.

This will eventually go into the FacileAnalysis package

Examples

# We'll setup two ffsea (GSEA) results and plot geneset effects from each
efds <- FacileData::exampleFacileDataSet()
gdb.h <- sparrow::getMSigGeneSetDb("H", "human", id.type = "entrez")
dge <- list(
  crc = efds %>%
    FacileData::filter_samples(indication == "CRC") %>%
    FacileAnalysis::flm_def(
      covariate = "sample_type", numer = "tumor", denom = "normal",
      batch = "sex") %>%
    FacileAnalysis::fdge(method = "voom"),
 blca = efds %>%
    FacileData::filter_samples(indication == "BLCA") %>%
    FacileAnalysis::flm_def(
      covariate = "sample_type", numer = "tumor", denom = "normal",
      batch = "sex") %>%
    FacileAnalysis::fdge(method = "voom"))
gsea <- lapply(dge, FacileAnalysis::ffsea, gdb.h, "fgsea")

gs.1 <- geneset_shifts(
  gsea,
  c("beta cells" = "HALLMARK_PANCREAS_BETA_CELLS",
    "angiogenesis" = "HALLMARK_ANGIOGENESIS"),
  gsea.method = "fgsea",
  columns = "genesets",
  with_stats = c(pval = "pvalue", padj = "FDR", NES = "NES"))
gs.1$plot

gs.2 <- geneset_shifts(
  gsea,
  c("beta cells" = "HALLMARK_PANCREAS_BETA_CELLS",
    "angiogenesis" = "HALLMARK_ANGIOGENESIS"),
  gsea.method = "fgsea",
  columns = "results",
  with_stats = c(pval = "pvalue", padj = "FDR", NES = "NES"))
gs.2$plot

facilebio/FacileIncubator documentation built on Oct. 26, 2023, 9:58 p.m.