knitr::opts_chunk$set(comment="", fig.align="center", fig.width=8.75, cache=FALSE) devtools::load_all(".")
Often researchers need to annotate multiple signatures across multiple experiments. Typically, the best way to manage this data is to process it all at once and generate a markdown report to analyze and share with collaborators. Let's take an example where we have one experiment with many signatures.
data(wgcna) signatures <- wgcna[[1]] str(signatures)
genesets <- hyperdb_rgsets("KEGG", "92.0") mhyp <- hypeR(signatures, genesets, test="hypergeometric", background=36000, fdr=0.05)
We have included some convenient functions that return some html for turning hyp
and mhyp
objects into concise tables for markdown documents. These tables can also include some plots for each individual hyp
object.
rctbl_build(mhyp, show_hmaps=TRUE)
Alright, how about we process all of these nested signatures and provide an example of what your markdown report might look like. Because we have a nested list of signatures, we use hyper()
with the lapply
function. This results in a list of mhyp
objects.
lmhyp <- lapply(wgcna, hypeR, genesets, test="hypergeometric", background=36000, fdr=0.05)
First start with a nice theme and include the css required to make the tables pretty.
title: "Project Title" subtitle: "Project Subtitle" author: "Anthony Federico" date: "Last Modified: 'r Sys.Date()'" output: html_document: theme: flatly toc: true toc_float: false code_folding: hide toc_depth: 4 css: 'r system.file("style", "rctbl.css", package="hypeR")'
hyp_dots(lmhyp$LA, merge=TRUE) rctbl_build(lmhyp$LA, show_hmaps=TRUE)
hyp_dots(lmhyp$LB, merge=TRUE) rctbl_build(lmhyp$LB, show_hmaps=TRUE)
hyp_dots(lmhyp$H2, merge=TRUE) rctbl_build(lmhyp$H2, show_hmaps=TRUE)
hyp_dots(lmhyp$BL, merge=TRUE) rctbl_build(lmhyp$BL, show_hmaps=TRUE)
If you're only looking at one signature you can format it with a dropdown table.
hyp <- hypeR(signatures[[1]], genesets, test="hypergeometric", background=36000, fdr=0.05) rctbl_build(hyp)
For quick report generation one can use hyp_to_rmd()
which will accept multiple formats, including a single hyp
or multihyp
object as well as a list of either, including a list of hyp
or multihyp
objects together. When a list of multihyp
objects are passed for example, each experiment will become its own section, while each signature becomes its own tab within that section. Lists of keyword arguments can be passed for hyp_dots()
, hyp_emap()
, and hyp_hmap()
, allowing customization of their functionality per report. See hyp_to_rmd()
for details.
hyp_to_rmd(lmultihyp_obj, file_path="hypeR.rmd", title="hypeR Report", subtitle="Weighted Gene Co-expression Analysis", author="Anthony Federico, Stefano Monti", show_dots=T, show_emaps=T, show_hmaps=T, show_tables=T)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.