I found the following blog useful, you need tweak the codes to fit F-value not -log10(p) value -
If you would like to use lattice or ggplot, we can create similar plot:
# just an example Fst <- rnorm(10000, 10, 5) chr <- c(rep(1, 2500), rep(2, 2500), rep(3, 2500), rep(4, 2500)) BP <- c(1:2500, 1:2500, 1:2500, 1:2500) mydf <- data.frame (Fst, chr, BP) require(ggplot2) qplot(BP, Fst, facets = . ~ chr, col = factor(chr), data = mydf)
I like bw theme better
qplot(BP, Fst, facets = . ~ chr, col = factor(chr), data = mydf) + theme_bw()
You need to reshape plot area or change arrangement of graph to make all facets in single line as Manhattan plot. The graph is pretty close but not exactly as in above blog code.
I have done the exact plot you want for FST.
here is where [R] becomes awesome:
dat<-read.csv("your.data.txt", header=FALSE, sep="\t") plot(dat$FST, col=as.factor(dat$CHR))
If you need the true coordinates ie BP I will send you a script I wrote to take that into account. Otherwise the code above will suffice.
Pretty much R gives the X values a number 1:length(dat$FST) and then colors the points by the dat$CHR
I want to create a Manhattan plot to plot Fst values of each SNP. I used John's first code to plot Fst values for 3 different chromosomes and it worked well. But the size of chromosomes are fixed, and I want to set the maximum size for each chromosome. Is it possible? The code that I used was:
Fst <- rnorm(48167,0.13, 0.2)
chr <- c(rep(1, 14552), rep(2, 33582), rep(10, 33))
BP <- c(1:14552, 1:33582, 1:33)
data <- data.frame (Fst, chr, BP) qplot(BP, Fst, facets = . ~ chr, col = factor(chr), data = data)
I tried to use the package qqman to plot Fst values instead of P values and did not work.
Or I need to use the perl script that Zev.Kronenberg mentioned? Convert chrmosomes positions into genomic coordiantes?