
Fold-change plotting helpers (overview)
get_foldchange_lollipop.RdOne-stop doc for fold-change plots:
get_foldchange_barplot(): log2FC by comparison (bars).get_foldchange_boxplot(): log2FC distributions per comparison (boxes).get_foldchange_lollipop(): log2FC stems/dots; supports 1–2 comparisons.get_foldchange_lineplot(): log2FC trajectories across comparisons (optional clustering).
Arguments
- x
A
VISTAobject.- sample_comparison
Character vector of length 1 or 2 naming the comparison(s) to plot (must exist in
metadata(x)$de_results).- genes
Optional character vector of gene IDs to include. When
NULL, all genes in the specified comparison(s) are shown.- sort_by
How to sort genes on the y-axis:
"input"(use supplied order),"log2fc"(descending log2FC; for two comparisons uses the first comparison), or"abs_log2fc"(descending max abs log2FC across comparisons).- palette
For a single comparison, named vector of colors for
"pos","neg", and"zero"sign classes (set toNULLto disable color by sign). For two comparisons, a named or unnamed vector of colors with one entry per comparison (defaults to a qualitative palette).- point_size
Numeric size of dots.
- line_size
Numeric size of stems (linewidth).
- label
Logical; draw numeric labels next to the dots.
- label_digits
Integer; digits to show in labels when
label = TRUE.- display_id
Optional column in
rowData(x)to use for gene labels. Input gene matching still usesgene_id.- dodge_width
Horizontal separation between comparisons when plotting two comparisons on the same axis.
- facet_by
Faceting mode:
"auto"(default),"gene","comparison", or"none".
Details
Shared arguments: x (VISTA with DE results), sample_comparisons/sample_comparison,
genes, display_id for label mapping, sort_by (where supported),
faceting controls (facet_*), and comparison colours pulled from
Plot log2 fold changes as a lollipop chart (one or two comparisons)
Extracts log2 fold changes from stored differential expression results and plots them as stems and dots, with labels and a zero reference line. You can optionally provide two comparisons; in that case both comparisons are drawn side-by-side, coloured by comparison.
Examples
v <- example_vista()
comp <- names(comparisons(v))[1]
genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 10)
p <- get_foldchange_lollipop(v, sample_comparison = comp, genes = genes)
print(p)
vista <- example_vista()
comp_name <- names(comparisons(vista))[1]
genes <- rownames(vista)[1:3]
get_foldchange_lollipop(vista, sample_comparison = comp_name, genes = genes)