Skip to content

Commit e07213a

Browse files
committed
Update seurat filter logic
1 parent 8454689 commit e07213a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

singlecell/resources/chunks/CommonFilters.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ totalPassed <- 0
22
for (datasetId in names(seuratObjects)) {
33
printName(datasetId)
44
seuratObj <- readRDS(seuratObjects[[datasetId]])
5+
origCells <- ncol(seuratObj)
56

67
print(paste0('Initial cells for dataset ', datasetId, ': ', ncol(seuratObj)))
78

@@ -11,7 +12,7 @@ for (datasetId in names(seuratObjects)) {
1112
}
1213

1314
expr <- Seurat::FetchData(object = seuratObj, vars = 'Saturation.RNA')
14-
cells <- which(x = expr >= saturation.RNA.min)
15+
cells <- which(x = expr > saturation.RNA.min)
1516
if (length(cells) > 0){
1617
seuratObj <- seuratObj[, cells]
1718
print(paste0('After saturation.RNA.min filter: ', length(colnames(x = seuratObj))))
@@ -32,7 +33,7 @@ for (datasetId in names(seuratObjects)) {
3233
}
3334

3435
expr <- Seurat::FetchData(object = seuratObj, vars = 'Saturation.RNA')
35-
cells <- which(x = expr <= saturation.RNA.max)
36+
cells <- which(x = expr < saturation.RNA.max)
3637
if (length(cells) > 0){
3738
seuratObj <- seuratObj[, cells]
3839
print(paste0('After saturation.RNA.max filter: ', length(colnames(x = seuratObj))))
@@ -129,7 +130,7 @@ for (datasetId in names(seuratObjects)) {
129130
saveData(seuratObj, datasetId)
130131
totalPassed <- totalPassed + 1
131132

132-
print(paste0('Final cells: ', ncol(seuratObj)))
133+
print(paste0('Final cells: ', ncol(seuratObj), 'of ', origCells, ' (', round((ncol(seuratObj)/origCells) * 100, 2), '%)'))
133134
}
134135
}
135136

0 commit comments

Comments
 (0)