It worked. Thanks!
• 2 views
•
link
Hello
I need to concatenate several hundreds of vcf files. When viewing the concatenated file I want to be able to know from which vcf file each row originated.
I thought about adding a column with the original file name but I'm:
I'm also rather new to working with vcf files so I don't want to reinvent the wheel, so I will really appreciate any advice to what is the standard way to do what I'm trying to accomplish.
Thanks in advance.
Using awk add a INFO definition in the header, and add the filename in the snp. The awk script should be something like (not tested):
/^#CHROM/ {
printf("##INFO=\n");
}
/^#/ { print; next;}
{
for(i=1;i<=NF;++i) { if(i>1) printf("\t"); if(i==8) printf("F=%s;",FILENAME); printf("%s",$i); }
printf("\n");
}
and then
awk -F '\t' -f script.awk in.vcf > out.vcf
It worked. Thanks!
Log in to answer this question.