Skip to content

Commit 8e801ab

Browse files
committed
Prevent unnecessary exception when seurat pipeline doesnt create new outputs
1 parent f500e83 commit 8e801ab

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

singlecell/src/org/labkey/singlecell/CellHashingServiceImpl.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,9 +1440,14 @@ public File subsetBarcodes(File allCellBarcodes, @Nullable String barcodePrefix)
14401440
}
14411441

14421442
public File getCellBarcodesFromSeurat(File seuratObj)
1443+
{
1444+
return getCellBarcodesFromSeurat(seuratObj, true);
1445+
}
1446+
1447+
public File getCellBarcodesFromSeurat(File seuratObj, boolean throwIfNotFound)
14431448
{
14441449
File barcodes = new File(seuratObj.getParentFile(), seuratObj.getName().replaceAll("seurat.rds", "cellBarcodes.csv"));
1445-
if (!barcodes.exists())
1450+
if (throwIfNotFound && !barcodes.exists())
14461451
{
14471452
throw new IllegalArgumentException("Unable to find expected cell barcodes file. This might indicate the seurat object was created with an older version of the pipeline. Expected: " + barcodes.getPath());
14481453
}
@@ -1451,9 +1456,14 @@ public File getCellBarcodesFromSeurat(File seuratObj)
14511456
}
14521457

14531458
public File getMetaTableFromSeurat(File seuratObj)
1459+
{
1460+
return getCellBarcodesFromSeurat(seuratObj, true);
1461+
}
1462+
1463+
public File getMetaTableFromSeurat(File seuratObj, boolean throwIfNotFound)
14541464
{
14551465
File barcodes = new File(seuratObj.getParentFile(), seuratObj.getName().replaceAll("seurat.rds", "seurat.meta.txt"));
1456-
if (!barcodes.exists())
1466+
if (throwIfNotFound && !barcodes.exists())
14571467
{
14581468
throw new IllegalArgumentException("Unable to find expected metadata file. This might indicate the seurat object was created with an older version of the pipeline. Expected: " + barcodes.getPath());
14591469
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ else if (step.createsSeuratObjects())
516516
ctx.getLogger().debug("Removing intermediate file: " + seurat.getFile().getPath());
517517
ctx.getFileManager().removeIntermediateFile(seurat.getFile());
518518
_resumer.getFileManager().removeIntermediateFile(seurat.getFile());
519-
_resumer.getFileManager().removeIntermediateFile(CellHashingServiceImpl.get().getCellBarcodesFromSeurat(seurat.getFile()));
520-
_resumer.getFileManager().removeIntermediateFile(CellHashingServiceImpl.get().getMetaTableFromSeurat(seurat.getFile()));
519+
_resumer.getFileManager().removeIntermediateFile(CellHashingServiceImpl.get().getCellBarcodesFromSeurat(seurat.getFile(), false));
520+
_resumer.getFileManager().removeIntermediateFile(CellHashingServiceImpl.get().getMetaTableFromSeurat(seurat.getFile(), false));
521521
}
522522
}
523523

0 commit comments

Comments
 (0)