Skip to content

Commit fe98a6b

Browse files
committed
The -m function did not respect the --min-overlap option
Fixes #1869
1 parent cfa3b4d commit fe98a6b

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Changes affecting specific commands:
77
- The `-m, --mark-sites` option can be now used to mark all sites without the
88
need to provide the `-a` file (#1861)
99

10+
- Fix a bug where the `-m` function did not respect the `--min-overlap` option (#1869)
11+
1012
* bcftools stats
1113

1214
- Collect new VAF (variant allele frequency) statistics from FORMAT/AD field

test/annotate.olap.2.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
##ALT=<ID=CNV,Description="Copy Number Variation">
66
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
77
##INFO=<ID=DB,Number=1,Type=String,Description="CNV id from a database">
8+
##INFO=<ID=XXX,Number=0,Type=Flag,Description="Sites listed in XXX">
89
#CHROM POS ID REF ALT QUAL FILTER INFO
9-
1 10 . C <CNV> . . END=19;DB=cnv10_15
10+
1 10 . C <CNV> . . END=19;DB=cnv10_15;XXX
1011
1 20 . C <CNV> . . END=30

test/test.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@
499499
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');
500500
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');
501501
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');
502-
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');
502+
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');
503503
run_test(\&test_vcf_annotate,$opts,in=>'annotate.id',vcf=>'annots.id',out=>'annotate.id.1.out',args=>'-c ALT');
504504
run_test(\&test_vcf_annotate,$opts,in=>'annotate.id',vcf=>'annots.id',out=>'annotate.id.2.out',args=>'-c +ALT');
505505
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');

vcfannotate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3103,9 +3103,9 @@ static void annotate(args_t *args, bcf1_t *line)
31033103
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);
31043104
if ( ret==0 )
31053105
args->cols[j].done = 1;
3106+
has_overlap = 1;
31063107
}
31073108
}
3108-
has_overlap = 1;
31093109
}
31103110
for (j=0; j<args->ncols; j++)
31113111
{
@@ -3264,6 +3264,7 @@ static void annotate(args_t *args, bcf1_t *line)
32643264
has_overlap = 1;
32653265
}
32663266
}
3267+
fprintf(stderr,"has_overlap=%d mark=%s\n",has_overlap,args->mark_sites);
32673268
if ( args->set_ids )
32683269
{
32693270
args->tmpks.l = 0;

0 commit comments

Comments
 (0)