Skip to content

Commit 77aacca

Browse files
committed
Improve handling of seurat and split layers
1 parent db3288c commit 77aacca

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

singlecell/resources/chunks/Functions.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ saveData <- function(seuratObj, datasetId) {
7474
print(paste0('Saving dataset: ', datasetId))
7575
print(seuratObj)
7676

77+
if (HasSplitLayers(seuratObj)) {
78+
stop('This seurat object has split layers!')
79+
}
80+
7781
datasetIdForFile <- makeLegalFileName(datasetId)
7882
fn <- paste0(outputPrefix, '.', datasetIdForFile, '.seurat.rds')
7983
message(paste0('Filename: ', fn))

singlecell/resources/chunks/MergeSeurat.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,22 @@ if (length(seuratObjects) == 1) {
3939
message(paste0('Merging batch ', i, ' of ', numBatches))
4040
start <- 1 + (i-1)*batchSize
4141
end <- min(start+batchSize-1, length(seuratObjects))
42-
message(paste0('processing: ', start, ' to ', end, ' of ', length(seuratObjects)))
42+
print(paste0('processing: ', start, ' to ', end, ' of ', length(seuratObjects)))
4343

4444
mergedObjects[[i]] <- mergeBatch(seuratObjects[start:end])
4545
gc()
4646
}
4747

48-
message('Done with batches')
48+
print('Done with batches')
4949
if (length(mergedObjects) == 1) {
5050
seuratObj <- mergedObjects[[1]]
5151
} else {
5252
message('performing final merge')
5353
seuratObj <- merge(x = mergedObjects[[1]], y = mergedObjects[2:length(mergedObjects)], project = mergedObjects[[1]]@project.name)
54+
seuratObj <- CellMembrane::MergeSeuratObjs(mergedObjects, projectName = mergedObjects[[1]]@project.name, doGC = doDiet, errorOnBarcodeSuffix = errorOnBarcodeSuffix)
55+
if (HasSplitLayers(seuratObj)) {
56+
seuratObj <- MergeSplitLayers(seuratObj)
57+
}
5458
}
5559

5660
rm(mergedObjects)

0 commit comments

Comments
 (0)