View source: R/composite_score_function.R
| PlotConvergenceCrossedProportion | R Documentation |
Draws a 100%-stacked barplot of cell proportions across categories of x_var, colored by a convergence-direction column, and separated (faceted) by a secondary categorical variable (facet_var).
PlotConvergenceCrossedProportion(
seurat_obj,
x_var,
fill_var,
facet_var,
color_var = NULL,
title = NULL,
x_label = NULL
)
seurat_obj |
Seurat object whose meta.data holds x_var, fill_var, facet_var, and the color column. |
x_var |
Character. Name of the meta.data column used on the x-axis. |
fill_var |
Character. Name of the meta.data column used to fill the bars. |
facet_var |
Character. Name of the meta.data column used to facet the plot (e.g., "tumor_status"). |
color_var |
Character or NULL. Name of the meta.data column holding the hex color. |
title |
Character or NULL. Plot title. |
x_label |
Character or NULL. X-axis label. |
A ggplot object.
seu_path <- system.file("extdata", "pbmc3k_subset.rds", package = "ConvergeR")
seu <- readRDS(seu_path)
set.seed(42)
seu$SS <- paste0("Patient_", sample(1:5, ncol(seu), replace = TRUE))
seu$tumor_status <- sample(c("Primary", "Metastatic"), ncol(seu), replace = TRUE)
seu$Score_IFN <- rnorm(ncol(seu))
seu$Score_Inflam <- rnorm(ncol(seu))
seu <- CalculateConvergedScore(
seurat_obj = seu,
principal_score = "Score_IFN",
other_scores = "Score_Inflam",
output_colname = "Converged_Immune"
)
b_cross <- PlotConvergenceCrossedProportion(
seurat_obj = seu,
x_var = "SS",
fill_var = "Converged_Immune_Direction",
facet_var = "tumor_status",
title = "Immune Convergence split by Tumor Status",
x_label = "Patient ID"
)
print(b_cross)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.