diff --git a/api/api.go b/api/api.go index e8f9059..cf470f3 100644 --- a/api/api.go +++ b/api/api.go @@ -540,6 +540,13 @@ func (s *Source) UpdateHeader(r HeaderUpdater, ends bool, htype string, number s if s.Op == "by_alt" { number = "A" ntype = "String" + if strings.HasSuffix(s.Name, "_float") { + ntype = "Float" + s.Name = s.Name[:len(s.Name)-6] + } else if strings.HasSuffix(s.Name, "_int") { + ntype = "Integer" + s.Name = s.Name[:len(s.Name)-4] + } // for 'self' and 'first', we can get the type from the header of the annotation file. } else if htype != "" && (s.Op == "self" || s.Op == "first") { ntype = htype diff --git a/tests/by_alt_float/annotation.tsv.gz b/tests/by_alt_float/annotation.tsv.gz new file mode 100644 index 0000000..6a4373a Binary files /dev/null and b/tests/by_alt_float/annotation.tsv.gz differ diff --git a/tests/by_alt_float/annotation.tsv.gz.tbi b/tests/by_alt_float/annotation.tsv.gz.tbi new file mode 100644 index 0000000..f4a615f Binary files /dev/null and b/tests/by_alt_float/annotation.tsv.gz.tbi differ diff --git a/tests/by_alt_float/conf.toml b/tests/by_alt_float/conf.toml new file mode 100644 index 0000000..d0468ac --- /dev/null +++ b/tests/by_alt_float/conf.toml @@ -0,0 +1,5 @@ +[[annotation]] +names = ["CADD_RAW_float"] +file = "annotation.tsv.gz" +columns = [5] +ops = ["by_alt"] diff --git a/tests/by_alt_float/q.vcf b/tests/by_alt_float/q.vcf new file mode 100644 index 0000000..791d665 --- /dev/null +++ b/tests/by_alt_float/q.vcf @@ -0,0 +1,7 @@ +##fileformat=VCFv4.2 +##contig= +##INFO= +##INFO= +##hailversion=0.2.9-8588a25687af +#CHROM POS ID REF ALT QUAL FILTER INFO +chr2 41647 2_41647_A_G A G 1328.0 . AF=1.56250e-02;AQ=1328 diff --git a/tests/functional-test.sh b/tests/functional-test.sh index ab6dd3c..11aa5b6 100755 --- a/tests/functional-test.sh +++ b/tests/functional-test.sh @@ -187,3 +187,10 @@ run self_test_with_A_and_many_overlaps fn_self_test_with_A_and_many_overlaps assert_exit_code 0 assert_equal $(tail -1 $STDOUT_FILE | cut -f 8) "AC=35,65;GN_AF=0.3717,0.6122" assert_in_stdout "ID=GN_AF,Number=A" + + +run check_by_alts_float vcfanno -base-path tests/by_alt_float/ tests/by_alt_float/conf.toml tests/by_alt_float/q.vcf +assert_exit_code 0 +assert_equal $(tail -1 $STDOUT_FILE | cut -f 8) "AF=1.56250e-02;AQ=1328;CADD_RAW=0.591814" +go install -a +