Skip to content

Commit 098b076

Browse files
Small fix that manual outlier removal uses default assay.
1 parent 19ff8a0 commit 098b076

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

R/outlier_detection.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
remove_outliers_manual <- function(seu,
1919
thresholds,
2020
negative = TRUE) {
21+
# get expression matrix
22+
data <- GetAssayData(seu)
23+
# make list of cells to remove
2124
remove_cells <- c()
2225
for(marker in names(thresholds)) {
2326
# get cell names of cells not passing threshold
24-
if(isTRUE(negative)) cells <- names(which(seu@assays$comp@data[marker,] < thresholds[[marker]]))
25-
if(!isTRUE(negative)) cells <- names(which(seu@assays$comp@data[marker,] > thresholds[[marker]]))
27+
if(isTRUE(negative)) cells <- names(which(data[marker,] < thresholds[[marker]]))
28+
if(!isTRUE(negative)) cells <- names(which(data[marker,] > thresholds[[marker]]))
2629
# add cellnames to the array
2730
remove_cells <- c(remove_cells, cells)
2831
}
@@ -33,7 +36,6 @@ remove_outliers_manual <- function(seu,
3336
return(seu)
3437
}
3538

36-
3739
#' Labels potentially noisy or outlier events in Seurat object (seu$outlier)
3840
#'
3941
#' Uses isolation forest to score events based on their probability to be an outlier. Scores and predicted outliers are stored in Seurat meta.data "outlier" and "outlier_score".

0 commit comments

Comments
 (0)