This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to merge VCF files, and consider variants within a set distance as one

I'm trying to merge several VCF files, each with inserts from a different individual. There are inserts that appear in only one individual, yet other individuals have inserts very close by (with a difference of a few nucleotides). I suspect that these inserts are the same. Is there a way of merging these VCF files, and consider variants located within a set distance (e.g. 100 nucleotides) to be the same variant?

Thanks!

vcf variant

1 answer

There are several options for merging VCF files. The GATK set of tools has CombineVariants and vcftools also has a vcf_merge script. I generally use the CombineVariants option. For your second problem I suspect there are a variety of ways to approach it but I'm not sure what the "best" way is off hand. You could certainly script something fairly readily to filter out everything except indels and select indels close to each other in different samples for reporting. If using Python for instance you could use PyVCF and iterate over variants and samples. PyVCF has fairly extensive documentation.

Log in to answer this question.