Run it on a headless node and suffer! Maybe add a pdf() so the plot is written to file?
• 0 views
•
link
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?
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
Log in to answer this question.
Use bcftools to perform the intersect operation then R to summarize and plot.