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

Hi, everyone.

I would like to create a figure plotting SNP density for each chromosome from a vcf file. All I have on hand now is the vcf file after the SNP call. If anyone knows of any software suitable for this, please tell me.

Otherwise, any help or advice would be much appreciated. It must be doable because I see plenty of published papers with SNP density plotted against chromosome position, but I can't figure out how to do it myself.

Thank you very mach.

Taguchi

snp

@Pierre Lindenbaum Thank you for your advice !

Hi, Pierre

I thought this post is nearest to my situation and need. snp density plot

And I have another question about the script in this post. What does it mean "data.txt" in this script ? Is it name of input vcf file ?

library(karyoploteR)

#Read the data
vars <- read.table("data.txt", comment.char = "", header = TRUE)

#Build a GRanges and convert chromosome names from "1" to "chr1" 
vars <- toGRanges(vars[,c(1,2,2,3:length(vars))])
seqlevelsStyle(vars) <- "UCSC"

#Plot SNPs as Points
kp <- plotKaryotype(genome="hg19")
kpPoints(kp, data=vars, y=0.5)

#Plot SNPs as density
kp <- plotKaryotype(genome="hg19")
kpPlotDensity(kp, data=vars)

0 answers

No answers yet.

Log in to answer this question.