View source: R/composite_score_function.R
| TestConvergenceScore | R Documentation |
Runs a statistical test between a numeric convergence score and another variable, automatically choosing the appropriate test (Spearman, Wilcoxon, or Kruskal-Wallis).
TestConvergenceScore(
seurat_obj,
score_var,
test_var,
level = c("cell", "patient"),
patient_id_var = NULL
)
seurat_obj |
Seurat object whose meta.data holds score_var and test_var. |
score_var |
Character. Name of the meta.data column holding the numeric score. |
test_var |
Character. Name of the meta.data column to test the score against. |
level |
Character. Either "cell" (default) or "patient" (pseudobulk aggregation). |
patient_id_var |
Character. Name of the meta.data column identifying patients (required if level = "patient"). |
The underlying htest object (invisibly). A message is printed summarizing the results.
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$age <- sample(20:70, 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"
)
TestConvergenceScore(
seurat_obj = seu,
score_var = "Converged_Immune",
test_var = "age",
level = "patient",
patient_id_var = "SS"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.