happy_hour {GeneTonic} | R Documentation

## Happy hour!

### Description

Start the happy hour, creating a report containing a document full of goodies derived from the provided objects.

### Usage

    happy_hour(
      dds,
      res_de,
      res_enrich,
      annotation_obj,
      project_id,
      mygenesets,
      mygenes,
      usage_mode = "batch_mode",
      input_rmd = NULL,
      output_file = "my_first_GeneTonic_happyhour.html",
      output_dir = tempdir(),
      output_format = NULL,
      force_overwrite = FALSE,
      knitr_show_progress = FALSE,
      ignore_pandoc = FALSE,
      open_after_creating = TRUE,
      ...
    )

### Arguments

`dds` | A `DESeqDataSet` object, normally obtained after running your data through the `DESeq2` framework.
`res_de` | A `DESeqResults` object. As for the `dds` parameter, this is also commonly used in the `DESeq2` framework.
`res_enrich` | A `data.frame` object, storing the result of the functional enrichment analysis. See `GeneTonic()` for the formatting requirements.
`annotation_obj` | A `data.frame` object with the feature annotation information, with at least two columns, `gene_id` and `gene_name`. See `GeneTonic()` for the formatting requirements.
`project_id` | A character string, which can be considered as an identifier for the set/session, and will be e.g. used in the title of the report created via `happy_hour()`
`mygenesets` | A vector of character strings, containing...
`mygenes` | A vector of character strings, containing...
`usage_mode` | A character string, which controls the behavior of the Rmd document, based on whether the rendering is triggered while using the app ("shiny_mode"), or offline, in batch mode. Defaults to "batch_mode".
`input_rmd` | Character string with the path to the RMarkdown (.Rmd) file that will be used as the template for generating the report. Defaults to NULL, which will then use the one provided with the `GeneTonic` package.
`output_file` | Character string, specifying the file name of the output report. The file name extension must be either `.html` or `.pdf`, and consistent with the value of `output_format`.
`output_dir` | Character, defining the path to the output directory where the report will be generated. Defaults to the temp directory (`tempdir()`).
`output_format` | The format of the output report. Either `html_document` or `pdf_document`. The file name extension of `output_file` must be consistent with this choice. Can also be left empty and determined accordingly.
`force_overwrite` | Logical, whether to force overwrite an existing report with the same name in the output directory. Defaults to FALSE.
`knitr_show_progress` | Logical, whether to display the progress of `knitr` while generating the report. Defaults to FALSE.
`ignore_pandoc` | Logical, controlling how the report generation function will behave if `pandoc` or `pandoc-citeproc` are missing.
`open_after_creating` | Logical, whether to open the report in the default browser after being generated. Defaults to TRUE.
`...` | Other arguments that will be passed to `rmarkdown::render()`.

### Details

When `happy_hour` is called, a RMarkdown template file will be copied into the output directory, and `rmarkdown::render()` will be called to generate the final report.

As a default template, `happy_hour` uses the one delivered together with the `GeneTonic` package, which provides a comprehensive overview of what the user can extract. Experienced users can take that as a starting point to further edit and customize.

If there is already a .Rmd file with the same name in the output directory, the function will raise an error and stop, to avoid overwriting the existing file. The reason for this behaviour is that the copied template in the output directory will be deleted once the report is generated.

Credits to the original implementation proposed by Charlotte Soneson, upon which this function is heavily inspired.

### Value

Generates a fully fledged report in the `output_dir` directory, called `output_file` and returns (invisibly) the name of the generated report.

### See Also

`GeneTonic()`, `shake_topGOtableResult()`, `shake_enrichResult()`

### Examples

    library("macrophage")
    library("DESeq2")
    library("org.Hs.eg.db")
    library("AnnotationDbi")

    # dds object
    data("gse", package = "macrophage")
    dds_macrophage <- DESeqDataSet(gse, design = ~line + condition)
    rownames(dds_macrophage) <- substr(rownames(dds_macrophage), 1, 15)
    dds_macrophage <- estimateSizeFactors(dds_macrophage)

    # annotation object
    anno_df <- data.frame(
      gene_id = rownames(dds_macrophage),
      gene_name = mapIds(org.Hs.eg.db,
                         keys = rownames(dds_macrophage),
                         column = "SYMBOL",
                         keytype = "ENSEMBL"),
      stringsAsFactors = FALSE,
      row.names = rownames(dds_macrophage)
    )

    # res object
    data(res_de_macrophage, package = "GeneTonic")
    res_de <- res_macrophage_IFNg_vs_naive

    # res_enrich object
    data(res_enrich_macrophage, package = "GeneTonic")
    res_enrich <- shake_topGOtableResult(topgoDE_macrophage_IFNg_vs_naive)
    res_enrich <- get_aggrscores(res_enrich, res_de, anno_df)

    ## Not run:
    happy_hour(dds = dds_macrophage,
               res_de = res_de,
               res_enrich = res_enrich,
               annotation_obj = anno_df,
               project_id = "examplerun",
               mygenesets = res_enrich$gs_id[c(1:5,11,31)],
               mygenes = c("ENSG00000125347",
                           "ENSG00000172399",
                           "ENSG00000137496")
    )

    ## End(Not run)

[Package GeneTonic version 1.2.0 Index]