This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is it possible to count the number of loci in a VCF file?

I'm wondering if in my VCF file, I can count the number of loci.

I would count the number of SNPs with

egrep -v "^#" input.vcf | wc -l

But what about the number of loci? If I have 55 individuals in my VCF file, does this is an issue?

vcf snp loci

1 answer

use option -c to count:

grep  -c -v "^#" input.vcf

I know that a SNP can be accounted as a locus, but do you know if there is a way to know how many SNPs I called in the different genes on my reference genome. I have he annotation file "GFF". Is there a tool that can map the number of SNPs to the genes?

convert the vcf to bed and then use bedtools intersect...

I used this code to intersect the GFF and the bed files, but how do you count the number of SNPs per gene in the GFF? bedtools intersect -a gene.gff \ -b output.bed

This is just, I think, giving the similarities in the 2 documents. Right?

Log in to answer this question.