---  
title: "ExpHunterSuite: Module Specific Report"
author: "SysBioLab"
output: 
  html_document:
    toc: true
    toc_float: true
    df_print: paged
    fig_width: 12
---

<style type='text/css'>
    body .main-container {
        max-width: 90%;

    }

    .plot_real_size {
      overflow: scroll;
      max-height: 600px;
    }

    .plot_real_size img{
      max-width: none;
      max-height: none;
    }

    embed {
   
  }   
</style>

```{r func_initial_details, eval=exists("cl_flags_ora"), echo=FALSE, results='asis', message=FALSE, warning=FALSE}
initial_out <- knitr::knit_expand(file.path(template_folder, "func_initial_details.Rmd"))
initial <- knitr::knit(text=initial_out, quiet=TRUE)
cat(initial, sep='\n')
```
```{r func_deg_details, echo=FALSE, results='asis', message=FALSE, warning=FALSE}
degh_out <- knitr::knit_expand(file.path(template_folder, "func_deg_details.Rmd"))
degh <- knitr::knit(text=degh_out, quiet=TRUE)
cat(degh, sep='\n')
```

```{r load_correlation_stats, echo=FALSE, results='asis', message=FALSE, warning=FALSE}
cor_out <- knitr::knit_expand(file.path(template_folder, "partial/corr_cl_stats.Rmd"))
rescorr <- knitr::knit(text=cor_out, quiet=TRUE)
cat(rescorr,sep='\n')
```

```{r ORA_analysis, eval=exists("cl_flags_ora"), echo=FALSE, results='asis', message=FALSE, warning=FALSE}
gene_set <- "ORA"
default_width <- 5
res <- list()
for(funsys in names(cl_flags_ora)) {
  if(cl_flags_ora[[funsys]] == TRUE) {
    func_clusters <- func_results$WGCNA_ORA_expanded[[funsys]]
    enrich_obj <- func_clusters[[which(names(func_clusters) == cl)]]
    gene_attribute_name <- "fold change"
    exp_res <- knitr::knit_expand("ora_plots_all_objects.Rmd")
    res[[funsys]] <- knitr::knit(text=exp_res, quiet = TRUE)
  } else {
    res[[funsys]] <- paste0("## **No enrichment found for ", funsys, "**\n")
  }
}
cat(unlist(res), sep = '\n')
```

