This is a test version of Biostars. For the public version, visit https://www.biostars.org.
SNP/kb in chromosome wise

Hi,

I need to calculate the SNPs per kb for my rice samples. I have separated out SNPs from the main vcf file as a separate vcf.

Previously I have generated SNP density plot using CMPlot R Package, where I have given 1 Mb window size (10e6). This was able to give the number SNPs per Mb for each chromosome. However when I tried the same tool for my current analysis (SNPs per 1Kb), it is not working, as it is not creating 1 Kb windows as intended.

What could be the possible reason? Is there any alternate method to get this SNPs per Kb and then generate an SNP density plot like the one generated using CMPlot?

Please help

Thanks

variant snp calling

1 answer

number of variants per 1Mb, assuming the vcf is ordered on chrom/pos:

bedtools makewindows  -g ref.fasta.fai -w 1000000 | LC_ALL=C sort -t $'\t' -k1,1 -k2,2n | bedtools intersect -a - -b in.vcf.gz  -c  -sorted

Log in to answer this question.