This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Count number of InDels per chromosome in Raw vcf file

Hello to all,

I want to count the number of InDels for each chromosome in the Raw VCF file.

What is the best idea?

Best Regard

Mostafa

snp

many thanks for your reply,

Now, if i want to count the number of SNPs for each Breed, what is the best idea?

i have 5 breed in the my raw vcf.

I used these two scripts to count insertions and deletions, but the output was zero?

insertions:

awk '! /\#/' variants.vcf | awk '{if(length($4) > 1 ) print}' | wc -l

deletions:

awk '! /\#/' variants.vcf | awk '{if(length($5) > 1) print}' | wc -l

That is not a good solution, as you might have variants with multiple alleles, see this example:

chr1    10812   rs1197106884    G       C,T     .       .       RS=1197106884;RSPOS=10812;dbSNPBuildID=151;SSR=0;SAO=0;VP=0x050000020005000002000100;GENEINFO=DDX11L1:100287102;WGT=1;VC=SNV;R5;ASP;TOPMED=0.99756307339449541,0.00242896279306829,0.00000796381243628

This would be a InDel count with your script, but is a SNP. Refer to the offered solutions.

1 answer

Via BEDOPS convert2bed:

$ vcf2bed --snvs < foo.vcf | wc -l
$ vcf2bed --insertions < foo.vcf | wc -l
$ vcf2bed --deletions < foo.vcf | wc -l

Log in to answer this question.