From e57a6c67c5bc4a6d927e937b5cf6595154d48742 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 7 Oct 2026 17:10:49 +1030 Subject: [PATCH] norm: left-align with INFO/END but no INFO/SVLEN (#2601) A took its length only from INFO/SVLEN, so one described by INFO/END alone was returned unchanged rather than realigned. The branch uses line->rlen, which htslib already derives from INFO/END or INFO/SVLEN for both types, so do the same for . Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Dave Lawrence --- test/norm.symbolic.4.1.out | 10 ++++++++++ test/norm.symbolic.4.vcf | 8 ++++++++ test/test.pl | 1 + vcfnorm.c | 5 +---- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 test/norm.symbolic.4.1.out create mode 100644 test/norm.symbolic.4.vcf diff --git a/test/norm.symbolic.4.1.out b/test/norm.symbolic.4.1.out new file mode 100644 index 00000000..64cc40be --- /dev/null +++ b/test/norm.symbolic.4.1.out @@ -0,0 +1,10 @@ +##fileformat=VCFv4.2 +##FILTER= +##INFO= +##INFO= +##INFO= +##contig= +#CHROM POS ID REF ALT QUAL FILTER INFO +1 11 . G GGATTACA . PASS SVTYPE=DUP +1 11 . G . PASS SVTYPE=DUP;END=18 +1 11 . G . PASS SVTYPE=DUP;SVLEN=7;END=18 diff --git a/test/norm.symbolic.4.vcf b/test/norm.symbolic.4.vcf new file mode 100644 index 00000000..1530a568 --- /dev/null +++ b/test/norm.symbolic.4.vcf @@ -0,0 +1,8 @@ +##fileformat=VCFv4.2 +##INFO= +##INFO= +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO +1 26 . G GATTACAG . PASS SVTYPE=DUP +1 26 . G . PASS SVTYPE=DUP;END=33 +1 26 . G . PASS SVTYPE=DUP;SVLEN=7;END=33 diff --git a/test/test.pl b/test/test.pl index c0e600c4..060c73a2 100755 --- a/test/test.pl +++ b/test/test.pl @@ -312,6 +312,7 @@ run_test(\&test_vcf_norm,$opts,in=>'norm.join-missing-ploidy',out=>'norm.join-missing-ploidy.1.out',args=>'-m +both'); run_test(\&test_vcf_norm,$opts,in=>'norm.split.5',out=>'norm.split.5.1.out',args=>'-m - --multi-overlaps .'); run_test(\&test_vcf_norm,$opts,in=>'norm.symbolic.3',out=>'norm.symbolic.3.1.out',fai=>'norm.symbolic.3',args=>''); +run_test(\&test_vcf_norm,$opts,in=>'norm.symbolic.4',out=>'norm.symbolic.4.1.out',fai=>'norm.symbolic.3',args=>''); run_test(\&test_vcf_norm,$opts,in=>'norm',out=>'norm.out',fai=>'norm',args=>'-cx'); run_test(\&test_vcf_norm,$opts,in=>'norm.split',out=>'norm.split.out',args=>'-m-'); run_test(\&test_vcf_norm,$opts,in=>'norm.split',out=>'norm.split.1.out',args=>'-m- -a'); diff --git a/vcfnorm.c b/vcfnorm.c index b32d521b..1b734694 100644 --- a/vcfnorm.c +++ b/vcfnorm.c @@ -697,10 +697,7 @@ static int realign(args_t *args, bcf1_t *line) // TODO: there should be check for symbolic allele length. If too big, perhaps should not attempt realignment int32_t sv_len = 0; if ( !strncmp("d.allele[i],4) ) sv_len = -line->rlen; - else if ( !strncmp("d.allele[i],4) ) - { - if ( bcf_get_info_int32(args->hdr,line,"SVLEN",&args->int32_arr,&args->nint32_arr)==1 ) sv_len = args->int32_arr[0]; - } + else if ( !strncmp("d.allele[i],4) ) sv_len = line->rlen - 1; // like , htslib sets rlen from INFO/END or INFO/SVLEN if ( !sv_len ) return ERR_SYMBOLIC; als[i].l = 0;