Skip to content

Commit e187c55

Browse files
committed
More error reporting
1 parent cd7fdd4 commit e187c55

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

singlecell/api-src/org/labkey/api/singlecell/pipeline/AbstractSingleCellPipelineStep.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public static void executeR(SequenceOutputHandler.JobContext ctx, String dockerC
283283
writer.println("\t-w /work \\");
284284
writer.println("\t-e HOME=/homeDir \\");
285285
writer.println("\t" + dockerContainerName + " \\");
286-
writer.println("\t" + rWrapperScript.getName());
286+
writer.println("\t/bin/bash " + rWrapperScript.getName());
287287
writer.println("");
288288
writer.println("echo 'Bash script complete'");
289289

@@ -316,6 +316,7 @@ public static void executeR(SequenceOutputHandler.JobContext ctx, String dockerC
316316
rWrapper.execute(Arrays.asList("/bin/bash", localBashScript.getName()));
317317

318318
localRScript.delete();
319+
rWrapperScript.delete();
319320
localBashScript.delete();
320321
}
321322

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

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ private File generateCellHashingCalls(File citeSeqCountOutDir, File outputDir, S
12341234
Set<String> allowableBarcodes = parameters.getAllowableBarcodeNames();
12351235
String allowableBarcodeParam = allowableBarcodes != null ? "c('" + StringUtils.join(allowableBarcodes, "','") + "')" : "NULL";
12361236

1237-
writer.println("cellhashR::CallAndGenerateReport(rawCountData = '/work/" + citeSeqCountOutDir.getName() + "', reportFile = '/work/" + htmlFile.getName() + "', callFile = '/work/" + callsFile.getName() + "', metricsFile = '/work/" + metricsFile.getName() + "', cellbarcodeWhitelist = " + cellbarcodeWhitelist + ", barcodeWhitelist = " + allowableBarcodeParam + ", title = '" + parameters.getReportTitle() + "', methods = c('" + StringUtils.join(methodNames, "','") + "'))");
1237+
writer.println("f <- cellhashR::CallAndGenerateReport(rawCountData = '/work/" + citeSeqCountOutDir.getName() + "', reportFile = '/work/" + htmlFile.getName() + "', callFile = '/work/" + callsFile.getName() + "', metricsFile = '/work/" + metricsFile.getName() + "', cellbarcodeWhitelist = " + cellbarcodeWhitelist + ", barcodeWhitelist = " + allowableBarcodeParam + ", title = '" + parameters.getReportTitle() + "', methods = c('" + StringUtils.join(methodNames, "','") + "'))");
12381238
writer.println("print('Rmarkdown complete')");
12391239

12401240
}
@@ -1248,7 +1248,8 @@ private File generateCellHashingCalls(File citeSeqCountOutDir, File outputDir, S
12481248
log.info("script exists, re-using: " + localRScript.getPath());
12491249
}
12501250

1251-
File localBashScript = new File(outputDir, "generateCallsWrapper.sh");
1251+
File localBashScript = new File(outputDir, "generateCallsDockerWrapper.sh");
1252+
File rWrapperScript = new File(outputDir, "generateCallsRWrapper.sh");
12521253
try (PrintWriter writer = PrintWriters.getPrintWriter(localBashScript))
12531254
{
12541255
writer.println("#!/bin/bash");
@@ -1278,7 +1279,25 @@ private File generateCellHashingCalls(File citeSeqCountOutDir, File outputDir, S
12781279
writer.println("\t-w /work \\");
12791280
writer.println("\t-e HOME=/homeDir \\");
12801281
writer.println("\tghcr.io/bimberlab/cellhashr:latest \\");
1281-
writer.println("\tRscript --vanilla " + localRScript.getName());
1282+
writer.println("\t/bin/bash " + rWrapperScript.getName());
1283+
}
1284+
catch (IOException e)
1285+
{
1286+
throw new PipelineJobException(e);
1287+
}
1288+
1289+
try (PrintWriter writer = PrintWriters.getPrintWriter(rWrapperScript))
1290+
{
1291+
writer.println("#!/bin/bash");
1292+
writer.println("set -x");
1293+
1294+
writer.println("if Rscript --vanilla " + localRScript.getName());
1295+
writer.println("then");
1296+
writer.println("\texit 0");
1297+
writer.println("else");
1298+
writer.println("\techo \"Rscript exited with value $?\"");
1299+
writer.println("\texit 0");
1300+
writer.println("fi");
12821301
}
12831302
catch (IOException e)
12841303
{
@@ -1315,6 +1334,10 @@ private File generateCellHashingCalls(File citeSeqCountOutDir, File outputDir, S
13151334
throw new PipelineJobException("Unable to find HTO calls file: " + callsFile.getPath());
13161335
}
13171336

1337+
localBashScript.delete();
1338+
rWrapperScript.delete();
1339+
localRScript.delete();
1340+
13181341
try
13191342
{
13201343
for (File f : toDelete)

0 commit comments

Comments
 (0)