Skip to content

Commit 254cedf

Browse files
committed
Allow seurat object to be set as output even when it has the same name as input, but different content
1 parent 046dca3 commit 254cedf

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
378378

379379
List<SingleCellStep.SeuratObjectWrapper> currentFiles;
380380
Set<File> originalInputs = inputFiles.stream().map(SequenceOutputFile::getFile).collect(Collectors.toSet());
381-
Set<File> originalRDSCopiedLocal = new HashSet<>();
381+
Map<File, File> localCopyToOrig = new HashMap<>();
382382
if (_doProcessRawCounts)
383383
{
384384
currentFiles = processRawCounts(ctx, inputFiles, basename);
@@ -453,9 +453,8 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
453453
}
454454

455455
currentFiles.add(new SingleCellStep.SeuratObjectWrapper(datasetId, datasetId, local, so));
456+
localCopyToOrig.put(local, so.getFile());
456457
}
457-
458-
originalRDSCopiedLocal.addAll(currentFiles.stream().map(AbstractSingleCellStep.SeuratObjectWrapper::getFile).collect(Collectors.toSet()));
459458
}
460459
catch (IOException e)
461460
{
@@ -664,11 +663,25 @@ else if (inputFiles.size() == 1)
664663
}
665664

666665
//This indicates the job processed an input file, but did not create a new object (like running FindMarkers)
667-
if (originalRDSCopiedLocal.contains(output.getFile()))
666+
boolean skipOutput = false;
667+
if (localCopyToOrig.containsKey(output.getFile()))
668668
{
669-
ctx.getLogger().info("Sequence output is the same as an input, will not re-create output for seurat object: " + output.getFile().getPath());
669+
try
670+
{
671+
ctx.getLogger().debug("Comparing file context of output to determine if it matches input: "+ output.getFile().getName());
672+
if (FileUtils.contentEquals(localCopyToOrig.get(output.getFile()), output.getFile()))
673+
{
674+
ctx.getLogger().info("Sequence output is the same as an input, will not re-create output for seurat object: " + output.getFile().getPath());
675+
skipOutput = true;
676+
}
677+
}
678+
catch (IOException e)
679+
{
680+
throw new PipelineJobException(e);
681+
}
670682
}
671-
else
683+
684+
if (!skipOutput)
672685
{
673686
Set<File> existingOutputs = _resumer.getFileManager().getOutputsToCreate().stream().map(SequenceOutputFile::getFile).collect(Collectors.toSet());
674687
if (existingOutputs.contains(so.getFile()))

0 commit comments

Comments
 (0)