Compiles classification results, visualizations, and optional differential expression analysis into a self-contained HTML report using an internal R Markdown template.
Usage
report_classification(
expr = NULL,
subtype,
probs = NULL,
degs = NULL,
idType = "SYMBOL",
output_file = "HNSC_classification_report.html"
)Arguments
- expr
A numeric gene expression matrix with genes in rows and samples in columns. Required for the heatmap section.
- subtype
A named character vector of predicted subtypes, as returned by
classifyHNSC(outputType = "class"). A data frame with columnsSampleandSubtypeis also accepted.- probs
Optional. A probability matrix as returned by
classifyHNSC(outputType = "prob"). If provided, a stacked bar chart of posterior probabilities is included in the report.- degs
Optional. A named list of data frames as returned by
extract_top_genes. If provided, the top differentially expressed genes per subtype are included.- idType
Character string specifying the gene identifier type. One of
"SYMBOL"(default),"ENSEMBL","ENTREZID", or"REFSEQ". Only used whenexpris provided for the heatmap section.- output_file
Character string for the output HTML file path. Default:
"HNSC_classification_report.html"in the current working directory.
Details
The report is rendered from an internal R Markdown template and includes the following sections:
Classification Summary — a table of subtype distribution with counts and percentages.
Subtype Distribution — a bar chart visualisation of the summary table.
Posterior Probabilities — a stacked bar chart of per-sample subtype probabilities (only shown if
probsis provided).Subtype Marker Gene Heatmap — an annotated heatmap of curated subtype-driver genes (only shown if
expris provided).Differentially Expressed Genes — top DEGs per subtype from one-vs-rest analysis (only shown if
degsis provided).Sample-Level Classification — a complete table of per-sample assignments.
The HTML file is self-contained (all plots are embedded as base64) and can be shared with collaborators or included as supplementary material.
Note
Requires the rmarkdown and knitr packages.
Install with: install.packages(c("rmarkdown", "knitr"))
See also
classifyHNSC for generating the required inputs,
extract_top_genes for differential expression analysis.
Examples
if (FALSE) { # \dontrun{
data(TCGA_LUSC)
subtypes <- classifyHNSC(TCGA_LUSC, outputType = "class")
probs <- classifyHNSC(TCGA_LUSC, outputType = "prob")
# Minimal report (class labels only)
report_classification(subtype = subtypes)
# Full report with heatmap and probabilities
report_classification(
expr = TCGA_LUSC,
subtype = subtypes,
probs = probs
)
# Include differential expression results
degs <- extract_top_genes(TCGA_LUSC, subtypes)
report_classification(
expr = TCGA_LUSC,
subtype = subtypes,
probs = probs,
degs = degs
)
} # }