Add tags/ header lines to a vcf file
1
0
Entering edit mode
5 months ago

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 • 362 views
ADD COMMENT
0
Entering edit mode
5 months ago
DBScan ▴ 450

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

ADD COMMENT
0
Entering edit mode

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?

ADD REPLY

Login before adding your answer.

Traffic: 2568 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6