@@ -205,6 +205,9 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
205205
206206 for (SequenceOutputFile so : inputFiles )
207207 {
208+ //This will error if the coverage file is not found. Perform check now to fail fast
209+ getDepthFile ();
210+
208211 if (so .getLibrary_id () == null )
209212 {
210213 throw new PipelineJobException ("VCF lacks library id: " + so .getRowid ());
@@ -226,6 +229,12 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
226229 continue ;
227230 }
228231
232+ //Also perform santity check of VCF early
233+ if (vc .getAttribute ("GATK_DP" ) == null )
234+ {
235+ throw new PipelineJobException ("Expected GATK_DP annotation on line " + key + " in file: " + so .getFile ().getPath ());
236+ }
237+
229238 double af = vc .getAttributeAsDouble ("AF" , 0.0 );
230239 if (af >= minAfThreshold )
231240 {
@@ -546,16 +555,23 @@ private Map<String, Integer> getContigToOffset(SAMSequenceDictionary dict)
546555 return ret ;
547556 }
548557
549- private int getReadDepth (File vcf , Map < String , Integer > contigToOffset , String contig , int position1 , JobContext ctx ) throws PipelineJobException
558+ private File getDepthFile (File vcf ) throws PipelineJobException
550559 {
551560 //NOTE: Earlier iterations used multiple VCF naming conventions
552561 String basename = vcf .getName ().split ("lofreq" )[0 ];
553562 File gatkDepth = new File (vcf .getParentFile (), basename + "lofreq.coverage" );
554563 if (!gatkDepth .exists ())
555564 {
556- throw new PipelineJobException ("File not found: " + gatkDepth .getPath ());
565+ throw new PipelineJobException ("File not found: " + gatkDepth .getPath () + ", for VCF: " + vcf . getName () );
557566 }
558567
568+ return gatkDepth ;
569+ }
570+
571+ private int getReadDepth (File vcf , Map <String , Integer > contigToOffset , String contig , int position1 , JobContext ctx ) throws PipelineJobException
572+ {
573+ File gatkDepth = getDepthFile (vcf );
574+
559575 int lineNo = contigToOffset .get (contig ) + position1 ;
560576 try (Stream <String > lines = Files .lines (gatkDepth .toPath ()))
561577 {
0 commit comments