derfinderReport: Generate a HTML/PDF report exploring the basic results from...

View source: R/derfinderReport.R

derfinderReportR Documentation

Generate a HTML/PDF report exploring the basic results from derfinder

Description

This function generates a HTML report exploring the basic results from single base-level approach derfinder analysis results (<www.bioconductor.org/packages/derfinder>). The HTML report itself is generated using rmarkdown (http://rmarkdown.rstudio.com/). It works best after using mergeResults.

Usage

derfinderReport(
  prefix,
  outdir = "basicExploration",
  output = "basicExploration",
  project = prefix,
  browse = interactive(),
  nBestRegions = 100,
  makeBestClusters = TRUE,
  nBestClusters = 2,
  fullCov = NULL,
  hg19 = TRUE,
  p.ideos = NULL,
  txdb = NULL,
  device = "png",
  significantVar = "qvalue",
  customCode = NULL,
  template = NULL,
  theme = NULL,
  digits = 2,
  ...
)

Arguments

prefix

The main data directory path where mergeResults was run. It should be the same as mergeResults(prefix).

outdir

The name of output directory relative to prefix.

output

The name of output HTML file (without the html extension).

project

The title of the project.

browse

If TRUE the HTML report is opened in your browser once it's completed.

nBestRegions

The number of region plots to make, ordered by area.

makeBestClusters

If TRUE, plotCluster is used on the nBestClusters regions by area. Note that these plots take some time to make.

nBestClusters

The number of region cluster plots to make by taking the nBestClusters regions ranked by area of the cluster.

fullCov

A list where each element is the result from loadCoverage used with cutoff=NULL. Can be generated using fullCoverage.

hg19

If TRUE then the reference is assumed to be hg19 and chromosome lengths as well as the default transcription database (TxDb.Hsapiens.UCSC.hg19.knownGene) will be used.

p.ideos

A list where each element is the result of plotIdeogram. If it's NULL and hg19=TRUE then they are created for the hg19 human reference.

txdb

Specify the transcription database to use for making the plots for the top regions by area. If NULL and hg19=TRUE then TxDb.Hsapiens.UCSC.hg19.knownGene is used.

device

The graphical device used when knitting. See more at http://yihui.name/knitr/options (dev argument).

significantVar

A character variable specifying whether to use the p-values, the FDR adjusted p-values or the FWER adjusted p-values to determine significance. Has to be either 'pvalue', 'qvalue' or 'fwer'.

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.

template

Template file to use for the report. If not provided, will use the default file found in basicExploration/basicExploration.Rmd within the package source.

theme

A ggplot2 theme to use for the plots made with ggplot2.

digits

The number of digits to round to in the interactive table of the top nBestRegions. Note that p-values and adjusted p-values won't be rounded.

...

Arguments passed to other methods and/or advanced arguments. Advanced arguments:

chrsStyle

The naming style of the chromosomes. By default, UCSC. See seqlevelsStyle.

species

Species name. See extendedMapSeqlevels for more information.

currentStyle

Current naming style used. See extendedMapSeqlevels for more information.

fullRegions

Part of the output of mergeResults. Specify it only if you have already loaded it in memory.

fullNullSummary

Part of the output of mergeResults. Specify it only if you have already loaded it in memory.

fullAnnotatedRegions

Part of the output of mergeResults. Specify it only if you have already loaded it in memory.

optionsStats

Part of the output of analyzeChr. Specify it only if you have already loaded it in memory.

optionsMerge

Part of the output of mergeResults. Specify it only if you have already loaded it in memory.

overviewParams

A two element list with base_size and areaRel that control the text size for the genomic overview plots.

output_format

Either html_document, pdf_document or knitrBootstrap::bootstrap_document unless you modify the YAML template.

clean

Logical, whether to clean the results or not. Passed to render.

Passed to extendedMapSeqlevels.

Details

Set output_format to 'knitrBootstrap::bootstrap_document' or 'pdf_document' if you want a HTML report styled by knitrBootstrap or a PDF report respectively. If using knitrBootstrap, we recommend the version available only via GitHub at https://github.com/jimhester/knitrBootstrap which has nicer features than the current version available via CRAN. You can also set the output_format to 'html_document' for a HTML report styled by rmarkdown. The default is set to 'BiocStyle::html_document'.

If you modify the YAML front matter of template, you can use other values for output_format.

The HTML report styled with knitrBootstrap can be smaller in size than the 'html_document' report.

Value

An HTML report with a basic exploration of the derfinder results. See the example output at http://leekgroup.github.io/regionReport/reference/derfinderReport-example/basicExploration/basicExploration.html.

Author(s)

Leonardo Collado-Torres

See Also

mergeResults, analyzeChr, fullCoverage

Examples


## Load derfinder
library("derfinder")

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

## For convenience, the derfinder output has been pre-computed
file.copy(system.file(file.path("extdata", "chr21"),
    package = "derfinder",
    mustWork = TRUE
), "derfinderReport-example", recursive = TRUE)
## Not run: 
## If you prefer, you can generate the output from derfinder
initialPath <- getwd()
setwd(file.path(initialPath, "derfinderReport-example"))

## Collapse the coverage information
collapsedFull <- collapseFullCoverage(list(genomeData$coverage),
    verbose = TRUE
)

## Calculate library size adjustments
sampleDepths <- sampleDepth(collapsedFull,
    probs = c(0.5), nonzero = TRUE,
    verbose = TRUE
)

## Build the models
group <- genomeInfo$pop
adjustvars <- data.frame(genomeInfo$gender)
models <- makeModels(sampleDepths, testvars = group, adjustvars = adjustvars)

## Analyze chromosome 21
analyzeChr(
    chr = "21", coverageInfo = genomeData, models = models,
    cutoffFstat = 1, cutoffType = "manual", seeds = 20140330, groupInfo = group,
    mc.cores = 1, writeOutput = TRUE, returnOutput = FALSE
)

## Change the directory back to the original one
setwd(initialPath)

## End(Not run)

## Merge the results from the different chromosomes. In this case, there's
## only one: chr21
mergeResults(
    chrs = "21", prefix = "derfinderReport-example",
    genomicState = genomicState$fullGenome
)

## Load the options used for calculating the statistics
load(file.path("derfinderReport-example", "chr21", "optionsStats.Rdata"))

## Generate the HTML report
report <- derfinderReport(
    prefix = "derfinderReport-example", browse = FALSE,
    nBestRegions = 15, makeBestClusters = TRUE,
    fullCov = list("21" = genomeDataRaw$coverage), optionsStats = optionsStats
)


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

## See the example output at
## http://leekgroup.github.io/regionReport/reference/derfinderReport-example/basicExploration/basicExploration.html
## Not run: 
## Note that you can run the example using:
example("derfinderReport", "regionReport", ask = FALSE)

## End(Not run)


leekgroup/regionReport documentation built on Dec. 17, 2024, 4:57 p.m.