Entering edit mode
9.6 years ago
aleix.arnau1990
▴
10
Hi! I am trying to plot a QQplot with results from a gwas runned with plink. I would like to know how can I add the tipical grey shadow showing confidence interval (95%CI). I can not find it. Does someone know?
My plot looks like that:
assoc<-read.table("all_SNPs_assoc.txt",header=TRUE,dec=".")
png("QQplot.png")
a<-assoc$SNP
n<-length(a)
the<-(-1*log(pchisq(rchisq(n,df=1),df=1,lower.tail=F),base=10))
# pchisq gives de distribution function
# rchisq generates random deviates
act<-(-1*log(assoc$P[a],base=10))
qqplot(the,act,main="QQplot assoc",xlab="Expected -log p",ylab="Observed -log p")
qqline(probs=0.05)
abline(0,1)
dev.off()
Thanks!
Thanks Ahill! But now, with my code like this:
It provides a nice plot, but with x and y axis in chi-squared values and I need it in expected -log pvalues. In my data I just have p-values that are the values that I give to variable P. How can I have the x and y axis with the original p-values and not converted to chi-squared values? Or there is some kind of
qq.pval()
function? Thanks.Don't worry! I found GWASTools package from bioconductor which solved my problem. Thanks for all.