Skip to content

Commit e0b5775

Browse files
committed
Improve cleanup after seurat processing
1 parent 0774bbc commit e0b5775

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

singlecell/src/org/labkey/singlecell/analysis/AbstractSingleCellHandler.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
370370
}
371371

372372
List<SingleCellStep.SeuratObjectWrapper> currentFiles;
373-
373+
Set<File> originalInputs = inputFiles.stream().map(SequenceOutputFile::getFile).collect(Collectors.toSet());
374+
Set<File> originalRDSCopiedLocal = new HashSet<>();
374375
if (_doProcessRawCounts)
375376
{
376377
currentFiles = processRawCounts(ctx, inputFiles, basename);
@@ -410,15 +411,15 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
410411

411412
currentFiles.add(new SingleCellStep.SeuratObjectWrapper(datasetId, datasetId, local, so));
412413
}
414+
415+
originalRDSCopiedLocal.addAll(currentFiles.stream().map(AbstractSingleCellStep.SeuratObjectWrapper::getFile).collect(Collectors.toSet()));
413416
}
414417
catch (IOException e)
415418
{
416419
throw new PipelineJobException(e);
417420
}
418421
}
419422

420-
Set<File> originalInputs = currentFiles.stream().map(AbstractSingleCellStep.SeuratObjectWrapper::getFile).collect(Collectors.toSet());
421-
422423
// Step 2: iterate seurat processing:
423424
String outputPrefix = basename;
424425
int stepIdx = 0;
@@ -522,7 +523,7 @@ else if (step.createsSeuratObjects())
522523
throw new PipelineJobException("No markdown files produced!");
523524
}
524525

525-
originalInputs.stream().forEach(x -> _resumer.getFileManager().removeIntermediateFile(x));
526+
originalInputs.forEach(x -> _resumer.getFileManager().removeIntermediateFile(x));
526527

527528
//process with pandoc
528529
ctx.getJob().setStatus(PipelineJob.TaskStatus.running, "Creating final report");
@@ -610,7 +611,7 @@ else if (inputFiles.size() == 1)
610611
}
611612

612613
//This indicates the job processed an input file, but did not create a new object (like running FindMarkers)
613-
if (originalInputs.contains(output.getFile()))
614+
if (originalRDSCopiedLocal.contains(output.getFile()))
614615
{
615616
ctx.getLogger().info("Sequence output is the same as an input, will not re-create output for seurat object: " + output.getFile().getPath());
616617
}

0 commit comments

Comments
 (0)