An ordered bar profile whose categories collapse into coloured header blocks. Built for the 96-context mutational signature plot, where the bars are the trinucleotide contexts and the six blocks are the substitution classes, a layout conventional enough that readers parse it without a legend. It generalises to any ordered categorical profile that groups into runs, hence the generic name.
Usage
bioprofile(
data,
groups = NULL,
group_colors = NULL,
title = NULL,
bar_width = 0.62,
as_fraction = FALSE,
show_header = TRUE,
show_bar_labels = TRUE,
y_label = "mutations",
theme = NULL,
width = NULL,
height = NULL,
element_id = NULL
)
profile_plotomics(
data,
groups = NULL,
group_colors = NULL,
title = NULL,
bar_width = 0.62,
as_fraction = FALSE,
show_header = TRUE,
show_bar_labels = TRUE,
y_label = "mutations",
theme = NULL,
width = NULL,
height = NULL,
element_id = NULL
)Arguments
- data
A data frame with a numeric
valuecolumn. Optionalgroup(category per bar, whose contiguous runs become the header blocks) andlabel(per-bar tick label) columns.- groups
Character vector fixing the group order and colour assignment. Defaults to order of appearance.
- group_colors
One hex colour per group.
NULLuses the component's categorical palette.- title
Optional title drawn above the header band.
- bar_width
Fraction of each slot the bar occupies, in
(0, 1].- as_fraction
Show values as a share of the total rather than raw counts.
- show_header, show_bar_labels
Toggle the header band and tick labels.
- y_label
Axis label.
- theme
Optional named list of theme overrides.
- width, height
Widget dimensions (any valid CSS size).
- element_id
Optional explicit DOM id.
Details
Bars are canvas-drawn, so a few thousand bins (a binned copy-number profile, a coverage track) work as well as 96 contexts.
Bars are drawn in the order given. For SBS96 that order is part of the convention, so the component does not sort.
Named bioprofile() rather than profile() so that attaching the package
does not mask the stats::profile() generic, which profiles a fitted
model's likelihood. This follows bioheatmap(), which keeps clear of
stats::heatmap() the same way. profile_plotomics() is an alias, for
symmetry with heatmap_plotomics().
Examples
df <- data.frame(
value = c(3, 5, 2, 8),
group = c("C>A", "C>A", "C>T", "C>T"),
label = c("ACA", "ACC", "TCA", "TCT")
)
bioprofile(df)