add INFO tag to vcf with bcftools
1
0
Entering edit mode
24 months ago

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.

bcftools vcf • 843 views
ADD COMMENT
1
Entering edit mode
24 months ago
Ram 43k

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.

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

Hi, I'm trying to do something similar, could you share the code to do what you describe.

Thanks

ADD REPLY

Login before adding your answer.

Traffic: 1951 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