# VCF merge containing CNV

How do I merge VCFs files containing CNVs?

I use vcf-merge, a VCFtools function, and after bgzip and tabix, SAMtools, to index and tab separate variants, but I don't know if it is the right way.

• Can you post an example line from the VCF? If the CNV is formatted like a SNP, just with insertion/deletion alleles, I see no reason why there should be any problem. Then again, you can always just extract a line from the merged file and see if it looks as expected. – juod Sep 8 '17 at 7:33

vcf-merge (or better: bcftools merge) does a column-based merge of VCF files, basically taking on an additional genotype column to each variant. While this sort-of works, it doesn't take into account all the information about variation. There might be low coverage at a region in one VCF file that indicates a deletion, but the deletion is only observable when considering other samples with high coverage at that same region. It's also possible that INDELs could be defined differently in different samples, requiring an additional bcftools norm step for left-normalisation prior to the merge.
Assuming this column-based merge is what you want (and if not, then bcftools concat is your friend for row-based merging), then it's better to regenerate the merged VCF file as a multi-column file directly. One way of doing this is feeding all BAM files into samtools mpileup to generate genotype likelihoods, then feeding the result of that into bcftools call. Something like the following:
samtools mpileup -uf ref.fa in1.bam in2.bam in3.bam | \