R/detectCellOutlier.R
detectCellOutlier.Rd
A wrapper function for isOutlier. Identify outliers from numeric vectors stored in the SingleCellExperiment object.
detectCellOutlier(
inSCE,
slotName,
itemName,
sample = NULL,
nmads = 3,
type = "both",
overwrite = TRUE
)
A SingleCellExperiment object.
Desired slot of SingleCellExperiment used for plotting. Possible options: "assays", "colData", "metadata", "reducedDims". Required.
Desired vector within the slot used for plotting. Required.
A single character specifying a name that can be found in
colData(inSCE)
to directly use the cell annotation; or a character
vector with as many elements as cells to indicates which sample each cell
belongs to. Default NULL. decontX will be run on cells from
each sample separately.
Integer. Number of median absolute deviation. Parameter may be adjusted for more lenient or stringent outlier cutoff. Default 3.
Character. Type/direction of outlier detection; whether the lower/higher outliers should be detected, or both. Options are "both", "lower", "higher".
Boolean. If TRUE, and this function has previously generated an outlier decision on the same itemName, the outlier decision will be overwritten. Default TRUE.
A SingleCellExperiment object with '' added to the
colData slot. Additionally, the decontaminated counts will be added as an assay called 'decontXCounts'.
data(scExample, package = "singleCellTK")
sce <- subsetSCECols(sce, colData = "type != 'EmptyDroplet'")
sce <- runDecontX(sce[,sample(ncol(sce),20)])
#> Wed Jan 10 17:41:50 2024 ... Running 'DecontX'
#> --------------------------------------------------
#> Starting DecontX
#> --------------------------------------------------
#> Wed Jan 10 17:41:51 2024 .. Analyzing all cells
#> Wed Jan 10 17:41:51 2024 .... Generating UMAP and estimating cell types
#> Wed Jan 10 17:41:54 2024 .... Estimating contamination
#> Wed Jan 10 17:41:54 2024 ...... Completed iteration: 10 | converge: 0.0115
#> Wed Jan 10 17:41:54 2024 ...... Completed iteration: 20 | converge: 0.004858
#> Wed Jan 10 17:41:55 2024 ...... Completed iteration: 30 | converge: 0.001651
#> Wed Jan 10 17:41:55 2024 ...... Completed iteration: 37 | converge: 0.0009961
#> Wed Jan 10 17:41:55 2024 .. Calculating final decontaminated matrix
#> --------------------------------------------------
#> Completed DecontX. Total time: 4.009717 secs
#> --------------------------------------------------
sce <- detectCellOutlier(sce, slotName = "colData", sample = sce$sample,
nmads = 4, itemName = "decontX_contamination", type = "both")