Hi,
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.
VCF-1:
chr1 123456 rs12345678 A G . PASS AC=10;...
VCF-2:
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.
I don't have the time right now, but I would have a look at vcfanno for this job.
Thank you, Wouter. This is a beautiful tool that addresses my requirement without needing any sacrifice on ALT comparison (which is where bcftools becomes a pain). I'll test the performance and add an update.