Changes

GWAS Controlling for Population Substructure

1,945 bytes added, 01:40, 7 June 2018
Created page with "<pre> plink --file GWAS_clean4 --genome --cluster --mds-plot 10 #### in R mydata &#61; read.table("mds_components.txt", header&#61;T) mydata$pch[mydata$Group&#61;&#61;1 ] &lt;..."
<pre>
plink --file GWAS_clean4 --genome --cluster --mds-plot 10
#### in R
mydata &#61; read.table("mds_components.txt", header&#61;T)
mydata$pch[mydata$Group&#61;&#61;1 ] &lt;-15
mydata$pch[mydata$Group&#61;&#61;2 ] &lt;-16
mydata$pch[mydata$Group&#61;&#61;3 ] &lt;-2
jpeg("mds.jpeg", height&#61;500, width&#61;500)
plot(mydata$C1, mydata$C2 ,pch&#61;mydata$pch)
dev.off()
q()
######
plink --file GWAS_clean4 --pheno pheno.txt --pheno-name Aff --logistic --adjust --out unadj
plink --file GWAS_clean4 --genome --cluster --pca 10 header
plink --file GWAS_clean4 --pheno pheno.txt --pheno-name Aff --covar plink.eigenvec --covar-name PC1 --logistic --adjust --out PC1
plink --file GWAS_clean4 --pheno pheno.txt --pheno-name Aff --covar plink.eigenvec --covar-name PC1-PC2 --logistic --adjust --out PC1-PC2
#### in R
broadqq &lt;-function(pvals, title)
{
observed &lt;- sort(pvals)
lobs &lt;- -(log10(observed))
expected &lt;- c(1:length(observed))
lexp &lt;- -(log10(expected / (length(expected)+1)))
plot(c(0,7), c(0,7), col&#61;"red", lwd&#61;3, type&#61;"l", xlab&#61;"Expected (-logP)", ylab&#61;"Observed (-logP)", xlim&#61;c(0,max(lobs)), ylim&#61;c(0,max(lobs)), las&#61;1, xaxs&#61;"i", yaxs&#61;"i", bty&#61;"l", main &#61; title)
points(lexp, lobs, pch&#61;23, cex&#61;.4, bg&#61;"black") }
jpeg("qqplot_compare.jpeg", height&#61;1000, width&#61;500)
par(mfrow&#61;c(2,1))
aff_unadj&lt;-read.table("unadj.assoc.logistic", header&#61;TRUE)
aff_unadj.add.p&lt;-aff_unadj[aff_unadj$TEST&#61;&#61;c("ADD"),]$P
broadqq(aff_unadj.add.p,"Some Trait Unadjusted")
aff_C1C2&lt;-read.table("PC1-PC2.assoc.logistic", header&#61;TRUE)
aff_C1C2.add.p&lt;-aff_C1C2[aff_C1C2$TEST&#61;&#61;c("ADD"),]$P
broadqq(aff_C1C2.add.p, "Some Trait Adjusted for PC1 and PC2")
dev.off()
gws_unadj &#61; aff_unadj[which(aff_unadj$P &lt; 0.0000001),]
gws_unadj
gws_adjusted &#61; aff_C1C2[which(aff_C1C2$P &lt; 0.0000001),]
gws_adjusted
</pre>
Bureaucrat, administrator
1,252
edits