Skip to content

Commit 35b8849

Browse files
committed
Error checking for CommonFilters
1 parent f3ffedb commit 35b8849

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

singlecell/resources/chunks/CommonFilters.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ for (datasetId in names(seuratObjects)) {
171171
}
172172

173173
toDrop <- is.na(seuratObj@meta.data$scGateConsensus)
174-
if (sum(toDrop) > 0) {
174+
if (sum(toDrop) == ncol(seuratObj)) {
175+
print(paste0('There were no cells remaining after dropping cells without a scGateConsensus value'))
176+
seuratObj <- NULL
177+
} else if (sum(toDrop) > 0) {
175178
cells <- colnames(seuratObj)[!is.na(seuratObj@meta.data$scGateConsensus)]
176179
seuratObj <- subset(seuratObj, cells = cells)
177180
print(paste0('After dropping cells without scGateConsensus: ', length(colnames(x = seuratObj))))

0 commit comments

Comments
 (0)