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 proteins are used to perform Over-representation Analysis (ORA) using WebGestalt.

If some of the contrasts did NOT produce any significant over-represented gene sets, they are not listed in the table below.

tmp <- params$ORA
dd <- unlist(tmp, recursive = FALSE)
ddd <- unlist(dd, recursive = FALSE)

make_gsea_path <- function(x){
  res <- list(outpath = x$outdir,
              contrast = x$fpath,
              contrast_name = x$contrast_name,
              target = x$target,
              greater = x$greater,
              threshold =  x$threshold,
              file_path = file.path(".",x$subdir_name , x$target, paste0("Project_", x$fpath), paste0("Report_",x$fpath,".html")), 
              merged_data = !is.null(x$merged_data))
  return(res)
}

paths <- purrr::map_df(ddd, make_gsea_path)

paths <- paths %>%  mutate(filter = paste0(dplyr::case_when(greater ~ "log2 FC > ", TRUE ~ "log2 FC < "  ), threshold))
paths <- paths %>% dplyr::filter( merged_data == TRUE) %>% dplyr::select(contrast, contrast_name, filter, target,  file_path)
#install.packages("flextable")
paths <- paths %>% dplyr::arrange(contrast, filter)
myfl <- flextable(paths) %>% set_caption("Over Representation Analysis (ORA) results using prora and WebgestaltR. (vs - versus, gv - given).")
myfl <- myfl %>% compose( j = "file_path",
                          value = as_paragraph( hyperlink_text(x = "ora result",
                                                               url = file_path ) ) )

myfl <- myfl %>% merge_v(j = ~   contrast + contrast_name + filter)
myfl <- myfl %>% autofit() %>% theme_box() %>%  color(j = "file_path", color = "#337ab7") 
myfl

The ORA analysis was exectuted by : r bioinf.



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