| wilcoxauc | R Documentation |
For every (feature, group) pair, computes the Wilcoxon rank-sum statistic comparing observations in that group against all other observations, and the area under the ROC curve as a measure of separability. P-values come from the standard Gaussian approximation to the U statistic with a tie correction. Returns one row per (feature, group) with effect-size and percent-expressed columns alongside the test statistics.
wilcoxauc(X, ...)
## S3 method for class 'seurat'
wilcoxauc(X, ...)
## S3 method for class 'Seurat'
wilcoxauc(
X,
group_by = NULL,
assay = "data",
groups_use = NULL,
seurat_assay = "RNA",
...
)
## S3 method for class 'SingleCellExperiment'
wilcoxauc(X, group_by = NULL, assay = NULL, groups_use = NULL, ...)
## Default S3 method:
wilcoxauc(
X,
y,
groups_use = NULL,
verbose = TRUE,
nthreads = 1,
transposed = FALSE,
...
)
X |
Input data. One of:
|
... |
Passed to the input-specific method. |
group_by |
For |
assay |
For |
groups_use |
Optional character vector restricting the test to
a subset of groups in |
seurat_assay |
For |
y |
For matrix input, a character/factor vector of group labels
with length equal to |
verbose |
Logical. Print warnings and informational messages.
Default |
nthreads |
Number of threads for the per-feature ranking of sparse
( |
transposed |
Set to |
Designed to be fast enough to run on whole-genome × hundred-thousand-
cell single-cell matrices in seconds. Sparse dgCMatrix inputs are
processed without densification. Convenience dispatchers extract the
counts matrix and group labels from Seurat and
SingleCellExperiment objects. See the getting-started vignette
for an end-to-end example on a real dataset.
table with the following columns:
feature - feature name (e.g. gene name).
group - group name.
avgExpr - mean value of feature in group.
logFC - difference of mean feature values between
observations in the group vs out of the group. When the input is
log-transformed expression (e.g. Seurat's "data" layer or
logcounts), this difference of means is a log fold change. On raw
(untransformed) values it is a plain difference of means, not a fold
change.
statistic - Wilcoxon rank sum U statistic.
auc - area under the receiver operator curve.
pval - nominal p value.
padj - Benjamini-Hochberg adjusted p value.
pct_in - Percent of observations in the group with non-zero feature value.
pct_out - Percent of observations out of the group with non-zero feature value.
top_markers() to summarize markers per group;
pseudobulk_deseq2() for a count-based pseudobulk alternative.
## generate a tiny toy dataset
set.seed(42)
exprs <- matrix(rpois(25 * 150, lambda = 2), nrow = 25,
dimnames = list(paste0("G", 1:25), NULL))
y <- rep(c("A", "B", "C"), each = 50)
## on a dense matrix
head(wilcoxauc(exprs, y))
## restrict the comparison to a subset of groups
head(wilcoxauc(exprs, y, c('A', 'B')))
## on a sparse matrix
exprs_sparse <- as(exprs, 'dgCMatrix')
head(wilcoxauc(exprs_sparse, y))
## on a Seurat object (>= v3)
if (requireNamespace("Seurat", quietly = TRUE) &&
packageVersion("Seurat") >= "3.0") {
object_seurat <- toy_seurat()
head(wilcoxauc(object_seurat, 'cell_type'))
}
## on a SingleCellExperiment object
if (requireNamespace("SingleCellExperiment", quietly = TRUE)) {
object_sce <- toy_sce()
head(wilcoxauc(object_sce, 'cell_type'))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.