Skip to content

Commit

Permalink
Replace assert with an error message to help with debugging. See #1044
Browse files Browse the repository at this point in the history
  • Loading branch information
pd3 committed Feb 8, 2023
1 parent d61277e commit f4fac3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vcfmerge.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ static int info_rules_add_values(args_t *args, bcf_hdr_t *hdr, bcf1_t *line, inf
else if ( var_len==BCF_VL_G )
{
args->maux->nagr_map = bcf_alleles2gt(line->n_allele-1,line->n_allele-1)+1;
assert( ret==line->n_allele || ret==args->maux->nagr_map );
if ( ret!=line->n_allele && ret!=args->maux->nagr_map ) error("Wrong number of %s fields at %s:%"PRId64"\n",rule->hdr_tag,bcf_seqname(hdr,line),(int64_t) line->pos+1);
if ( ret==line->n_allele ) // haploid
{
args->maux->nagr_map = line->n_allele;
Expand Down Expand Up @@ -974,7 +974,7 @@ void merge_chrom2qual(args_t *args, bcf1_t *out)
int k = 0;
for (i=0; i<ma->nals; i++)
if ( i==0 || al_idxs[i] ) ma->out_als[k++] = strdup(ma->als[i]);
assert( k==ma->nout_als );
if ( k!=ma->nout_als ) error("Error: could not merge alleles at %s:%"PRId64", sanity check failed: %d!=%d\n",bcf_seqname(out_hdr,out),out->pos+1,k,ma->nout_als);
normalize_alleles(ma->out_als, ma->nout_als);
bcf_update_alleles(out_hdr, out, (const char**) ma->out_als, ma->nout_als);
free(al_idxs);
Expand Down

0 comments on commit f4fac3c

Please sign in to comment.