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


This function generates a HTML report exploring the basic results from single base-level approach derfinder analysis results (<>). The HTML report itself is generated using rmarkdown ( It works best after using mergeResults.


  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,



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


The name of output directory relative to prefix.


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


The title of the project.


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


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


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


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


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


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.


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.


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.


The graphical device used when knitting. See more at (dev argument).


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'.


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 file to use for the report. If not provided, will use the default file found in basicExploration/basicExploration.Rmd within the package source.


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


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:


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


Species name. See extendedMapSeqlevels for more information.


Current naming style used. See extendedMapSeqlevels for more information.


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


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


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


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


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


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


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


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

Passed to extendedMapSeqlevels.


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 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.


An HTML report with a basic exploration of the derfinder results. See the example output at


Leonardo Collado-Torres

See Also

mergeResults, analyzeChr, fullCoverage


## Load 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
    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

## End(Not run)

## Merge the results from the different chromosomes. In this case, there's
## only one: chr21
    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

## See the example output at
## Not run: 
## Note that you can run the example using:
example("derfinderReport", "regionReport", ask = FALSE)

## End(Not run)

leekgroup/regionReport documentation built on May 10, 2023, 11:37 p.m.