<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://genome.sph.umich.edu/w/index.php?action=history&amp;feed=atom&amp;title=Tutorial%3A_EMMAX_GotCloud_STOM%3A_Lecture_2</id>
	<title>Tutorial: EMMAX GotCloud STOM: Lecture 2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://genome.sph.umich.edu/w/index.php?action=history&amp;feed=atom&amp;title=Tutorial%3A_EMMAX_GotCloud_STOM%3A_Lecture_2"/>
	<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Tutorial:_EMMAX_GotCloud_STOM:_Lecture_2&amp;action=history"/>
	<updated>2026-09-25T17:42:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Tutorial:_EMMAX_GotCloud_STOM:_Lecture_2&amp;diff=9243&amp;oldid=prev</id>
		<title>Hmkang: Created page with &quot;STOM 2014 Workshop - Practical Sessions 2  == Lecture 2 ==  The slides describing the notes below are available  here (PDF)  === Basic Setup ==...&quot;</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Tutorial:_EMMAX_GotCloud_STOM:_Lecture_2&amp;diff=9243&amp;oldid=prev"/>
		<updated>2014-01-06T07:07:41Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;STOM 2014 Workshop - Practical Sessions 2  == Lecture 2 ==  The slides describing the notes below are available &lt;a href=&quot;/w/images/6/62/Stom_practice_02.pdf&quot; class=&quot;internal&quot; title=&quot;Stom practice 02.pdf&quot;&gt; here (PDF)&lt;/a&gt;  === Basic Setup ==...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;STOM 2014 Workshop - Practical Sessions 2&lt;br /&gt;
&lt;br /&gt;
== Lecture 2 ==&lt;br /&gt;
&lt;br /&gt;
The slides describing the notes below are available [[Media:Stom practice 02.pdf | here (PDF)]]&lt;br /&gt;
&lt;br /&gt;
=== Basic Setup ===&lt;br /&gt;
&lt;br /&gt;
* To see the files for the session, type&lt;br /&gt;
 ls /data/stom2014/session2/&lt;br /&gt;
If you see any errors, please let me know now!&lt;br /&gt;
&lt;br /&gt;
* For convenience, let’s set some variables&lt;br /&gt;
 export S2=/data/stom2014/session2&lt;br /&gt;
 mkdir ~/out&lt;br /&gt;
&lt;br /&gt;
=== Naive Association Test ===&lt;br /&gt;
&lt;br /&gt;
* Run naive association test using PLINK&lt;br /&gt;
&lt;br /&gt;
 $S2/bin/plink --noweb --bfile $S2/data/1000G.auto.omni.phased.EUR --pheno $S2/data/1000G_EUR_20_1459060.phe --linear --out ~/out/naive&lt;br /&gt;
&lt;br /&gt;
* Check your output file and see what it looks like&lt;br /&gt;
&lt;br /&gt;
 less ~/out/naive.assoc.linear&lt;br /&gt;
&lt;br /&gt;
* Check the p-value at the causal variant&lt;br /&gt;
&lt;br /&gt;
 grep -w ADD ~/out/naive.assoc.linear | grep 20:1459060&lt;br /&gt;
&lt;br /&gt;
* Draw QQ plot using the following R commands&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; source(&amp;#039;/data/stom2014/session2/r/qqconf.r&amp;#039;)&lt;br /&gt;
 &amp;gt; T &amp;lt;- read.table(&amp;#039;~/out/naive.assoc.linear&amp;#039;,header=TRUE)&lt;br /&gt;
 &amp;gt; pdf(&amp;#039;~/out/naive.pdf&amp;#039;)&lt;br /&gt;
 &amp;gt; qq.conf.beta(T$P)&lt;br /&gt;
 &amp;gt; dev.off()&lt;br /&gt;
&lt;br /&gt;
=== Genomic Control ===&lt;br /&gt;
&lt;br /&gt;
* Add --adjust option to enable genomic control&lt;br /&gt;
&lt;br /&gt;
 $S2/bin/plink --noweb --bfile $S2/data/1000G.auto.omni.phased.EUR --pheno $S2/data/1000G_EUR_20_1459060.phe --linear --adjust --out ~/out/naive&lt;br /&gt;
&lt;br /&gt;
* Calculate inflation factor on your own&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; T &amp;lt;- read.table(&amp;#039;~/out/naive.assoc.linear&amp;#039;,header=TRUE)&lt;br /&gt;
&lt;br /&gt;
** First, find the median p-value&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; median(T$P)&lt;br /&gt;
 &amp;gt; 0.4814&lt;br /&gt;
&lt;br /&gt;
** Convert p-value into chi-square using R, and compute lambda&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; qchisq(0.4814,1,lower.tail=FALSE)&lt;br /&gt;
 [1] 0,4956901&lt;br /&gt;
 &amp;gt; 0.4958032/0.456&lt;br /&gt;
 [1] 1.08704&lt;br /&gt;
&lt;br /&gt;
* Check out the custom script to calculate inflation factor&lt;br /&gt;
&lt;br /&gt;
 less $S2/r/calc.GC.lambda.r&lt;br /&gt;
&lt;br /&gt;
** Feed the p-values from association results&lt;br /&gt;
 cut -c 96- ~/out/naive.assoc.linear | Rscript $S2/r/calc.GC.lambda.r&lt;br /&gt;
&lt;br /&gt;
=== Principal Component Analysis ===&lt;br /&gt;
&lt;br /&gt;
* Convert PLINK format file to EMMAX-compatible format to obtain PCs&lt;br /&gt;
&lt;br /&gt;
 $S2/bin/plink --noweb --bfile $S2/data/1000G.auto.omni.phased.EUR --recode12 --output-missing-genotype 0 --transpose --out ~/out/1000G.auto.omni.phased.EUR&lt;br /&gt;
&lt;br /&gt;
* Create kinship matrix using EMMAX&lt;br /&gt;
&lt;br /&gt;
$S2/bin/emmax-kin-intel64 -T 1 -M 0.2 -v -d 10 ~/out/1000G.auto.omni.phased.EUR&lt;br /&gt;
less ~/out/1000G.auto.omni.phased.EUR.aBN.kinf&lt;br /&gt;
&lt;br /&gt;
* Calculate principal component using custom script&lt;br /&gt;
&lt;br /&gt;
 Rscript $S2/r/calc.PC.from.kinf.r ~/out/1000G.auto.omni.phased.EUR.aBN.kinf ~/out/1000G.auto.omni.phased.EUR.tfam ~/out/1000G.auto.omni.phased.EUR.pc10&lt;br /&gt;
&lt;br /&gt;
* Check out how the PCA outcome looks like&lt;br /&gt;
&lt;br /&gt;
 less ~/out/1000G.auto.omni.phased.EUR.pc10&lt;br /&gt;
&lt;br /&gt;
* Visualize the population structure using PCs with custom script&lt;br /&gt;
&lt;br /&gt;
 Rscript $S2/r/plot_pc_pop.r ~/out/1000G.auto.omni.phased.EUR.pc10 $S2/data/1000G.auto.omni.phased.EUR.pop ~/out/1000G.auto.omni.phased.EUR.pc10.pdf&lt;br /&gt;
&lt;br /&gt;
* Use PCs as covariates to adjust for PCs&lt;br /&gt;
&lt;br /&gt;
 $S2/bin/plink --noweb --bfile $S2/data/1000G.auto.omni.phased.EUR --pheno $S2/data/1000G_EUR_20_1459060.phe --covar ~/out/1000G.auto.omni.phased.EUR.pc10 --covar-number 1,2,3,4 --linear --adjust --out ~/out/pca&lt;br /&gt;
&lt;br /&gt;
* Check out the p-value at the causal variant and inflation of statistics&lt;br /&gt;
&lt;br /&gt;
 grep -w ADD ~/out/pca.assoc.linear | grep 20:1459060 &lt;br /&gt;
 grep -w ADD ~/out/pca.assoc.linear | cut -c 96- | Rscript $S2/r/calc.GC.lambda.r&lt;br /&gt;
&lt;br /&gt;
=== Mixed Model Association ===&lt;br /&gt;
&lt;br /&gt;
* Run EMMAX association&lt;br /&gt;
&lt;br /&gt;
$S2/bin/emmax-intel64 -t ~/out/1000G.auto.omni.phased.EUR -o ~/out/emmax -p $S2/data/1000G_EUR_20_1459060.phe -k ~/out/1000G.auto.omni.phased.EUR.aBN.kinf &lt;br /&gt;
&lt;br /&gt;
* Check the inflation factor&lt;br /&gt;
&lt;br /&gt;
 cut -f 4 ~out/emmax.ps | Rscript $S2/r/calc.GC.lambda.r&lt;br /&gt;
 [1] 1.006079&lt;br /&gt;
&lt;br /&gt;
* Draw and compare multiple QQ plots using the R function provided&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; source(&amp;#039;/data/stom2014/session2/r/qqconf.r&amp;#039;)&lt;br /&gt;
 &amp;gt; T1 &amp;lt;- read.table(&amp;#039;~/out/naive.assoc.linear&amp;#039;,header=TRUE)&lt;br /&gt;
 &amp;gt; T2 &amp;lt;- read.table(&amp;#039;~/out/pca.assoc.linear&amp;#039;,header=TRUE)&lt;br /&gt;
 &amp;gt; T3 &amp;lt;- read.table(&amp;#039;~/out/emmax.ps&amp;#039;)&lt;br /&gt;
 &amp;gt; pdf(&amp;#039;~/out/all.pdf&amp;#039;)&lt;br /&gt;
 &amp;gt; qq.conf.beta(T1$P)&lt;br /&gt;
 &amp;gt; qq.conf.beta(T2$P,drawaxis=FALSE,ptcolor=&amp;quot;blue&amp;quot;)&lt;br /&gt;
 &amp;gt; qq.conf.beta(T3$V4,drawaxis=FALSE,ptcolor=&amp;quot;red&amp;quot;)&lt;br /&gt;
 &amp;gt; dev.off()&lt;/div&gt;</summary>
		<author><name>Hmkang</name></author>
	</entry>
</feed>