VCF file comparison and plotting them
1
0
Entering edit mode
2.2 years ago
Sara ▴ 260

I have 2 vcf files and want to compare them and make some plots including venndiagram. I tried bcftools to compare 2 vcf files but it does not make any plot. Do you know what tool I can use for this purpose?

vcf • 793 views
ADD COMMENT
1
Entering edit mode

Use bcftools to perform the intersect operation then R to summarize and plot.

ADD REPLY
2
Entering edit mode
2.2 years ago

A one liner:

comm \
   <(bcftools query -f '%CHROM:%POS:%REF:%ALT\n' vcf1.vcf.gz |  sort )  \
   <(bcftools query -f '%CHROM:%POS:%REF:%ALT\n' vcf2.vcf.gz |  sort )  |\
    awk -F '\t' '{if($1!="") N1++; if($2!="") N2++;if($3!="") N3++;} END {printf("pdf(\"out.pdf\");barplot(c(%d,%d,%d),main=\"compare\",ylab=\"Variants\",names.arg=c(\"uniq to VCF1\",\"uniq to VCF2\",\"Common\"));dev.off();\n",N1,N2,N3);}' |\
   R --vanilla
ADD COMMENT
0
Entering edit mode

Run it on a headless node and suffer! Maybe add a pdf() so the plot is written to file?

ADD REPLY
1
Entering edit mode

Run it on a headless node and suffer!

fixed

ADD REPLY

Login before adding your answer.

Traffic: 1262 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6