Use bcftools annotate to add or remove annotations from VCF/BCF files. You can use annotation files in VCF, BED, or tab-delimited formats.
Key Options:
-a, --annotations <file>: The annotation source file.-c, --columns <list>: Defines which columns/tags to carry over. Use special prefixes for merge logic:TAG: Overwrite existing values (unless source is .).+TAG: Add only if existing value is ...TAG: Overwrite even if source is ...+TAG: Add new tag, never overwrite existing.\-TAG: Overwrite existing, never add if target doesn't exist.=TAG: Append to existing values.
-x, --remove <list>: Remove specific annotations (e.g., INFO, FORMAT/GT).-i, --include <EXPRESSION>: Include only sites matching an expression.-e, --exclude <EXPRESSION>: Exclude sites matching an expression.-m, --mark-sites <TAG>: Mark sites present/absent in the annotation file with a new INFO flag.
# Remove three fields
bcftools annotate -x ID,INFO/DP,FORMAT/DP file.vcf.gz
# Remove all INFO fields and all FORMAT fields except for GT and PL
bcftools annotate -x INFO,^FORMAT/GT,FORMAT/PL file.vcf
# Add ID, QUAL and INFO/TAG, not replacing TAG if already present
bcftools annotate -a src.bcf -c ID,QUAL,+TAG dst.bcf
# Carry over all INFO and FORMAT annotations except FORMAT/GT
bcftools annotate -a src.bcf -c INFO,^FORMAT/GT dst.bcf