% \VignetteIndexEntry{Reporting on RNA-seq differential expression} % \VignetteDepends{} % \VignetteKeywords{reprise} % \VignettePackage{ReportingTools} \documentclass[10pt]{article} \usepackage{times} \usepackage{hyperref} \usepackage{Sweave} \textwidth=6.5in \textheight=8.5in \oddsidemargin=-.1in \evensidemargin=-.1in \headheight=-.3in \title{Using ReportingTools in an Analysis of RNA-seq Data} \author{Jessica L. Larson and Christina Chaivorapol} \date{\today} \begin{document} \maketitle \tableofcontents \newpage \section{Introduction} The \tt ReportingTools \rm package can be used with differential gene expression results from RNA-sequencing analysis. In this vignette we show how to \tt publish \rm output from an \tt edgeR\rm, Gene Ontology (GO) and/or Protein family (PFAM) analysis. In the final section we \tt publish \rm all our pages onto one, creating a comprehensive output page. \section{Differential expression analysis} In this section we demonstrate how to use the \tt ReportingTools \rm package to generate a table of differentially expressed genes. We begin by loading our library and data set. The \tt mockRnaSeqData \rm contains random RNA-seq output for random mouse genes. <>= library(ReportingTools) data(mockRnaSeqData) @ Next, we run \tt edgeR \rm to find differentially expressed genes. <>= library(edgeR) conditions <- c(rep("case",3), rep("control", 3)) d <- DGEList(counts = mockRnaSeqData, group = conditions) d <- calcNormFactors(d) d <- estimateCommonDisp(d) ## Get an edgeR object edgeR.de <- exactTest(d) @ Now the results can be written to a report using the \tt edgeR \rm object. Currently, only \tt DGEExact \rm objects returned from the \tt exactTest \rm function in the \tt edgeR \rm package are supported. <>= library(lattice) rep.theme <- reporting.theme() ## Change symbol colors in plots rep.theme$superpose.symbol$col <- c("blue", "red") rep.theme$superpose.symbol$fill <- c("blue", "red") lattice.options(default.theme = rep.theme) deReport <- HTMLReport(shortName = 'RNAseq_analysis_with_edgeR', title = 'RNA-seq analysis of differential expression using edgeR', reportDirectory = "./reports/", baseUrl = "") ## Publish a report of the top 10 genes with p-values < 0.05 and log-fold change > 2 publish(edgeR.de, deReport, mockRnaSeqData, conditions, annotation.db = 'org.Mm.eg', pvalueCutoff = .05, lfc = 2, n = 10) finish(deReport) @ \begin{figure} \centering \includegraphics[scale = .5]{rnaseq1} \caption{Resulting page created by \tt publish \rm for \tt edgeR.de\rm.} \end{figure} \section{GO analysis using GOstats} In this section, we show how to use \tt ReportingTools \rm to write a table of GO analysis results to an html file. First we select or genes of interest and then we run the \tt hyperGTest\rm. <>= library(GOstats) library(org.Mm.eg.db) tt<-topTags(edgeR.de, n = 1000, adjust.method = 'BH', sort.by = 'p.value') selectedIDs<-rownames(tt$table) universeIDs<-rownames(mockRnaSeqData) goParams <- new("GOHyperGParams", geneIds = selectedIDs, universeGeneIds = universeIDs, annotation ="org.Mm.eg" , ontology = "MF", pvalueCutoff = 0.01, conditional = TRUE, testDirection = "over") goResults <- hyperGTest(goParams) @ With these results, we then make the GO report. Here we set \tt makePlot=TRUE \rm to get a large image of the relationship between our significant ontologies. <>= goReport <- HTMLReport(shortName = 'go_analysis_rnaseq', title = "GO analysis of mockRnaSeqData", reportDirectory = "./reports", baseUrl = "") publish(goResults, goReport, selectedIDs, annotation.db="org.Mm.eg", pvalueCutoff= 0.05, makePlot=TRUE) finish(goReport) @ \begin{figure} \centering \includegraphics[scale = .5]{rnaseq2.png} \caption{Resulting page created by \tt publish \rm for \tt goResults\rm.} \end{figure} \section{PFAM analysis} In this section, we show how to use \tt ReportingTools \rm to write a table of PFAM analysis results to an html file. First we run the \tt hyperGTest \rm using our genes of interest from the previous section. <>= library(Category) params <- new("PFAMHyperGParams", geneIds= selectedIDs, universeGeneIds=universeIDs, annotation="org.Mm.eg", pvalueCutoff= 0.01, testDirection="over") PFAMResults <- hyperGTest(params) @ Then we make the PFAM report. <>= PFAMReport <- HTMLReport(shortName = 'pfam_analysis_rnaseq', title = "PFAM analysis of mockRnaSeqData", reportDirectory = "./reports", baseUrl = "") publish(PFAMResults, PFAMReport, selectedIDs, annotation.db="org.Mm.eg",categorySize=5) finish(PFAMReport) @ \begin{figure} \centering \includegraphics[scale = .5]{rnaseq3.png} \caption{Resulting page created by \tt publish \rm for \tt PFAMResults\rm.} \end{figure} \section{Putting it all together} Here, we make an index page that puts all three analyses together for easy navigation. <>= indexPage <- HTMLReport(shortName = "indexRNASeq", title = "Analysis of mockRnaSeqData", reportDirectory = "./reports", baseUrl = "") publish(c(deReport,goReport, PFAMReport), indexPage) finish(indexPage) @ \begin{figure} \centering \includegraphics[scale = .5]{rnaseq4.png} \caption{Resulting page created by calling \tt publish \rm on all our analysis pages.} \end{figure} \end{document}