R/derfinderReport.R
derfinderReport.Rd
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,
...
)
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
http://yihui.name/knitr/options (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.
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.
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.
## 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) { # \dontrun{
## 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
#> 2024-12-12 21:47:25.012216 mergeResults: Saving options used
#> 2024-12-12 21:47:25.012868 Loading chromosome chr21
#> Neither 'cutoffFstatUsed' nor 'optionsStats' were supplied, so the FWER calculation step will be skipped.
#> 2024-12-12 21:47:25.055373 mergeResults: Saving fullNullSummary
#> 2024-12-12 21:47:25.055903 mergeResults: Re-calculating the p-values
#> 2024-12-12 21:47:25.112169 mergeResults: Saving fullRegions
#> 2024-12-12 21:47:25.11306 mergeResults: assigning genomic states
#> 2024-12-12 21:47:25.182144 annotateRegions: counting
#> 2024-12-12 21:47:25.234207 annotateRegions: annotating
#> 2024-12-12 21:47:25.252053 mergeResults: Saving fullAnnotatedRegions
#> 2024-12-12 21:47:25.252804 mergeResults: Saving fullFstats
#> 2024-12-12 21:47:25.253461 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
#> 1/77
#> 2/77 [docSetup]
#> 3/77
#> 4/77 [setup]
#> 5/77
#> 6/77 [pvals]
#> 7/77
#> 8/77 [summPval]
#> 9/77
#> 10/77 [summQval]
#> 11/77
#> 12/77 [qsummary]
#> 13/77
#> 14/77 [summFwer]
#> 15/77
#> 16/77 [FWERsummary]
#> 17/77
#> 18/77 [regLen]
#> 19/77
#> 20/77 [regLen2]
#> 21/77
#> 22/77 [regArea]
#> 23/77
#> 24/77 [regArea2]
#> 25/77
#> 26/77 [nullLengthArea]
#> 27/77
#> 28/77 [meanCov]
#> 29/77
#> 30/77 [meanCov2]
#> 31/77
#> 32/77 [MAstyle]
#> 33/77
#> 34/77 [genomeOverview1]
#> 35/77
#> 36/77 [manhattanPlots]
#> 37/77
#> 38/77 [genomeOverview2]
#> 39/77
#> 40/77 [annoReg]
#> 41/77
#> 42/77 [genomeOverview3]
#> 43/77
#> 44/77 [plotRegions]
#> 45/77
#> 46/77 [countTable]
#> 47/77
#> 48/77 [vennDiagram]
#> 49/77
#> 50/77 [vennDiagramSignificant]
#> 51/77
#> 52/77 [bestAreaInfo]
#> 53/77
#> 54/77 [plotCluster]
#> 55/77
#> 56/77 [bestClusters]
#> 57/77
#> 58/77 [permute2]
#> 59/77
#> 60/77 [permuteTable]
#> 61/77
#> 62/77 [unnamed-chunk-1]
#> 63/77
#> 64/77 [analysisCall]
#> 65/77
#> 66/77 [mergeCall]
#> 67/77
#> 68/77 [thecall]
#> 69/77
#> 70/77 [reproducibility1]
#> 71/77
#> 72/77 [reproducibility2]
#> 73/77
#> 74/77 [reproducibility3]
#> 75/77
#> 76/77 [bibliography]
#> 77/77
#> output file: basicExploration.knit.md
#> /usr/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 --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/table-classes.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/RtmplloSdM/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/RtmplloSdM/rmarkdown-str9b376f9f874.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) { # \dontrun{
## Note that you can run the example using:
example("derfinderReport", "regionReport", ask = FALSE)
} # }