How to plot "Distribution of SNPs per Mbp"
2
2
Entering edit mode
6 months ago
Curls ▴ 20

Hi,

I am trying to get the similar plot below for my data. I have VCF file from GBS analysis. How can I draw this plot from VCF file. Thanks.

plot • 660 views
0
Entering edit mode

Do you have a preferred language? What analysis environments are you familiar with?

0
Entering edit mode

5
Entering edit mode
6 months ago
tothepoint ▴ 620

A similar plot can be generated with CMplot if you have data in such format.

0
Entering edit mode

Thanks all.

devarora Your suggestion worked well. Finally I obtained my plot. Thank you so much!

1
Entering edit mode
6 months ago

Here's a way to get a text file containing counts of variants per 1Mb bin across hg38 (replace with your assembly of choice):

$fetchChromSizes hg38 \ | awk -vOFS="\t" '{ print$1, "0", \$2; } \
| grep -vE '*_*' \
| sort-bed - \
| bedops --chop 1000000 - \
| bedmap --echo --count --delim '\t' - <(vcf2bed < variants.vcf) \

Once you have answer.txt, you can bring that into R to make a density plot with ggplot2.

I have an example Rscript from a previous question, which demonstrates use of geom_tile for making an ideogram-like figure similar to what is in your question:

Plotting SNP density heatmap chromosome ideogram