comparing variants between two VCF files

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.





Read more here: Source link