gotcha! thanks. this seems to be a little less straightforward than I had hoped but also not overly complicated. I simply used reheader and concatenated CIPOS to each INFO field using awk.
My vcf is missing the CIPOS tag and i would simply like to add CIPOS=0,0 to all records. I am having trouble executing this with bcftools
> bcftools annotate -c INFO/CIPOS="0,0" -o out.vcf in.vcf
The tag "CIPOS=0" is not defined in (null)
> bcftools annotate -c CIPOS=0,0 -o out.vcf in.vcf
The tag "CIPOS=0" is not defined in (null)
> bcftools annotate -c INFO/CIPOS -o out.vcf in.vcf
The tag "CIPOS" is not defined in (null)
Do I have to create another file? Is this because CIPOS is not defined in the header and I have to manually add it there?
Update: Adding a line to the header does prevent non-zero exit, but the default value I want is not added
echo "##INFO=<ID=CIPOS,Number=2,Type=Integer,Description=\"Confidence interval around POS\">" > hdr.txt
bcftools annotate -h hdr.txt -c CIPOS -o out.vcf in.vcf
Even with hdr.txt, i cannot explicitly set the value.
1 answer
This is not how bcftools annotate works. Please read the examples in the documentation to understand how to use -c - you will need -a as well.
I think the easiest thing to do in your case would be to add a header line manually then use awk to add CIPOS=0,0; to $8.
Hi, I'm trying to do something similar, could you share the code to do what you describe.
Thanks
Log in to answer this question.