plot_upset_genes: Upset plots of significant genes

View source: R/plot_upset_genes.R

plot_upset_genesR Documentation

Upset plots of significant genes

Description

Upset plots of significant genes

Usage

plot_upset_genes(
  model_result,
  models = NULL,
  variables = NULL,
  contrasts = NULL,
  intercept = FALSE,
  random = FALSE,
  return_genes = FALSE,
  fdr_cutoff = c(0.05, 0.1, 0.2, 0.3, 0.4, 0.5),
  return.genes = NULL,
  fdr.cutoff = NULL
)

Arguments

model_result

NAMED list of lists output by kimma::kmFit() such as list("model1"=model_result1, "model2"=model_result2)

models

Character vector of model(s) to plot. Must match object names in model_result. For example, "lm", "lme", "lmerel", "limma"

variables

Character vector of variables in model_result to include in plots

contrasts

Character vector of contrasts in model_result to include in plots. Format is c("contrast_lvl - contrast_ref", "..."). Only applicable if model name includes 'contrast'

intercept

Logical if should include the intercept variable. Default is FALSE

random

Logical if should include random effect variable(s). Default is FALSE

return_genes

Logical if should return data frame of genes in upsets. Default is FALSE

fdr_cutoff

Numeric vector of FDR cutoffs to assess. One upset per FDR value

return.genes

Deprecated form of return_genes

fdr.cutoff

Deprecated form of fdr_cutoff

Value

List with 1 each for each FDR cutoff of (1) upset diagram ggplot object and (2) data frame of genes in upset

Examples

# A single model, multiple variables
upset.result <- plot_upset_genes(model_result = list("example.model" = example.model),
    models = "lme", return_genes = TRUE,
    fdr_cutoff = c(0.05,0.5))
#plot all upset
patchwork::wrap_plots(upset.result[["upset"]])
#Plot 1 upset
upset.result[["upset"]][["0.05"]]
#see genes in intersections
upset.result[["gene"]]

# Multiple models, subset of variables
model1 <- list("lme" = example.model$lme)
model2 <- list("lmerel" = example.model$lmerel)
plot_upset_genes(list("lme"=model1, "lmerel"=model2),
    variables = c("virus","virus:asthma"),
    fdr_cutoff = c(0.05))

# Contrasts
model1 <- list("lme" = example.model$lme.contrast)
model2 <- list("lmerel" = example.model$lmerel.contrast)
plot_upset_genes(model_result = list("lme"=model1, "lmerel"=model2),
    contrasts = c("HRV asthma - none asthma"),
    fdr_cutoff = c(0.4))

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