Learn R Programming

regionReport (version 1.4.0)

renderReport: Generate a HTML report exploring a set of genomic regions

Description

This function generates a HTML report with quality checks, genome location exploration, and an interactive table with the results. Other output formats are possible such as PDF but lose the interactivity. Users can easily append to the report by providing a R Markdown file to customCode, or can customize the entire template by providing an R Markdown file to template.

Usage

renderReport(regions, project, pvalueVars = c(`P-values` = "pval"), densityVars = NULL, significantVar = mcols(regions)$pval <= 0.05,="" annotation =" NULL," nbestregions =" 500," customcode =" NULL," outdir =" "regionExploration"," output =" "regionExploration"," browse =" interactive()," txdb =" NULL," device =" "png"," densitytemplates =" list(Pvalue = templatePvalueDensity," common="templateDensity," manhattan =" templateManhattan)," template =" NULL," ...)<="" div="">
templatePvalueDensity
templateDensity
templateManhattan

Arguments

regions
The set of genomic regions of interest as a GRanges object. All sequence lengths must be provided.
project
The title of the project.
pvalueVars
The names of the variables with values between 0 and 1 to plot density values by chromosome and a table for commonly used cutoffs. Most commonly used to explore p-value distributions. If a named character vector is provided, the names are used in the plot titles.
densityVars
The names of variables to use for making density plots by chromosome. Commonly used to explore scores and other variables given by region. If a named character vector is provided, the names are used in the plot titles.
significantVar
A logical variable differentiating statistically significant regions from the rest. When provided, both types of regions are compared against each other to see differences in width, location, etc.
annotation
The output from matchGenes used on regions. Note that this can take time for a large set of regions so it's better to pre-compute this information and save it.
nBestRegions
The number of regions to include in the interactive table.
customCode
An absolute path to a child R Markdown file with code to be evaluated before the reproducibility section. Its useful for users who want to customize the report by adding conclusions derived from the data and/or further quality checks and plots.
outdir
The name of output directory.
output
The name of output HTML file (without the html extension).
browse
If TRUE the HTML report is opened in your browser once it's completed.
txdb
Specify the transcription database to use for identifying the closest genes via matchGenes. If NULL it will use TxDb.Hsapiens.UCSC.hg19.knownGene by default.
device
The graphical device used when knitting. See more at http://yihui.name/knitr/options (dev argument).
densityTemplates
A list of length 3 with templates for the p-value density plots (variables from pvalueVars), the continuous variables density plots (variables from densityVars), and Manhattan plots for the p-value variables (pvalueVars). These templates are processed by whisker.render. Check the default templates for more information. The densityTemplates argument is available for those users interested in customizing these plots. For example, to show histograms instead of density plots.
template
Template file to use for the report. If not provided, will use the default file found in regionExploration/regionExploration.Rmd within the package source.
...
Arguments passed to other methods and/or advanced arguments.

Value

An HTML report with a basic exploration for the given set of genomic regions.

Format

 chr "\n## {{{densityVarName}}}\n\n```{r density-{{{varName}}}, fig.width=10, fig.height=10, dev=device}\np1{{{varName}}} <- ggplot(r"| __truncated__

Examples

Run this code
## Load derfinder for an example set of regions
library('derfinder')
regions <- genomeRegions$regions

## Assign chr length
library('GenomicRanges')
seqlengths(regions) <- c('chr21' = 48129895)

## The output will be saved in the 'derfinderReport-example' directory
dir.create('renderReport-example', showWarnings = FALSE, recursive = TRUE)

## Generate the HTML report
report <- renderReport(regions, 'Example run', pvalueVars = c(
    'Q-values' = 'qvalues', 'P-values' = 'pvalues'), densityVars = c(
    'Area' = 'area', 'Mean coverage' = 'meanCoverage'),
    significantVar = regions$qvalues <= 0.05, nBestRegions = 20,
    outdir = 'renderReport-example')

if(interactive()) {
    ## Browse the report
    browseURL(report)
}

## Not run: 
# ## Note that you can run the example using:
# example('renderReport', 'regionReport', ask=FALSE)
# ## End(Not run)

## Check the default templates. For users interested in customizing these
## plots.
## For p-value variables:
cat(templatePvalueDensity)

## For continous variables:
cat(templateDensity)

## For Manhattan plots
cat(templateManhattan)

Run the code above in your browser using DataLab