Skip to content

Commit 2ebe4a4

Browse files
committed
Always overwrite scripts
1 parent c66642f commit 2ebe4a4

File tree

2 files changed

+19
-32
lines changed

2 files changed

+19
-32
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,13 @@ protected void executeR(SequenceOutputHandler.JobContext ctx, File rmd, String o
237237
public static void executeR(SequenceOutputHandler.JobContext ctx, String dockerContainerName, String outputPrefix, List<String> lines) throws PipelineJobException
238238
{
239239
File localRScript = new File(ctx.getOutputDir(), outputPrefix + ".R");
240-
if (!localRScript.exists())
240+
try (PrintWriter writer = PrintWriters.getPrintWriter(localRScript))
241241
{
242-
try (PrintWriter writer = PrintWriters.getPrintWriter(localRScript))
243-
{
244-
lines.forEach(writer::println);
245-
}
246-
catch (IOException e)
247-
{
248-
throw new PipelineJobException(e);
249-
}
242+
lines.forEach(writer::println);
250243
}
251-
else
244+
catch (IOException e)
252245
{
253-
ctx.getLogger().info("R script exists, re-using: " + localRScript.getPath());
246+
throw new PipelineJobException(e);
254247
}
255248

256249
File localBashScript = new File(ctx.getOutputDir(), "dockerWrapper.sh");

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

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,10 +1111,11 @@ public File ensureLocalCopy(File input, File outputDir, Logger log, Set<File> to
11111111
try
11121112
{
11131113
//needed for docker currently
1114-
log.debug("Copying file to working directory: " + input.getName());
1114+
log.debug("Copying file to working directory: " + input.getPath());
11151115
File dest = new File(outputDir, input.getName());
11161116
if (dest.exists())
11171117
{
1118+
log.debug("deleting existing folder: " + dest.getPath());
11181119
if (input.isDirectory())
11191120
{
11201121
FileUtils.deleteDirectory(dest);
@@ -1224,33 +1225,26 @@ private File generateCellHashingCalls(File citeSeqCountOutDir, File outputDir, S
12241225
File metricsFile = getMetricsFile(callsFile);
12251226

12261227
File localRScript = new File(outputDir, "generateCallsWrapper.R");
1227-
if (!localRScript.exists())
1228+
try (PrintWriter writer = PrintWriters.getPrintWriter(localRScript))
12281229
{
1229-
try (PrintWriter writer = PrintWriters.getPrintWriter(localRScript))
1230-
{
1231-
List<String> methodNames = parameters.methods.stream().map(Enum::name).collect(Collectors.toList());
1230+
List<String> methodNames = parameters.methods.stream().map(Enum::name).collect(Collectors.toList());
12321231

1233-
String cellbarcodeWhitelist = "";
1234-
if (cellBarcodeWhitelistFile != null)
1235-
{
1236-
cellbarcodeWhitelist = "'/work/" + cellBarcodeWhitelistFile.getName() + "'";
1237-
}
1232+
String cellbarcodeWhitelist = "";
1233+
if (cellBarcodeWhitelistFile != null)
1234+
{
1235+
cellbarcodeWhitelist = "'/work/" + cellBarcodeWhitelistFile.getName() + "'";
1236+
}
12381237

1239-
Set<String> allowableBarcodes = parameters.getAllowableBarcodeNames();
1240-
String allowableBarcodeParam = allowableBarcodes != null ? "c('" + StringUtils.join(allowableBarcodes, "','") + "')" : "NULL";
1238+
Set<String> allowableBarcodes = parameters.getAllowableBarcodeNames();
1239+
String allowableBarcodeParam = allowableBarcodes != null ? "c('" + StringUtils.join(allowableBarcodes, "','") + "')" : "NULL";
12411240

1242-
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, "','") + "'))");
1243-
writer.println("print('Rmarkdown complete')");
1241+
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, "','") + "'))");
1242+
writer.println("print('Rmarkdown complete')");
12441243

1245-
}
1246-
catch (IOException e)
1247-
{
1248-
throw new PipelineJobException(e);
1249-
}
12501244
}
1251-
else
1245+
catch (IOException e)
12521246
{
1253-
log.info("script exists, re-using: " + localRScript.getPath());
1247+
throw new PipelineJobException(e);
12541248
}
12551249

12561250
File localBashScript = new File(outputDir, "generateCallsDockerWrapper.sh");

0 commit comments

Comments
 (0)