Builds a self-contained HTML report from a DEprot or DEprot.analyses object. The report always includes a quality-control (QC) section (analysis parameters, value distributions, PCA of PC1/PC2/PC3 and sample correlation heatmaps) and, when differential analyses are present in the object (DEprot.analyses), a results section reporting the parameters used, a cross-contrast summary and, for each contrast, the volcano plot, MA-plot and the top differential proteins. A final section lists the R session and the versions of the packages used to generate the report.

The function writes a parameterised R Markdown document to a temporary file and renders it with rmarkdown::render(); all plots are produced with the native DEprot plotting functions (perform.PCA, plot.PC.scatter.123, plot.PC.cumulative, plot.correlation.heatmap, plot.volcano and plot.MA) or the plots already stored inside the object.

export.report(
  DEprot.object,
  output.file = "DEprot.report.html",
  report.title = "DEprot report",
  author.name = "DEprot",
  which.data = NULL,
  correlation.method = c("pearson", "spearman"),
  correlation.display.values = TRUE,
  PCA.color.column = "column.id",
  PCA.shape.column = NULL,
  PCA.label.column = NULL,
  protein.summary.group.column = "column.id",
  volcano.use.uncorrected.pvalue = FALSE,
  show.MA.plot = TRUE,
  include.contrast.qc = TRUE,
  top.n.proteins = 25,
  plot.width = 8,
  plot.height = 5.5,
  self.contained = TRUE,
  keep.Rmd = FALSE,
  quiet = TRUE
)

Arguments

DEprot.object

An object of class DEprot or DEprot.analyses.

output.file

String with the path (or file name) of the HTML file to create. A .html extension is added when missing. Default: "DEprot.report.html".

report.title

String used as the report title. Default: "DEprot report".

author.name

String used as the report author. Default: "DEprot".

which.data

String indicating which counts to use for the QC section. One among 'raw', 'normalized'/'norm', 'randomized'/'random', 'imputed'/'imp'. Default: NULL, in which case the best available data are chosen automatically (imputed > normalized > randomized > raw).

correlation.method

Character vector with the correlation method(s) to display in the QC section. Any of 'pearson', 'spearman', 'kendall'. Default: c("pearson", "spearman").

correlation.display.values

Logical; whether the correlation coefficient is printed inside each cell of the sample-correlation heatmaps. Default: TRUE.

PCA.color.column

String with the metadata column used to color the PCA points. Default: "column.id" (one color per sample).

PCA.shape.column

String with the metadata column used for the PCA point shapes. Default: NULL.

PCA.label.column

String with the metadata column used to label the PCA points. Default: NULL.

protein.summary.group.column

String with the metadata column used to group samples in the protein-summary barplot (absolute protein counts). Default: "column.id" (one bar per sample).

volcano.use.uncorrected.pvalue

Logical; if TRUE the volcano plots are regenerated using the uncorrected p-value. Default: FALSE.

show.MA.plot

Logical; whether to include the MA-plot for each contrast. Default: TRUE.

include.contrast.qc

Logical indicating whether to additionally include the per-contrast PCA and correlation plots stored in the object. Default: TRUE.

top.n.proteins

Integer; number of top proteins shown in the per-contrast results table, ranked by a combined score -log10(padj) * abs(log2FC) (the score itself is not shown). Default: 25.

plot.width, plot.height

Numeric; default figure width and height (in inches) used in the report. Default: 8 and 5.5.

self.contained

Logical indicating whether the HTML embeds all resources into a single portable file. Default: TRUE.

keep.Rmd

Logical; if TRUE the intermediate .Rmd source is copied next to the output file. Default: FALSE.

quiet

Logical indicating whether to suppress the rendering log. Default: TRUE.

Value

Invisibly, the path to the generated HTML file.

Author

Sebastian Gregoricchio

Examples

if (FALSE) { # \dontrun{
# QC-only report (DEprot object)
export.report(DEprot.object = DEprot::test.toolbox$dpo.imp,
              output.file = "QC.report.html",
              report.title = "Proteomics QC",
              author.name = "Jane Doe")

# Full report with differential analyses (DEprot.analyses object)
export.report(DEprot.object = DEprot::test.toolbox$diff.exp.limma,
              output.file = "DE.report.html",
              report.title = "FBS vs DCC differential analysis",
              author.name = "Jane Doe",
              PCA.color.column = "condition",
              PCA.shape.column = "replicate")
} # }