Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ static int filters_cache_genotypes(filter_t *flt, bcf1_t *line)
flt->cached_GT.nbuf = 0;
return -1;
}
flt->cached_GT.mask[i] |= 1<<allele;
flt->cached_GT.mask[i] |= 1ULL<<allele;
}
}
return 0;
Expand Down Expand Up @@ -1001,7 +1001,7 @@ static void filters_set_format_int(filter_t *flt, bcf1_t *line, token_t *tok)
int k, j = 0;
for (k=0; k<nsrc1; k++) // source values are AD[0..nsrc1]
{
if ( !(flt->cached_GT.mask[i] & (1<<k)) ) continue;
if ( !(flt->cached_GT.mask[i] & (1ULL<<k)) ) continue;
dst[j++] = src[k];
}
if ( !j ) { bcf_double_set_missing(dst[j]); j++; }
Expand Down Expand Up @@ -1086,7 +1086,7 @@ static void filters_set_format_float(filter_t *flt, bcf1_t *line, token_t *tok)
int k, j = 0;
for (k=0; k<nsrc1; k++) // source values are AF[0..nsrc1]
{
if ( !(flt->cached_GT.mask[i] & (1<<k)) ) continue;
if ( !(flt->cached_GT.mask[i] & (1ULL<<k)) ) continue;
if ( bcf_float_is_missing(src[k]) )
bcf_double_set_missing(dst[j]);
else if ( bcf_float_is_vector_end(src[k]) )
Expand Down Expand Up @@ -1167,7 +1167,7 @@ static void filters_set_format_string(filter_t *flt, bcf1_t *line, token_t *tok)
}
else if ( tok->idx == -3 ) // given by GT index, e.g. AD[:GT]
{
if ( flt->cached_GT.mask[i] & (1<<idx) ) keep = 1;
if ( flt->cached_GT.mask[i] & (1ULL<<idx) ) keep = 1;
}
else // given as a list, e.g. AD[:0,3]
{
Expand Down Expand Up @@ -1753,7 +1753,7 @@ static int func_median(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **sta
static int func_smpl_median(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **stack, int nstack)
{
token_t *tok = stack[nstack - 1];
if ( !tok->nsamples ) return func_avg(flt,line,rtok,stack,nstack);
if ( !tok->nsamples ) return func_median(flt,line,rtok,stack,nstack);
rtok->nsamples = tok->nsamples;
rtok->nvalues = tok->nsamples;
rtok->nval1 = 1;
Expand Down Expand Up @@ -1831,7 +1831,7 @@ static int func_stddev(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **sta
static int func_smpl_stddev(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **stack, int nstack)
{
token_t *tok = stack[nstack - 1];
if ( !tok->nsamples ) return func_avg(flt,line,rtok,stack,nstack);
if ( !tok->nsamples ) return func_stddev(flt,line,rtok,stack,nstack);
rtok->nsamples = tok->nsamples;
rtok->nvalues = tok->nsamples;
rtok->nval1 = 1;
Expand Down Expand Up @@ -1903,7 +1903,7 @@ static int func_sum(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **stack,
static int func_smpl_sum(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **stack, int nstack)
{
token_t *tok = stack[nstack - 1];
if ( !tok->nsamples ) return func_avg(flt,line,rtok,stack,nstack);
if ( !tok->nsamples ) return func_sum(flt,line,rtok,stack,nstack);
rtok->nsamples = tok->nsamples;
rtok->nvalues = tok->nsamples;
rtok->nval1 = 1;
Expand Down Expand Up @@ -2006,7 +2006,7 @@ static int func_count(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **stac
static int func_smpl_count(filter_t *flt, bcf1_t *line, token_t *rtok, token_t **stack, int nstack)
{
token_t *tok = stack[nstack - 1];
if ( !tok->nsamples ) return func_max(flt,line,rtok,stack,nstack);
if ( !tok->nsamples ) return func_count(flt,line,rtok,stack,nstack);
rtok->nsamples = tok->nsamples;
rtok->nvalues = tok->nsamples;
rtok->nval1 = 1;
Expand Down Expand Up @@ -2888,7 +2888,6 @@ static void cmp_vector_strings(token_t *atok, token_t *btok, token_t *rtok)
{
token_t *tok = atok->regex ? btok : atok;
rtok->pass_site = _regex_vector_strings(regex, tok->str_value.s, tok->str_value.l, logic, missing_logic);
fprintf(stderr,"pass=%d [%s]\n",rtok->pass_site,tok->str_value.s);
}
return;
}
Expand Down
4 changes: 2 additions & 2 deletions vcffilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,14 @@ static void set_genotypes(args_t *args, bcf1_t *line, int pass_site)
if ( args->set_gts==SET_GTS_MISSING && !bcf_gt_is_missing(gts[j]) )
{
int ial = bcf_gt_allele(gts[j]);
if ( has_ac && ial>0 && ial<=line->n_allele ) args->tmp_ac[ ial-1 ]--;
if ( has_ac && ial>0 && ial<line->n_allele ) args->tmp_ac[ ial-1 ]--;
an--;
}
else if ( args->set_gts==SET_GTS_REF )
{
int ial = bcf_gt_allele(gts[j]);
if ( bcf_gt_is_missing(gts[j]) ) an++;
else if ( has_ac && ial>0 && ial<=line->n_allele ) args->tmp_ac[ ial-1 ]--;
else if ( has_ac && ial>0 && ial<line->n_allele ) args->tmp_ac[ ial-1 ]--;
}
gts[j] = new_gt;
}
Expand Down