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 © 2013, Genentech Outline (1) (2) (3) (4) (5) ReportingTools introduction and basics ReportingTools and microarray experiments ReportingTools and RNA-seq experiments ReportingTools and knitr ReportingTools and shiny 1 ReportingTools Genomic analyses output Microarray Next-gen Sequence Geneset Tabular Data GO: 0016581 G O: 0000118GO: 0005667G O: 0016592GO: 0017053 G O: 0090545 G O: 0034707 G O: 0044451 G O: 0034702 GO: 0032587 G O: 0030690GO: 0042613 G O: 0042612 G O: 0001726GO: 0031256 G O: 0030686GO: 0030687 G O: 0009897GO: 0070436 G O: 0071062 Assay data G O: 0031252 GO: 0042611 GO: 0030684 GO: 0016323 G O: 0031264 G O: 0044459 G O: 0031265 G O: 0008287G O: 0035693 G O: 0035692G O: 0070022 G O: 0008305 G O: 0005654 G O: 0031226 GO: 0016324 GO: 0043234 GO: 0071556 G O: 0043235 GO: 0031224 GO: 0030426 G O: 0044306 G O: 0071565 G O: 0000159G O: 0005887GO: 0070032 G O: 0070044 G O: 0033256 G O: 0000307G O: 0030689 G O: 0016021GO: 0031225 G O: 0031201 GO: 0031526 G O: 0031253 GO: 0032991 G O: 0005886G O: 0044425 G O: 0043025 GO: 0044297 G O: 0030427 G O: 0071564 GO: 0043197 G O: 0043005 G O: 0005929 GO: 0005902 G O: 0044463G O: 0030529 G O: 0031143GO: 0030175 G O: 0005903 G O: 0097458 G O: 0042995 G O: 0030018 G O: 0090544 G O: 0016514GO: 0071778 GO: 0014069 G O: 0031514GO: 0072372 G O: 0044327 G O: 0030424G O: 0030425 GO: 0044309 GO: 0009986 G O: 0042622 G O: 0031528 GO: 0008250 G O: 0001750 G O: 0044441 GO: 0031513 GO: 0005905 G O: 0045121 G O: 0071944 G O: 0031674 GO: 0070603 G O: 0030017 G O: 0044432 GO: 0005840 G O: 0048471 GO: 0005829G O: 0043292GO: 0048786 GO: 0030176 GO: 0001931 GO: 0005741 GO: 0031301G O: 0031227 G O: 0031968G O: 0005764 G O: 0044440GO: 0005769 GO: 0005637 G O: 0005766 G O: 0005765G O: 0043202GO: 0031966 GO: 0000139 G O: 0031300 GO: 0005774 G O: 0005775 GO: 0000323 G O: 0005783GO: 0032421 G O: 0016020 G O: 0005768 G O: 0019867 G O: 0044444 GO: 0005622 GO: 0012505G O: 0005773GO: 0031090 G O: 0042582 G O: 0005758G O: 0031965 G O: 0005641 G O: 0005740G O: 0005635GO: 0019866 G O: 0031970 GO: 0044429 G O: 0044431 G O: 0005739 G O: 0031967 G O: 0005794G O: 0044446GO: 0005938 GO: 0031094 GO: 0043231 GO: 0030670 G O: 0000775G O: 0000785G O: 0044454 G O: 0030864 G O: 0030863 G O: 0005802 G O: 0016363 G O: 0044427G O: 0000793G O: 0000228 GO: 0008290 G O: 0042641 G O: 0031095GO: 0032588 G O: 0043227 GO: 0044424 GO: 0043209 G O: 0044437 G O: 0044422 GO: 0005737 G O: 0031254 G O: 0045177 GO: 0005640 G O: 0005771G O: 0031902 G O: 0031901 G O: 0005789 GO: 0005770 G O: 0010008 GO: 0042175G O: 0030016GO: 0032420 G O: 0044449 G O: 0000790 G O: 0005874GO: 0005694 G O: 0044428G O: 0070013 G O: 0044448G O: 0045120 G O: 0034399 G O: 0031981 GO: 0031974 GO: 0043229 G O: 0043228 G O: 0043226 G O: 0031975 G O: 0044464 G O: 0005623 G O: 0005813 G O: 0030658G O: 0030134 GO: 0005819 G O: 0005815G O: 0005798 G O: 0030662 G O: 0031088G O: 0031092 G O: 0008021G O: 0031093 G O: 0030139 GO: 0030136 G O: 0042827G O: 0030667 G O: 0042581 G O: 0031091GO: 0034774 G O: 0042470 GO: 0030133 G O: 0030659GO: 0030135 G O: 0030141G O: 0060205 G O: 0048770 G O: 0012506GO: 0044433 G O: 0016023G O: 0031983 G O: 0070062G O: 0045211 G O: 0005856 GO: 0043232 G O: 0030672 G O: 0012507G O: 0045335G O: 0030666GO: 0030665 G O: 0045334 G O: 0005730 G O: 0015629GO: 0044430 G O: 0015630 GO: 0045111 G O: 0005634GO: 0043233 G O: 0005801 GO: 0030669 G O: 0031410G O: 0031988 G O: 0097060 G O: 0031982G O: 0065010G O: 0044456GO: 0031594 G O: 0043230 G O: 0005604 G O: 0072563 G O: 0072562 G O: 0044420 G O: 0005578 G O: 0005615 G O: 0031012 G O: 0044421 GO: 0005576 G O: 0045202 G O: 0005916 G O: 0005925 G O: 0014704GO: 0005913 G O: 0005924 G O: 0005921 G O: 0044291 G O: 0005912 G O: 0005911 GO: 0070161GO: 0030055 G O: 0030054 G O: 0005575 Bioconductor analysis tool limma DESeq DESeq2 edgeR DEXSeq GOStats GSEAlm PFAM data.frame ReportingTools: analysis processing and presentation Automated processes Result detection detection of analysis type object-oriented dispatching requires only 3 lines of code Result preparation analysis -specific modular and customizable cross-link to public databases analysis-specific graphics additional annotations Result presentation search, filter, and sort functionality added by default flexible css styling 2 Example output and code from the package vignettes http://research-pub.gene.com/ReportingTools/ 3 Publishing a data.frame There are three basic calls to publish to an HTML page: (1) 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) 4 Publishing the Iris data library(ReportingTools) data(iris) htmlRep <- HTMLReport(shortName = 'my_html_file', reportDirectory = './reports') publish(iris, htmlRep) finish(htmlRep) 5 More basics with the Iris data I. Adding plots (including basic, lattice, .png, .pdf) II. Adding text (including links to other pages) III. Adding additional tables IV. Modify data frames upon publication (.modifyDF) V. Publishing to CSV files (CSVFile) 6 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) 7 Outline (1) (2) (3) (4) (5) ReportingTools introduction and basics ReportingTools and microarray experiments ReportingTools and RNA-seq experiments ReportingTools and knitr ReportingTools and shiny 8 Microarray examples I. Publish output from limma (add new images and links) II. Publish GO and PFAM analysis output III. Publish gene sets IV. Create index pages 9 Outline (1) (2) (3) (4) (5) ReportingTools introduction and basics ReportingTools and microarray experiments ReportingTools and RNA-seq experiments ReportingTools and knitr ReportingTools and shiny 10 RNA-seq Methods for: I. edgeR exact tests II. edgeR LRTs III.DESeq IV.DESeq2 (with .modifyDF and .toDF) 11 Outline (1) (2) (3) (4) (5) ReportingTools introduction and basics ReportingTools and microarray experiments ReportingTools and RNA-seq experiments ReportingTools and knitr ReportingTools and shiny 12 knitr Can easily integrate ReporingTools tables into knitr reports Need to call ‘knit2html’ from report directory and specify the knitrHandlers in HTMLReport() > setwd("reports") > library(knitr) > knit2html("/home/ubuntu/4BioCknitr.Rmd”) 13 Updates to run the knitr example (due to permission issues) (1) (2) (3) (4) Open 4BioCknitr.Rmd Save to the /home/ubuntu directory setwd(“reports”) Then call knit2html("/home/ubuntu/4BioCknitr.Rmd") 14 Outline (1) (2) (3) (4) (5) ReportingTools introduction and basics ReportingTools and microarray experiments ReportingTools and RNA-seq experiments ReportingTools and knitr ReportingTools and shiny 15 Shiny and ReportingTools 16 Updates to run the shiny example (due to permission issues) (1) (2) (3) (4) Open server.R and ui.R Save these to the /home/ubuntu/reports directory setwd(“reports”) Then call myRunApp() 17 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) }) 18 Changes to ui.R (1) 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), ), 19 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 20 Future methods DESeq2 methods Return the decorated DF More flexibility with annotations 21 Acknowledgements Jason Hackney Josh Kaminker Melanie Huntley Christina Chaivorapol Gabriel Becker Michael Lawrence Robert Gentleman Martin Morgan Dan Tenenbaum 22