Skip to content

Commit 5d58e85

Browse files
committed
Support nimble HTML report
1 parent bf4ae47 commit 5d58e85

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

singlecell/src/org/labkey/singlecell/run/NimbleHelper.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,13 @@ public void doNimbleAlign(File bam, PipelineStepOutput output, Readset rs, Strin
290290

291291
output.addSequenceOutput(results, basename + ": nimble align", "Nimble Alignment", rs.getRowId(), null, genome.getGenomeId(), description);
292292

293+
File reportHtml = getReportHtmlFileFromResults(results);
294+
if (!reportHtml.exists())
295+
{
296+
throw new PipelineJobException("Unable to find file: " + reportHtml.getPath());
297+
}
298+
output.addSequenceOutput(results, basename + ": nimble report", "Nimble Report", rs.getRowId(), null, genome.getGenomeId(), description);
299+
293300
File outputBam = new File(results.getPath().replaceAll("results." + genome.genomeId + ".txt.gz", "nimbleAlignment." + genome.genomeId + ".bam"));
294301
if (outputBam.exists())
295302
{
@@ -497,11 +504,42 @@ private Map<NimbleGenome, File> doAlignment(List<NimbleGenome> genomes, List<Fil
497504
}
498505

499506
resultMap.put(genome, reportResultsGz);
507+
508+
// Also run nimble plot. Always re-run since this is fast:
509+
List<String> plotArgs = new ArrayList<>();
510+
plotArgs.add("python3");
511+
plotArgs.add("-m");
512+
plotArgs.add("nimble");
513+
514+
plotArgs.add("plot");
515+
plotArgs.add("--input_file");
516+
plotArgs.add("/work/" + reportResultsGz.getName());
517+
518+
File plotResultsHtml = getReportHtmlFileFromResults(reportResultsGz);
519+
if (reportResultsGz.exists())
520+
{
521+
plotResultsHtml.delete();
522+
}
523+
524+
plotArgs.add("--output_file");
525+
plotArgs.add("/work/" + plotResultsHtml.getName());
526+
527+
runUsingDocker(plotArgs, output, null);
528+
529+
if (!plotResultsHtml.exists())
530+
{
531+
throw new PipelineJobException("Missing file: " + plotResultsHtml.getPath());
532+
}
500533
}
501534

502535
return resultMap;
503536
}
504537

538+
private File getReportHtmlFileFromResults(File reportResultsGz)
539+
{
540+
return new File(reportResultsGz.getPath().replaceAll("txt.gz$", "html$"));
541+
}
542+
505543
private File getNimbleDoneFile(File parentDir, String resumeString)
506544
{
507545
return new File(parentDir, "nimble." + resumeString + ".done");

0 commit comments

Comments
 (0)