plot_venn_genes: Venn diagrams of significant genes

View source: R/plot_venn_genes.R

plot_venn_genesR Documentation

Venn diagrams of significant genes

Description

Venn diagrams of significant genes

Usage

plot_venn_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 venns. Default is FALSE

fdr_cutoff

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

return.genes

Depreciated form of return_genes

fdr.cutoff

Depreciated form of fdr_cutoff

Value

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

Examples

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

# Multiple models, subset of variables
model1 <- list("lme" = example.model$lme)
model2 <- list("lmerel" = example.model$lmerel)
plot_venn_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_venn_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.