From fe98a6b54536246ce650ad5fde0b75e99bb22fa0 Mon Sep 17 00:00:00 2001 From: Petr Danecek Date: Fri, 24 Feb 2023 15:37:41 +0100 Subject: [PATCH] The `-m` function did not respect the `--min-overlap` option Fixes #1869 --- NEWS | 2 ++ test/annotate.olap.2.out | 3 ++- test/test.pl | 2 +- vcfannotate.c | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 3609f0004..59a7efdd3 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/test/annotate.olap.2.out b/test/annotate.olap.2.out index eab0ef4fc..8453306df 100644 --- a/test/annotate.olap.2.out +++ b/test/annotate.olap.2.out @@ -5,6 +5,7 @@ ##ALT= ##INFO= ##INFO= +##INFO= #CHROM POS ID REF ALT QUAL FILTER INFO -1 10 . C . . END=19;DB=cnv10_15 +1 10 . C . . END=19;DB=cnv10_15;XXX 1 20 . C . . END=30 diff --git a/test/test.pl b/test/test.pl index 316a40be4..0d8490240 100755 --- a/test/test.pl +++ b/test/test.pl @@ -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'); diff --git a/vcfannotate.c b/vcfannotate.c index e0122585f..0f2e86380 100644 --- a/vcfannotate.c +++ b/vcfannotate.c @@ -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; jncols; j++) { @@ -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;