Question: bcftools annotate from ID file in 1 VCF to an INFO field in another VCF
gravatar for RamRS
5 months ago by
Baylor College of Medicine, Houston, TX
RamRS30k wrote:


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.

bcftools annotate • 213 views
ADD COMMENTlink written 5 months ago by RamRS30k

I don't have the time right now, but I would have a look at vcfanno for this job.

ADD REPLYlink written 5 months ago by WouterDeCoster44k

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.

ADD REPLYlink written 5 months ago by RamRS30k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1360 users visited in the last hour