Count all variants from vcf file
2
0
Entering edit mode
2.3 years ago
t.ali • 0

I have vcf files from gatk pipleline, now I want to count all the variants in a file. Can anyone help? Thanks

variants vcf Count • 947 views
ADD COMMENT
0
Entering edit mode
zgrep -cv "^#" <vcf_file>
ADD REPLY
1
Entering edit mode
2.3 years ago
raphael.B ▴ 520

Hello! You can use bcftools query -f "A\n" <your_vcf> | wc -l

ADD COMMENT
0
Entering edit mode

I tried this and it worked. Thanks alot

ADD REPLY
1
Entering edit mode
2.3 years ago
bcftools query -N -f '.' in.vcf | wc -c

or

  bcftools index -s indexed.vcf.gz |  cut -f 3 |  paste -s -d '+' | bc

EDIT 2024: there is now a new behavior in bcftools query:

    -N, --disable-automatic-newline   Disable automatic addition of newline character when not present
ADD COMMENT

Login before adding your answer.

Traffic: 1568 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