Generates an HTML report from an AlphaVarSet object.
Usage
av_create_report(
obj,
output_file = "AlphaVaR_Report.html",
open = TRUE,
custom_template = NULL,
top_n_genes = NULL
)Arguments
- obj
An
AlphaVarSetobject.- output_file
Path where the HTML file should be saved.
- open
Logical. Open the file in the browser after creating? Only takes effect in an interactive session.
- custom_template
One of:
NULL(default spec); anAlphaVarReportSpecobject; a path to a.yaml/.ymlspec file; or a path to a.Rmd/.rmdfile for direct rendering. See Details for the behaviour of each mode.- top_n_genes
Integer, or
NULL(default) to keep the number of genes the template itself declares. A number overrides everygene_deep_diveblock. Passed as-is for.Rmdpassthrough; ignored for spec/YAML templates.
Details
The custom_template parameter supports four modes:
- NULL (default)
Builds the report from the default spec (
av_report_template_default(), which hasauto_compute = TRUE). Missing enrichment stats are computed automatically, so no prior call toav_calc_*()is required. A non-NULLtop_n_genesoverrides everygene_deep_diveblock.- AlphaVarReportSpec object
Validates the spec and renders via the modular engine (
report_modular.Rmd). Missing stats cause a hard error unless the spec carriesauto_compute = TRUE.- YAML file (.yaml / .yml)
Loads an
AlphaVarReportSpecfrom disk and renders via the modular engine. The same auto-compute/hard-error contract applies.- Rmd file (.Rmd / .rmd)
Renders the supplied Rmd directly with
params = list(obj = obj, top_n_genes = top_n_genes). No spec validation is performed.
Examples
example_file <- system.file("extdata", "bcl11a_rs1427407_example.csv",
package = "AlphaVaR")
obj <- av_import_csv(example_file)
#> Reading bcl11a_rs1427407_example.csv ...
# The NULL default renders av_report_template_default(), whose
# auto_compute = TRUE computes every stat a block needs during the render.
spec <- av_report_template_default()
length(spec$blocks)
#> [1] 27
# open = FALSE leaves the browser closed, and tempdir() keeps the figure
# directory knitr creates out of the working directory.
report_path <- av_create_report(
obj,
output_file = file.path(tempdir(), "bcl11a_report.html"),
open = FALSE
)
#> Rendering modular report to: /tmp/RtmpZ7Nxif/bcl11a_report.html
file.exists(report_path)
#> [1] TRUE