| sig_box | R Documentation |
Creates box plots to visualize signature distributions across groups with optional statistical pairwise comparisons. Supports both data frames and Seurat objects for single-cell data visualization.
sig_box(
data,
signature,
variable,
palette = "nrc",
cols = NULL,
jitter = FALSE,
point_size = 5,
angle_x_text = 0,
hjust = 0.5,
show_pairwise_p = TRUE,
show_overall_p = FALSE,
return_stat_res = FALSE,
size_of_pvalue = 6,
size_of_font = 10,
assay = NULL,
slot = "scale.data",
scale = FALSE
)
data |
Data frame or Seurat object containing the signature and grouping variable. |
signature |
Character string specifying the column name (or feature name in Seurat) for the signature values to plot on the y-axis. |
variable |
Character string specifying the grouping variable column name for the x-axis. |
palette |
Character string specifying the color palette name. Default is '"nrc"'. |
cols |
Character vector of custom fill colors. If 'NULL', palette is used. Default is 'NULL'. |
jitter |
Logical indicating whether to add jittered points to the box plot. Default is 'FALSE'. |
point_size |
Numeric value specifying the size of jittered points. Default is 5. |
angle_x_text |
Numeric value specifying the rotation angle for x-axis labels (in degrees). Default is 0. |
hjust |
Numeric value specifying the horizontal justification of x-axis labels. Default is 0.5. |
show_pairwise_p |
Logical indicating whether to display pairwise comparison p-values between groups. Default is 'TRUE'. |
show_overall_p |
Logical indicating whether to display the overall group difference p-value. Default is 'FALSE'. |
return_stat_res |
Logical indicating whether to return statistical test results instead of the plot. Default is 'FALSE'. |
size_of_pvalue |
Numeric value specifying the font size for p-values. Default is 6. |
size_of_font |
Numeric value specifying the base font size. Default is 10. |
assay |
Character string specifying the assay name (for Seurat objects). Default is 'NULL'. |
slot |
Character string specifying the slot name (for Seurat objects). Default is '"scale.data"'. |
scale |
Logical indicating whether to scale signature values (z-score transformation). Default is 'FALSE'. |
If 'return_stat_res = FALSE', returns a ggplot2 object. If 'return_stat_res = TRUE', returns a data frame containing statistical test results.
Dongqiang Zeng
# Create small example data
set.seed(123)
test_data <- data.frame(
subtype = rep(c("A", "B"), each = 50),
TMEscore_plus = rnorm(100)
)
sig_box(
data = test_data,
signature = "TMEscore_plus",
variable = "subtype",
jitter = TRUE,
palette = "jco"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.