
Plot gene expression distributions as boxplots
get_expression_boxplot.RdDisplays per-sample or per-group distributions for selected genes using
normalized counts. When multiple genes are supplied and facet = TRUE,
facets are per gene (not per group). When facet = FALSE with multiple
genes, genes are shown on the x-axis and facets are per group.
Usage
get_expression_boxplot(
x,
genes = NULL,
sample_group = NULL,
group_column = NULL,
facet = TRUE,
log_transform = TRUE,
display_id = NULL,
display_from = NULL,
display_orgdb = NULL,
facet_scales = "free_y",
stats_group = FALSE,
p.label = "p.signif",
comparisons = NULL,
pool_genes = FALSE,
x_by = "group",
facet_by = "none",
fill_by = NULL
)Arguments
- x
A
VISTAobject.- genes
Optional character vector of genes to display (≤20). Defaults to all genes.
- sample_group
Optional character vector specifying which groups (as defined by
group_column) to include.- group_column
Optional column name in
sample_infoused as the grouping variable.- facet
Logical; facet the plot when
facet_byis not"none".- log_transform
Logical; apply log2(x + 1) transform before plotting.
- display_id
Optional column in
rowData(x)to use for gene labels (facets).- display_from
Optional source ID type for mapping (used when
display_idis not found inrowData).- display_orgdb
Optional
OrgDbobject used for ID mapping whendisplay_idis set but not found inrowData.- facet_scales
Facet scales argument passed to
facet_wrap()(default"free_y").- stats_group
Logical; add statistical comparisons between groups when
TRUE.- p.label
Label format for
ggpubr::stat_compare_means().- comparisons
Optional list of specific group comparisons for
stat_compare_means().- pool_genes
Logical; when
TRUE, pool selected genes into one distribution per x-axis category (scenario 1).- x_by
When
pool_genes = TRUE, either"group"or"sample"(x-axis and optional fill). Whenpool_genes = FALSE, either"group"or"gene"(x-axis for per-gene distributions).- facet_by
Faceting control: for pooled genes,
"group"or"none"; for per-gene,"none"(default) or"gene".- fill_by
When
pool_genes = TRUE, either"x"(default) or"group"to force group colors even if x_by = "sample". Whenpool_genes = FALSE, either"gene"or"group".