<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://genome.sph.umich.edu/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Chaolong+Wang</id>
	<title>Genome Analysis Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://genome.sph.umich.edu/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Chaolong+Wang"/>
	<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/wiki/Special:Contributions/Chaolong_Wang"/>
	<updated>2026-09-26T04:18:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12259</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12259"/>
		<updated>2014-12-09T15:13:53Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Population information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European or East Asian or Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
18 East Asian populations in the HGDP dataset, including 224 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
For European ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For East Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.easia.2.geno -c $HGDP/HGDP.633K.easia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-EAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For Central/South Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.csasia.2.geno -c $HGDP/HGDP.633K.csasia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-CSAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the results for European ancestry:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord&lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot for European ancestry:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord &lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.easia.2.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord &lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.csasia.2.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12255</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12255"/>
		<updated>2014-12-09T06:26:19Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Estimate ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European or East Asian or Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
For European ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For East Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.easia.2.geno -c $HGDP/HGDP.633K.easia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-EAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For Central/South Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.csasia.2.geno -c $HGDP/HGDP.633K.csasia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-CSAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the results for European ancestry:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord&lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot for European ancestry:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord &lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.easia.2.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord &lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.csasia.2.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12254</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12254"/>
		<updated>2014-12-09T06:17:05Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing Ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European or East Asian or Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
For European ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For East Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.easia.2.geno -c $HGDP/HGDP.633K.easia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-EAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For Central/South Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.csasia.2.geno -c $HGDP/HGDP.633K.csasia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-CSAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the results for European ancestry:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord&lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot for European ancestry:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord &lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.easia.2.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord &lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.csasia.2.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12253</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12253"/>
		<updated>2014-12-09T06:16:23Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing Ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European or East Asian or Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
For European ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For East Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.easia.2.geno -c $HGDP/HGDP.633K.easia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-EAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For Central/South Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.csasia.2.geno -c $HGDP/HGDP.633K.csasia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-CSAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the results for European ancestry:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord&lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot for European ancestry:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord &lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.easia.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord &lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.csasia.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12252</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12252"/>
		<updated>2014-12-09T06:15:40Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Estimate ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European or East Asian or Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
For European ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For East Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.easia.2.geno -c $HGDP/HGDP.633K.easia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-EAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For Central/South Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.csasia.2.geno -c $HGDP/HGDP.633K.csasia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-CSAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the results for European ancestry:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
or for East Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord&lt;br /&gt;
or for Central/South Asian ancestry&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord &lt;br /&gt;
or&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.easia.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord &lt;br /&gt;
or&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.csasia.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12251</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12251"/>
		<updated>2014-12-09T06:14:53Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing Ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European or East Asian or Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
For European ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For East Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.easia.2.geno -c $HGDP/HGDP.633K.easia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-EAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For Central/South Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.csasia.2.geno -c $HGDP/HGDP.633K.csasia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-CSAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
or &lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord&lt;br /&gt;
or &lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord &lt;br /&gt;
or&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.easia.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord &lt;br /&gt;
or&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.csasia.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12250</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12250"/>
		<updated>2014-12-09T06:12:25Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Interested in looking just at European/East Asian/Central South Asian populations? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European or East Asian or Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
For European ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For East Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.easia.2.geno -c $HGDP/HGDP.633K.easia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-EAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
For Central/South Asian ancestry:&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.csasia.2.geno -c $HGDP/HGDP.633K.csasia.2.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-CSAsia &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
or &lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-EAsia.SeqPC.coord&lt;br /&gt;
or &lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-CSAsia.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12249</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12249"/>
		<updated>2014-12-09T06:08:59Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Interested in looking just at European (or East Asian or Central South Asian) populations? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European/East Asian/Central South Asian populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12248</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12248"/>
		<updated>2014-12-09T06:05:15Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Population information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European (or East Asian or Central South Asian) populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |300px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12247</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12247"/>
		<updated>2014-12-09T06:04:45Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* HGDP reference panel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HGDP reference panel ==&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |400px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r $LASER/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12246</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12246"/>
		<updated>2014-12-09T06:02:50Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Population information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European (or East Asian or Central South Asian) populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |600px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12245</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12245"/>
		<updated>2014-12-09T06:02:17Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Population information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European (or East Asian or Central South Asian) populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12244</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12244"/>
		<updated>2014-12-09T06:02:04Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Interested in looking just at European populations? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European (or East Asian or Central South Asian) populations?== &lt;br /&gt;
=== Population information ===&lt;br /&gt;
8 European populations in the HGDP dataset, including 156 individuals in total.&lt;br /&gt;
17 East Asian populations in the HGDP dataset, including 215 individuals after excluding 4 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration).&lt;br /&gt;
8 Central/South Asian populations in the HGDP dataset, including 195 individuals after excluding 5 outliers (defined as more than 5 standard deviations from mean in any of top 10 PCs, 1 removal iteration). Note that 7 out of these 8 population were collected in Pakistan and 1 was collected in China (Uygur).&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12243</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12243"/>
		<updated>2014-12-09T06:00:34Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* HGDP reference panel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HGDP reference panel ==&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |600px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r $LASER/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12242</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12242"/>
		<updated>2014-12-09T06:00:07Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* HGDP reference panel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HGDP reference panel ==&lt;br /&gt;
[[File:HGDP Popualtions.png|thumb|center|alt=HGDP populations |400px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r $LASER/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12241</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12241"/>
		<updated>2014-12-09T05:59:55Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* HGDP reference panel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HGDP reference panel ==&lt;br /&gt;
[[File:HGDP Popualtions.png.png|thumb|center|alt=HGDP populations |400px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r $LASER/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12240</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12240"/>
		<updated>2014-12-09T05:59:34Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* LASER workflow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== HGDP reference panel ==&lt;br /&gt;
[[File:File:HGDP Popualtions.png.png|thumb|center|alt=HGDP populations |400px|HGDP populations]]&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r $LASER/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=File:HGDP_Popualtions.png&amp;diff=12239</id>
		<title>File:HGDP Popualtions.png</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=File:HGDP_Popualtions.png&amp;diff=12239"/>
		<updated>2014-12-09T05:57:44Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12238</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12238"/>
		<updated>2014-12-09T05:34:08Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Estimate ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.HGDP.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP-Euro &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP-Euro.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12237</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12237"/>
		<updated>2014-12-09T05:32:51Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 2: pileup --&amp;gt; seq */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too, because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12236</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12236"/>
		<updated>2014-12-09T05:32:33Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 2: pileup --&amp;gt; seq */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too because you already did it.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12235</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12235"/>
		<updated>2014-12-09T05:32:02Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 2: pileup --&amp;gt; seq */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
You can skip this step too because you have done it already.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12234</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12234"/>
		<updated>2014-12-09T05:30:26Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing Ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP.633K.euro.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.Euro.laser \&lt;br /&gt;
 $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12233</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12233"/>
		<updated>2014-12-09T05:29:30Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Estimate ancestry */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.HGDP &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.HGDP.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP.633K.euro.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.Euro.laser \&lt;br /&gt;
 $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12232</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12232"/>
		<updated>2014-12-09T05:28:05Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 2: pileup --&amp;gt; seq */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.HGDP \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.laser.2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP.633K.euro.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.Euro.laser \&lt;br /&gt;
 $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12231</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12231"/>
		<updated>2014-12-09T05:27:28Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: bam --&amp;gt; pileup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.HGDP.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes ~1 hour for a genome sequenced at 17X.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.laser \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.laser.2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP.633K.euro.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.Euro.laser \&lt;br /&gt;
 $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12194</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12194"/>
		<updated>2014-12-08T05:51:20Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: Estimate ancestry for sequenced samples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r $LASER/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12193</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12193"/>
		<updated>2014-12-08T05:46:17Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: bam --&amp;gt; pileup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.laser \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.laser.2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP.633K.euro.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.Euro.laser \&lt;br /&gt;
 $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12192</id>
		<title>SeqShop: Ancestry On Your Own Genome, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Ancestry_On_Your_Own_Genome,_December_2014&amp;diff=12192"/>
		<updated>2014-12-08T05:45:00Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&#039;&#039;If you were sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=Sample*&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you were not sequenced, set these values:&#039;&#039;&lt;br /&gt;
 export SAMPLE=NA12878&lt;br /&gt;
 source /net/seqshop-server/home/mktrost/seqshop/setupSS.txt&lt;br /&gt;
 source /net/seqshop-server/home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
After setting this, also do&lt;br /&gt;
 mkdir -p $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Verify that this does not give an error:&lt;br /&gt;
 ls $OUT/bams/${SAMPLE}.recal.bam&lt;br /&gt;
&lt;br /&gt;
== Run ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa -l $HGDP/HGDP_938.bed $OUT/bams/${SAMPLE}.recal.bam &amp;gt; $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.laser \&lt;br /&gt;
 $OUT/ancestry/$SAMPLE.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take about 5-6 minutes.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s $OUT/ancestry/$SAMPLE.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.laser.2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord $OUT/ancestry/${SAMPLE}.laser.2.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
==Interested in looking just at European populations?==&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
You can skip this, you already did it.  &lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP.633K.euro.site \&lt;br /&gt;
 -o $OUT/ancestry/$SAMPLE.Euro.laser \&lt;br /&gt;
 $OUT/ancestry/${SAMPLE}.recal.pileup&lt;br /&gt;
&lt;br /&gt;
This step takes just a few seconds.&lt;br /&gt;
&lt;br /&gt;
=== Estimate ancestry ===&lt;br /&gt;
This step will take a few seconds.&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP.633K.euro.geno -c $HGDP/HGDP.633K.euro.RefPC.coord -s $OUT/ancestry/$SAMPLE.Euro.laser.seq -K 20 -k 4 -M 0.8 -o $OUT/ancestry/$SAMPLE.Euro.laser.1 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
== Visualizing Ancestry ==&lt;br /&gt;
Copy the R code to plot your ancestry&lt;br /&gt;
 cp -r $LASER/plot/ $OUT/ancestry/.&lt;br /&gt;
&lt;br /&gt;
Change to that new directory:&lt;br /&gt;
 cd $OUT/ancestry/plot&lt;br /&gt;
&lt;br /&gt;
Move your other plot so you don&#039;t over-write it&lt;br /&gt;
 mv Results_on_HGDP.pdf Results_on_HGDP_All.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate the plot:&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP.633K.euro.RefPC.coord $OUT/ancestry/${SAMPLE}.Euro.laser.1.SeqPC.coord &lt;br /&gt;
&lt;br /&gt;
Take a look:&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12191</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12191"/>
		<updated>2014-12-08T04:59:46Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 mosrun -e $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 mosrun -e $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r $LASER/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12190</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12190"/>
		<updated>2014-12-08T04:56:00Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: Estimate ancestry for sequenced samples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 mosrun -e $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 mosrun -e $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12189</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12189"/>
		<updated>2014-12-08T04:54:07Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Estimating ancestry coordinates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # $LASER/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 $LASER/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12187</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12187"/>
		<updated>2014-12-08T04:49:22Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 2: pileup --&amp;gt; seq */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12186</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12186"/>
		<updated>2014-12-08T04:48:47Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 2: pileup --&amp;gt; seq */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python $LASER/LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12154</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, December 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_December_2014&amp;diff=12154"/>
		<updated>2014-12-07T23:45:38Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Setup your run environment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setup in person at the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for the SeqShop Workshop computers.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are not running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopLogin}}&lt;br /&gt;
&lt;br /&gt;
=== Setup your run environment===&lt;br /&gt;
This is the same setup you did for the previous tutorial, but you need to redo it each time you log in.&lt;br /&gt;
&lt;br /&gt;
This will setup some environment variables to point you to&lt;br /&gt;
* Tutorial input files&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
* You won&#039;t see any output after running &amp;lt;code&amp;gt;source&amp;lt;/code&amp;gt;&lt;br /&gt;
** It silently sets up your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/gotcloud/gotcloud.ref&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export LASER=/home/chaolong/LASER-Tutorial/LASER-2.01&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Point to where you want the output to go replacing the path with where you would like your output to go&lt;br /&gt;
&amp;lt;pre&amp;gt;export OUT=~/seqshop_output/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Setup when running on your own outside of the SeqShop Workshop ==&lt;br /&gt;
&#039;&#039;This section is specifically for running on your own outside of the SeqShop Workshop.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;If you are running during the SeqShop Workshop, please skip this section.&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial uses samtools from GotCloud, as well as example data downloaded in the Sequence Mapping &amp;amp; Assembly tutorial, so if you have not already installed GotCloud and the tutorial data in a previous tutorial, please do so now: [[SeqShop:_Sequence_Mapping_and_Assembly_Practical#Setup_when_running_on_your_own_outside_of_the_SeqShop_Workshop|Tutorial Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{SeqShopRemoteEnv}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Additional variables for Ancestry:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using bash (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;export REF=$SS/ancestry/ref&amp;amp;#10;export HGDP=$SS/ancestry/HGDP&amp;amp;#10;export BAM=$SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Using tcsh (replace the paths below with the appropriate paths):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:&amp;lt;pre&amp;gt;setenv REF $SS/ancestry/ref&amp;amp;#10;setenv HGDP $SS/ancestry/HGDP&amp;amp;#10;setenv BAM $SS/ancestry/bams&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir $OUT/ancestry&lt;br /&gt;
 cd $OUT/ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
In person at workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
*It takes about 2 mins for each pileup job. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible&amp;quot; style=&amp;quot;width:500px&amp;quot;&amp;gt;&lt;br /&gt;
Outside of the workshop notes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*The BAMs provided as part of the download are chr22 only BAMs.  They are used to demonstrate how to run this step.&lt;br /&gt;
*Pileup files for the whole genome BAMs are provided with the download and will be used in the next step.&lt;br /&gt;
* You only need to try one of these.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
* These pre-generated pileup files are for the whole genome of all 6 samples&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below (results will vary slightly):&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11310</id>
		<title>LASER</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11310"/>
		<updated>2014-07-30T15:22:43Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction  =&lt;br /&gt;
&lt;br /&gt;
LASER, which stands for Locating Ancestry using SEquencing Reads, is a C++ software package that can estimate individual ancestry directly from genome-wide shortgun sequencing reads without calling genotypes. The method relies on the availability of a set of reference individuals whose genome-wide SNP genotypes and ancestral information are known. We first construct a reference coordinate system by applying principal components analysis (PCA) to the genotype data of the reference individuals. Then, for each sequencing sample, use the genome-wide sequencing reads to place the sample into the reference PCA space. With an appropriate reference panel, the estimated coordinates of the sequencing samples identify their ancestral background and can be directly used to correct for population structure in association studies or to ensure adequate matching of cases and controls.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
The goal of this wiki page is to help you get start using LASER.&lt;br /&gt;
This page was created for LASER 1.0. Some of the information might be outdated for LASER 2.0. &lt;br /&gt;
A more updated wiki page can be found at [http://genome.sph.umich.edu/wiki/SeqShop:_Estimates_of_Genetic_Ancestry_Practical 2014 UM Sequencing Workshop].&lt;br /&gt;
We also encourage you to read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual] for more details of the software.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
&lt;br /&gt;
To get a copy of the software and manual, go to the [http://www.sph.umich.edu/csg/chaolong/LASER/ LASER Download] page.&lt;br /&gt;
&lt;br /&gt;
= Workflow  =&lt;br /&gt;
&lt;br /&gt;
LASER generates the coordinates from both reference individuals and sequence samples. It requires essentially two input files: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER-Workflow.png|thumb|center|alt=LASER workflow|400px|LASER Workflow]] &lt;br /&gt;
&lt;br /&gt;
*Seq file: a text file processed from BAM (alignment) files. (See [[#Process sequencing file (BAM)|Processing sequencing file]] for how to prepare seq file) &lt;br /&gt;
*Geno file: genotypes of reference individuals. (See [[#Geno file|Geno file]] to understand geno file format)&lt;br /&gt;
&lt;br /&gt;
LASER typically outputs two coord files: (1) in reference individuals&#039; coord file(Reference.coord), LASER outputs the reference coordinates in the PCA space; (2) in sequence samples&#039; coord files(AllSamples.coord), LASER infers their ancestries by placing their ancestry coordinates onto reference samples&#039; PCA space.&lt;br /&gt;
&lt;br /&gt;
An example result of the coord file of sequence samples is shown below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
In the header line, popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci that has been covered by at least one read, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity. PC1 and PC2 mean coordinates of the first and second principal components.&lt;br /&gt;
&lt;br /&gt;
= Tutorial  =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will show you how to prepare data and run LASER.&lt;br /&gt;
&lt;br /&gt;
== Process sequencing file (BAM)  ==&lt;br /&gt;
&lt;br /&gt;
We illustrate how to obtain .seq file from BAM files in this section. &lt;br /&gt;
In this example, we use HGDP data set as a reference, which contains 938 individuals and 632,958 markers.&lt;br /&gt;
[[File:LASER-DataProcessing.png|thumb|center|alt=LASER workflow|400px|LASER Data Processing Procedure]] &lt;br /&gt;
&lt;br /&gt;
1. Obtain pileup files from BAM files  &lt;br /&gt;
&lt;br /&gt;
The first step is to generate a BED file:&lt;br /&gt;
&lt;br /&gt;
 cat ../resource/HGDP/HGDP_938.site |awk &#039;{if (NR &amp;gt; 1) {print $1, $2-1, $2;}}&#039; &amp;gt; HGDP_938.bed&lt;br /&gt;
&lt;br /&gt;
This BED file contains the positions of all the reference markers.  &lt;br /&gt;
&lt;br /&gt;
Then we use &#039;&#039;samtools&#039;&#039; to extract the sequence bases overlapping these 632,958 reference markers.&lt;br /&gt;
Assuming your BAM file name is &#039;&#039;NA12878.chrom22.recal.bam&#039;&#039; (our example BAM file), you can use this:&lt;br /&gt;
&lt;br /&gt;
 samtools mpileup -q 30 -Q 20 -f ../../LASER-resource/reference/hs37d5.fa -l HGDP_938.bed exampleBAM/NA12878.chrom22.recal.bam &amp;gt; NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
to obtain a pileup file named &#039;&#039;NA12878.chrom22.pileup&#039;&#039;. It is required to keep the &#039;&#039;.pileup&#039; suffix.&lt;br /&gt;
&lt;br /&gt;
2. Obtain a seq file from pileup files. &lt;br /&gt;
&lt;br /&gt;
After obtaining pileup files from each BAM file, you can convert them into a single seq file before running LASER. &lt;br /&gt;
Use the same site file and all generated pileup files from step 1 to generate a seq file:&lt;br /&gt;
&lt;br /&gt;
 python pileup2seq.py  -m ../resource/HGDP/HGDP_938.site -o test NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
You should obtain test.seq file after this step.&lt;br /&gt;
&lt;br /&gt;
== Estimate ancestries of sequence samples  ==&lt;br /&gt;
&lt;br /&gt;
The easiest way to perform LASER using its exemplar data is: &lt;br /&gt;
&lt;br /&gt;
 ./laser -s pileup2seq/test.seq  -g resource/HGDP/HGDP_938.geno -c resource/HGDP/HGDP_938.RefPC.coord -o test -k 2&lt;br /&gt;
&lt;br /&gt;
Upon successful calculation,  you will find a result file &amp;quot;test.SeqPC.coord&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Interpret LASER outputs ==&lt;br /&gt;
&lt;br /&gt;
Upon successfully launching LASER command line as above, the output messages should be similar to below: &lt;br /&gt;
&lt;br /&gt;
    ===================================================================&lt;br /&gt;
    ====       LASER: Locating Ancestry from SEquencing Reads       ====&lt;br /&gt;
    ====            Version 1.0 | (c) Chaolong Wang 2013            ====&lt;br /&gt;
    ====================================================================&lt;br /&gt;
    Started at: Fri Nov 15 01:05:48 2013&lt;br /&gt;
&lt;br /&gt;
    938 individuals are detected in the GENO_FILE.&lt;br /&gt;
    632958 loci are detected in the GENO_FILE.&lt;br /&gt;
    1 individuals are detected in the SEQ_FILE.&lt;br /&gt;
    632958 loci are detected in the SEQ_FILE.&lt;br /&gt;
    938 individuals are detected in the COORD_FILE.&lt;br /&gt;
    100 PCs are detected in the COORD_FILE.&lt;br /&gt;
&lt;br /&gt;
    Parameter values used in execution:&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
    GENO_FILE (-g)resource/HGDP/HGDP_938.geno&lt;br /&gt;
    SEQ_FILE (-s)pileup2seq/test.seq&lt;br /&gt;
    COORD_FILE (-c)resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
    OUT_PREFIX (-o)test&lt;br /&gt;
    DIM (-k)2&lt;br /&gt;
    MIN_LOCI (-l)100&lt;br /&gt;
    SEQ_ERR (-e)0.01&lt;br /&gt;
    FIRST_IND (-x)1&lt;br /&gt;
    LAST_IND (-y)1&lt;br /&gt;
    REPS (-r)1&lt;br /&gt;
    OUTPUT_REPS (-R)0&lt;br /&gt;
    CHECK_FORMAT (-fmt)10&lt;br /&gt;
    CHECK_COVERAGE (-cov)0&lt;br /&gt;
    PCA_MODE (-pca)0&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:05:50 2013&lt;br /&gt;
    Checking data format ...&lt;br /&gt;
    GENO_FILE: OK.&lt;br /&gt;
    SEQ_FILE: OK.&lt;br /&gt;
    COORD_FILE: OK.&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:06:01 2013&lt;br /&gt;
    Reading reference genotypes ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Reading reference PCA coordinates ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Analyzing sequence samples ...&lt;br /&gt;
    Results for the sequence samples are output to &#039;test.SeqPC.coord&#039;.&lt;br /&gt;
&lt;br /&gt;
    Finished at: Fri Nov 15 01:09:21 2013&lt;br /&gt;
    ====================================================================&lt;br /&gt;
&lt;br /&gt;
The ancestry of input samples are store in the file &#039;&#039;&#039;test.SeqPC.coord&#039;&#039;&#039;, which content is shown below:&lt;br /&gt;
&lt;br /&gt;
    popID	indivID	L1	Ci	t	PC1	PC2&lt;br /&gt;
    NA12878.chrom22	NA12878.chrom22	1601	0.00858193	0.977243	31.522	224.098&lt;br /&gt;
&lt;br /&gt;
The ancestry coordinates for NA12878 samples are given in PC1 (31.522) and PC2 (224.098).&lt;br /&gt;
&lt;br /&gt;
It is recommended to visualize this results with HGDP reference samples whose coordinates are given in file: resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
In our manuscript, an example figure is shown: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER paper Figure 2.png|thumb|center|alt=LASER example outputs as in Figure 2|400px|LASER Outputs]] &lt;br /&gt;
&lt;br /&gt;
In this figure, 238 individuals were randomly selected from the total 938 HGDP samples as the testing set (colored symbols), &lt;br /&gt;
and the remaining 700 HGDP individuals were used as the reference panel (gray symbols).&lt;br /&gt;
&lt;br /&gt;
= File format  =&lt;br /&gt;
&lt;br /&gt;
== Geno file  ==&lt;br /&gt;
&lt;br /&gt;
Geno file are from reference samples. LASER use genotype of these samples as a reference panel. You can obtain geno file from VCF files using [https://github.com/zhanxw/vcf2geno vcf2geno].&lt;br /&gt;
&lt;br /&gt;
In our resource folder, we provide an example geno file for the HGDP data set (resource/HGDP/HGDP_938.geno):&lt;br /&gt;
&lt;br /&gt;
 Brahui	HGDP00001	1	2	1	1	0	2	0	2	1	2	2	2	1	1	2	1	0&lt;br /&gt;
 Brahui	HGDP00003	0	0	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00005	0	2	2	0	0	1	0	2	1	2	2	2	2	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00007	0	2	2	0	0	2	0	2	0	2	2	2	1	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00009	0	1	0	1	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00011	1	1	2	1	1	2	1	1	1	2	2	2	1	1	2	2	0&lt;br /&gt;
 Brahui	HGDP00013	1	2	2	1	1	2	1	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00015	1	1	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00017	1	1	2	0	0	1	0	0	0	2	0	1	1	2	2	2	0&lt;br /&gt;
 Brahui	HGDP00019	0	2	2	0	0	1	0	1	0	2	1	2	2	1	2	2	0&lt;br /&gt;
&lt;br /&gt;
The first and second columns represent the population id and individual id. &lt;br /&gt;
From the third column, each number represents a genotype.&lt;br /&gt;
To be consistent with the sequence data, genotypes should be given on the &#039;&#039;&#039;forward strand&#039;&#039;&#039;. Genotypes are coded by 0, 1, or 2, representing copies of the&lt;br /&gt;
reference allele at a locus in one individual. &lt;br /&gt;
&lt;br /&gt;
In this geno file, we have 632,960 columns which contains 632,958 markers from column 3 to the last column.&lt;br /&gt;
&lt;br /&gt;
== Seq file  ==&lt;br /&gt;
Seq file is generated from pileup files. It contains sequencing information and organize it in a LASER readable format.&lt;br /&gt;
The first two columns represent population id and individual id.&lt;br /&gt;
Subsequent columns are total read depths and reference base counts.&lt;br /&gt;
For example, column 3 and 4 are 0, 0 in the following example. That means at first marker, the sequence read depth is 0 and thus none of the reads has reference base.&lt;br /&gt;
We enforce tab delimiters between markers and space delimiters between each read depths and reference base counts.&lt;br /&gt;
On line of seq file looks like below:&lt;br /&gt;
&lt;br /&gt;
 NA12878.chrom22	NA12878.chrom22	0 0	0 0	0 0	0 0	0 &lt;br /&gt;
&lt;br /&gt;
== Pileup file  ==&lt;br /&gt;
&lt;br /&gt;
Pileup file are generated using samtools. An example pileup file is shown below:&lt;br /&gt;
 &lt;br /&gt;
 22	17094749	A	1	c	D&lt;br /&gt;
 22	17202602	T	1	.	D&lt;br /&gt;
 22	17411899	A	1	.	C&lt;br /&gt;
 22	17450515	G	2	.,	9&amp;lt;&lt;br /&gt;
 22	17452966	T	1	c	5&lt;br /&gt;
 22	17470779	C	1	,	A&lt;br /&gt;
 22	17492203	G	1	,	B&lt;br /&gt;
 22	17504945	C	3	,..	BCA&lt;br /&gt;
 22	17529814	T	3	..,	CCC&lt;br /&gt;
&lt;br /&gt;
The columns are chromosome, position (1-based), reference base, depth, bases and base qualities.&lt;br /&gt;
&lt;br /&gt;
== BED file  ==&lt;br /&gt;
BED file represents genomic regions and it follows [http://genome.ucsc.edu/FAQ/FAQformat.html#format1 UCSC conventions]:&lt;br /&gt;
&lt;br /&gt;
 1 752565 752566&lt;br /&gt;
 1 768447 768448&lt;br /&gt;
 1 1005805 1005806&lt;br /&gt;
 1 1018703 1018704&lt;br /&gt;
 1 1021414 1021415&lt;br /&gt;
&lt;br /&gt;
The columns are: chromosome, start position (0-based) and end position (1-based).&lt;br /&gt;
&lt;br /&gt;
== Coord file  ==&lt;br /&gt;
Coord files represent the ancestries of both reference samples and sequence samples.&lt;br /&gt;
An example coord file looks like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
The columns are: popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci has been covered, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity.&lt;br /&gt;
PC1, PC2 means coordinates of first and second principal components. You may notice L1, Ci, and t are omitted in the coord files of reference samples. The reason is that reference samples use genotypes and do not have coverage information.&lt;br /&gt;
&lt;br /&gt;
== Site file ==&lt;br /&gt;
Site file is equivalent to BED file and it is used here to represent marker positions. An example site file looks like below:&lt;br /&gt;
 CHR  POS      ID          REF  ALT&lt;br /&gt;
 1    752566   rs3094315   G    A&lt;br /&gt;
 1    768448   rs12562034  G    A&lt;br /&gt;
 1    1005806  rs3934834   C    T&lt;br /&gt;
 1    1018704  rs9442372   A    G&lt;br /&gt;
 1    1021415  rs3737728   A    G&lt;br /&gt;
&lt;br /&gt;
The site file has header line, and it contains chromosome, position(1-based), id (usually marker name), ref (reference allele) and alt (alternative allele).&lt;br /&gt;
&lt;br /&gt;
= Advanced options =&lt;br /&gt;
&lt;br /&gt;
LASER has advanced options including (1) parallel computing; (2) increase ancestry inference accuracy using repeated runs; (3) generate PCA coordiates using genotypes.&lt;br /&gt;
See [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf LASER Manual] for detailed information.&lt;br /&gt;
&lt;br /&gt;
= Contact  =&lt;br /&gt;
Comments on this wiki page or questions related to preparing input files for LASER can be sent to [mailto:zhanxw@umich.edu Xiaowei Zhan].&lt;br /&gt;
Comments on the LASER software or the user&#039;s manual can be sent to [mailto:chaolong@umich.edu Chaolong Wang].&lt;br /&gt;
This project was directed by Gonçalo Abecasis and Sebastian Zöllner at the University of Michigan.&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11309</id>
		<title>LASER</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11309"/>
		<updated>2014-07-30T15:22:28Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction  =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
The goal of this wiki page is to help you get start using LASER.&lt;br /&gt;
This page was created for LASER 1.0. Some of the information might be outdated for LASER 2.0. &lt;br /&gt;
A more updated wiki page can be found at [http://genome.sph.umich.edu/wiki/SeqShop:_Estimates_of_Genetic_Ancestry_Practical 2014 UM Sequencing Workshop].&lt;br /&gt;
We also encourage you to read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual] for more details of the software.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
LASER, which stands for Locating Ancestry using SEquencing Reads, is a C++ software package that can estimate individual ancestry directly from genome-wide shortgun sequencing reads without calling genotypes. The method relies on the availability of a set of reference individuals whose genome-wide SNP genotypes and ancestral information are known. We first construct a reference coordinate system by applying principal components analysis (PCA) to the genotype data of the reference individuals. Then, for each sequencing sample, use the genome-wide sequencing reads to place the sample into the reference PCA space. With an appropriate reference panel, the estimated coordinates of the sequencing samples identify their ancestral background and can be directly used to correct for population structure in association studies or to ensure adequate matching of cases and controls.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
&lt;br /&gt;
To get a copy of the software and manual, go to the [http://www.sph.umich.edu/csg/chaolong/LASER/ LASER Download] page.&lt;br /&gt;
&lt;br /&gt;
= Workflow  =&lt;br /&gt;
&lt;br /&gt;
LASER generates the coordinates from both reference individuals and sequence samples. It requires essentially two input files: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER-Workflow.png|thumb|center|alt=LASER workflow|400px|LASER Workflow]] &lt;br /&gt;
&lt;br /&gt;
*Seq file: a text file processed from BAM (alignment) files. (See [[#Process sequencing file (BAM)|Processing sequencing file]] for how to prepare seq file) &lt;br /&gt;
*Geno file: genotypes of reference individuals. (See [[#Geno file|Geno file]] to understand geno file format)&lt;br /&gt;
&lt;br /&gt;
LASER typically outputs two coord files: (1) in reference individuals&#039; coord file(Reference.coord), LASER outputs the reference coordinates in the PCA space; (2) in sequence samples&#039; coord files(AllSamples.coord), LASER infers their ancestries by placing their ancestry coordinates onto reference samples&#039; PCA space.&lt;br /&gt;
&lt;br /&gt;
An example result of the coord file of sequence samples is shown below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
In the header line, popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci that has been covered by at least one read, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity. PC1 and PC2 mean coordinates of the first and second principal components.&lt;br /&gt;
&lt;br /&gt;
= Tutorial  =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will show you how to prepare data and run LASER.&lt;br /&gt;
&lt;br /&gt;
== Process sequencing file (BAM)  ==&lt;br /&gt;
&lt;br /&gt;
We illustrate how to obtain .seq file from BAM files in this section. &lt;br /&gt;
In this example, we use HGDP data set as a reference, which contains 938 individuals and 632,958 markers.&lt;br /&gt;
[[File:LASER-DataProcessing.png|thumb|center|alt=LASER workflow|400px|LASER Data Processing Procedure]] &lt;br /&gt;
&lt;br /&gt;
1. Obtain pileup files from BAM files  &lt;br /&gt;
&lt;br /&gt;
The first step is to generate a BED file:&lt;br /&gt;
&lt;br /&gt;
 cat ../resource/HGDP/HGDP_938.site |awk &#039;{if (NR &amp;gt; 1) {print $1, $2-1, $2;}}&#039; &amp;gt; HGDP_938.bed&lt;br /&gt;
&lt;br /&gt;
This BED file contains the positions of all the reference markers.  &lt;br /&gt;
&lt;br /&gt;
Then we use &#039;&#039;samtools&#039;&#039; to extract the sequence bases overlapping these 632,958 reference markers.&lt;br /&gt;
Assuming your BAM file name is &#039;&#039;NA12878.chrom22.recal.bam&#039;&#039; (our example BAM file), you can use this:&lt;br /&gt;
&lt;br /&gt;
 samtools mpileup -q 30 -Q 20 -f ../../LASER-resource/reference/hs37d5.fa -l HGDP_938.bed exampleBAM/NA12878.chrom22.recal.bam &amp;gt; NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
to obtain a pileup file named &#039;&#039;NA12878.chrom22.pileup&#039;&#039;. It is required to keep the &#039;&#039;.pileup&#039; suffix.&lt;br /&gt;
&lt;br /&gt;
2. Obtain a seq file from pileup files. &lt;br /&gt;
&lt;br /&gt;
After obtaining pileup files from each BAM file, you can convert them into a single seq file before running LASER. &lt;br /&gt;
Use the same site file and all generated pileup files from step 1 to generate a seq file:&lt;br /&gt;
&lt;br /&gt;
 python pileup2seq.py  -m ../resource/HGDP/HGDP_938.site -o test NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
You should obtain test.seq file after this step.&lt;br /&gt;
&lt;br /&gt;
== Estimate ancestries of sequence samples  ==&lt;br /&gt;
&lt;br /&gt;
The easiest way to perform LASER using its exemplar data is: &lt;br /&gt;
&lt;br /&gt;
 ./laser -s pileup2seq/test.seq  -g resource/HGDP/HGDP_938.geno -c resource/HGDP/HGDP_938.RefPC.coord -o test -k 2&lt;br /&gt;
&lt;br /&gt;
Upon successful calculation,  you will find a result file &amp;quot;test.SeqPC.coord&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Interpret LASER outputs ==&lt;br /&gt;
&lt;br /&gt;
Upon successfully launching LASER command line as above, the output messages should be similar to below: &lt;br /&gt;
&lt;br /&gt;
    ===================================================================&lt;br /&gt;
    ====       LASER: Locating Ancestry from SEquencing Reads       ====&lt;br /&gt;
    ====            Version 1.0 | (c) Chaolong Wang 2013            ====&lt;br /&gt;
    ====================================================================&lt;br /&gt;
    Started at: Fri Nov 15 01:05:48 2013&lt;br /&gt;
&lt;br /&gt;
    938 individuals are detected in the GENO_FILE.&lt;br /&gt;
    632958 loci are detected in the GENO_FILE.&lt;br /&gt;
    1 individuals are detected in the SEQ_FILE.&lt;br /&gt;
    632958 loci are detected in the SEQ_FILE.&lt;br /&gt;
    938 individuals are detected in the COORD_FILE.&lt;br /&gt;
    100 PCs are detected in the COORD_FILE.&lt;br /&gt;
&lt;br /&gt;
    Parameter values used in execution:&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
    GENO_FILE (-g)resource/HGDP/HGDP_938.geno&lt;br /&gt;
    SEQ_FILE (-s)pileup2seq/test.seq&lt;br /&gt;
    COORD_FILE (-c)resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
    OUT_PREFIX (-o)test&lt;br /&gt;
    DIM (-k)2&lt;br /&gt;
    MIN_LOCI (-l)100&lt;br /&gt;
    SEQ_ERR (-e)0.01&lt;br /&gt;
    FIRST_IND (-x)1&lt;br /&gt;
    LAST_IND (-y)1&lt;br /&gt;
    REPS (-r)1&lt;br /&gt;
    OUTPUT_REPS (-R)0&lt;br /&gt;
    CHECK_FORMAT (-fmt)10&lt;br /&gt;
    CHECK_COVERAGE (-cov)0&lt;br /&gt;
    PCA_MODE (-pca)0&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:05:50 2013&lt;br /&gt;
    Checking data format ...&lt;br /&gt;
    GENO_FILE: OK.&lt;br /&gt;
    SEQ_FILE: OK.&lt;br /&gt;
    COORD_FILE: OK.&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:06:01 2013&lt;br /&gt;
    Reading reference genotypes ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Reading reference PCA coordinates ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Analyzing sequence samples ...&lt;br /&gt;
    Results for the sequence samples are output to &#039;test.SeqPC.coord&#039;.&lt;br /&gt;
&lt;br /&gt;
    Finished at: Fri Nov 15 01:09:21 2013&lt;br /&gt;
    ====================================================================&lt;br /&gt;
&lt;br /&gt;
The ancestry of input samples are store in the file &#039;&#039;&#039;test.SeqPC.coord&#039;&#039;&#039;, which content is shown below:&lt;br /&gt;
&lt;br /&gt;
    popID	indivID	L1	Ci	t	PC1	PC2&lt;br /&gt;
    NA12878.chrom22	NA12878.chrom22	1601	0.00858193	0.977243	31.522	224.098&lt;br /&gt;
&lt;br /&gt;
The ancestry coordinates for NA12878 samples are given in PC1 (31.522) and PC2 (224.098).&lt;br /&gt;
&lt;br /&gt;
It is recommended to visualize this results with HGDP reference samples whose coordinates are given in file: resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
In our manuscript, an example figure is shown: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER paper Figure 2.png|thumb|center|alt=LASER example outputs as in Figure 2|400px|LASER Outputs]] &lt;br /&gt;
&lt;br /&gt;
In this figure, 238 individuals were randomly selected from the total 938 HGDP samples as the testing set (colored symbols), &lt;br /&gt;
and the remaining 700 HGDP individuals were used as the reference panel (gray symbols).&lt;br /&gt;
&lt;br /&gt;
= File format  =&lt;br /&gt;
&lt;br /&gt;
== Geno file  ==&lt;br /&gt;
&lt;br /&gt;
Geno file are from reference samples. LASER use genotype of these samples as a reference panel. You can obtain geno file from VCF files using [https://github.com/zhanxw/vcf2geno vcf2geno].&lt;br /&gt;
&lt;br /&gt;
In our resource folder, we provide an example geno file for the HGDP data set (resource/HGDP/HGDP_938.geno):&lt;br /&gt;
&lt;br /&gt;
 Brahui	HGDP00001	1	2	1	1	0	2	0	2	1	2	2	2	1	1	2	1	0&lt;br /&gt;
 Brahui	HGDP00003	0	0	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00005	0	2	2	0	0	1	0	2	1	2	2	2	2	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00007	0	2	2	0	0	2	0	2	0	2	2	2	1	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00009	0	1	0	1	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00011	1	1	2	1	1	2	1	1	1	2	2	2	1	1	2	2	0&lt;br /&gt;
 Brahui	HGDP00013	1	2	2	1	1	2	1	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00015	1	1	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00017	1	1	2	0	0	1	0	0	0	2	0	1	1	2	2	2	0&lt;br /&gt;
 Brahui	HGDP00019	0	2	2	0	0	1	0	1	0	2	1	2	2	1	2	2	0&lt;br /&gt;
&lt;br /&gt;
The first and second columns represent the population id and individual id. &lt;br /&gt;
From the third column, each number represents a genotype.&lt;br /&gt;
To be consistent with the sequence data, genotypes should be given on the &#039;&#039;&#039;forward strand&#039;&#039;&#039;. Genotypes are coded by 0, 1, or 2, representing copies of the&lt;br /&gt;
reference allele at a locus in one individual. &lt;br /&gt;
&lt;br /&gt;
In this geno file, we have 632,960 columns which contains 632,958 markers from column 3 to the last column.&lt;br /&gt;
&lt;br /&gt;
== Seq file  ==&lt;br /&gt;
Seq file is generated from pileup files. It contains sequencing information and organize it in a LASER readable format.&lt;br /&gt;
The first two columns represent population id and individual id.&lt;br /&gt;
Subsequent columns are total read depths and reference base counts.&lt;br /&gt;
For example, column 3 and 4 are 0, 0 in the following example. That means at first marker, the sequence read depth is 0 and thus none of the reads has reference base.&lt;br /&gt;
We enforce tab delimiters between markers and space delimiters between each read depths and reference base counts.&lt;br /&gt;
On line of seq file looks like below:&lt;br /&gt;
&lt;br /&gt;
 NA12878.chrom22	NA12878.chrom22	0 0	0 0	0 0	0 0	0 &lt;br /&gt;
&lt;br /&gt;
== Pileup file  ==&lt;br /&gt;
&lt;br /&gt;
Pileup file are generated using samtools. An example pileup file is shown below:&lt;br /&gt;
 &lt;br /&gt;
 22	17094749	A	1	c	D&lt;br /&gt;
 22	17202602	T	1	.	D&lt;br /&gt;
 22	17411899	A	1	.	C&lt;br /&gt;
 22	17450515	G	2	.,	9&amp;lt;&lt;br /&gt;
 22	17452966	T	1	c	5&lt;br /&gt;
 22	17470779	C	1	,	A&lt;br /&gt;
 22	17492203	G	1	,	B&lt;br /&gt;
 22	17504945	C	3	,..	BCA&lt;br /&gt;
 22	17529814	T	3	..,	CCC&lt;br /&gt;
&lt;br /&gt;
The columns are chromosome, position (1-based), reference base, depth, bases and base qualities.&lt;br /&gt;
&lt;br /&gt;
== BED file  ==&lt;br /&gt;
BED file represents genomic regions and it follows [http://genome.ucsc.edu/FAQ/FAQformat.html#format1 UCSC conventions]:&lt;br /&gt;
&lt;br /&gt;
 1 752565 752566&lt;br /&gt;
 1 768447 768448&lt;br /&gt;
 1 1005805 1005806&lt;br /&gt;
 1 1018703 1018704&lt;br /&gt;
 1 1021414 1021415&lt;br /&gt;
&lt;br /&gt;
The columns are: chromosome, start position (0-based) and end position (1-based).&lt;br /&gt;
&lt;br /&gt;
== Coord file  ==&lt;br /&gt;
Coord files represent the ancestries of both reference samples and sequence samples.&lt;br /&gt;
An example coord file looks like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
The columns are: popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci has been covered, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity.&lt;br /&gt;
PC1, PC2 means coordinates of first and second principal components. You may notice L1, Ci, and t are omitted in the coord files of reference samples. The reason is that reference samples use genotypes and do not have coverage information.&lt;br /&gt;
&lt;br /&gt;
== Site file ==&lt;br /&gt;
Site file is equivalent to BED file and it is used here to represent marker positions. An example site file looks like below:&lt;br /&gt;
 CHR  POS      ID          REF  ALT&lt;br /&gt;
 1    752566   rs3094315   G    A&lt;br /&gt;
 1    768448   rs12562034  G    A&lt;br /&gt;
 1    1005806  rs3934834   C    T&lt;br /&gt;
 1    1018704  rs9442372   A    G&lt;br /&gt;
 1    1021415  rs3737728   A    G&lt;br /&gt;
&lt;br /&gt;
The site file has header line, and it contains chromosome, position(1-based), id (usually marker name), ref (reference allele) and alt (alternative allele).&lt;br /&gt;
&lt;br /&gt;
= Advanced options =&lt;br /&gt;
&lt;br /&gt;
LASER has advanced options including (1) parallel computing; (2) increase ancestry inference accuracy using repeated runs; (3) generate PCA coordiates using genotypes.&lt;br /&gt;
See [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf LASER Manual] for detailed information.&lt;br /&gt;
&lt;br /&gt;
= Contact  =&lt;br /&gt;
Comments on this wiki page or questions related to preparing input files for LASER can be sent to [mailto:zhanxw@umich.edu Xiaowei Zhan].&lt;br /&gt;
Comments on the LASER software or the user&#039;s manual can be sent to [mailto:chaolong@umich.edu Chaolong Wang].&lt;br /&gt;
This project was directed by Gonçalo Abecasis and Sebastian Zöllner at the University of Michigan.&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11308</id>
		<title>LASER</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11308"/>
		<updated>2014-07-30T15:21:20Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction  =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
LASER, which stands for Locating Ancestry using SEquencing Reads, is a C++ software package that can estimate individual ancestry directly from genome-wide shortgun sequencing reads without calling genotypes. The method relies on the availability of a set of reference individuals whose genome-wide SNP genotypes and ancestral information are known. We first construct a reference coordinate system by applying principal components analysis (PCA) to the genotype data of the reference individuals. Then, for each sequencing sample, use the genome-wide sequencing reads to place the sample into the reference PCA space. With an appropriate reference panel, the estimated coordinates of the sequencing samples identify their ancestral background and can be directly used to correct for population structure in association studies or to ensure adequate matching of cases and controls. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
The goal of this wiki page is to help you get start using LASER.&lt;br /&gt;
This page was created for LASER 1.0. Some of the information might be outdated for LASER 2.0. &lt;br /&gt;
A more updated wiki page can be found at [http://genome.sph.umich.edu/wiki/SeqShop:_Estimates_of_Genetic_Ancestry_Practical 2014 UM Sequencing Workshop].&lt;br /&gt;
We also encourage you to read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual] for more details of the software.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
&lt;br /&gt;
To get a copy of the software and manual, go to the [http://www.sph.umich.edu/csg/chaolong/LASER/ LASER Download] page.&lt;br /&gt;
&lt;br /&gt;
= Workflow  =&lt;br /&gt;
&lt;br /&gt;
LASER generates the coordinates from both reference individuals and sequence samples. It requires essentially two input files: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER-Workflow.png|thumb|center|alt=LASER workflow|400px|LASER Workflow]] &lt;br /&gt;
&lt;br /&gt;
*Seq file: a text file processed from BAM (alignment) files. (See [[#Process sequencing file (BAM)|Processing sequencing file]] for how to prepare seq file) &lt;br /&gt;
*Geno file: genotypes of reference individuals. (See [[#Geno file|Geno file]] to understand geno file format)&lt;br /&gt;
&lt;br /&gt;
LASER typically outputs two coord files: (1) in reference individuals&#039; coord file(Reference.coord), LASER outputs the reference coordinates in the PCA space; (2) in sequence samples&#039; coord files(AllSamples.coord), LASER infers their ancestries by placing their ancestry coordinates onto reference samples&#039; PCA space.&lt;br /&gt;
&lt;br /&gt;
An example result of the coord file of sequence samples is shown below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
In the header line, popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci that has been covered by at least one read, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity. PC1 and PC2 mean coordinates of the first and second principal components.&lt;br /&gt;
&lt;br /&gt;
= Tutorial  =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will show you how to prepare data and run LASER.&lt;br /&gt;
&lt;br /&gt;
== Process sequencing file (BAM)  ==&lt;br /&gt;
&lt;br /&gt;
We illustrate how to obtain .seq file from BAM files in this section. &lt;br /&gt;
In this example, we use HGDP data set as a reference, which contains 938 individuals and 632,958 markers.&lt;br /&gt;
[[File:LASER-DataProcessing.png|thumb|center|alt=LASER workflow|400px|LASER Data Processing Procedure]] &lt;br /&gt;
&lt;br /&gt;
1. Obtain pileup files from BAM files  &lt;br /&gt;
&lt;br /&gt;
The first step is to generate a BED file:&lt;br /&gt;
&lt;br /&gt;
 cat ../resource/HGDP/HGDP_938.site |awk &#039;{if (NR &amp;gt; 1) {print $1, $2-1, $2;}}&#039; &amp;gt; HGDP_938.bed&lt;br /&gt;
&lt;br /&gt;
This BED file contains the positions of all the reference markers.  &lt;br /&gt;
&lt;br /&gt;
Then we use &#039;&#039;samtools&#039;&#039; to extract the sequence bases overlapping these 632,958 reference markers.&lt;br /&gt;
Assuming your BAM file name is &#039;&#039;NA12878.chrom22.recal.bam&#039;&#039; (our example BAM file), you can use this:&lt;br /&gt;
&lt;br /&gt;
 samtools mpileup -q 30 -Q 20 -f ../../LASER-resource/reference/hs37d5.fa -l HGDP_938.bed exampleBAM/NA12878.chrom22.recal.bam &amp;gt; NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
to obtain a pileup file named &#039;&#039;NA12878.chrom22.pileup&#039;&#039;. It is required to keep the &#039;&#039;.pileup&#039; suffix.&lt;br /&gt;
&lt;br /&gt;
2. Obtain a seq file from pileup files. &lt;br /&gt;
&lt;br /&gt;
After obtaining pileup files from each BAM file, you can convert them into a single seq file before running LASER. &lt;br /&gt;
Use the same site file and all generated pileup files from step 1 to generate a seq file:&lt;br /&gt;
&lt;br /&gt;
 python pileup2seq.py  -m ../resource/HGDP/HGDP_938.site -o test NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
You should obtain test.seq file after this step.&lt;br /&gt;
&lt;br /&gt;
== Estimate ancestries of sequence samples  ==&lt;br /&gt;
&lt;br /&gt;
The easiest way to perform LASER using its exemplar data is: &lt;br /&gt;
&lt;br /&gt;
 ./laser -s pileup2seq/test.seq  -g resource/HGDP/HGDP_938.geno -c resource/HGDP/HGDP_938.RefPC.coord -o test -k 2&lt;br /&gt;
&lt;br /&gt;
Upon successful calculation,  you will find a result file &amp;quot;test.SeqPC.coord&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Interpret LASER outputs ==&lt;br /&gt;
&lt;br /&gt;
Upon successfully launching LASER command line as above, the output messages should be similar to below: &lt;br /&gt;
&lt;br /&gt;
    ===================================================================&lt;br /&gt;
    ====       LASER: Locating Ancestry from SEquencing Reads       ====&lt;br /&gt;
    ====            Version 1.0 | (c) Chaolong Wang 2013            ====&lt;br /&gt;
    ====================================================================&lt;br /&gt;
    Started at: Fri Nov 15 01:05:48 2013&lt;br /&gt;
&lt;br /&gt;
    938 individuals are detected in the GENO_FILE.&lt;br /&gt;
    632958 loci are detected in the GENO_FILE.&lt;br /&gt;
    1 individuals are detected in the SEQ_FILE.&lt;br /&gt;
    632958 loci are detected in the SEQ_FILE.&lt;br /&gt;
    938 individuals are detected in the COORD_FILE.&lt;br /&gt;
    100 PCs are detected in the COORD_FILE.&lt;br /&gt;
&lt;br /&gt;
    Parameter values used in execution:&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
    GENO_FILE (-g)resource/HGDP/HGDP_938.geno&lt;br /&gt;
    SEQ_FILE (-s)pileup2seq/test.seq&lt;br /&gt;
    COORD_FILE (-c)resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
    OUT_PREFIX (-o)test&lt;br /&gt;
    DIM (-k)2&lt;br /&gt;
    MIN_LOCI (-l)100&lt;br /&gt;
    SEQ_ERR (-e)0.01&lt;br /&gt;
    FIRST_IND (-x)1&lt;br /&gt;
    LAST_IND (-y)1&lt;br /&gt;
    REPS (-r)1&lt;br /&gt;
    OUTPUT_REPS (-R)0&lt;br /&gt;
    CHECK_FORMAT (-fmt)10&lt;br /&gt;
    CHECK_COVERAGE (-cov)0&lt;br /&gt;
    PCA_MODE (-pca)0&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:05:50 2013&lt;br /&gt;
    Checking data format ...&lt;br /&gt;
    GENO_FILE: OK.&lt;br /&gt;
    SEQ_FILE: OK.&lt;br /&gt;
    COORD_FILE: OK.&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:06:01 2013&lt;br /&gt;
    Reading reference genotypes ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Reading reference PCA coordinates ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Analyzing sequence samples ...&lt;br /&gt;
    Results for the sequence samples are output to &#039;test.SeqPC.coord&#039;.&lt;br /&gt;
&lt;br /&gt;
    Finished at: Fri Nov 15 01:09:21 2013&lt;br /&gt;
    ====================================================================&lt;br /&gt;
&lt;br /&gt;
The ancestry of input samples are store in the file &#039;&#039;&#039;test.SeqPC.coord&#039;&#039;&#039;, which content is shown below:&lt;br /&gt;
&lt;br /&gt;
    popID	indivID	L1	Ci	t	PC1	PC2&lt;br /&gt;
    NA12878.chrom22	NA12878.chrom22	1601	0.00858193	0.977243	31.522	224.098&lt;br /&gt;
&lt;br /&gt;
The ancestry coordinates for NA12878 samples are given in PC1 (31.522) and PC2 (224.098).&lt;br /&gt;
&lt;br /&gt;
It is recommended to visualize this results with HGDP reference samples whose coordinates are given in file: resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
In our manuscript, an example figure is shown: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER paper Figure 2.png|thumb|center|alt=LASER example outputs as in Figure 2|400px|LASER Outputs]] &lt;br /&gt;
&lt;br /&gt;
In this figure, 238 individuals were randomly selected from the total 938 HGDP samples as the testing set (colored symbols), &lt;br /&gt;
and the remaining 700 HGDP individuals were used as the reference panel (gray symbols).&lt;br /&gt;
&lt;br /&gt;
= File format  =&lt;br /&gt;
&lt;br /&gt;
== Geno file  ==&lt;br /&gt;
&lt;br /&gt;
Geno file are from reference samples. LASER use genotype of these samples as a reference panel. You can obtain geno file from VCF files using [https://github.com/zhanxw/vcf2geno vcf2geno].&lt;br /&gt;
&lt;br /&gt;
In our resource folder, we provide an example geno file for the HGDP data set (resource/HGDP/HGDP_938.geno):&lt;br /&gt;
&lt;br /&gt;
 Brahui	HGDP00001	1	2	1	1	0	2	0	2	1	2	2	2	1	1	2	1	0&lt;br /&gt;
 Brahui	HGDP00003	0	0	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00005	0	2	2	0	0	1	0	2	1	2	2	2	2	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00007	0	2	2	0	0	2	0	2	0	2	2	2	1	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00009	0	1	0	1	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00011	1	1	2	1	1	2	1	1	1	2	2	2	1	1	2	2	0&lt;br /&gt;
 Brahui	HGDP00013	1	2	2	1	1	2	1	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00015	1	1	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00017	1	1	2	0	0	1	0	0	0	2	0	1	1	2	2	2	0&lt;br /&gt;
 Brahui	HGDP00019	0	2	2	0	0	1	0	1	0	2	1	2	2	1	2	2	0&lt;br /&gt;
&lt;br /&gt;
The first and second columns represent the population id and individual id. &lt;br /&gt;
From the third column, each number represents a genotype.&lt;br /&gt;
To be consistent with the sequence data, genotypes should be given on the &#039;&#039;&#039;forward strand&#039;&#039;&#039;. Genotypes are coded by 0, 1, or 2, representing copies of the&lt;br /&gt;
reference allele at a locus in one individual. &lt;br /&gt;
&lt;br /&gt;
In this geno file, we have 632,960 columns which contains 632,958 markers from column 3 to the last column.&lt;br /&gt;
&lt;br /&gt;
== Seq file  ==&lt;br /&gt;
Seq file is generated from pileup files. It contains sequencing information and organize it in a LASER readable format.&lt;br /&gt;
The first two columns represent population id and individual id.&lt;br /&gt;
Subsequent columns are total read depths and reference base counts.&lt;br /&gt;
For example, column 3 and 4 are 0, 0 in the following example. That means at first marker, the sequence read depth is 0 and thus none of the reads has reference base.&lt;br /&gt;
We enforce tab delimiters between markers and space delimiters between each read depths and reference base counts.&lt;br /&gt;
On line of seq file looks like below:&lt;br /&gt;
&lt;br /&gt;
 NA12878.chrom22	NA12878.chrom22	0 0	0 0	0 0	0 0	0 &lt;br /&gt;
&lt;br /&gt;
== Pileup file  ==&lt;br /&gt;
&lt;br /&gt;
Pileup file are generated using samtools. An example pileup file is shown below:&lt;br /&gt;
 &lt;br /&gt;
 22	17094749	A	1	c	D&lt;br /&gt;
 22	17202602	T	1	.	D&lt;br /&gt;
 22	17411899	A	1	.	C&lt;br /&gt;
 22	17450515	G	2	.,	9&amp;lt;&lt;br /&gt;
 22	17452966	T	1	c	5&lt;br /&gt;
 22	17470779	C	1	,	A&lt;br /&gt;
 22	17492203	G	1	,	B&lt;br /&gt;
 22	17504945	C	3	,..	BCA&lt;br /&gt;
 22	17529814	T	3	..,	CCC&lt;br /&gt;
&lt;br /&gt;
The columns are chromosome, position (1-based), reference base, depth, bases and base qualities.&lt;br /&gt;
&lt;br /&gt;
== BED file  ==&lt;br /&gt;
BED file represents genomic regions and it follows [http://genome.ucsc.edu/FAQ/FAQformat.html#format1 UCSC conventions]:&lt;br /&gt;
&lt;br /&gt;
 1 752565 752566&lt;br /&gt;
 1 768447 768448&lt;br /&gt;
 1 1005805 1005806&lt;br /&gt;
 1 1018703 1018704&lt;br /&gt;
 1 1021414 1021415&lt;br /&gt;
&lt;br /&gt;
The columns are: chromosome, start position (0-based) and end position (1-based).&lt;br /&gt;
&lt;br /&gt;
== Coord file  ==&lt;br /&gt;
Coord files represent the ancestries of both reference samples and sequence samples.&lt;br /&gt;
An example coord file looks like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
The columns are: popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci has been covered, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity.&lt;br /&gt;
PC1, PC2 means coordinates of first and second principal components. You may notice L1, Ci, and t are omitted in the coord files of reference samples. The reason is that reference samples use genotypes and do not have coverage information.&lt;br /&gt;
&lt;br /&gt;
== Site file ==&lt;br /&gt;
Site file is equivalent to BED file and it is used here to represent marker positions. An example site file looks like below:&lt;br /&gt;
 CHR  POS      ID          REF  ALT&lt;br /&gt;
 1    752566   rs3094315   G    A&lt;br /&gt;
 1    768448   rs12562034  G    A&lt;br /&gt;
 1    1005806  rs3934834   C    T&lt;br /&gt;
 1    1018704  rs9442372   A    G&lt;br /&gt;
 1    1021415  rs3737728   A    G&lt;br /&gt;
&lt;br /&gt;
The site file has header line, and it contains chromosome, position(1-based), id (usually marker name), ref (reference allele) and alt (alternative allele).&lt;br /&gt;
&lt;br /&gt;
= Advanced options =&lt;br /&gt;
&lt;br /&gt;
LASER has advanced options including (1) parallel computing; (2) increase ancestry inference accuracy using repeated runs; (3) generate PCA coordiates using genotypes.&lt;br /&gt;
See [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf LASER Manual] for detailed information.&lt;br /&gt;
&lt;br /&gt;
= Contact  =&lt;br /&gt;
Comments on this wiki page or questions related to preparing input files for LASER can be sent to [mailto:zhanxw@umich.edu Xiaowei Zhan].&lt;br /&gt;
Comments on the LASER software or the user&#039;s manual can be sent to [mailto:chaolong@umich.edu Chaolong Wang].&lt;br /&gt;
This project was directed by Gonçalo Abecasis and Sebastian Zöllner at the University of Michigan.&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11307</id>
		<title>LASER</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=LASER&amp;diff=11307"/>
		<updated>2014-07-30T15:20:51Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction  =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
LASER, which stands for Locating Ancestry using SEquencing Reads, is a C++ software package that can estimate individual ancestry directly from genome-wide shortgun sequencing reads without calling genotypes. The method relies on the availability of a set of reference individuals whose genome-wide SNP genotypes and ancestral information are known. We first construct a reference coordinate system by applying principal components analysis (PCA) to the genotype data of the reference individuals. Then, for each sequencing sample, use the genome-wide sequencing reads to place the sample into the reference PCA space. With an appropriate reference panel, the estimated coordinates of the sequencing samples identify their ancestral background and can be directly used to correct for population structure in association studies or to ensure adequate matching of cases and controls. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
The goal of this wiki page is to help you get start using LASER.&lt;br /&gt;
This page was created for LASER version 1.0. Some of the information might be outdated for LASER version 2.0. &lt;br /&gt;
A more updated wiki page can be found at [http://genome.sph.umich.edu/wiki/SeqShop:_Estimates_of_Genetic_Ancestry_Practical 2014 UM Sequencing Workshop].&lt;br /&gt;
We also encourage you to read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual] for more details of the software.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
&lt;br /&gt;
To get a copy of the software and manual, go to the [http://www.sph.umich.edu/csg/chaolong/LASER/ LASER Download] page.&lt;br /&gt;
&lt;br /&gt;
= Workflow  =&lt;br /&gt;
&lt;br /&gt;
LASER generates the coordinates from both reference individuals and sequence samples. It requires essentially two input files: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER-Workflow.png|thumb|center|alt=LASER workflow|400px|LASER Workflow]] &lt;br /&gt;
&lt;br /&gt;
*Seq file: a text file processed from BAM (alignment) files. (See [[#Process sequencing file (BAM)|Processing sequencing file]] for how to prepare seq file) &lt;br /&gt;
*Geno file: genotypes of reference individuals. (See [[#Geno file|Geno file]] to understand geno file format)&lt;br /&gt;
&lt;br /&gt;
LASER typically outputs two coord files: (1) in reference individuals&#039; coord file(Reference.coord), LASER outputs the reference coordinates in the PCA space; (2) in sequence samples&#039; coord files(AllSamples.coord), LASER infers their ancestries by placing their ancestry coordinates onto reference samples&#039; PCA space.&lt;br /&gt;
&lt;br /&gt;
An example result of the coord file of sequence samples is shown below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
In the header line, popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci that has been covered by at least one read, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity. PC1 and PC2 mean coordinates of the first and second principal components.&lt;br /&gt;
&lt;br /&gt;
= Tutorial  =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will show you how to prepare data and run LASER.&lt;br /&gt;
&lt;br /&gt;
== Process sequencing file (BAM)  ==&lt;br /&gt;
&lt;br /&gt;
We illustrate how to obtain .seq file from BAM files in this section. &lt;br /&gt;
In this example, we use HGDP data set as a reference, which contains 938 individuals and 632,958 markers.&lt;br /&gt;
[[File:LASER-DataProcessing.png|thumb|center|alt=LASER workflow|400px|LASER Data Processing Procedure]] &lt;br /&gt;
&lt;br /&gt;
1. Obtain pileup files from BAM files  &lt;br /&gt;
&lt;br /&gt;
The first step is to generate a BED file:&lt;br /&gt;
&lt;br /&gt;
 cat ../resource/HGDP/HGDP_938.site |awk &#039;{if (NR &amp;gt; 1) {print $1, $2-1, $2;}}&#039; &amp;gt; HGDP_938.bed&lt;br /&gt;
&lt;br /&gt;
This BED file contains the positions of all the reference markers.  &lt;br /&gt;
&lt;br /&gt;
Then we use &#039;&#039;samtools&#039;&#039; to extract the sequence bases overlapping these 632,958 reference markers.&lt;br /&gt;
Assuming your BAM file name is &#039;&#039;NA12878.chrom22.recal.bam&#039;&#039; (our example BAM file), you can use this:&lt;br /&gt;
&lt;br /&gt;
 samtools mpileup -q 30 -Q 20 -f ../../LASER-resource/reference/hs37d5.fa -l HGDP_938.bed exampleBAM/NA12878.chrom22.recal.bam &amp;gt; NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
to obtain a pileup file named &#039;&#039;NA12878.chrom22.pileup&#039;&#039;. It is required to keep the &#039;&#039;.pileup&#039; suffix.&lt;br /&gt;
&lt;br /&gt;
2. Obtain a seq file from pileup files. &lt;br /&gt;
&lt;br /&gt;
After obtaining pileup files from each BAM file, you can convert them into a single seq file before running LASER. &lt;br /&gt;
Use the same site file and all generated pileup files from step 1 to generate a seq file:&lt;br /&gt;
&lt;br /&gt;
 python pileup2seq.py  -m ../resource/HGDP/HGDP_938.site -o test NA12878.chrom22.pileup&lt;br /&gt;
&lt;br /&gt;
You should obtain test.seq file after this step.&lt;br /&gt;
&lt;br /&gt;
== Estimate ancestries of sequence samples  ==&lt;br /&gt;
&lt;br /&gt;
The easiest way to perform LASER using its exemplar data is: &lt;br /&gt;
&lt;br /&gt;
 ./laser -s pileup2seq/test.seq  -g resource/HGDP/HGDP_938.geno -c resource/HGDP/HGDP_938.RefPC.coord -o test -k 2&lt;br /&gt;
&lt;br /&gt;
Upon successful calculation,  you will find a result file &amp;quot;test.SeqPC.coord&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Interpret LASER outputs ==&lt;br /&gt;
&lt;br /&gt;
Upon successfully launching LASER command line as above, the output messages should be similar to below: &lt;br /&gt;
&lt;br /&gt;
    ===================================================================&lt;br /&gt;
    ====       LASER: Locating Ancestry from SEquencing Reads       ====&lt;br /&gt;
    ====            Version 1.0 | (c) Chaolong Wang 2013            ====&lt;br /&gt;
    ====================================================================&lt;br /&gt;
    Started at: Fri Nov 15 01:05:48 2013&lt;br /&gt;
&lt;br /&gt;
    938 individuals are detected in the GENO_FILE.&lt;br /&gt;
    632958 loci are detected in the GENO_FILE.&lt;br /&gt;
    1 individuals are detected in the SEQ_FILE.&lt;br /&gt;
    632958 loci are detected in the SEQ_FILE.&lt;br /&gt;
    938 individuals are detected in the COORD_FILE.&lt;br /&gt;
    100 PCs are detected in the COORD_FILE.&lt;br /&gt;
&lt;br /&gt;
    Parameter values used in execution:&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
    GENO_FILE (-g)resource/HGDP/HGDP_938.geno&lt;br /&gt;
    SEQ_FILE (-s)pileup2seq/test.seq&lt;br /&gt;
    COORD_FILE (-c)resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
    OUT_PREFIX (-o)test&lt;br /&gt;
    DIM (-k)2&lt;br /&gt;
    MIN_LOCI (-l)100&lt;br /&gt;
    SEQ_ERR (-e)0.01&lt;br /&gt;
    FIRST_IND (-x)1&lt;br /&gt;
    LAST_IND (-y)1&lt;br /&gt;
    REPS (-r)1&lt;br /&gt;
    OUTPUT_REPS (-R)0&lt;br /&gt;
    CHECK_FORMAT (-fmt)10&lt;br /&gt;
    CHECK_COVERAGE (-cov)0&lt;br /&gt;
    PCA_MODE (-pca)0&lt;br /&gt;
    -------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:05:50 2013&lt;br /&gt;
    Checking data format ...&lt;br /&gt;
    GENO_FILE: OK.&lt;br /&gt;
    SEQ_FILE: OK.&lt;br /&gt;
    COORD_FILE: OK.&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:06:01 2013&lt;br /&gt;
    Reading reference genotypes ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Reading reference PCA coordinates ...&lt;br /&gt;
&lt;br /&gt;
    Fri Nov 15 01:09:15 2013&lt;br /&gt;
    Analyzing sequence samples ...&lt;br /&gt;
    Results for the sequence samples are output to &#039;test.SeqPC.coord&#039;.&lt;br /&gt;
&lt;br /&gt;
    Finished at: Fri Nov 15 01:09:21 2013&lt;br /&gt;
    ====================================================================&lt;br /&gt;
&lt;br /&gt;
The ancestry of input samples are store in the file &#039;&#039;&#039;test.SeqPC.coord&#039;&#039;&#039;, which content is shown below:&lt;br /&gt;
&lt;br /&gt;
    popID	indivID	L1	Ci	t	PC1	PC2&lt;br /&gt;
    NA12878.chrom22	NA12878.chrom22	1601	0.00858193	0.977243	31.522	224.098&lt;br /&gt;
&lt;br /&gt;
The ancestry coordinates for NA12878 samples are given in PC1 (31.522) and PC2 (224.098).&lt;br /&gt;
&lt;br /&gt;
It is recommended to visualize this results with HGDP reference samples whose coordinates are given in file: resource/HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
In our manuscript, an example figure is shown: &lt;br /&gt;
&lt;br /&gt;
[[File:LASER paper Figure 2.png|thumb|center|alt=LASER example outputs as in Figure 2|400px|LASER Outputs]] &lt;br /&gt;
&lt;br /&gt;
In this figure, 238 individuals were randomly selected from the total 938 HGDP samples as the testing set (colored symbols), &lt;br /&gt;
and the remaining 700 HGDP individuals were used as the reference panel (gray symbols).&lt;br /&gt;
&lt;br /&gt;
= File format  =&lt;br /&gt;
&lt;br /&gt;
== Geno file  ==&lt;br /&gt;
&lt;br /&gt;
Geno file are from reference samples. LASER use genotype of these samples as a reference panel. You can obtain geno file from VCF files using [https://github.com/zhanxw/vcf2geno vcf2geno].&lt;br /&gt;
&lt;br /&gt;
In our resource folder, we provide an example geno file for the HGDP data set (resource/HGDP/HGDP_938.geno):&lt;br /&gt;
&lt;br /&gt;
 Brahui	HGDP00001	1	2	1	1	0	2	0	2	1	2	2	2	1	1	2	1	0&lt;br /&gt;
 Brahui	HGDP00003	0	0	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00005	0	2	2	0	0	1	0	2	1	2	2	2	2	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00007	0	2	2	0	0	2	0	2	0	2	2	2	1	1	2	2	1&lt;br /&gt;
 Brahui	HGDP00009	0	1	0	1	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00011	1	1	2	1	1	2	1	1	1	2	2	2	1	1	2	2	0&lt;br /&gt;
 Brahui	HGDP00013	1	2	2	1	1	2	1	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00015	1	1	2	0	0	2	0	2	0	2	2	2	2	0	2	2	0&lt;br /&gt;
 Brahui	HGDP00017	1	1	2	0	0	1	0	0	0	2	0	1	1	2	2	2	0&lt;br /&gt;
 Brahui	HGDP00019	0	2	2	0	0	1	0	1	0	2	1	2	2	1	2	2	0&lt;br /&gt;
&lt;br /&gt;
The first and second columns represent the population id and individual id. &lt;br /&gt;
From the third column, each number represents a genotype.&lt;br /&gt;
To be consistent with the sequence data, genotypes should be given on the &#039;&#039;&#039;forward strand&#039;&#039;&#039;. Genotypes are coded by 0, 1, or 2, representing copies of the&lt;br /&gt;
reference allele at a locus in one individual. &lt;br /&gt;
&lt;br /&gt;
In this geno file, we have 632,960 columns which contains 632,958 markers from column 3 to the last column.&lt;br /&gt;
&lt;br /&gt;
== Seq file  ==&lt;br /&gt;
Seq file is generated from pileup files. It contains sequencing information and organize it in a LASER readable format.&lt;br /&gt;
The first two columns represent population id and individual id.&lt;br /&gt;
Subsequent columns are total read depths and reference base counts.&lt;br /&gt;
For example, column 3 and 4 are 0, 0 in the following example. That means at first marker, the sequence read depth is 0 and thus none of the reads has reference base.&lt;br /&gt;
We enforce tab delimiters between markers and space delimiters between each read depths and reference base counts.&lt;br /&gt;
On line of seq file looks like below:&lt;br /&gt;
&lt;br /&gt;
 NA12878.chrom22	NA12878.chrom22	0 0	0 0	0 0	0 0	0 &lt;br /&gt;
&lt;br /&gt;
== Pileup file  ==&lt;br /&gt;
&lt;br /&gt;
Pileup file are generated using samtools. An example pileup file is shown below:&lt;br /&gt;
 &lt;br /&gt;
 22	17094749	A	1	c	D&lt;br /&gt;
 22	17202602	T	1	.	D&lt;br /&gt;
 22	17411899	A	1	.	C&lt;br /&gt;
 22	17450515	G	2	.,	9&amp;lt;&lt;br /&gt;
 22	17452966	T	1	c	5&lt;br /&gt;
 22	17470779	C	1	,	A&lt;br /&gt;
 22	17492203	G	1	,	B&lt;br /&gt;
 22	17504945	C	3	,..	BCA&lt;br /&gt;
 22	17529814	T	3	..,	CCC&lt;br /&gt;
&lt;br /&gt;
The columns are chromosome, position (1-based), reference base, depth, bases and base qualities.&lt;br /&gt;
&lt;br /&gt;
== BED file  ==&lt;br /&gt;
BED file represents genomic regions and it follows [http://genome.ucsc.edu/FAQ/FAQformat.html#format1 UCSC conventions]:&lt;br /&gt;
&lt;br /&gt;
 1 752565 752566&lt;br /&gt;
 1 768447 768448&lt;br /&gt;
 1 1005805 1005806&lt;br /&gt;
 1 1018703 1018704&lt;br /&gt;
 1 1021414 1021415&lt;br /&gt;
&lt;br /&gt;
The columns are: chromosome, start position (0-based) and end position (1-based).&lt;br /&gt;
&lt;br /&gt;
== Coord file  ==&lt;br /&gt;
Coord files represent the ancestries of both reference samples and sequence samples.&lt;br /&gt;
An example coord file looks like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1    Ci        t         PC1       PC2&lt;br /&gt;
 YRI    NA19238  1409  0.304122  0.98933   52.7634   -39.7924&lt;br /&gt;
 CEU    NA12892  1552  0.330037  0.989709  9.82674   25.2898&lt;br /&gt;
 CEU    NA12891  1609  0.362198  0.988082  0.439573  26.8872&lt;br /&gt;
 CEU    NA12878  1579  0.334825  0.988677  8.83775   28.1342&lt;br /&gt;
 YRI    NA19239  1558  0.34898   0.988302  53.9104   -39.1727&lt;br /&gt;
 YRI    NA19240  1735  0.404142  0.990264  59.8379   -45.2765&lt;br /&gt;
&lt;br /&gt;
The columns are: popID means &amp;quot;population ID&amp;quot;, indivID means &amp;quot;individual ID&amp;quot;, L1 means number of loci has been covered, Ci means &amp;quot;average coverage&amp;quot;, t means Procrustes similarity.&lt;br /&gt;
PC1, PC2 means coordinates of first and second principal components. You may notice L1, Ci, and t are omitted in the coord files of reference samples. The reason is that reference samples use genotypes and do not have coverage information.&lt;br /&gt;
&lt;br /&gt;
== Site file ==&lt;br /&gt;
Site file is equivalent to BED file and it is used here to represent marker positions. An example site file looks like below:&lt;br /&gt;
 CHR  POS      ID          REF  ALT&lt;br /&gt;
 1    752566   rs3094315   G    A&lt;br /&gt;
 1    768448   rs12562034  G    A&lt;br /&gt;
 1    1005806  rs3934834   C    T&lt;br /&gt;
 1    1018704  rs9442372   A    G&lt;br /&gt;
 1    1021415  rs3737728   A    G&lt;br /&gt;
&lt;br /&gt;
The site file has header line, and it contains chromosome, position(1-based), id (usually marker name), ref (reference allele) and alt (alternative allele).&lt;br /&gt;
&lt;br /&gt;
= Advanced options =&lt;br /&gt;
&lt;br /&gt;
LASER has advanced options including (1) parallel computing; (2) increase ancestry inference accuracy using repeated runs; (3) generate PCA coordiates using genotypes.&lt;br /&gt;
See [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf LASER Manual] for detailed information.&lt;br /&gt;
&lt;br /&gt;
= Contact  =&lt;br /&gt;
Comments on this wiki page or questions related to preparing input files for LASER can be sent to [mailto:zhanxw@umich.edu Xiaowei Zhan].&lt;br /&gt;
Comments on the LASER software or the user&#039;s manual can be sent to [mailto:chaolong@umich.edu Chaolong Wang].&lt;br /&gt;
This project was directed by Gonçalo Abecasis and Sebastian Zöllner at the University of Michigan.&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Template:SeqShopLogin&amp;diff=11100</id>
		<title>Template:SeqShopLogin</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Template:SeqShopLogin&amp;diff=11100"/>
		<updated>2014-06-26T15:52:35Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Login to the seqshop-server Linux Machine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Login to the seqshop-server Linux Machine ==&lt;br /&gt;
&#039;&#039; This section will appear redundantly in each session. If you already know how to log in to the server, please skip this section&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Login to the windows machine&amp;lt;/li&amp;gt;&lt;br /&gt;
* The username/password for the Windows machine should be written on the right-hand monitor&lt;br /&gt;
&amp;lt;li&amp;gt; Start xming so you can open external windows on our Linux machine&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Start-&amp;gt;Enter &amp;quot;Xming&amp;quot; in the search and select &amp;quot;Xming&amp;quot; from the program list&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Nothing will happen, but Xming was started.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:200px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View Screenshot&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
[[File:xming.png]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Open putty&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Start-&amp;gt;Enter &amp;quot;putty&amp;quot; in the search and select &amp;quot;PuTTY&amp;quot; from the program list&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:200px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View Screenshot&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
[[File:PuttyS.png]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Configure PuTTY in the PuTTY Configuration window&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Host Name: &amp;lt;code&amp;gt;seqshop-server.sph.umich.edu&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:200px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View Screenshot&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
[[File:seqshop.png]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Setup to allow you to open external windows:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; In the left pannel: Connection-&amp;gt;SSH-&amp;gt;X11&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Add a check mark in the box next to &amp;lt;code&amp;gt;Enable X11 forwarding&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:200px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;View Screenshot&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
[[File:seqshopX11.png]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Click &amp;lt;code&amp;gt;Open&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; If it prompts about a key, click &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Enter your provided username &amp;amp; password as provided&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now be logged into a terminal on the seqshop-server and be able to access the test files.&lt;br /&gt;
* If you need another terminal, repeat from step 3.&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=File:LASER-tutorial.pdf&amp;diff=11017</id>
		<title>File:LASER-tutorial.pdf</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=File:LASER-tutorial.pdf&amp;diff=11017"/>
		<updated>2014-06-19T18:30:02Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: Chaolong Wang uploaded a new version of &amp;amp;quot;File:LASER-tutorial.pdf&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10990</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10990"/>
		<updated>2014-06-19T03:21:01Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: bam --&amp;gt; pileup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to exclude reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10989</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10989"/>
		<updated>2014-06-19T03:20:38Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: bam --&amp;gt; pileup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We use -q 30 and -Q 20 to remove reads that have mapping quality score lower than 30 or base quality score lower than 20.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10988</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10988"/>
		<updated>2014-06-19T03:00:32Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 CEU samples cluster with HGDP Europeans and 3 YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10987</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10987"/>
		<updated>2014-06-19T02:42:04Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Go to the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 HapMap CEU samples cluster with HGDP Europeans and 3 HapMap YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10986</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10986"/>
		<updated>2014-06-19T02:37:46Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
Enter the plot folder and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 HapMap CEU samples cluster with HGDP Europeans and 3 HapMap YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10985</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10985"/>
		<updated>2014-06-19T02:36:22Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: bam --&amp;gt; pileup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
   $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
And then we enter the directory and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 HapMap CEU samples cluster with HGDP Europeans and 3 HapMap YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10984</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10984"/>
		<updated>2014-06-19T02:34:17Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Step 1: bam --&amp;gt; pileup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/human.g1k.v37.fa -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
And then we enter the directory and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 HapMap CEU samples cluster with HGDP Europeans and 3 HapMap YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10983</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10983"/>
		<updated>2014-06-19T02:33:00Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Getting started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export REF=/home/mktrost/seqshop/reference/all&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
And then we enter the directory and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 HapMap CEU samples cluster with HGDP Europeans and 3 HapMap YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10982</id>
		<title>SeqShop: Estimates of Genetic Ancestry Practical, June 2014</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SeqShop:_Estimates_of_Genetic_Ancestry_Practical,_June_2014&amp;diff=10982"/>
		<updated>2014-06-19T01:47:58Z</updated>

		<summary type="html">&lt;p&gt;Chaolong Wang: /* Visualizing results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
See the [[Media:LASER-tutorial.pdf|tutorial slides]] for an introduction of the LASER analysis workflow, input/output file formats, and usage of the LASER software.&lt;br /&gt;
&lt;br /&gt;
The main purpose of this page is to provide step-by-step command lines for using LASER to estimate ancestry of 6 targeted sequenced samples (2 HapMap trios) in a principal component space generated using genome-wide SNP data from the Human Genome Diversity Project (HGDP). The HGDP reference panel contains genotype data across 632,958 autosomal loci for 938 individuals from 53 populations worldwide.&lt;br /&gt;
&lt;br /&gt;
For more details about the options and usage of LASER, please read the [http://www.sph.umich.edu/csg/chaolong/LASER/LASER_Manual.pdf manual].&lt;br /&gt;
&lt;br /&gt;
== LASER workflow ==&lt;br /&gt;
[[File:LASER-workflow.png|thumb|center|alt=LASER workflow|400px|LASER workflow]]&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 mkdir ancestry&lt;br /&gt;
 cd ancestry&lt;br /&gt;
&lt;br /&gt;
Download and decompress software package:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.sph.umich.edu/csg/chaolong/LASER/LASER-2.01.tar.gz&lt;br /&gt;
 tar xzvf LASER-2.01.tar.gz&lt;br /&gt;
&lt;br /&gt;
Set up to access data:&lt;br /&gt;
 source /home/chaolong/LASER-Tutorial/setup.txt&lt;br /&gt;
&lt;br /&gt;
What is in the setup.txt file:&lt;br /&gt;
 export GC=/home/mktrost/seqshop/gotcloud&lt;br /&gt;
 export BAM=/home/chaolong/LASER-Tutorial/BAM&lt;br /&gt;
 export REF=/home/chaolong/LASER-Tutorial/reference&lt;br /&gt;
 export HGDP=/home/chaolong/LASER-Tutorial/HGDP&lt;br /&gt;
&lt;br /&gt;
== Preparing input files for LASER ==&lt;br /&gt;
=== Step 0: vcf --&amp;gt; geno ===&lt;br /&gt;
&lt;br /&gt;
This step prepares the reference panel by converting a VCF genotype file to a GENO file. We will skip this step and use a ready-to-use HGDP reference panel. A typical command to run the vcf2geno tool is given in the file &amp;quot;./LASER-2.01/vcf2geno/cmd.sh&amp;quot;:&lt;br /&gt;
 # cd ./LASER-2.01/vcf2geno/&lt;br /&gt;
 # ./vcf2geno --inVcf exampleVCF/example.vcf.gz --updateID test.updateId --out test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Step 1: bam --&amp;gt; pileup ===&lt;br /&gt;
&lt;br /&gt;
This step uses samtools to generate pileup files from bam files. &lt;br /&gt;
Please only try one sample so that we won&#039;t overload the sever with everyone running 6 jobs at the same time. Pileup files for these 6 samples have been prepared for later steps.&lt;br /&gt;
It takes about 2 mins for each pileup job. &lt;br /&gt;
&lt;br /&gt;
 $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101035.recal.bam &amp;gt; 121101035.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101043.recal.bam &amp;gt; 121101043.recal.pileup &amp;amp; &lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101050.recal.bam &amp;gt; 121101050.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101052.recal.bam &amp;gt; 121101052.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101415.recal.bam &amp;gt; 121101415.recal.pileup &amp;amp;&lt;br /&gt;
 # $GC/bin/samtools mpileup -q 30 -Q 20 -f $REF/hs37d5.fa.rz -l $HGDP/HGDP_938.bed $BAM/121101861.recal.bam &amp;gt; 121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
=== Step 2: pileup --&amp;gt; seq ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will generate a file called &amp;quot;hapmap_trios.seq&amp;quot;, containing the information of 6 samples. It takes about 30 seconds to run.&lt;br /&gt;
We will use the pre-generated pileup files in the $BAM folder.&lt;br /&gt;
&lt;br /&gt;
 python ./LASER-2.01/pileup2seq/pileup2seq.py \&lt;br /&gt;
 -m $HGDP/HGDP_938.site \&lt;br /&gt;
 -b $BAM/AMD_roi_1-based.bed \&lt;br /&gt;
 -i $BAM/AMD_hapmap_trios_id.txt \&lt;br /&gt;
 -o hapmap_trios \&lt;br /&gt;
 $BAM/121101035.recal.pileup \&lt;br /&gt;
 $BAM/121101043.recal.pileup \&lt;br /&gt;
 $BAM/121101050.recal.pileup \&lt;br /&gt;
 $BAM/121101052.recal.pileup \&lt;br /&gt;
 $BAM/121101415.recal.pileup \&lt;br /&gt;
 $BAM/121101861.recal.pileup &amp;amp;&lt;br /&gt;
&lt;br /&gt;
In the above command, -b provides the targeted regions to exclude and -i specifies alternative IDs for the BAM files to be used in the .seq file (including popID and indivID). &lt;br /&gt;
-b and -i are optional.&lt;br /&gt;
&lt;br /&gt;
== Estimating ancestry coordinates ==&lt;br /&gt;
&lt;br /&gt;
=== Step 0: Generate the reference ancestry space ===&lt;br /&gt;
&lt;br /&gt;
LASER can perform principal components analysis (PCA) on genotype data of the reference panel to generate a reference ancestry space.&lt;br /&gt;
&lt;br /&gt;
 # ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -pca 1 -k 30 -o HGDP_938&lt;br /&gt;
&lt;br /&gt;
The above command takes ~20 minutes to finish. &lt;br /&gt;
We will skip this step, and use a set of reference ancestry coordinates that have been generated in the file $HGDP/HGDP_938.RefPC.coord.&lt;br /&gt;
View the reference coordinates:&lt;br /&gt;
&lt;br /&gt;
 less -S $HGDP/HGDP_938.RefPC.coord&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Estimate ancestry for sequenced samples ===&lt;br /&gt;
&lt;br /&gt;
Submit two jobs to place sequenced samples into the reference ancestry space:&lt;br /&gt;
&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 1 -y 3 -o hapmap_trios.1-3 &amp;amp;&lt;br /&gt;
 ./LASER-2.01/laser -g $HGDP/HGDP_938.geno -c $HGDP/HGDP_938.RefPC.coord -s hapmap_trios.seq -K 20 -k 4 -x 4 -y 6 -o hapmap_trios.4-6 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
The first job will process samples 1 to 3 and the second job will processed samples 4 to 6. &lt;br /&gt;
Each sequenced sample will be projected from a 20-dimensional PCA space onto a 4-dimensional reference ancestry space. &lt;br /&gt;
The running time is ~10 minutes for processing 3 samples in each job.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Combine results ===&lt;br /&gt;
&lt;br /&gt;
Results from previous step will be output to two files &amp;quot;hapmap_trios.1-3.SeqPC.coord&amp;quot; and &amp;quot;hapmap_trios.4-6.SeqPC.coord&amp;quot;. &lt;br /&gt;
Here we simply concatenate the two files while skipping the header line of the second file.&lt;br /&gt;
&lt;br /&gt;
 cp hapmap_trios.1-3.SeqPC.coord hapmap_trios.SeqPC.coord&lt;br /&gt;
 more +2 hapmap_trios.4-6.SeqPC.coord &amp;gt;&amp;gt; hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
View the results:&lt;br /&gt;
 less -S hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
The results should look like below:&lt;br /&gt;
&lt;br /&gt;
 popID  indivID  L1      Ci         K     t          PC1        PC2         PC3         PC4&lt;br /&gt;
 YRI    NA19238  78386   0.170864   20    0.999688   467.989    -210.294    -14.1729    -14.4204&lt;br /&gt;
 CEU    NA12892  85486   0.185973   20    0.999723   10.796     199.095     -9.90387    -21.4534&lt;br /&gt;
 CEU    NA12891  87588   0.190442   20    0.99973    2.04224    196.07      -19.5705    -12.8022&lt;br /&gt;
 CEU    NA12878  83213   0.181748   20    0.999711   4.34591    199.861     -12.4825    -22.6281&lt;br /&gt;
 YRI    NA19239  87564   0.193424   20    0.999734   474.464    -215.96     -9.02921    -19.7372&lt;br /&gt;
 YRI    NA19240  95866   0.213874   20    0.999748   469.914    -214.94     -14.9923    -13.6559&lt;br /&gt;
&lt;br /&gt;
== Visualizing results ==&lt;br /&gt;
&lt;br /&gt;
Example R codes are available in ./LASER-2.01/plot/. Let&#039;s copy the folder to current working directory:&lt;br /&gt;
&lt;br /&gt;
 cp -r ./LASER-2.01/plot/ ./&lt;br /&gt;
&lt;br /&gt;
And then we enter the directory and run the script to plot results:&lt;br /&gt;
 cd plot&lt;br /&gt;
 Rscript plotHGDP.r $HGDP/HGDP_938.RefPC.coord ../hapmap_trios.SeqPC.coord&lt;br /&gt;
&lt;br /&gt;
A figure named &amp;quot;Results_on_HGDP.pdf&amp;quot; will be generated. &lt;br /&gt;
Visualize the figure:&lt;br /&gt;
&lt;br /&gt;
 evince Results_on_HGDP.pdf &amp;amp;&lt;br /&gt;
&lt;br /&gt;
We expect to see the following figure, in which 3 HapMap CEU samples cluster with HGDP Europeans and 3 HapMap YRI samples cluster with HGDP Africans: &lt;br /&gt;
[[File:Results_on_HGDP.png|thumb|center|alt=LASER results|400px|LASER results]]&lt;/div&gt;</summary>
		<author><name>Chaolong Wang</name></author>
	</entry>
</feed>