This is a test version of Biostars. For the public version, visit https://www.biostars.org.
comparing variants between two VCF files

I have two VCF files (e.g. SV1.vcf.gz, SV2.vcf.gz) and a bed file (reg.bed). I would like to compare the variants among them in the BED regions. The comparison includes the common variants and unique variants present in SV1 and SV2.

I am currently doing this with several steps like the followings

tabix -R reg.bed SV1.vcf.gz > SV1.BR.vcf.gz  
tabix -R reg.bed SV2.vcf.gz > SV2.BR.vcf.gz

It seems the above two steps do not retain the headers, so I needed to extract the headers and append them at the beginning and then use bgzip and tabix. For finding the common and unique variants among these two, I used the following

bcftools isec -n~11 -c all SV1.BR.vcf.gz SV2.BR.vcf.gz > common.txt
bcftools view -T common.txt SV1.BR.vcf.gz -Oz > SV1.unique.txt
bcftools view -T common.txt SV2.BR.vcf.gz -Oz > SV2.unique.txt 

I am just wondering if there exist any other tools for this without running the script with the above commands. Any tools that also produces some good visualizations will be really useful.

vcf sv bed

1 answer

You may want to look at https://github.com/asntech/intervene We use this to produce VCF UpSet plots for benchmarkingenter image description here

intervene upset --figtype png --type genomic -i vcf1 vcf2 vcf3 --save-overlaps --filenames --bedtools-options header

Log in to answer this question.