Hi everyone, I am adding new vcf files to a previously made bcf file in which the ID field in the VCF had been set to CHR:POS:POS:REF:ALT ? How do I set the ID field in the VCF to CHR:POS:POS:REF:ALT ?
Thanks
Hi everyone, I am adding new vcf files to a previously made bcf file in which the ID field in the VCF had been set to CHR:POS:POS:REF:ALT ? How do I set the ID field in the VCF to CHR:POS:POS:REF:ALT ?
Thanks
Hey hrora,
You can set the VCF ID field to CHR:POS:POS:REF:ALT
with:
bcftools annotate -Ob -x 'ID' -I +'%CHROM:%POS:%POS:%REF:%ALT' MyVCF.vcf > out.bcf ;
To output VCF, use -Ov
, not -Ob
.
May I also recommend that you normalise your VCF by splitting multi-alleles into separate records and also left-aligning indels with the following piped commands:
bcftools norm -m-any MyVCF.vcf | \
bcftools norm --check-ref w -f human_g1k_v37.fasta | \
bcftools annotate -Ob -x 'ID' -I +'%CHROM:%POS:%POS:%REF:%ALT' > out.bcf ;
The middle command requires a reference genome - this is for left-aligning indels. If it's not needed, then simply remove that middle command.
Kevin
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.