Skip to content

Commit 3c454e3

Browse files
committed
Bugfix to sawfish
1 parent dccf4c7 commit 3c454e3

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/SawfishAnalysis.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,24 @@ public Output performAnalysisPerSampleRemote(Readset rs, File inputBam, Referenc
9292
args.add(String.valueOf(maxThreads));
9393
}
9494

95-
new SimpleScriptWrapper(getPipelineCtx().getLogger()).execute(args);
95+
File bcf = new File(svOutDir, "candidate.sv.bcf");
96+
File bcfIdx = new File(bcf.getPath() + ".csi");
97+
if (bcfIdx.exists())
98+
{
99+
getPipelineCtx().getLogger().debug("BCF index already exists, reusing output");
100+
}
101+
else
102+
{
103+
new SimpleScriptWrapper(getPipelineCtx().getLogger()).execute(args);
104+
}
96105

97-
File vcf = new File(svOutDir, "genotyped.sv.vcf.gz");
98-
if (!vcf.exists())
106+
if (!bcf.exists())
99107
{
100-
throw new PipelineJobException("Unable to find file: " + vcf.getPath());
108+
throw new PipelineJobException("Unable to find file: " + bcf.getPath());
101109
}
102110

103-
output.addSequenceOutput(vcf, rs.getName() + ": sawfish", "Sawfish SV Discovery", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
111+
output.addSequenceOutput(bcf, rs.getName() + ": sawfish", "Sawfish SV Discovery", rs.getReadsetId(), null, referenceGenome.getGenomeId(), null);
112+
104113
return output;
105114
}
106115

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/SawfishJointCallingHandler.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public SawfishJointCallingHandler()
4343
@Override
4444
public boolean canProcess(SequenceOutputFile o)
4545
{
46-
return o.getFile() != null && SequenceUtil.FILETYPE.vcf.getFileType().isType(o.getFile());
46+
return o.getFile() != null && SequenceUtil.FILETYPE.bcf.getFileType().isType(o.getFile());
4747
}
4848

4949
@Override
@@ -90,8 +90,6 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
9090
}
9191

9292
File expectedFinalOutput = new File(ctx.getOutputDir(), outputBaseName + ".vcf.gz");
93-
File expectedFinalOutputIdx = new File(expectedFinalOutput.getPath() + ".tbi");
94-
boolean jobCompleted = expectedFinalOutputIdx.exists(); // this would occur if the job died during the cleanup phase
9593

9694
File ouputVcf = runSawfishCall(ctx, filesToProcess, genome, outputBaseName);
9795

@@ -150,20 +148,22 @@ private File runSawfishCall(JobContext ctx, List<File> inputs, ReferenceGenome g
150148
if (vcfOutFinal.exists())
151149
{
152150
vcfOutFinal.delete();
153-
FileUtils.moveFile(vcfOut, vcfOutFinal);
154-
155-
File targetIndex = new File(vcfOutFinal.getPath() + ".tbi");
156-
if (targetIndex.exists())
157-
{
158-
targetIndex.delete();
159-
}
151+
}
152+
FileUtils.moveFile(vcfOut, vcfOutFinal);
160153

161-
File origIndex = new File(vcfOut.getPath() + ".tbi");
162-
if (origIndex.exists())
163-
{
164-
FileUtils.moveFile(origIndex, targetIndex);
165-
}
154+
File targetIndex = new File(vcfOutFinal.getPath() + ".tbi");
155+
if (targetIndex.exists())
156+
{
157+
targetIndex.delete();
158+
}
166159

160+
File origIndex = new File(vcfOut.getPath() + ".tbi");
161+
if (origIndex.exists())
162+
{
163+
FileUtils.moveFile(origIndex, targetIndex);
164+
}
165+
else
166+
{
167167
SequenceAnalysisService.get().ensureVcfIndex(vcfOutFinal, ctx.getLogger(), true);
168168
}
169169
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public enum FILETYPE
9696
bed(Collections.singletonList(".bed"), true),
9797
bw(Collections.singletonList(".bw"), false),
9898
vcf(List.of(".vcf"), true),
99+
bcf(List.of(".bcf"), true),
99100
gvcf(List.of(".g.vcf"), true);
100101

101102
private final List<String> _extensions;

0 commit comments

Comments
 (0)