This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get Insertion / Deletion Count From Vcf

I have a VCF file and I wanted to get only the count for insertion and deletions identified in the VCF. Is there any way to simply output the count of insertions and deletions from a VCF file?

vcf

Line representing indel has a "INDEL" tag in most of the vcf files. You now have to compare the reference sequence and alternate sequence to find out if the variant is an insertion or deletion.

2 answers

In BEDOPS 2.4 and greater, you can do the following to get the counts of the number of single nucleotide variants:

$ vcf2bed --snvs < myVariants.vcf | wc -l

To get the number of insertions:

$ vcf2bed --insertions < myVariants.vcf | wc -l

And the number of deletions:

$ vcf2bed --deletions < myVariants.vcf | wc -l

vcfstats provides one simple method to do so. You can also generate length-frequency distributions using vcflengthdelta (also in vcflib).

Log in to answer this question.