knitr::opts_chunk$set(echo = FALSE)
library(purrr)
library(tidyverse)
library(flextable)

bioinf <- eval(params$bioinf)

The fold change estimates for all contrast of all the proteins are used to perform Gene Set Enrichment Analysis (GSEA) using WebGestalt.

If some of the contrasts did NOT produce any significant gene set enrichments, they are not listed in the table below.

tmp <- unlist(params$GSEA, recursive = FALSE)
make_gsea_path <- function(x){
  res <- c(contrast = x$fpath,
           contrast_name = x$contrast_name,
           target =  x$target,
           file_path = file.path(".",x$target, paste0("Project_", x$fpath), "GSEA.html"))
  return(data.frame(t(res), stringsAsFactors = FALSE))
}


paths <- map(tmp,make_gsea_path)
paths <- dplyr::bind_rows(paths)
paths <- paths %>% dplyr::arrange(contrast)

if (ncol(paths) == 0) {
  cat("NO enrichments:", dim(paths))
} else {
  myfl <- flextable(paths) %>% set_caption("Gene Set Enrichment Analysis results (GSEA) using prora and WebgestaltR. (vs - versus, gv - given) ")
  myfl <- myfl %>% compose( j = "file_path",
                            value = as_paragraph( hyperlink_text(x = "enrichment result",
                                                                 url = file_path ) ) )
  myfl <- myfl %>% merge_v(j = ~   contrast + contrast_name)
  myfl <- myfl %>% autofit() %>% theme_box() %>%  color(j = "file_path", color = "#337ab7")
  myfl
}

The GSEA analysis was exectuted by : r bioinf.



protViz/fgczgseaora documentation built on Dec. 14, 2021, 9:22 p.m.