Skip to content

fixref round up float numbers, convert small numbers to 0. #2486

@logust79

Description

@logust79

Hello developers!

I noticed that the fixref plugin (v1.22.1) will round up float numbers, and flatten small numbers to 0. Is this expected?

Example input vcf:

##fileformat=VCFv4.2
##INFO=<ID=AF,Number=A,Type=Float>
##INFO=<ID=SmallNumber,Number=A,Type=Float>
##contig=<ID=chr1,length=1000000000000>
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
chr1	55038469	.	C	A	.	.	AF=0.123894357;SmallNumber=2.03e-78

Example output vcf:

##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##INFO=<ID=AF,Number=A,Type=Float>
##INFO=<ID=SmallNumber,Number=A,Type=Float>
##contig=<ID=chr1,length=1000000000000>
##INFO=<ID=FIXREF,Number=.,Type=String,Description="The change made by bcftools/fixref">
##bcftools_pluginVersion=6b463daf-dirty+htslib-1.22.1
##bcftools_pluginCommand=plugin fixref -Ov -o out.vcf -- test.vcf -f /data/human_ref/Homo_sapiens_assembly38.fasta.gz -m swap; Date=Thu Nov 27 11:11:24 2025
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
chr1	55038469	.	C	A	.	.	AF=0.123894;SmallNumber=0;FIXREF=none

Notice that AF is rounded up to the sixth digit after decimal point and SmallNumber got flattened to 0.
command:

bcftools +fixref test.vcf -Ov -o out.vcf -- -f <ref> -m swap

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions