Skip to content

consensus --missing not compatible with gvcf blocks #2350

@Fan-iX

Description

@Fan-iX

bcftools version: 1.21
Doing consensus with flag --missing will throw error on missing (./.) gvcf blocks. Here is a minimal reproducible example:

test.vcf.gz:

##fileformat=VCFv4.2
##contig=<ID=1,length=100>
##ALT=<ID=*,Description="Represents allele(s) other than observed.">
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
##INFO=<ID=MIN_DP,Number=1,Type=Integer,Description="Minimum per-sample depth in this gVCF block">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT  1
1       3       .       A       .       .       .       END=5;MIN_DP=1;AN=0     GT      ./.
Inline commands to reproduce, for your convenience
printf '##fileformat=VCFv4.2\n##contig=<ID=1,length=100>\n##ALT=<ID=*,Description="Represents allele(s) other than observed.">\n##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">\n##INFO=<ID=MIN_DP,Number=1,Type=Integer,Description="Minimum per-sample depth in this gVCF block">\n##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">\n##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">\n#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t1\n1\t3\t.\tA\t.\t.\t.\tEND=5;MIN_DP=1;AN=0\tGT\t./.' | bcftools view -Oz -o test.vcf.gz --write-index

Running command

printf ">1\nAAAAAA" | bcftools consensus --missing N test.vcf.gz

will throws error:

The fasta sequence does not match the REF allele at 1:3:
   REF .vcf: [A]
   ALT .vcf: [N]
   REF .fa : [AAA]A

While the expected output is

>1
AANNNA

Or is there any other way to preserve missing sites when performing consensus on gvcf files?

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