---
title: <Drug> GESS/FEA analysis
author: "Author: Your Name"
date: "Last update: `r format(Sys.time(), '%d %B, %Y')`" 
output:
  html_document:
    toc_float: true
    code_folding: hide
fontsize: 15pt
vignette: >
  %\VignetteIndexEntry{signatureSearch}
  %\VignetteEncoding{UTF-8}
  %\VignetteEngine{knitr::rmarkdown}
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)
})
```

# 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)




