This is a test version of Biostars. For the public version, visit https://www.biostars.org.
What is the difference between `view` and `annotate` in bcftools?

I am wondering what is the difference between view and annotate in bcftools?

Example:

bcftools annotate -x FILTER/PASS file.vcf.gz

VS

bcftools view -f PASS file.vcf.gz

maybe in terms of speed, memory... etc?

bcftools

2 answers

most bcftools commands have the -e and -i options to select some variants. bcftools view have more options for filtering "-m, -M , --types , etc..` . The main goal of bcftools annotate is to remove/add information from a VCF input.

bcftools annotate -x FILTER/PASS file.vcf.gz

you're NOT filtrering out any variant here, you're just removing the information FILTER/PASS from the variant

bcftools view -f PASS file.vcf.gz

here you DO filter out variants that don't have the FILTER=PASS

but if I do bcftools annotate -x ^FILTER/PASS file.vcf.gz, which is removing all information other than FILTER=PASS, is it the same as bcftools view -f PASS file.vcf.gz ?

Got it! Thank you!

The view command is used to filter, subset, and convert VCF/BCF files, while the annotate command is used to add information to VCF/BCF files.

but can i use the annotate command for filtering? Is there any advantage or disadvantage with the annotate over view? Thanks!

Log in to answer this question.