Skip to content

Commit

Permalink
The -m function did not respect the --min-overlap option
Browse files Browse the repository at this point in the history
Fixes #1869
  • Loading branch information
pd3 committed Feb 24, 2023
1 parent cfa3b4d commit fe98a6b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changes affecting specific commands:
- The `-m, --mark-sites` option can be now used to mark all sites without the
need to provide the `-a` file (#1861)

- Fix a bug where the `-m` function did not respect the `--min-overlap` option (#1869)

* bcftools stats

- Collect new VAF (variant allele frequency) statistics from FORMAT/AD field
Expand Down
3 changes: 2 additions & 1 deletion test/annotate.olap.2.out
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
##ALT=<ID=CNV,Description="Copy Number Variation">
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
##INFO=<ID=DB,Number=1,Type=String,Description="CNV id from a database">
##INFO=<ID=XXX,Number=0,Type=Flag,Description="Sites listed in XXX">
#CHROM POS ID REF ALT QUAL FILTER INFO
1 10 . C <CNV> . . END=19;DB=cnv10_15
1 10 . C <CNV> . . END=19;DB=cnv10_15;XXX
1 20 . C <CNV> . . END=30
2 changes: 1 addition & 1 deletion test/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@
run_test(\&test_vcf_annotate,$opts,in=>'annotate.missing',tab=>'annotate.missing',out=>'annotate.missing.5.out',args=>'-c CHROM,POS,REF,ALT,.=TSTR,.=TFLT,.=TINT');
run_test(\&test_vcf_annotate,$opts,in=>'annotate.missing',tab=>'annotate.missing',out=>'annotate.missing.6.out',args=>'-c CHROM,POS,REF,ALT,=TSTR,=TFLT,=TINT');
run_test(\&test_vcf_annotate,$opts,in=>'annotate.olap',tab=>'annots.olap',out=>'annotate.olap.1.out',args=>'-c CHROM,BEG,END,DB -l DB:unique');
run_test(\&test_vcf_annotate,$opts,in=>'annotate.olap',tab=>'annots.olap',out=>'annotate.olap.2.out',args=>'-c CHROM,BEG,END,DB -l DB:unique --min-overlap 0.4:0.5');
run_test(\&test_vcf_annotate,$opts,in=>'annotate.olap',tab=>'annots.olap',out=>'annotate.olap.2.out',args=>'-c CHROM,BEG,END,DB -l DB:unique --min-overlap 0.4:0.5 -m XXX');
run_test(\&test_vcf_annotate,$opts,in=>'annotate.id',vcf=>'annots.id',out=>'annotate.id.1.out',args=>'-c ALT');
run_test(\&test_vcf_annotate,$opts,in=>'annotate.id',vcf=>'annots.id',out=>'annotate.id.2.out',args=>'-c +ALT');
run_test(\&test_vcf_annotate,$opts,in=>'annotate.id.2',vcf=>'annots.id.2',out=>'annotate.id.2.1.out',args=>'--pair-logic some -c +ID');
Expand Down
3 changes: 2 additions & 1 deletion vcfannotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3103,9 +3103,9 @@ static void annotate(args_t *args, bcf1_t *line)
error("fixme: Could not set %s at %s:%"PRId64"\n", args->cols[j].hdr_key_src,bcf_seqname(args->hdr,line),(int64_t) line->pos+1);
if ( ret==0 )
args->cols[j].done = 1;
has_overlap = 1;
}
}
has_overlap = 1;
}
for (j=0; j<args->ncols; j++)
{
Expand Down Expand Up @@ -3264,6 +3264,7 @@ static void annotate(args_t *args, bcf1_t *line)
has_overlap = 1;
}
}
fprintf(stderr,"has_overlap=%d mark=%s\n",has_overlap,args->mark_sites);
if ( args->set_ids )
{
args->tmpks.l = 0;
Expand Down

0 comments on commit fe98a6b

Please sign in to comment.