How can I annotate a vcf file with IDs from a bed file?
I have a bgzip compressed bed file with the required three columns (chrom, chromStart and chromEnd) and a fourth column that contains the IDs. The bed file does not have a header record.
I indexed the file with
tabix -p bed myBedFile.gz
Now I would like to annotate SNP variant records in a vcf file with the IDs from the bed file, based on exact matching of the vcf CHROM / POS fields to the chrom, chromStart and chromEnd columns of the bed file.
I believe this should be possible with bcftools annotate
bcftools annotate -c CHROM,FROM,TO,ID -a myBedFile.bed.gz myVcfFile.vcf.gz
returns a vcf file with unchanged SNP variant records, no ID is set in the ID column or the INFO column.
How can I annotate the vcf ID column with IDs from matching positions a bed file? Preferable with a tool like bcftools?