Skip to content

Commit 1214204

Browse files
committed
Fix error in several BAM processing steps that did not specify their output BAM
1 parent debee8a commit 1214204

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

SequenceAnalysis/api-src/org/labkey/api/sequenceanalysis/pipeline/BamProcessingStep.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ public interface BamProcessingStep extends PipelineStep
2929
{
3030
public BamProcessingStep.Output processBam(Readset rs, File inputBam, ReferenceGenome referenceGenome, File outputDirectory) throws PipelineJobException;
3131

32+
/**
33+
* The BamProcessingStep must call Output.setBam() to explicitly specify the modified file. This method exists as a check
34+
* to prevent the developer from forgetting this. Unless this is overridden, the pipeline will error if the original BAM is returned
35+
* instead.
36+
*/
37+
default boolean expectToCreateNewBam()
38+
{
39+
return true;
40+
}
41+
3242
public static interface Output extends PipelineStepOutput
3343
{
3444
/**

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/AlignmentNormalizationTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ public RecordedActionSet run() throws PipelineJobException
172172
{
173173
bam = output.getBAM();
174174
}
175+
else if (step.expectToCreateNewBam())
176+
{
177+
throw new PipelineJobException("The BAM processing step should have created a new BAM, no BAM was specified. This is possible a coding error on this step");
178+
}
175179
getJob().getLogger().info("\ttotal alignments in processed BAM: " + SequenceUtil.getAlignmentCount(bam));
176180

177181
action.setEndTime(new Date());

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,10 @@ private void alignSet(Readset rs, String basename, Map<ReadData, Pair<File, File
714714
//getJob().getLogger().info("\ttotal alignments in processed BAM: " + SequenceUtil.getAlignmentCount(bam));
715715
getJob().getLogger().info("\tfile size: " + FileUtils.byteCountToDisplaySize(bam.length()));
716716
}
717+
else if (step.expectToCreateNewBam())
718+
{
719+
throw new PipelineJobException("The BAM processing step should have created a new BAM, no BAM was specified. This is possible a coding error on this step");
720+
}
717721
else
718722
{
719723
getJob().getLogger().info("no BAM created by step, using output from previous step");

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/bampostprocessing/BaseQualityScoreRecalibrator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ public Output processBam(Readset rs, File inputBam, ReferenceGenome referenceGen
140140

141141
getWrapper().execute(inputBam, referenceGenome.getWorkingFastaFile(), outputBam, knownVariants);
142142

143+
output.setBAM(outputBam);
144+
143145
return output;
144146
}
145147
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/bampostprocessing/ClipOverlappingAlignmentsWrapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public Output processBam(Readset rs, File inputBam, ReferenceGenome referenceGen
110110
getWrapper().execute(inputBam, referenceGenome.getWorkingFastaFile(), bedFile, outputBam, reportFile);
111111

112112
output.addSequenceOutput(reportFile, rs.getName() + ": alignment clipping report", "Alignment Clipping Report", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
113+
output.setBAM(outputBam);
113114

114115
return output;
115116
}

0 commit comments

Comments
 (0)