Skip to contents

Creates violin + box plots showing gene expression stratified by cytogenetic marker status (positive vs negative). Adds Wilcoxon or t-test p-value annotation.

Usage

plot_expression_by_subtype(
  expr_matrix,
  cyto_data,
  gene,
  markers = NULL,
  test = c("wilcox", "t.test")
)

Arguments

expr_matrix

Numeric matrix (genes x samples) of transformed expression values (e.g., VST). Column names should match `cyto_data$patient_id`.

cyto_data

Data frame with `patient_id` and marker columns (values: "positive"/"negative"/NA)

gene

Gene name (rowname of `expr_matrix`)

markers

Character vector of marker columns. Default auto-detects.

test

Statistical test: "wilcox" (default) or "t.test"

Value

A ggplot object with faceted violin/box plots, one panel per marker