outlierByAssay: Outlier analysis for each assay

View source: R/outlier.R

outlierByAssayR Documentation

Outlier analysis for each assay

Description

Compute outlier score for each sample in each assay using outlier() run on the top principal components. Mahalanobis distance is used for outlier detect and multivariate normal assumption is used to compute p-values

Usage

outlierByAssay(object, assays = names(object), nPC = 2, robust = FALSE, ...)

Arguments

object

dreamletProcessedData from processAssays()

assays

assays / cell types to analyze

nPC

number of PCs to uses for outlier score with outlier()

robust

use robust covariance method, defaults to FALSE

...

arguments passed to MASS::cov.rob()

Value

  • ID:sample identifier

  • assay:specify assay

  • PCs:principal components

  • chisq:mahalanobis distance that is distributed as chisq(k) k = nPC if the data is multivariate gaussian

  • z:z-score corresponding to the chisq distance

See Also

outlier()

Examples

library(muscat)
library(SingleCellExperiment)

data(example_sce)

# create pseudobulk for each sample and cell cluster
pb <- aggregateToPseudoBulk(example_sce,
  assay = "counts",
  cluster_id = "cluster_id",
  sample_id = "sample_id",
  verbose = FALSE
)

# voom-style normalization
res.proc <- processAssays(pb, ~group_id)

# Compute PCs and outlier scores
outlierByAssay( res.proc, c("B cells", "CD14+ Monocytes")) 

GabrielHoffman/dreamlet documentation built on Nov. 23, 2024, 12:28 a.m.