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.
https://genome.ucsc.edu/FAQ/FAQformat.html
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
https://samtools.github.io/bcftools/bcftools.html#annotate
but my
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?
Ok good to known that this should work / works for someone else. I might very well have made a mistake my self. I'll double check what I did and the points you mentioned. Thanks.