boxplot_lr_group_comparison {PopComm} | R Documentation |
Boxplot Comparison of Ligand-Receptor Interaction Scores Across Groups
Description
Generates a boxplot comparing LR (ligand-receptor) interaction scores across sample groups. with optional significance testing (t-test or Wilcoxon).
Usage
boxplot_lr_group_comparison(
lr_scores,
metadata,
ligand,
receptor,
sender,
receiver,
group_by,
score = c("normalized", "raw"),
test = TRUE,
paired = FALSE,
test_method = c("wilcox.test", "t.test"),
colors = c("#5fa9d1", "#154778"),
title = NULL
)
Arguments
lr_scores |
Data frame containing LR interaction scores per sample (data frame). |
metadata |
Data frame containing sample metadata (data frame). |
ligand |
Ligand gene name to filter (character). |
receptor |
Receptor gene name to filter (character). |
sender |
Sender cell type to filter (character). |
receiver |
Receiver cell type to filter (character). |
group_by |
Column name in |
score |
Use 'normalized' or 'raw' score (default: "normalized") (character). |
test |
Whether to add a statistical test annotation (logical, default: TRUE). |
paired |
Whether to treat the comparison as paired (logical, default: FALSE). |
test_method |
Statistical test to use: "t.test" or "wilcox.test" (default = "wilcox.test") (character). |
colors |
Vector of colors for groups (default: c("#5fa9d1", "#154778")). |
title |
Custom plot title (optional). |
Value
A list containing:
plot - ggplot object of the boxplot
df - data frame used for plotting
Examples
# Boxplot of LR Score by group
data(lr_scores_eg)
data(metadata_eg)
res <- boxplot_lr_group_comparison(
lr_scores_eg, metadata_eg,
ligand = "TAC4", receptor = "TACR1",
sender = "Perivascular", receiver = "Cardiac",
group_by = "IFN_type", score = "normalized"
)
print(res$plot)
head(res$df)