knitr::opts_chunk$set( echo = TRUE, warning = FALSE, message = FALSE, error = TRUE ) # knitr::opts_knit$set( # progress = FALSE, # verbose = FALSE # )
This is an overview on the provided objects:
library(GeneTonic)
# if (exists("reactive_values$mygenesets")) { # selected_genesets <- reactive_values$mygenesets # } else { # selected_genesets <- mygenesets # } # # if (exists("reactive_values$mygenes")) { # selected_genes <- reactive_values$mygenes # } else { # selected_genes <- mygenes # } if (usage_mode == "shiny_mode") { selected_genesets <- reactive_values$mygenesets selected_genes <- reactive_values$mygenes # picking from the reactive values dds <- reactive_values$dds res_de <- reactive_values$res_de res_enrich <- reactive_values$res_enrich annotation_obj <- reactive_values$annotation_obj intgroup <- input$exp_condition # checking that a group is provided if (is.null(input$exp_condition)) { # defaults to first column name in the colData intgroup <- colnames(colData(dds))[1] } } else if (usage_mode == "batch_mode"){ selected_genesets <- mygenesets selected_genes <- mygenes intgroup <- mygroup } selected_genesets selected_genes intgroup
If provided as a gtl object:
if (!is.null(gtl)) { cat(describe_gtl(gtl)) }
Otherwise, these are the individual components as provided:
dds res_de head(res_enrich) head(annotation_obj) res_enrich <- get_aggrscores(res_enrich, res_de, annotation_obj)
If running from shiny, it might be relevant to keep track of the parameters currently selected in the app, as they determine the look and content of what is displayed.
if (usage_mode == "shiny_mode") { input$exp_condition input$n_genesets input$emap_colorby # print(shiny::reactiveValuesToList(input)) # print(shiny::reactiveValuesToList(reactive_values)) }
This section reports an interactive enrichment map for the results from the enrichment analysis, as an overview.
library("visNetwork") library("magrittr") emap_graph <- enrichment_map( res_enrich = res_enrich, res_de = res_de, annotation_obj = annotation_obj, n_gs = 50, overlap_threshold = 0.1, scale_edges_width = 200, color_by = "z_score" ) emap_graph visNetwork::visIgraph(emap_graph) %>% visOptions( highlightNearest = list( enabled = TRUE, degree = 1, hover = TRUE ), nodesIdSelection = TRUE ) %>% visExport( name = "emap_network", type = "png", label = "Save enrichment map" )
The following genes were reported as bookmarked in the call to this report, either in batch or in the shiny usage mode.
DT::datatable(annotation_obj[annotation_obj$gene_id %in% selected_genes, ])
For each of them, a plot for the expression values is displayed in the content that follows.
lapply(selected_genes, function(arg) { mosdef::gene_plot(dds,gene = arg,intgroup = intgroup, annotation_obj = annotation_obj)})
The following genesets were reported as bookmarked in the call to this report, either in batch or in the shiny usage mode.
DT::datatable(res_enrich[res_enrich$gs_id %in% selected_genesets, ])
Some general visualization, with a focus on the genesets specified above, is displayed as a result of the following chunk.
gs_mds(res_enrich, res_de, annotation_obj, gs_labels = selected_genesets) gs_volcano(res_enrich, volcano_labels = selected_genesets)
Here is a heatmap for each bookmarked set. Click on the tabset labels to navigate among each of the elements.
vst_data <- DESeq2::vst(dds) # or also have it passed as param for (gs in selected_genesets) { corresponding_gs_desc <- res_enrich[gs, "gs_description"] cat("### ", corresponding_gs_desc, " {-}\n") gs_heatmap(vst_data, res_de, res_enrich, annotation_obj, geneset_id = gs, cluster_columns = TRUE) cat(mosdef::go_to_html(gs, res_enrich)) cat("\n\n") }
This report has been generated via the happy_hour()
function from the GeneTonic package.
You can extend and modify the template provided in the package, and provide the location of the custom version as a parameter to the call to happy_hour()
(specifically, input_rmd
).
If you use this report in your scientific work, please cite GeneTonic:
citation("GeneTonic")
This is the output of the sessionInfo()
command, reported for improving the reproducibility of the analysis.
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.