Skip to content

Commit 30d5a29

Browse files
committed
Update output paths for nimble BAMs
1 parent 59bb6c4 commit 30d5a29

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ public void doNimbleAlign(File bam, PipelineStepOutput output, Readset rs, Strin
197197

198198
String description = genome.getScorePercent() > 0 ? "score_percent: " + genome.getScorePercent() : null;
199199
output.addSequenceOutput(results, basename + ": nimble align", "Nimble Alignment", rs.getRowId(), null, genome.getGenomeId(), description);
200+
201+
File outputBam = new File(results.getPath().replaceAll("results." + genome.genomeId + ".txt.gz", "nimbleAlignment." + genome.genomeId + ".bam"));
202+
if (outputBam.exists())
203+
{
204+
output.addSequenceOutput(outputBam, basename + ": nimble align", "Nimble Alignment", rs.getRowId(), null, genome.getGenomeId(), description);
205+
}
206+
else
207+
{
208+
getPipelineCtx().getLogger().debug("BAM not found: " + outputBam.getPath());
209+
}
200210
}
201211
}
202212

@@ -326,7 +336,7 @@ private Map<NimbleGenome, File> doAlignment(List<NimbleGenome> genomes, List<Fil
326336
alignArgs.add("/work/" + getNimbleLogFile(getPipelineCtx().getWorkingDirectory(), null).getName());
327337

328338
boolean alignOutput = getProvider().getParameterByName(ALIGN_OUTPUT).extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Boolean.class, false);
329-
File alignmentOutputFile = new File(getPipelineCtx().getWorkingDirectory(), "nimbleAlignment.txt.gz");
339+
File alignmentOutputFile = new File(getPipelineCtx().getWorkingDirectory(), "nimbleAlignment.bam");
330340
if (alignOutput)
331341
{
332342
alignArgs.add("--alignment_path");
@@ -406,17 +416,6 @@ else if (!resultsGz.exists())
406416
throw new PipelineJobException(e);
407417
}
408418

409-
if (alignmentOutputFile.exists())
410-
{
411-
SimpleScriptWrapper runner = new SimpleScriptWrapper(getPipelineCtx().getLogger());
412-
File alignmentOutputFile2 = new File(alignmentOutputFile.getParentFile(), alignmentOutputFile.getName().replace(".txt.gz", ".nimbleHits.txt.gz"));
413-
runner.execute(Arrays.asList("/bin/bash", "-c", "zcat '" + alignmentOutputFile.getPath() + "' | awk -F '\t' ' $1!=\"\" ' | gzip -c > " + alignmentOutputFile2.getPath()));
414-
}
415-
else
416-
{
417-
getPipelineCtx().getLogger().debug("Alignment output file not present: " + alignmentOutputFile.getName());
418-
}
419-
420419
resultMap.put(genome, resultsGz);
421420
}
422421

0 commit comments

Comments
 (0)