Skip to content

Commit 8c041d9

Browse files
committed
Improve cleanup of old columns
1 parent 1818264 commit 8c041d9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

singlecell/resources/chunks/PredictTcellActivation.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ for (datasetId in names(seuratObjects)) {
22
printName(datasetId)
33
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
44

5+
toDrop <- grep(names(seuratObj@meta.data), pattern = "sPLS", value = TRUE)
6+
if (length(toDrop) > 0) {
7+
print(paste0('Dropping pre-existing columns: ', paste0(toDrop, collapse = ', ')))
8+
for (colName in toDrop) {
9+
seuratObj[[toDrop]] <- NULL
10+
}
11+
}
12+
513
seuratObj <- RIRA::PredictTcellActivation(seuratObj)
614

715
saveData(seuratObj, datasetId)

singlecell/resources/chunks/UpdateSeuratPrototype.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,20 @@ for (datasetId in names(seuratObjects)) {
4747
}
4848

4949
if (scoreActivation) {
50+
# Drop existing columns:
51+
toDrop <- grep(names(seuratObj@meta.data), pattern = "sPLS", value = TRUE)
52+
if (length(toDrop) > 0) {
53+
print(paste0('Dropping pre-existing columns: ', paste0(toDrop, collapse = ', ')))
54+
for (colName in toDrop) {
55+
seuratObj[[toDrop]] <- NULL
56+
}
57+
}
58+
5059
seuratObj <- RIRA::PredictTcellActivation(seuratObj)
5160
}
5261

5362
if (recalculateUCells) {
54-
seuratObj <- RIRA::CalculateUCellScores(seuratObj, storeRanks = FALSE, assayName = 'RNA', forceRecalculate = TRUE, ncores = nCores)
63+
seuratObj <- RIRA::CalculateUCellScores(seuratObj, storeRanks = FALSE, assayName = 'RNA', forceRecalculate = TRUE, ncores = nCores, dropAllExistingUcells = TRUE)
5564
}
5665

5766
saveData(seuratObj, datasetId)

0 commit comments

Comments
 (0)