Summarize Molecular Subtype Classification Results
Source:R/summarize_subtype.R
summarize_subtype.RdProduces a tidy summary table from the output of
classifyHNSC(outputType = "class"), showing sample counts,
percentages, and an optional bar plot of the subtype distribution.
Arguments
- subtype
A named character vector or factor giving the predicted subtype for each sample, as returned by
classifyHNSC(outputType = "class"). Must have names (sample IDs). Alternatively, a data frame with columnsSampleandSubtype.- plot
Logical. If
TRUE(default), aggplot2bar chart of the subtype distribution is printed as a side effect.
Value
A data frame (invisibly, if plot = TRUE) with columns:
Subtype: the four TCGA molecular subtypesN: number of samples assigned to each subtypePct: percentage of total samples (rounded to 1 decimal)Proportion: numeric proportion (0–1)
The rows are sorted by frequency in descending order. If a subtype
has zero samples, it is still included with N = 0.
Details
The function always includes all four TCGA subtypes (Atypical, Basal, Classical, Mesenchymal) in the output, even if one or more have zero assigned samples. This ensures consistent output across cohorts.
Examples
if (FALSE) { # \dontrun{
data(TCGA_LUSC)
subtypes <- classifyHNSC(TCGA_LUSC, outputType = "class")
# Table + bar plot (default)
summarize_subtype(subtypes)
# Table only, store result
tbl <- summarize_subtype(subtypes, plot = FALSE)
print(tbl)
} # }