Variants along a protein, drawn over its domain architecture: a backbone spanning the sequence with domain rectangles on it, mutation stems whose head area is proportional to recurrence, and an optional post-translational modification track below. Hotspots inside a functional domain read very differently from truncating variants scattered across one, which is what this figure exists to show.
Usage
lollipop(
variants,
length,
gene = NULL,
uniprot = NULL,
domains = NULL,
ptms = NULL,
classes = NULL,
class_colors = NULL,
domain_colors = NULL,
label_top_n = 12,
show_ptms = TRUE,
show_domains = TRUE,
show_legend = TRUE,
min_head_radius = 3,
max_head_radius = 11,
y_label = "samples",
backbone_color = "#E6DCC8",
stem_color = "#93a1b8",
theme = NULL,
width = NULL,
height = NULL,
element_id = NULL
)Arguments
- variants
A data frame with columns
position(amino-acid position, 1-based) andcount(recurrence). Optionalclass(variant class) andlabel(e.g."R175H") columns drive the colour and the text labels.- length
Protein length in residues.
- gene, uniprot
Identifiers shown on the axis title.
- domains
Optional data frame of domain rectangles with columns
name,startandend.- ptms
Optional data frame of modification sites with columns
positionandtype.- classes
Character vector fixing the legend order and colour assignment. Defaults to the classes present, most frequent first.
- class_colors, domain_colors
Character vectors of hex colours.
NULLuses the component's categorical palette.- label_top_n
Label the
nmost recurrent variants. Which stems get a label is resolved here and sent to the browser, so a redraw, an export and any static counterpart all label the same ones.- show_ptms, show_domains, show_legend
Toggle the surrounding tracks.
- min_head_radius, max_head_radius
Stem head radius range in pixels. Head area is proportional to recurrence, so these bound the mapping rather than setting a size: raise
max_head_radiuswhen one hotspot dwarfs the rest and you want the difference to read at a glance.- y_label
Axis title for the recurrence axis.
- backbone_color, stem_color
Hex colours for the protein backbone rectangle and the mutation stems.
- theme
Optional named list of theme overrides.
- width, height
Widget dimensions (any valid CSS size).
- element_id
Optional explicit DOM id.
Details
Stems and domains are canvas-drawn so a protein with thousands of variants stays responsive; labels, axis and legend are a vector overlay.
Examples
v <- data.frame(
position = c(175, 248, 273),
count = c(21, 15, 13),
class = c("Missense", "Missense", "Missense"),
label = c("R175H", "R248Q", "R273H")
)
d <- data.frame(name = "P53 DNA-binding", start = 100, end = 288)
lollipop(v, length = 393, gene = "TP53", uniprot = "P04637", domains = d)