<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://statgen.us/index.php?action=history&amp;feed=atom&amp;title=GWAS_Data_QC_Exercise</id>
		<title>GWAS Data QC Exercise - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://statgen.us/index.php?action=history&amp;feed=atom&amp;title=GWAS_Data_QC_Exercise"/>
		<link rel="alternate" type="text/html" href="http://statgen.us/index.php?title=GWAS_Data_QC_Exercise&amp;action=history"/>
		<updated>2026-04-05T21:55:39Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://statgen.us/index.php?title=GWAS_Data_QC_Exercise&amp;diff=621&amp;oldid=prev</id>
		<title>Zhihuiz at 15:34, 7 June 2018</title>
		<link rel="alternate" type="text/html" href="http://statgen.us/index.php?title=GWAS_Data_QC_Exercise&amp;diff=621&amp;oldid=prev"/>
				<updated>2018-06-07T15:34:21Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:34, 7 June 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__NOTITLE__&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==GWAS Data QC Exercise==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt; plink --file GWAS --noweb&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt; plink --file GWAS --noweb&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; plink --file GWAS --mind 0.10 --recode --out GWAS_clean_mind --noweb&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; plink --file GWAS --mind 0.10 --recode --out GWAS_clean_mind --noweb&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhihuiz</name></author>	</entry>

	<entry>
		<id>http://statgen.us/index.php?title=GWAS_Data_QC_Exercise&amp;diff=573&amp;oldid=prev</id>
		<title>Zhihuiz at 17:00, 6 June 2018</title>
		<link rel="alternate" type="text/html" href="http://statgen.us/index.php?title=GWAS_Data_QC_Exercise&amp;diff=573&amp;oldid=prev"/>
				<updated>2018-06-06T17:00:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 17:00, 6 June 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;==GWAS Data QC==&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt; plink --file GWAS --noweb&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;plink --file GWAS --noweb&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; plink --file GWAS --mind 0.10 --recode --out GWAS_clean_mind --noweb&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; plink --file GWAS --mind 0.10 --recode --out GWAS_clean_mind --noweb&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; plink --file GWAS_clean_mind --maf 0.05 --recode --out MAF_greater_5 --noweb&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; plink --file GWAS_clean_mind --maf 0.05 --recode --out MAF_greater_5 --noweb&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Zhihuiz</name></author>	</entry>

	<entry>
		<id>http://statgen.us/index.php?title=GWAS_Data_QC_Exercise&amp;diff=572&amp;oldid=prev</id>
		<title>Zhihuiz: Created page with &quot;==GWAS Data QC== &lt;pre&gt;  plink --file GWAS --noweb  plink --file GWAS --mind 0.10 --recode --out GWAS_clean_mind --noweb  plink --file GWAS_clean_mind --maf 0.05 --recode --out...&quot;</title>
		<link rel="alternate" type="text/html" href="http://statgen.us/index.php?title=GWAS_Data_QC_Exercise&amp;diff=572&amp;oldid=prev"/>
				<updated>2018-06-06T16:59:14Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;==GWAS Data QC== &amp;lt;pre&amp;gt;  plink --file GWAS --noweb  plink --file GWAS --mind 0.10 --recode --out GWAS_clean_mind --noweb  plink --file GWAS_clean_mind --maf 0.05 --recode --out...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==GWAS Data QC==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 plink --file GWAS --noweb&lt;br /&gt;
 plink --file GWAS --mind 0.10 --recode --out GWAS_clean_mind --noweb&lt;br /&gt;
 plink --file GWAS_clean_mind --maf 0.05 --recode --out MAF_greater_5 --noweb&lt;br /&gt;
 plink --file GWAS_clean_mind --exclude MAF_greater_5.map --recode --out MAF_less_5 --noweb&lt;br /&gt;
 plink --file MAF_greater_5 --geno 0.05 --recode --out MAF_greater_5_clean --noweb&lt;br /&gt;
 plink --file MAF_less_5 --geno 0.01 --recode --out MAF_less_5_clean --noweb&lt;br /&gt;
 plink --file MAF_greater_5_clean --merge MAF_less_5_clean.ped MAF_less_5_clean.map --recode --out GWAS_MAF_clean --noweb&lt;br /&gt;
 plink --file GWAS_MAF_clean --mind 0.03 --recode --out GWAS_clean2 --noweb&lt;br /&gt;
 plink --file GWAS_clean2 --check-sex --out GWAS_sex_checking --noweb&lt;br /&gt;
 &lt;br /&gt;
R:&lt;br /&gt;
 sexcheck = read.table(&amp;quot;GWAS_sex_checking.sexcheck&amp;quot;, header=T)&lt;br /&gt;
 names(sexcheck)&lt;br /&gt;
 sex_problem = sexcheck[which(sexcheck$STATUS==&amp;quot;PROBLEM&amp;quot;),]&lt;br /&gt;
 sex_problem&lt;br /&gt;
 q()&lt;br /&gt;
 plink --file GWAS_clean2 --genome --out duplicates --noweb&lt;br /&gt;
 &lt;br /&gt;
R:&lt;br /&gt;
 dups = read.table(&amp;quot;duplicates.genome&amp;quot;, header = T)&lt;br /&gt;
 problem_pairs = dups[which(dups$PI_HAT &amp;gt; 0.4),]&lt;br /&gt;
 problem_pairs&lt;br /&gt;
 problem_pairs = dups[which(dups$PI_HAT &amp;gt; 0.05),]&lt;br /&gt;
 myvars = c(&amp;quot;FID1&amp;quot;, &amp;quot;IID1&amp;quot;, &amp;quot;FID2&amp;quot;, &amp;quot;IID2&amp;quot;, &amp;quot;PI_HAT&amp;quot;)&lt;br /&gt;
 problem_pairs[myvars]&lt;br /&gt;
 q()&lt;br /&gt;
 plink --file GWAS_clean2 --remove IBS_excluded.txt --recode --out GWAS_clean3 --noweb&lt;br /&gt;
 plink --file GWAS_clean3 --het --noweb&lt;br /&gt;
 &lt;br /&gt;
R:&lt;br /&gt;
 Dataset &amp;amp;lt;- read.table(&amp;quot;plink.het&amp;quot;, header=TRUE, sep=&amp;quot;&amp;quot;, na.strings=&amp;quot;NA&amp;quot;, dec=&amp;quot;.&amp;quot;,&lt;br /&gt;
 strip.white=TRUE)&lt;br /&gt;
 mean(Dataset$F)&lt;br /&gt;
 sd(Dataset$F)&lt;br /&gt;
 jpeg(&amp;quot;hist.jpeg&amp;quot;, height=1000, width=1000)&lt;br /&gt;
 hist(scale(Dataset$F), xlim=c(-4,4))&lt;br /&gt;
 dev.off()&lt;br /&gt;
 q()&lt;br /&gt;
 plink --file GWAS_clean3 --pheno pheno.txt --pheno-name Aff --hardy --noweb&lt;br /&gt;
 &lt;br /&gt;
R:&lt;br /&gt;
 hardy = read.table(&amp;quot;plink.hwe&amp;quot;, header = T)&lt;br /&gt;
 names(hardy)&lt;br /&gt;
 hwe_prob = hardy[which(hardy$P &amp;lt; 0.0000009),]&lt;br /&gt;
 hwe_prob&lt;br /&gt;
 q()&lt;br /&gt;
 plink --file GWAS_clean3 --exclude HWE_out.txt --recode --out GWAS_clean4 --noweb==GWAS Control Substructure==&lt;br /&gt;
 plink --file GWAS_clean4 --genome --mds-plot 10 --noweb&lt;br /&gt;
 &lt;br /&gt;
R:&lt;br /&gt;
 mydata = read.table(&amp;quot;mds_components.txt&amp;quot;, header=T)&lt;br /&gt;
 mydata$pch[mydata$Group==1 ] &amp;amp;lt;-15&lt;br /&gt;
 mydata$pch[mydata$Group==2 ] &amp;amp;lt;-16&lt;br /&gt;
 mydata$pch[mydata$Group==3 ] &amp;amp;lt;-2&lt;br /&gt;
 jpeg(&amp;quot;mds.jpeg&amp;quot;, height=1000, width=1000)&lt;br /&gt;
 plot(mydata$C1, mydata$C2 ,pch=mydata$pch)&lt;br /&gt;
 dev.off()&lt;br /&gt;
 q()&lt;br /&gt;
 plink --file GWAS_clean4 --pheno pheno.txt --pheno-name Aff --logistic --adjust --out unadj --noweb&lt;br /&gt;
 plink --file GWAS_clean4 --pheno pheno.txt --pheno-name Aff --covar plink.mds --covar-name C1 --logistic --adjust --out C1 --noweb&lt;br /&gt;
 plink --file GWAS_clean4 --pheno pheno.txt --pheno-name Aff --covar plink.mds --covar-name C1-C2 --logistic --adjust --out C1-C2 --noweb&lt;br /&gt;
 &lt;br /&gt;
R:&lt;br /&gt;
 broadqq &amp;amp;lt;-function(pvals, title)&lt;br /&gt;
 {&lt;br /&gt;
 &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;observed &amp;amp;lt;- sort(pvals)&lt;br /&gt;
 &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;lobs &amp;amp;lt;- -(log10(observed))&lt;br /&gt;
 &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;expected &amp;amp;lt;- c(1:length(observed))&lt;br /&gt;
 &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;lexp &amp;amp;lt;- -(log10(expected / (length(expected)+1)))&lt;br /&gt;
 &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;plot(c(0,7), c(0,7), col=&amp;quot;red&amp;quot;, lwd=3, type=&amp;quot;l&amp;quot;, xlab=&amp;quot;Expected (-logP)&amp;quot;, ylab=&amp;quot;Observed (-logP)&amp;quot;, xlim=c(0,max(lobs)), ylim=c(0,max(lobs)), las=1, xaxs=&amp;quot;i&amp;quot;, yaxs=&amp;quot;i&amp;quot;, bty=&amp;quot;l&amp;quot;, main = title)&lt;br /&gt;
 &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;points(lexp, lobs, pch=23, cex=.4, bg=&amp;quot;black&amp;quot;) }&lt;br /&gt;
 jpeg(&amp;quot;qqplot_compare.jpeg&amp;quot;, height=1000, width=1000)&lt;br /&gt;
 par(mfrow=c(2,1))&lt;br /&gt;
 aff_unadj&amp;amp;lt;-read.table(&amp;quot;unadj.assoc.logistic&amp;quot;, header=TRUE)&lt;br /&gt;
 aff_unadj.add.p&amp;amp;lt;-aff_unadj[aff_unadj$TEST==c(&amp;quot;ADD&amp;quot;),]$P&lt;br /&gt;
 broadqq(aff_unadj.add.p,&amp;quot;Some Trait Unadjusted&amp;quot;)&lt;br /&gt;
 aff_C1C2&amp;amp;lt;-read.table(&amp;quot;C1-C2.assoc.logistic&amp;quot;, header=TRUE)&lt;br /&gt;
 aff_C1C2.add.p&amp;amp;lt;-aff_C1C2[aff_C1C2$TEST==c(&amp;quot;ADD&amp;quot;),]$P&lt;br /&gt;
 broadqq(aff_C1C2.add.p, &amp;quot;Some Trait Adjusted&amp;quot;)&lt;br /&gt;
 dev.off()&lt;br /&gt;
 gws_unadj = aff_unadj[which(aff_unadj$P &amp;lt; 0.0000001),]&lt;br /&gt;
 gws_unadj&lt;br /&gt;
 gws_adjusted = aff_C1C2[which(aff_C1C2$P &amp;lt; 0.0000001),]&lt;br /&gt;
 gws_adjusted&lt;br /&gt;
 q()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Zhihuiz</name></author>	</entry>

	</feed>