Skip to contents

Creates a box plot using a pseudo-bulk approach and performs a Wilcoxon test on single-cell level. Allows customization of outlier removal, statistical labels, and color schemes. Supports comparison of conditions with optional second grouping. Useful for visualizing gene expression and statistical differences.

Usage

DO.BoxPlot(
  Seu_object,
  Feature,
  sample.column = "orig.ident",
  ListTest = NULL,
  group.by = "condition",
  group.by.2 = NULL,
  ctrl.condition = NULL,
  outlier_removal = T,
  plot_sample = T,
  vector_colors = c("#1f77b4", "#ea7e1eff", "royalblue4", "tomato2", "darkgoldenrod",
    "palegreen4", "maroon", "thistle3"),
  wilcox_test = T,
  stat_pos_mod = 1.15,
  step_mod = 0,
  hjust.wilcox = 0.5,
  vjust.wilcox = 0.25,
  size.wilcox = 3.33,
  hjust.wilcox.2 = 0.5,
  vjust.wilcox.2 = 0,
  sign_bar = 0.8,
  orderAxis = NULL
)

Arguments

Seu_object

The seurat object

group.by

group name to look for in meta data

group.by.2

second group name to look for in meta data

ctrl.condition

select condition to compare to

outlier_removal

Outlier calculation

vector_colors

get the colours for the plot

wilcox_test

If you want to have wilcoxon performed between ctrl.condition and given ones

stat_pos_mod

modificator for where the p-value is plotted increase for higher

step_mod

value for defining the space between one test and the next one

hjust.wilcox

value for adjusting height of the text

vjust.wilcox

value for vertical of text

size.wilcox

value for size of text of statistical test

orderAxis

vector for xaxis sorting, alphabetically by default

Value

a ggplot

Author

Mariano Ruz Jurado

Examples

if (FALSE) { # \dontrun{

(optional)
ListTest <- list()
ListTest[[1]] <- c("CTRL", "CONDITION")

DO.BoxPlot(
  Seu_object = Seurat,
  Feature = "CDH5",
  sample.column="orig.ident",
  ListTest = ListTest,
  group.by="condition",
  ctrl.condition = "CTRL",
)
} # }