---
title: "GESS/FEA analysis"
author: "Author: Your Name"
date: "Last update: `r format(Sys.time(), '%d %B, %Y')`"
output:
  BiocStyle::html_document:
    toc_float: true
    toc_depth: 3
    code_folding: hide
    number_sections: false
always_allow_html: yes
vignette: |
  %\VignetteIndexEntry{LC_GESS_P03_Summary}
  %\VignetteEncoding{UTF-8}
  %\VignetteEngine{knitr::rmarkdown}
fontsize: 14pt
editor_options:
  chunk_output_type: console
---

<style>
pre code, pre, code {
  white-space: pre !important;
  overflow-x: auto !important;
  word-break: keep-all !important;
  word-wrap: initial !important;
}
</style>

```{r setup, echo=FALSE, messages=FALSE, warnings=FALSE}
suppressPackageStartupMessages({ library(signatureSearch); library(readr); library(dplyr); library(DT); library(data.table) })
setwd("<env_name>")
```

# Short Introduction
This vignette shows the code and results for Gene Expression Signature Searches (GESS)
with the downstream Functional Enrichment Analysis (FEA) of the <drug> query.
Rank transformed GESS results grouped by cell type and
the level of expression for each gene used in the query signature are illustrated for each result.  
The introduction of GESS and FEA as well as their
corresponding methods is available at this [vignette](https://bioconductor.org/packages/release/bioc/vignettes/signatureSearch/inst/doc/signatureSearch.html)
of the `signatureSearch` package. Here, `<gess_method>` is used as GESS method,
The `<N_gess_drugs>` top ranking unique hits in the GESS table were then used
for FEA where three different annotation systems were used: GO Molecular
Function (GO MF) and GO Biological Process (GO BP) terms.

# GESS/FEA workflow
```{r runWF, eval=FALSE}
wf_list <- runWF(drug="<drug>", refdb="<refdb>",
                 gess_method="<gess_method>", fea_method="<fea_method>",
                 N_gess_drugs=<N_gess_drugs>)
```

# GESS/FEA results
## <gess_method> GESS
```{r gess_res, eval=TRUE, message=FALSE, warning=FALSE}
gess_tb <- suppressMessages(as.data.frame(fread("results/<gess_method>_res.xls")))
datatable(gess_tb[1:10, 1:15], colnames=c('No'=1), escape = FALSE, options=list(scrollX=TRUE, autoWidth=TRUE))
```

[Full table](results/<gess_method>_res.tsv)

# GESS result ranks by cell type

```{r cell, eval=TRUE, message=FALSE}
Cell_tb <- suppressMessages(as.data.frame(fread("results/ResultRankByCell.xls")))
datatable(Cell_tb[1:10,], colnames=c('No'=1), escape = FALSE, options=list(scrollX=TRUE, autoWidth=TRUE))
```

[Full table](results/ResultRankByCell.xls)


# GES expression level by query

```{r Express, eval=TRUE, message=FALSE}
Expres_tb <- suppressMessages(as.data.frame(fread("results/GESExpressionLevel.xls")))
datatable(Expres_tb[1:10,], colnames=c('No'=1), escape = FALSE, options=list(scrollX=TRUE, autoWidth=TRUE))
```

[Full table](results/GESExpressionLevel.xls)

## <fea_method> GO MF
```{r mf, eval=TRUE, message=FALSE}
mf_tb <- suppressMessages(as.data.frame(fread("results/<fea_method>_mf_res.xls")))
datatable(mf_tb[1:50, colnames(mf_tb) != "itemID"], colnames=c('No'=1), escape = FALSE, options=list(scrollX=TRUE, autoWidth=TRUE))
```

[Full table](results/<fea_method>_mf_res.tsv)

## <fea_method> GO BP
```{r bp, eval=TRUE, message=FALSE}
bp_tb <- suppressMessages(as.data.frame(fread("results/<fea_method>_bp_res.xls")))
datatable(bp_tb[1:50, colnames(bp_tb) != "itemID"], colnames=c('No'=1), escape = FALSE, options=list(scrollX=TRUE, autoWidth=TRUE))
```

[Full table](results/<fea_method>_bp_res.tsv)


