230 likes | 241 Views
An introduction to ReportingTools, a toolkit for processing high-throughput genomic analysis results automatically. Learn how to use ReportingTools with microarray experiments, RNA-seq experiments, knitr, and shiny. Examples and code included.
E N D
ReportingTools: an automated result processing toolkit for high throughput genomic analyses Jessica Larson, PhD Computational Biologist Genentech, Inc. larson.jessica@gene.com July 19 2013
Outline • ReportingTools introduction and basics • ReportingTools and microarray experiments • ReportingTools and RNA-seq experiments • ReportingTools and knitr • ReportingTools and shiny
Example output and code from the package vignettes http://research-pub.gene.com/ReportingTools/
Publishing a data.frame • There are three basic calls to publish to an HTML page: • Define the report with • htmlRep <- • HTMLReport(shortName ='my_html_file', • reportDirectory = './reports’) • (2) Fill the report with • publish(iris, htmlRep) • (3) Close the report with • finish(htmlRep)
Publishing the Iris data library(ReportingTools) data(iris) htmlRep <- HTMLReport(shortName = 'my_html_file', reportDirectory = './reports') publish(iris, htmlRep) finish(htmlRep)
More basics with the Iris data • Adding plots (including basic, lattice, .png, .pdf) • Adding text (including links to other pages) • Adding additional tables • Modify data frames upon publication (.modifyDF) • Publishing to CSV files (CSVFile)
Using .modifyDF htmlRep <- HTMLReport(shortName = 'my_html_file_modify', title = 'Manipulating the data frame directly before publishing’, reportDirectory = './reports') publish(iris, htmlRep, numdigits = 1, .modifyDF = list(roundLength, makeImages, addSpeciesLink, cleanUpDF)) finish(htmlRep)
Outline • ReportingTools introduction and basics • ReportingTools and microarray experiments • ReportingTools and RNA-seq experiments • ReportingTools and knitr • ReportingTools and shiny
Microarray examples • Publish output from limma (add new images and links) • Publish GO and PFAM analysis output • Publish gene sets • Create index pages
Outline • ReportingTools introduction and basics • ReportingTools and microarray experiments • ReportingTools and RNA-seq experiments • ReportingTools and knitr • ReportingTools and shiny
RNA-seq • Methods for: • edgeR exact tests • edgeR LRTs • DESeq • DESeq2 (with .modifyDF and .toDF)
Outline • ReportingTools introduction and basics • ReportingTools and microarray experiments • ReportingTools and RNA-seq experiments • ReportingTools and knitr • ReportingTools and shiny
knitr > setwd("reports") > library(knitr) > knit2html("/home/ubuntu/4BioCknitr.Rmd”) Can easily integrate ReporingTools tables into knitr reports Need to call ‘knit2html’ from report directory and specify the knitrHandlers in HTMLReport()
Updates to run the knitr example (due to permission issues) • Open 4BioCknitr.Rmd • Save to the /home/ubuntu directory • setwd(“reports”) • Then call knit2html("/home/ubuntu/4BioCknitr.Rmd")
Outline • ReportingTools introduction and basics • ReportingTools and microarray experiments • ReportingTools and RNA-seq experiments • ReportingTools and knitr • ReportingTools and shiny
Updates to run the shiny example (due to permission issues) • Open server.R and ui.R • Save these to the /home/ubuntu/reports directory • setwd(“reports”) • Then call myRunApp()
Changes to server.R (1) Create a report with shinyHandlers to stream the HTML form of any elements added to our Report: htmlrep <- HTMLReport(reportDirectory = "./", shortName="bigtest", handlers = shinyHandlers) (2) Define a custom rendering function so that shiny can ‘hear’ elements being added to our report and insert them into the dynamic HTML: renderRepTools <- function(expr, env=parent.frame(), quoted=FALSE) { func <- exprToFunction(expr, env, quoted) function(){ paste(capture.output(func()), collapse="\n") } } (3) Publish elements to our report within the expression passed to renderRepTools: output$view2 <- renderRepTools({ publish(datasetInput(), htmlrep) })
Changes to ui.R • Include the JavaScript and CSS files so that the ReportingTools tables function properly via custHeaderPanel function: • ##this function accepts the tile and window title arguments by shiny's headerpanel function • ##plus the js and cs arguments • custHeaderPanel = function(title, windowTitle =title, js= NULL, css=NULL){ • mytlist = c(lapply(js, function(x) tags$script(HTML(paste(readLines(x), collapse="\n")))), • lapply(css, function(x) tags$style(HTML(paste(readLines(x), collapse="\n"))))) • tagList(tag("head",mytlist), div(class = "span12", • style = "padding: 10px 0px;", h1(title))) • } • # Define UI for dataset viewer application • shinyUI(pageWithSidebar( • custHeaderPanel("ReportingTools", • js = list.files(system.file("extdata/jslib", package="ReportingTools"), • full.names=TRUE), • css = list.files(system.file("extdata/csslib", package="ReportingTools"), • pattern="bootstrap.css", full.names=TRUE), • ),
Changes to ui.R (2) Declare elements formated by ReportingTools as htmlOutput mainPanel( verbatimTextOutput("summary"), htmlOutput("view2") ) This indicates to the shiny system that the output with be HTML code
Future methods DESeq2 methods Return the decorated DF More flexibility with annotations
Acknowledgements Jason Hackney Josh Kaminker Melanie Huntley Christina Chaivorapol Gabriel Becker Michael Lawrence Robert Gentleman Martin Morgan Dan Tenenbaum