In the methods sections the authors specified that they used the --r2 command in plink. I read the details of this command in the plink website, but I am still not sure how should I use the output file to plot a similar thing.
Any help would be really appreciated.
Thank you in advance.
Javier
Ps: Heres the article's title: Population Genetic Structure of the People of Qatar (2010)
I got an answer from another post, and what I need to do is calculate the distance between SNP A and SNP B and calculate the r2 averages for every distance binned for example every 1kb. Do you know how to do a script that could do that?
In the plink.ld file you have colums CHR_A, BP_A, SNP_A, CHR_B, BP_B, SNP_B and R2.
in R do
# install and load ggplot2
install.packages("ggplot2")
library(ggplot2)
# import the data
ld <- read.table("plink.ld", sep="\t",header=T)
# plot the average correlation for each snp distance
ggplot(ld) +
geom_line(aes(x=BP_B - BP_A, y = R2))
No i have never used plink before, for me this is just a visualization question. And it should be really straightforward. Check if your data frame is alright by dim(ld), str(ld), summary(ld)
I had the same problem as described by veronicaschroeder78:
Error in eval(expr, envir, enclos) : object 'BP_B' not found.
I solved the problem by modifying a little be in Iran's codes: change sep="\t" to sep="", others keep the same, and also change "geom_line" to "geom_point" will give you scatter plot of the LD.
Can you post the first 4 lines of the plink.ld file containing the pai wise correlations?
Hi Irsan:
Heres the output file I get from plink using default values
http://postimg.org/image/87hq8nodp/
I got an answer from another post, and what I need to do is calculate the distance between SNP A and SNP B and calculate the r2 averages for every distance binned for example every 1kb. Do you know how to do a script that could do that?
Thank you!
Hi
i have two file:ped and map
which command of plink is requir to build input file for R?(for linkage disequilibrium decay across the genome)
Your question is unrelated to this old thread and should be asked in a separate question.