Skip to content

bcftools consensus mask not applied when input vcf file contains no variants #1592

Closed
@charlesfoster

Description

Hi,
As part of a workflow I use bcftools consensus to generate consensus genomes, with low coverage sites masked with Ns. Command as follows:

bcftools consensus -p $PREFIX -f $REFERENCE --mark-del '-' -m $MASK -H I -i 'INFO/DP >= 10 & GT!="mis"' $VCF > consensus.fa

This command works well in most cases: variants are applied, and low-coverage sites are masked with 'N'. However, there are some cases where (for whatever reason) the reads files for sample(s) are completely empty, then the mapped BAM files are empty and no variants are called as expected (VCF file contains only headers and no variants). In this situation, my coverage mask (bed-format file) indicates that the whole consensus genome (29903 nt) should be masked:

NC_045512.2	0	29903	0

Instead, in these cases no variants are applied (obviously), but the resulting consensus genome is returned as identical to the reference genome since the full-genome mask is not applied. I would instead hope that the resulting consensus genome is 100% Ns.

Is it possible to have the mask be respected even when no variants are in the VCF file? If I add even a single fake variant with a depth of 1 to the VCF file, the resulting consensus genome is 100% Ns (as hoped).

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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