Question: How to replicate vcftool's sliding window SNP density?
gravatar for serpalma.v
7 months ago by
serpalma.v30 wrote:


vcftools can calculate statistics such as pi and Fst using sliding windows.

I've noticed that windows in which the alternative allele is fixed are not taken into account. However, those appear in the VCF file.

For example, N_VARIANTS for pi at window_x is 20, but the region in the vcf file reports 25 SNPs, 5 of which are hom-alt in all samples.

I would like to find a way to calculate the SNP density as it comes in the vcf file using the same boundaries reported by vcftools.

Is there a way to make vcftools to do this?


sequencing snp vcftools • 288 views
ADD COMMENTlink modified 6 months ago by Vitis2.3k • written 7 months ago by serpalma.v30
gravatar for Vitis
6 months ago by
New York
Vitis2.3k wrote:

Create a window file in BED format and use 'bedtools intersect' to intersect VCF and the window file. I believe there is an option to report number of overlaps, which in your case, would be number of SNPs in the windows. Please see:

ADD COMMENTlink written 6 months ago by Vitis2.3k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1172 users visited in the last hour