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.
Bioinformatics Stack Exchange is a question and answer site for researchers, developers, students, teachers, and end users interested in bioinformatics. It only takes a minute to sign up.
Sign up to join this communityHow 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.
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 | \
bcftools call -mv -O z -o variants_ref_1-3.vcf.gz
depending on your goals you could possibly use tools like https://github.com/mkirsche/Jasmine or simple bedtools intersect on the vcf entries could help (e.g. harmonize after the calling)
or if you have a cohort maybe possibly doing joint-CNV calling or "genotyping CNV" in a cohort is useful http://penncnv.openbioinformatics.org/en/latest/user-guide/joint/ or https://github.com/abyzovlab/CNVpytor#merging-calls-form-multiple-samples