I am trying to extract only the columns I need from VCF preserving VCF structure, its header, its formatting. I am using bcftools. I tried doing:
bcftools annotate -c CHROM,POS,ID,REF,ALT,QUAL,FILTER,INFO/AF,INFO/AC,INFO/AN Holland.vcf -o Holland_selected_cols.vcf
But the output file just stays the same. Then I tried query:
bcftools query -f'[%CHROM\t%POS\t%ID\t%REF\t%ALT\t%QUAL\t%FILTER\t%INFO/AF;%INFO/AC;%INFO/AN\n]' -H Holland.vcf -o Holland_selected_cols.vcf
But it does not preserve VCF header. What would be the right bcftools command for that?
bcftools
vcf