Automatically generated using iDEP at r format(Sys.time(), "%H:%M, %Y-%m-%d").

knitr::opts_chunk$set(echo = params$printcode) # , include = FALSE, eval = FALSE)
::: {style="color: Blue"} If this site has contributed to your work, please cite: Ge, Son & Yao, iDEP: an integrated web application for differential expression and pathway analysis of RNA-Seq data. BMC Bioinformatics 19, 534 (2018). :::

This document contains what parameters values were selected on the IDEP interface. It also includes the plots generated from those selections.

Summary

r params$descr

The comparison selected was r params$select_contrast using r params$go genesets. r params$n_pathway_show pathways with between r params$min_set_size and r params$max_set_size genes were included. Absolute fold values were r ifelse(params$absolute_fold, 'not', '') used. Pathways were found using the r switch(as.character(params$pathway_method), "1" = "GAGE", "2" = "PGSEA", "3" = "GSEA (Pre-Ranked)", "4" = "PGSEA with all samples", "5" = "ReactomePA" ) method. Pathway p values cutoff is set to r params$pathway_p_val_cutoff. Genes with FDR (DEG) greater than r params$gene_p_val_cutoff were removed.

Selections

# exclude long parameter we won't print
excluded_params <- c(
  "sample_info", "loaded_data", "pre_processed", "deg",
  "idep_data", "converted", "limma", "gene_sets",
  "pathway_list_data", "all_gene_names", "all_gene_info",
  "selected_pathway_data", 'descr'
)

for (i in 1:length(params)) {
  if (!(names(params)[i] %in% excluded_params)) {
    cat(paste0(names(params)[i], ": ", params[[i]], "\n"))
  }
}
library(kableExtra)
library(dplyr)
library(idepGolem)

Gene Sets

gene_sets <- read_gene_sets(
  converted = params$converted,
  all_gene_names = params$all_gene_names,
  go = params$go,
  select_org = params$select_org,
  idep_data = params$idep_data,
  my_range = params$my_range
)

gene_sets$gene_lists[1:2]

Pathway analysis for contrast: r params$select_contrast

if (params$pathway_method == 1) {
  gage <- idepGolem::gage_data(
    select_go = params$go,
    select_contrast = params$select_contrast,
    min_set_size = params$min_set_size,
    max_set_size = params$max_set_size,
    limma = params$limma,
    gene_p_val_cutoff = params$gene_p_val_cutoff,
    gene_sets = params$gene_sets,
    absolute_fold = params$absolute_fold,
    pathway_p_val_cutoff = params$pathway_p_val_cutoff,
    n_pathway_show = params$n_pathway_show
  )
  kbl(gage) %>% 
    kable_classic(full_width = F, html_font = "Cambria")  
}
if (params$pathway_method == 2) {
  # only remove pathway ID for Ensembl species
  show_pathway_id <- params$show_pathway_id
  # always show pathway ID for STRING species
  if (params$select_org < 0) {
    show_pathway_id <- TRUE
  }
  plot_pgsea(
    my_range = c(params$min_set_size, params$max_set_size),
    processed_data = params$pre_processed,
    contrast_samples = params$contrast_samples,
    gene_sets = params$gene_sets,
    pathway_p_val_cutoff = params$pathway_p_val_cutoff,
    n_pathway_show = params$n_pathway_show,
    select_go = params$go,
    show_pathway_id = show_pathway_id,
    margin = c(3, 1, 13, 20)
  ) 
}
if (params$pathway_method == 4) {
  # only remove pathway ID for Ensembl species
  show_pathway_id <- params$show_pathway_id
  # always show pathway ID for STRING species
  if (params$select_org < 0) {
    show_pathway_id <- TRUE
  }
  pgsea_plot_all(
    go = params$go,
    my_range = c(params$min_set_size, params$max_set_size),
    data = params$pre_processed,
    select_contrast = params$contrast_samples,
    gene_sets = params$gene_sets,
    pathway_p_val_cutoff = params$pathway_p_val_cutoff,
    n_pathway_show = params$n_pathway_show,
    select_go = params$go,
    show_pathway_id = show_pathway_id,
    margin = c(3, 1, 13, 20)
  ) 
}
if (params$pathway_method %in% c(6:8)) {
  gsva_algorithm <- switch(
    as.numeric(params$pathway_method) - 5, 
    "gsva",   #6
    "ssgsea", #7
    "plage"   #8
  )

  # only remove pathway ID for Ensembl species
  show_pathway_id <- params$show_pathway_id
  # always show pathway ID for STRING species
  if (params$select_org < 0) {
    show_pathway_id <- TRUE
  }

    plot_gsva(
      my_range = c(params$min_set_size, params$max_set_size),
      processed_data = params$pre_processed,
      contrast_samples = params$contrast_samples,
      gene_sets = params$gene_sets,
      pathway_p_val_cutoff = params$pathway_p_val_cutoff,
      n_pathway_show = params$n_pathway_show,
      select_go = params$go,
      show_pathway_id = show_pathway_id,
      algorithm = gsva_algorithm
    )
}
if (params$pathway_method == 3) {
  fgsea_pathway_data <- fgsea_data(
    select_contrast = params$select_contrast,
    my_range = c(params$min_set_size, params$max_set_size),
    limma = params$limma,
    gene_p_val_cutoff = params$gene_p_val_cutoff,
    gene_sets = params$gene_sets,
    absolute_fold = params$absolute_fold,
    pathway_p_val_cutoff = params$pathway_p_val_cutoff,
    n_pathway_show = params$n_pathway_show
  )
  kbl(fgsea_pathway_data) %>% 
    kable_classic(full_width = F, html_font = "Cambria")
}

Tree

idepGolem::enrichment_tree_plot(
  go_table = params$pathway_list_data,
  group = "All Groups",
  right_margin = 10
)

Network plot

network_data <- idepGolem::network_data(
  network = params$pathway_list_data,
  up_down_reg_deg = params$up_down_reg_deg,
  wrap_text_network_deg = params$wrap_text_network_deg,
  layout_vis_deg = params$layout_vis_deg,
  edge_cutoff_deg = params$edge_cutoff_deg
)
idepGolem::vis_network_plot(
  network_data = network_data
 )

Heatmap

params$sig_pathways
if(!is.null(params$sig_pathways)) {
  deg_heatmap(
    df = params$selected_pathway_data,
    bar = NULL,
    heatmap_color_select = unlist(strsplit(params$heatmap_color_select, "-")),
    cluster_rows = TRUE
  )
} else {
  print("Click on the Heatmap tab to do the analysis first.")
}

KEGG pathway

out_image <- kegg_pathway(
  go = params$go,
  gage_pathway_data = params$pathway_list_data[, 1:5],
  sig_pathways = params$sig_pathways_kegg, 
  select_contrast = params$select_contrast,
  limma = params$limma,
  converted = params$converted,
  idep_data = params$idep_data,
  select_org = params$select_org,
  low_color = params$kegg_colors[[params$kegg_color_select]][1],
  high_color = params$kegg_colors[[params$kegg_color_select]][2]
)

\centering r params$sig_pathways_kegg {width=100%}

# GAGE Method
if (params$pathway_method == 0) {
  gene_sets <- read_gene_sets(
    converted = params$converted,
    all_gene_names = params$all_gene_names,
    go = params$go,
    select_org = params$select_org,
    idep_data = params$idep_data,
    my_range = params$my_range
  )

  gage <- gage_data(
    select_go = params$go,
    select_contrast = params$select_contrast,
    min_set_size = params$min_set_size,
    max_set_size = params$max_set_size,
    limma = params$limma,
    gene_p_val_cutoff = params$gene_p_val_cutoff,
    gene_sets = params$gene_sets,
    absolute_fold = params$absolute_fold,
    pathway_p_val_cutoff = params$pathway_p_val_cutoff,
    n_pathway_show = params$n_pathway_show
  )

   gage
}
# PGSEA -- Not tested
if (params$pathway_method == 2) {
  res <- get_pgsea_plot_data(
    my_range = c(params$min_set_size, params$max_set_size),
    data = params$pre_process$data,
    select_contrast = params$select_contrast,
    gene_sets = params$gene_sets,
    sample_info = params$sample_info,
    select_factors_model = deg$select_factors_model,
    select_model_comprions = deg$select_model_comprions,
    pathway_p_val_cutoff = params$pathway_p_val_cutoff,
    n_pathway_show = params$n_pathway_show
  )

  pathway_list_data <- get_pathway_list_data(
    pathway_method = params$pathway_method,
    gage_pathway_data = NULL, # gage_pathway_data(),
    fgsea_pathway_data = NULL, # fgsea_pathway_data(),
    pgsea_plot_data = res,
    pgsea_plot_all_samples_data = NULL, # pgsea_plot_all_samples_data(),
    go = params$go,
    select_org = params$select_org,
    gene_info = params$all_gene_info,
    gene_sets = params$gene_sets
  )

  idepGolem::enrichment_tree_plot(
    go_table = pathway_list_data,
    group = "All Groups" # ,
    # right_margin = 45
  )
}

Free for academic use. No warranty of correctness.



espors/idepGolem documentation built on Oct. 27, 2024, 4:56 a.m.