|
| 1 | +package org.labkey.sequenceanalysis.run.bampostprocessing; |
| 2 | + |
| 3 | +import org.labkey.api.pipeline.PipelineJobException; |
| 4 | +import org.labkey.api.sequenceanalysis.model.Readset; |
| 5 | +import org.labkey.api.sequenceanalysis.pipeline.AbstractPipelineStepProvider; |
| 6 | +import org.labkey.api.sequenceanalysis.pipeline.BamProcessingOutputImpl; |
| 7 | +import org.labkey.api.sequenceanalysis.pipeline.BamProcessingStep; |
| 8 | +import org.labkey.api.sequenceanalysis.pipeline.PipelineContext; |
| 9 | +import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider; |
| 10 | +import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome; |
| 11 | +import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; |
| 12 | +import org.labkey.api.sequenceanalysis.run.AbstractCommandPipelineStep; |
| 13 | +import org.labkey.api.util.FileUtil; |
| 14 | +import org.labkey.sequenceanalysis.run.analysis.LofreqAnalysis; |
| 15 | + |
| 16 | +import java.io.File; |
| 17 | +import java.util.Collections; |
| 18 | + |
| 19 | +public class LofreqIndelQualStep extends AbstractCommandPipelineStep<LofreqAnalysis.LofreqWrapper> implements BamProcessingStep |
| 20 | +{ |
| 21 | + public LofreqIndelQualStep(PipelineStepProvider provider, PipelineContext ctx) |
| 22 | + { |
| 23 | + super(provider, ctx, new LofreqAnalysis.LofreqWrapper(ctx.getLogger())); |
| 24 | + } |
| 25 | + |
| 26 | + public static class Provider extends AbstractPipelineStepProvider<MarkDuplicatesStep> |
| 27 | + { |
| 28 | + public Provider() |
| 29 | + { |
| 30 | + super("LofreqIndelQual", "Lofreq Indelqual", "Lofreq", "This runs lofreq's indelqual, which adds indel qualities necessary to call somatic indels.", Collections.emptyList(), null, "http://csb5.github.io/lofreq/"); |
| 31 | + } |
| 32 | + |
| 33 | + @Override |
| 34 | + public MarkDuplicatesStep create(PipelineContext ctx) |
| 35 | + { |
| 36 | + return new MarkDuplicatesStep(this, ctx); |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + @Override |
| 41 | + public Output processBam(Readset rs, File inputBam, ReferenceGenome referenceGenome, File outputDirectory) throws PipelineJobException |
| 42 | + { |
| 43 | + BamProcessingOutputImpl output = new BamProcessingOutputImpl(); |
| 44 | + getWrapper().setOutputDir(outputDirectory); |
| 45 | + |
| 46 | + File outputBam = new File(outputDirectory, FileUtil.getBaseName(inputBam) + ".lofreqindel.bam"); |
| 47 | + output.addIntermediateFile(outputBam); |
| 48 | + output.setBAM(getWrapper().addIndelQuals(inputBam, outputBam, referenceGenome.getWorkingFastaFile())); |
| 49 | + |
| 50 | + SequencePipelineService.get().ensureBamIndex(outputBam, getPipelineCtx().getLogger(), false); |
| 51 | + |
| 52 | + return output; |
| 53 | + } |
| 54 | +} |
0 commit comments