Render a HowMaHiCo QC report from the installed package templates
Source:R/run-report.R
run_howmahico_report.RdThin wrapper around rmarkdown::render() that locates one of the package's
two report templates via system.file() and renders it with the supplied
params. One call renders one report — composable (loop it for batch runs,
see derive_filtered_annotation()/the batch-rendering example below) and
Docker-idiomatic ("one container run = one job").
Arguments
- template
Which report template to render.
"00_mhc_report"is the all-in-one QC report (it parses the raw search files itself) and"00_mhc_upsets"its per-sample overlap/UpSet companion; both are kept frozen for backward compatibility. The other templates render against apep_allcache built once bybuild_pep_all()(or by00_mhc_report):"01_mhc_overview"(the main report: at-a-glance summary and red flags, identification counts and size distributions, the per-sample quality score, overlaps, log2(Area) correlation and %CV, motifs and PTMs),"02_prot_all"(protein level: source proteins per sample, ligands per protein, and any protein-level values the search engine reported),"03_lcms_qc"(RT/1k0/mz distributions, Score/ppm QC),"04_pepchem"(peptide physicochemical properties: amino-acid composition, per-position residue frequency and descriptors such as GRAVY, compared between Conditions) and"05_quant_stats"(advanced quantification: normalization, PCA/clustering and limma differential abundance between Conditions).The names used before v0.27.0 still work, with a deprecation warning:
"01_id_counts","02_overlaps","04_quant","05_quality_score"and"09_overview"render"01_mhc_overview";"06_quant_stats","07_pepchem"and"08_prot_all"render"05_quant_stats","04_pepchem"and"02_prot_all".- params
Named list of report parameters, as declared in the template's YAML header (
SampleSet,AnnotationFile,Subset,FolderData,FolderResults,FolderFigures,Software,MHCclass, ...). The report title is auto-generated fromSampleSet,Subset,MHCclass, and the render date — noTitleparam needed. Key params:MHCclass—"MHC1"(8-13 AA window, default) or"MHC2"(12-25 AA window); overridesShortPeptideLengthMin/ShortPeptideLengthMaxwhen set to a recognised value. PassProjectDir = "/absolute/path/to/project"to resolve relative folder paths from that directory instead of the current working directory — useful when R is started from a subdirectory.- output_file
Output HTML file path. Relative paths are resolved against
params$ProjectDir(if supplied) or the current working directory at call time — never against the package-internal skeleton location.- envir
Environment the report is knitted in. The default, a fresh environment, is discarded after the render; pass your own to inspect the report's objects (
pep_all,pep_short, intermediate tables) afterwardsin particular after a render that failed:
e <- new.env(); try(run_howmahico_report(..., envir = e)); ls(e). See alsoreport_params()andreport_setup()for running a report step by step.
- ...
Additional arguments forwarded to
rmarkdown::render()(e.g.quiet).
Value
The path to the rendered output file (invisibly), as returned by
rmarkdown::render().
Details
FolderData/FolderResults/FolderFigures in params are absolute
paths (or paths relative to the current working directory at render
time) — unlike the legacy 0_code/-era reports, the rendered template no
longer assumes a fixed project-root-relative layout, since it now lives
inside an installed package and can be rendered from anywhere.
Examples
if (FALSE) { # \dontrun{
run_howmahico_report(
template = "00_mhc_report",
params = list(SampleSet = "MEGF_035_K251128",
AnnotationFile = "sample_annotation_dda_all.csv",
Subset = "dda_all",
FolderData = "/data/2_data",
FolderResults = "/data/3_results",
FolderFigures = "/data/4_figures",
Software = "fragpipe_dda_combined"),
output_file = "01_report_main__hla1_dda_all.html"
)
# Focused-report framework: build the pep_all cache once, then render any
# subset of the focused reports against it (no re-parsing per report).
annot <- read_annot("1_documentation/sample_annotation_dda_all.csv")
build_pep_all(software = "fragpipe_dda_combined", folder_data = "2_data",
annotation = annot, shortpep_range = c(8, 13),
file_rda = "2_data/dda_all_pep_all.rda")
focused_params <- list(SampleSet = "MEGF_035", Subset = "dda_all",
FolderData = "2_data", FolderResults = "3_results",
FolderFigures = "4_figures", Software = "fragpipe_dda_combined")
for (tmpl in c("01_mhc_overview", "02_prot_all", "03_lcms_qc",
"04_pepchem", "05_quant_stats")) {
run_howmahico_report(tmpl, params = focused_params,
output_file = paste0(tmpl, "__dda_all.html"))
}
# Batch-rendering pattern (preserves 00_knit_reports.R's 6-subset loop):
annot_jy <- derive_filtered_annotation("sample_annotation_dda_all.csv",
"1_documentation", "JY")
for (subset in c("dda_all", "dda_jy", "dda_plasma")) {
run_howmahico_report(template = "00_mhc_report",
params = list(Subset = subset, ...),
output_file = paste0("01_report_main__hla1_", subset, ".html"))
}
} # }