This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Add tags/ header lines to a vcf file

hi all,

I'm trying to add some tags to my vcf file with a simple awk command but it's not working. I'm fairly new to this bioinformatics world and I highly appreciate your help. I'm sure there is a bcftools command that could do this (please let me know) but I found this awk command and tried it. Here is the command,

awk '/^#CHROM/ {printf("##fileformat==VCF4.0\n"); printf("##FORMAT=<ID=GT,Number=1, Type=String,Description=\"Genotype\">\n"); printf("##FORMAT=<ID=AD,Number=.,Type=Integer,Description=\"Alleic depths for the reference and alternate alleles in the order listed\">\n"); printf("##FORMAT=<ID=DP,Number=1,Type=Integer,Description=\"Read Depth (only filtered reads used for calling)\">\n"); printf("##FORMAT=<ID=PL,Number=3,Type=Float,Description=\"Normalized, Phred-scaled likelihoods for AA,AB,BB genotypes where A=ref and B=alt; not applicable if site is not biallelic\">\n"); } {print;} ' chrom1_DCas22_7004.vcf >> chrom1.vcf

best,

bcftools vcf

1 answer

Put your header lines in a text file (for instance header.txt) and use bcftools reheader --header header.txt for this.

I tried;

bcftools annotate -h hdr.txt chr1.vcf

but I'm getting this error message;

Failed to read from chr1.vcf: unknown file type

chr1.vcf is a vcf file without the tags/header lines. any thoughts on this?

Log in to answer this question.