Hi,
I draw Manhattan plot in R but I like to show also the name of genes on it (http://www.genetics.org/content/187/2/367/F2.large.jpg) ? how can i do that ?
many thanks in advance
Hi,
I draw Manhattan plot in R but I like to show also the name of genes on it (http://www.genetics.org/content/187/2/367/F2.large.jpg) ? how can i do that ?
many thanks in advance
In relation to the above comments I just wanted to add a small example of a manhatten plot with addition of rs number (or genes) in R:
pval<-runif(100000, 0, 1); logPval<--log(pval,base=10); pos=1:100000; chr<-paste("chr",rep(1:20,ea=5000),sep=""); rsID<-paste("rs",1:100000,sep=""); data<-as.data.frame(cbind(chr,pos,rsID,pval,logPval));
vek<-as.numeric(gsub(data$chr,pattern="chr",replacement=""))%%2
vek2<-ifelse(as.numeric(as.character(data[,"pval"]))<0.0001,T,F)
plot(x=as.numeric(data$pos),y=as.numeric(as.character(data$logPval)),col=c("red","blue")[as.factor(vek)])
text(labels=as.character(data$rsID[vek2]),x=as.numeric(data$pos)[vek2],y=as.numeric(as.character(data$logPval))[vek2],pos=4,cex=0.8)
If I look at this plot I would almost think that these are placed there by hand.
I'm not sure how your Manhattan plot looks like right now (did you use any package?) but Getting Genetics Done has quite some nice code examples about making a Manhattan plot and QQ plot in R using ggplot2
If you are willing to leave R you could also look at WGA viewer which can plot your Manhattan plot and add different data tracks next to it.
If you're just interested in showing the association later for a specific region I would recommend using LocusZoom, that tool can plot gene names + locations and adds LD information to a locus of interest.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
@Sander - Thanks for the link to my code. I've also used LocusZoom and found it useful. You can probably d/l a local copy and mod the code to add text to the plot.
@Sarah - It shouldn't be hard to add the text in R using a text() command after creating the plot using the code in http://gettinggeneticsdone.blogspot.com/2011/04/annotated-manhattan-plots-and-qq-plots.html. You could even join your list of SNPs to a list of genes (as in http://gettinggeneticsdone.blogspot.com/2011/06/mapping-snps-to-genes-for-gwas.html ) and then automatically add gene labels if p is less than a threshold.
I'd agree with Stephen that adding using text is probably the easiest way to do it. Unless you do this everyday and need a function to do it repeatedly, it's probably the best time investment.