Wilcoxon test to compare cell population frequencies
Source:R/differential_testing.R
frequency_wilcox_test.Rd
frequency_wilcox_test()
performs a two-sided, two-sample Wilcoxon Rank Sum test (independent) or Wilcoxon Signed Rank test (paired data) on cell type frequencies.
Usage
frequency_wilcox_test(
fcd,
cluster_slot,
cluster_var,
sample_var,
group_var,
pair_var = NULL,
paired_test = F,
p.adjust.method = "bonferroni",
detailed = F,
numeric = F
)
Arguments
- fcd
flow cytometry data set, that has been subjected to clustering or cell type label prediction with cyCONDOR
- cluster_slot
string specifying which clustering slot to use to find variable specified in cluster_var
- cluster_var
string specifying variable in cluster_slot that identifies cell population labels to be used (e.g. clusters, metaclusters or predicted labels).
- sample_var
string indicating variable in cell_anno that defines sample IDs to be used.
- group_var
string indicating variable in cell_anno that should be used to group samples in sample_var. group_var must have exactly two levels.
- pair_var
string indicating variable in cell_anno that defines pairing of samples, e.g. donor ID, that should be used if
paired_test = T
.- paired_test
logical, indicating if a paired (TRUE) or unpaired test (FALSE, default) should be performed.
- p.adjust.method
p-value adjustment method to use for multiple comparison testing, e.g "bonferroni" (default) or "BH" (Benjamini-Hochberg). All available options can be checked in the documentation of the
adjust_pvalue
function from the packagerstatix
.- detailed
logical if detailed output from
wilcox_test
should be reported.- numeric
logical, if TRUE numeric levels in cluster_var are ordered in ascending order and "Cluster_" is pasted before number, if FALSE alphabetical ordering is applied.
Value
frequency_wilcox_test
returns a data frame produced by wilcox_test
with two additional columns, "cluster" containing the information, which cell population was tested, and "applied_test", indicating which test was used.
Details
frequency_wilcox_test
frequency_wilcox_test()
is a wrapper function around the wilcox_test()
function implemented in the package rstatix
.
The function first calculates cell population frequencies for each sample in sample_var. Then a two-sided, two sample wilcoxon test is performed between two groups defined in group_var.
The test can either be run unpaired (two independent groups) or paired. Afterwards, p-value adjustment will be performed across all comparisons that were made.