Skip to content

Commit 0e2b777

Browse files
committed
Make missing AD into a non-critical warning for VAF/VAF1 and make it more informative. Resolves #1769
1 parent 4edd317 commit 0e2b777

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugins/fill-tags.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,14 @@ static void process_vaf_vaf1(bcf1_t *rec)
976976

977977
args->niarr = bcf_get_format_int32(args->in_hdr, rec, "AD", &args->iarr, &args->miarr);
978978
if ( args->niarr <= 0 )
979-
error("Could not read FORMAT/AD annotation at %s:%"PRIhts_pos"\n",bcf_seqname(args->in_hdr,rec),rec->pos+1);
979+
{
980+
static int missing_ad_warned = 0;
981+
if ( !missing_ad_warned )
982+
fprintf(stderr,"Warning: cannot add the VAF/VAF1 annotations, the required FORMAT/AD tag is missing at %s:%"PRIhts_pos".\n"
983+
" (This warning is printed only once.)\n",bcf_seqname(args->in_hdr,rec),rec->pos+1);
984+
missing_ad_warned = 1;
985+
return;
986+
}
980987

981988
int nsmpl = bcf_hdr_nsamples(args->in_hdr);
982989
if ( args->niarr != nsmpl*rec->n_allele ) return; // incorrect number of values (possibly all missing)

0 commit comments

Comments
 (0)