Skip to content

Commit 37b042f

Browse files
committed
Inspect all VCFs before throwing validation errors
1 parent c7556f1 commit 37b042f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
201201
final double minAfThreshold = ctx.getParams().optDouble(MIN_AF, 0.0);
202202
final int minDepth = ctx.getParams().optInt(MIN_COVERAGE, 0);
203203

204+
Set<String> errors = new HashSet<>();
205+
204206
ctx.getLogger().info("Pass 1: Building whitelist of sites");
205207
Map<String, SiteAndAlleles> siteToAllele = new HashMap<>();
206208
List<Pair<String, Integer>> whitelistSites = new ArrayList<>();
@@ -210,7 +212,14 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
210212
for (SequenceOutputFile so : inputFiles)
211213
{
212214
//This will error if the coverage file is not found. Perform check now to fail fast
213-
getDepthFile(so.getFile());
215+
try
216+
{
217+
getDepthFile(so.getFile());
218+
}
219+
catch (PipelineJobException e)
220+
{
221+
errors.add(e.getMessage());
222+
}
214223

215224
if (so.getLibrary_id() == null)
216225
{
@@ -236,7 +245,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
236245
//Also perform santity check of VCF early
237246
if (vc.getAttribute("GATK_DP") == null)
238247
{
239-
throw new PipelineJobException("Expected GATK_DP annotation on line " + getCacheKey(vc.getContig(), vc.getStart()) + " in file: " + so.getFile().getPath());
248+
errors.add("Expected GATK_DP annotation on line " + getCacheKey(vc.getContig(), vc.getStart()) + " in file: " + so.getFile().getPath());
240249
}
241250

242251
double af = vc.getAttributeAsDouble("AF", 0.0);
@@ -259,6 +268,12 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
259268
}
260269
}
261270

271+
if (!errors.isEmpty())
272+
{
273+
errors.forEach(ctx.getLogger()::error);
274+
throw new PipelineJobException("Problems with either input VCFs or DepthOfCoverage files");
275+
}
276+
262277
ctx.getLogger().info("total sites: " + whitelistSites.size());
263278
Collections.sort(whitelistSites);
264279

0 commit comments

Comments
 (0)