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.

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.

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.

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.

Author

Leonardo Collado-Torres

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)
#> [1] TRUE
if (FALSE) {
## 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)
}

## Merge the results from the different chromosomes. In this case, there's
## only one: chr21
mergeResults(
    chrs = "21", prefix = "derfinderReport-example",
    genomicState = genomicState$fullGenome
)
#> extendedMapSeqlevels: sequence names mapped from NCBI to UCSC for species homo_sapiens
#> 2023-05-07 05:32:32.870869 mergeResults: Saving options used
#> 2023-05-07 05:32:32.872067 Loading chromosome chr21
#> Neither 'cutoffFstatUsed' nor 'optionsStats' were supplied, so the FWER calculation step will be skipped.
#> 2023-05-07 05:32:32.961237 mergeResults: Saving fullNullSummary
#> 2023-05-07 05:32:32.962004 mergeResults: Re-calculating the p-values
#> 2023-05-07 05:32:33.085096 mergeResults: Saving fullRegions
#> 2023-05-07 05:32:33.086493 mergeResults: assigning genomic states
#> 2023-05-07 05:32:33.236859 annotateRegions: counting
#> 2023-05-07 05:32:33.34875 annotateRegions: annotating
#> 2023-05-07 05:32:33.390975 mergeResults: Saving fullAnnotatedRegions
#> 2023-05-07 05:32:33.392281 mergeResults: Saving fullFstats
#> 2023-05-07 05:32:33.393115 mergeResults: Saving fullTime

## 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
)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
#> Writing 9 Bibtex entries ... 
#> OK
#> Results written to file 'derfinderReport-example/basicExploration/basicExploration.bib'
#> extendedMapSeqlevels: sequence names mapped from NCBI to UCSC for species homo_sapiens
#> 
#> 
#> processing file: basicExploration.Rmd
#> 
  |                                                                                           
  |                                                                                     |   0%
  |                                                                                           
  |.                                                                                    |   1%                         
  |                                                                                           
  |..                                                                                   |   3% (docSetup)              
  |                                                                                           
  |...                                                                                  |   4%                         
  |                                                                                           
  |....                                                                                 |   5% (setup)                 
  |                                                                                           
  |......                                                                               |   6%                         
  |                                                                                           
  |.......                                                                              |   8% (pvals)                 
  |                                                                                           
  |........                                                                             |   9%                         
  |                                                                                           
  |.........                                                                            |  10% (summPval)              
  |                                                                                           
  |..........                                                                           |  12%                         
  |                                                                                           
  |...........                                                                          |  13% (summQval)              
  |                                                                                           
  |............                                                                         |  14%                         
  |                                                                                           
  |.............                                                                        |  16% (qsummary)              
  |                                                                                           
  |..............                                                                       |  17%                         
  |                                                                                           
  |...............                                                                      |  18% (summFwer)              
  |                                                                                           
  |.................                                                                    |  19%                         
  |                                                                                           
  |..................                                                                   |  21% (FWERsummary)           
  |                                                                                           
  |...................                                                                  |  22%                         
  |                                                                                           
  |....................                                                                 |  23% (regLen)                
  |                                                                                           
  |.....................                                                                |  25%                         
  |                                                                                           
  |......................                                                               |  26% (regLen2)               
  |                                                                                           
  |.......................                                                              |  27%                         
  |                                                                                           
  |........................                                                             |  29% (regArea)               
  |                                                                                           
  |.........................                                                            |  30%                         
  |                                                                                           
  |..........................                                                           |  31% (regArea2)              
  |                                                                                           
  |............................                                                         |  32%                         
  |                                                                                           
  |.............................                                                        |  34% (nullLengthArea)        
  |                                                                                           
  |..............................                                                       |  35%                         
  |                                                                                           
  |...............................                                                      |  36% (meanCov)               
  |                                                                                           
  |................................                                                     |  38%                         
  |                                                                                           
  |.................................                                                    |  39% (meanCov2)              
  |                                                                                           
  |..................................                                                   |  40%                         
  |                                                                                           
  |...................................                                                  |  42% (MAstyle)               
  |                                                                                           
  |....................................                                                 |  43%                         
  |                                                                                           
  |......................................                                               |  44% (genomeOverview1)       
  |                                                                                           
  |.......................................                                              |  45%                         
  |                                                                                           
  |........................................                                             |  47% (manhattanPlots)        
  |                                                                                           
  |.........................................                                            |  48%                         
  |                                                                                           
  |..........................................                                           |  49% (genomeOverview2)       
  |                                                                                           
  |...........................................                                          |  51%                         
  |                                                                                           
  |............................................                                         |  52% (annoReg)               
  |                                                                                           
  |.............................................                                        |  53%                         
  |                                                                                           
  |..............................................                                       |  55% (genomeOverview3)       
  |                                                                                           
  |...............................................                                      |  56%                         
  |                                                                                           
  |.................................................                                    |  57% (plotRegions)           
  |                                                                                           
  |..................................................                                   |  58%                         
  |                                                                                           
  |...................................................                                  |  60% (countTable)            
  |                                                                                           
  |....................................................                                 |  61%                         
  |                                                                                           
  |.....................................................                                |  62% (vennDiagram)           
  |                                                                                           
  |......................................................                               |  64%                         
  |                                                                                           
  |.......................................................                              |  65% (vennDiagramSignificant)
  |                                                                                           
  |........................................................                             |  66%                         
  |                                                                                           
  |.........................................................                            |  68% (bestAreaInfo)          
  |                                                                                           
  |...........................................................                          |  69%                         
  |                                                                                           
  |............................................................                         |  70% (plotCluster)           
  |                                                                                           
  |.............................................................                        |  71%                         
  |                                                                                           
  |..............................................................                       |  73% (bestClusters)          
  |                                                                                           
  |...............................................................                      |  74%                         
  |                                                                                           
  |................................................................                     |  75% (permute2)              
  |                                                                                           
  |.................................................................                    |  77%                         
  |                                                                                           
  |..................................................................                   |  78% (permuteTable)          
  |                                                                                           
  |...................................................................                  |  79%                         
  |                                                                                           
  |....................................................................                 |  81% (unnamed-chunk-1)       
  |                                                                                           
  |......................................................................               |  82%                         
  |                                                                                           
  |.......................................................................              |  83% (analysisCall)          
  |                                                                                           
  |........................................................................             |  84%                         
  |                                                                                           
  |.........................................................................            |  86% (mergeCall)             
  |                                                                                           
  |..........................................................................           |  87%                         
  |                                                                                           
  |...........................................................................          |  88% (thecall)               
  |                                                                                           
  |............................................................................         |  90%                         
  |                                                                                           
  |.............................................................................        |  91% (reproducibility1)      
  |                                                                                           
  |..............................................................................       |  92%                         
  |                                                                                           
  |...............................................................................      |  94% (reproducibility2)      
  |                                                                                           
  |.................................................................................    |  95%                         
  |                                                                                           
  |..................................................................................   |  96% (reproducibility3)      
  |                                                                                           
  |...................................................................................  |  97%                         
  |                                                                                           
  |.................................................................................... |  99% (bibliography)          
  |                                                                                           
  |.....................................................................................| 100%                         
                                                                                                                                                           
#> output file: basicExploration.knit.md
#> /usr/local/bin/pandoc +RTS -K512m -RTS basicExploration.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output basicExploration.html --lua-filter /__w/_temp/Library/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --wrap preserve --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template /tmp/RtmpoLEapv/BiocStyle/template.html --no-highlight --variable highlightjs=1 --number-sections --variable theme=bootstrap --css /__w/_temp/Library/BiocStyle/resources/html/bioconductor.css --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpoLEapv/rmarkdown-str848451b6d1e.html --variable code_folding=hide --variable code_menu=1 
#> 
#> Output created: basicExploration.html


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

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