I have 2 VCF files. I'd like to annotate one of them using the other. My first VCF is a regular VCF file, while the other is an annotation file in VCF format. The annotation VCF has my field of interest in the ID field. It is pretty simple to copy over matching
INFO fields from 1 VCF to another, but there doesn't seem to be a way to do this for the ID field.
chr1 123456 rs12345678 A G . PASS AC=10;...
chr1 123456 custom_ID_ABC123 A G . . custom_field=value;...
I'd like this as the output:
chr1 123456 rs12345678 A G . PASS AC=10;my_ID=custom_ID_ABC123...
The aim is to get the value in the ID field from VCF-2 to an INFO field in VCF-1. I tried:
bcftools annotate --collapse none -c 'INFO/my_ID:=ID' -a VCF-1 VCF-2
but I get the error:
The tag "INFO/my_ID" is not defined in VCF-2
I tried swapping the column parameter (to
ID:=INFO/my_ID - I know it makes no sense but what's the harm in trying) but that didn't work either.
I know I can extract the CHR, POS, ID as a tab separated file to use in
bcftools annotate but I want to use the
--collapse none option and that only works if the annotation file is in VCF format.
I'd appreciate any pointers on this.