#To perform GWAS with correlation
#Input: y-vector of phenotype, X matrix of numeric genotype with rows as individuals and SNPs as column
#Output: vector of probability for SNPs in same order
GWASbyCor=function(X,y){
n=nrow(X)
r=cor(y,X)
n=nrow(X)
t=r/sqrt((1-r^2)/(n-2))
p=2*(1-pt(abs(t),n-2))
zeros=p==0
p[zeros]=1e-10
return(p)}