Skip to content

Commit 3c5d8f9

Browse files
committed
Create VCF indexes after pbsv call
1 parent 4548569 commit 3c5d8f9

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

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

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -147,38 +147,42 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
147147
outputs.add(runPbsvCall(ctx, filesToProcess, genome, outputBaseName, null));
148148
}
149149

150-
File vcfOutGz;
151-
if (outputs.size() == 1)
150+
try
152151
{
153-
File unzipVcfOut = outputs.get(0);
154-
vcfOutGz = SequenceAnalysisService.get().bgzipFile(unzipVcfOut, ctx.getLogger());
155-
if (unzipVcfOut.exists())
152+
File vcfOutGz;
153+
if (outputs.size() == 1)
156154
{
157-
throw new PipelineJobException("Unzipped VCF should not exist: " + vcfOutGz.getPath());
155+
File unzipVcfOut = outputs.get(0);
156+
vcfOutGz = SequenceAnalysisService.get().bgzipFile(unzipVcfOut, ctx.getLogger());
157+
if (unzipVcfOut.exists())
158+
{
159+
throw new PipelineJobException("Unzipped VCF should not exist: " + vcfOutGz.getPath());
160+
}
161+
}
162+
else
163+
{
164+
for (File f : outputs)
165+
{
166+
ctx.getFileManager().addIntermediateFile(f);
167+
ctx.getFileManager().addIntermediateFile(SequenceAnalysisService.get().ensureVcfIndex(f, ctx.getLogger(), true));
168+
}
169+
vcfOutGz = SequenceUtil.combineVcfs(outputs, genome, new File(ctx.getOutputDir(), outputBaseName + ".vcf.gz"), ctx.getLogger(), true, null, false);
158170
}
159-
}
160-
else
161-
{
162-
outputs.forEach(f -> ctx.getFileManager().addIntermediateFile(f));
163-
vcfOutGz = SequenceUtil.combineVcfs(outputs, genome, new File(ctx.getOutputDir(), outputBaseName), ctx.getLogger(), true, null, false);
164-
}
165171

166-
try
167-
{
168172
SequenceAnalysisService.get().ensureVcfIndex(vcfOutGz, ctx.getLogger(), true);
173+
174+
SequenceOutputFile so = new SequenceOutputFile();
175+
so.setName("pbsv call: " + outputBaseName);
176+
so.setFile(vcfOutGz);
177+
so.setCategory(OUTPUT_CATEGORY);
178+
so.setLibrary_id(genome.getGenomeId());
179+
180+
ctx.addSequenceOutput(so);
169181
}
170182
catch (IOException e)
171183
{
172184
throw new PipelineJobException(e);
173185
}
174-
175-
SequenceOutputFile so = new SequenceOutputFile();
176-
so.setName("pbsv call: " + outputBaseName);
177-
so.setFile(vcfOutGz);
178-
so.setCategory(OUTPUT_CATEGORY);
179-
so.setLibrary_id(genome.getGenomeId());
180-
181-
ctx.addSequenceOutput(so);
182186
}
183187

184188
private File runPbsvCall(JobContext ctx, List<File> inputs, ReferenceGenome genome, String outputBaseName, @Nullable String contig) throws PipelineJobException

0 commit comments

Comments
 (0)