<?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=Pha</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=Pha"/>
	<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/wiki/Special:Contributions/Pha"/>
	<updated>2026-09-24T04:37:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamUtil:_convert&amp;diff=3895</id>
		<title>BamUtil: convert</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamUtil:_convert&amp;diff=3895"/>
		<updated>2011-10-04T18:47:48Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* BAM File Recovery */ better grammar and more text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:BamUtil|convert]]&lt;br /&gt;
[[Category:BAM Software]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
= Overview of the &amp;lt;code&amp;gt;convert&amp;lt;/code&amp;gt; function of &amp;lt;code&amp;gt;bamUtil&amp;lt;/code&amp;gt; =&lt;br /&gt;
The &amp;lt;code&amp;gt;convert&amp;lt;/code&amp;gt; option on the [[bamUtil]] executable reads a SAM/BAM file and writes it as a SAM/BAM file.&lt;br /&gt;
&lt;br /&gt;
The executable converts the input file into the format of the output file.  &lt;br /&gt;
&lt;br /&gt;
It has options to allow for the conversion of the sequence to/from &#039;=&#039; from/to the actual bases by using the reference sequence.&lt;br /&gt;
&lt;br /&gt;
If you want to convert a BAM file to a SAM file, just call:&lt;br /&gt;
 &amp;lt;pathToExe&amp;gt;/bam --in &amp;lt;bamFile&amp;gt;.bam --out &amp;lt;newSamFile&amp;gt;.sam&lt;br /&gt;
Don&#039;t forget to put in the paths to the executable and your test files.&lt;br /&gt;
&lt;br /&gt;
= Parameters =&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Required Parameters:&lt;br /&gt;
        --in        : the SAM/BAM file to be read&lt;br /&gt;
        --out       : the SAM/BAM file to be written&lt;br /&gt;
    Optional Parameters:&lt;br /&gt;
	--refFile   : reference file name&lt;br /&gt;
        --noeof     : do not expect an EOF block on a bam file.&lt;br /&gt;
        --params    : print the parameter settings&lt;br /&gt;
        --recover   : attempt to recover the input bam file.&lt;br /&gt;
    Optional Sequence Parameters (only specify one):&lt;br /&gt;
	--seqOrig   : Leave the sequence as is (default &amp;amp; used if reference is not specified).&lt;br /&gt;
	--seqBases  : Convert any &#039;=&#039; in the sequence to the appropriate base using the reference (requires --ref).&lt;br /&gt;
	--seqEquals : Convert any bases that match the reference to &#039;=&#039; (requires --ref).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Representation Parameters ==&lt;br /&gt;
The sequence parameters options specify how to represent the sequence if the reference is specified (refFile option).  If the reference is not specified or seqOrig is specified, no modifications are made to the sequence.  If the reference and seqBases is specified, any matches between the sequence and the reference are represented in the sequence as the appropriate base.  If the reference and seqEquals is specified, any matches between the sequence and the reference are represented in the sequence as &#039;=&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AATAA  CTAGA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Bases:  AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AATGA  CTGGA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Bases:  AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Equals: AA=G===GG===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AAT=A  CT=GA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AAT=ACT=GATAGGG&lt;br /&gt;
 Sequence with Bases:  AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AA===  ===G=   = =GGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AA======G===GGG&lt;br /&gt;
 Sequence with Bases:  AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
= BAM File Recovery =&lt;br /&gt;
&lt;br /&gt;
A BAM file that has been corrupted or truncated due to a copy or disk problem can often be partially recovered.&lt;br /&gt;
&lt;br /&gt;
Both the BGZF format and binary BAM format have enough information to scan forward and resynchronize the input data.  While some data will be lost, substantial recovery can often be done.&lt;br /&gt;
&lt;br /&gt;
When a file has bad blocks in it, normal copy commands (cp) will truncate the file at the point of disk read failure.  To recover the maximum amount of data possible, use the dd command with the conv=noerror option.&lt;br /&gt;
&lt;br /&gt;
So a normal use case for recovery would look this this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# dd if=brokenbamfile.bam of=/tmp/brokenbamfile1.bam conv=noerror bs=4k&lt;br /&gt;
# bam convert --recover --in /tmp/brokenbamfile1.bam --out /tmp/brokenbamfilerecovered.bam&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, you will of course need to output the result file to a known good filesystem.&lt;br /&gt;
&lt;br /&gt;
Currently, no statistics are printed as far as how many BAM records are recovered, but subsequent tests can readily be done on the resulting file to determine the quality of recovery.&lt;br /&gt;
&lt;br /&gt;
In real cases, we have recovered better than 94% of reads from a set of severely damaged files (numerous 64K chunks of a RAID were lost), and better than 99.9% recovery from a moderately damaged file (3 disk pages were corrupt).&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
 ./bam convert --in &amp;lt;inputFile&amp;gt; --out &amp;lt;outputFile.sam/bam/ubam (ubam is uncompressed bam)&amp;gt; [--refFile &amp;lt;reference filename&amp;gt;] [--seqBases|--seqEquals|--seqOrig] [--noeof] [--params]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Return Value =&lt;br /&gt;
Returns the SamStatus for the reads/writes.&lt;br /&gt;
&lt;br /&gt;
= Example Output =&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Number of records read = 10&lt;br /&gt;
Number of records written = 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamUtil:_convert&amp;diff=3894</id>
		<title>BamUtil: convert</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamUtil:_convert&amp;diff=3894"/>
		<updated>2011-10-04T18:44:16Z</updated>

		<summary type="html">&lt;p&gt;Pha: add recovery section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:BamUtil|convert]]&lt;br /&gt;
[[Category:BAM Software]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
= Overview of the &amp;lt;code&amp;gt;convert&amp;lt;/code&amp;gt; function of &amp;lt;code&amp;gt;bamUtil&amp;lt;/code&amp;gt; =&lt;br /&gt;
The &amp;lt;code&amp;gt;convert&amp;lt;/code&amp;gt; option on the [[bamUtil]] executable reads a SAM/BAM file and writes it as a SAM/BAM file.&lt;br /&gt;
&lt;br /&gt;
The executable converts the input file into the format of the output file.  &lt;br /&gt;
&lt;br /&gt;
It has options to allow for the conversion of the sequence to/from &#039;=&#039; from/to the actual bases by using the reference sequence.&lt;br /&gt;
&lt;br /&gt;
If you want to convert a BAM file to a SAM file, just call:&lt;br /&gt;
 &amp;lt;pathToExe&amp;gt;/bam --in &amp;lt;bamFile&amp;gt;.bam --out &amp;lt;newSamFile&amp;gt;.sam&lt;br /&gt;
Don&#039;t forget to put in the paths to the executable and your test files.&lt;br /&gt;
&lt;br /&gt;
= Parameters =&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Required Parameters:&lt;br /&gt;
        --in        : the SAM/BAM file to be read&lt;br /&gt;
        --out       : the SAM/BAM file to be written&lt;br /&gt;
    Optional Parameters:&lt;br /&gt;
	--refFile   : reference file name&lt;br /&gt;
        --noeof     : do not expect an EOF block on a bam file.&lt;br /&gt;
        --params    : print the parameter settings&lt;br /&gt;
        --recover   : attempt to recover the input bam file.&lt;br /&gt;
    Optional Sequence Parameters (only specify one):&lt;br /&gt;
	--seqOrig   : Leave the sequence as is (default &amp;amp; used if reference is not specified).&lt;br /&gt;
	--seqBases  : Convert any &#039;=&#039; in the sequence to the appropriate base using the reference (requires --ref).&lt;br /&gt;
	--seqEquals : Convert any bases that match the reference to &#039;=&#039; (requires --ref).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Representation Parameters ==&lt;br /&gt;
The sequence parameters options specify how to represent the sequence if the reference is specified (refFile option).  If the reference is not specified or seqOrig is specified, no modifications are made to the sequence.  If the reference and seqBases is specified, any matches between the sequence and the reference are represented in the sequence as the appropriate base.  If the reference and seqEquals is specified, any matches between the sequence and the reference are represented in the sequence as &#039;=&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AATAA  CTAGA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Bases:  AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AATGA  CTGGA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Bases:  AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Equals: AA=G===GG===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AAT=A  CT=GA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AAT=ACT=GATAGGG&lt;br /&gt;
 Sequence with Bases:  AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AA===  ===G=   = =GGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AA======G===GGG&lt;br /&gt;
 Sequence with Bases:  AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
= BAM File Recovery =&lt;br /&gt;
&lt;br /&gt;
A BAM file that has been corrupted, or truncated due to a copy or disk problem can often be partially recovered.&lt;br /&gt;
&lt;br /&gt;
Both the BGZF format and binary BAM format have enough information to scan forward and resynchronize the input data.  While some data will be lost, substantial recovery can often be done.&lt;br /&gt;
&lt;br /&gt;
When a file has bad blocks in it, normal copy commands (cp) will truncate the file at the point of disk read failure.  To recover the maximum amount of data possible, use the dd command with the conv=noerror option.&lt;br /&gt;
&lt;br /&gt;
So a normal use case for recovery would look this this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# dd if=brokenbamfile.bam of=/tmp/brokenbamfile1.bam conv=noerror bs=4k&lt;br /&gt;
# bam convert --recover --in /tmp/brokenbamfile1.bam --out /tmp/brokenbamfilerecovered.bam&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, you will of course need to output the result file to a known good filesystem.&lt;br /&gt;
&lt;br /&gt;
Currently, no statistics are printed as far as how many BAM records are recovered, but subsequent tests can readily be done on the resulting file to determine the quality of recovery.&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
 ./bam convert --in &amp;lt;inputFile&amp;gt; --out &amp;lt;outputFile.sam/bam/ubam (ubam is uncompressed bam)&amp;gt; [--refFile &amp;lt;reference filename&amp;gt;] [--seqBases|--seqEquals|--seqOrig] [--noeof] [--params]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Return Value =&lt;br /&gt;
Returns the SamStatus for the reads/writes.&lt;br /&gt;
&lt;br /&gt;
= Example Output =&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Number of records read = 10&lt;br /&gt;
Number of records written = 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamUtil:_convert&amp;diff=3893</id>
		<title>BamUtil: convert</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamUtil:_convert&amp;diff=3893"/>
		<updated>2011-10-04T18:32:26Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Parameters */ add recover option&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:BamUtil|convert]]&lt;br /&gt;
[[Category:BAM Software]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
= Overview of the &amp;lt;code&amp;gt;convert&amp;lt;/code&amp;gt; function of &amp;lt;code&amp;gt;bamUtil&amp;lt;/code&amp;gt; =&lt;br /&gt;
The &amp;lt;code&amp;gt;convert&amp;lt;/code&amp;gt; option on the [[bamUtil]] executable reads a SAM/BAM file and writes it as a SAM/BAM file.&lt;br /&gt;
&lt;br /&gt;
The executable converts the input file into the format of the output file.  &lt;br /&gt;
&lt;br /&gt;
It has options to allow for the conversion of the sequence to/from &#039;=&#039; from/to the actual bases by using the reference sequence.&lt;br /&gt;
&lt;br /&gt;
If you want to convert a BAM file to a SAM file, just call:&lt;br /&gt;
 &amp;lt;pathToExe&amp;gt;/bam --in &amp;lt;bamFile&amp;gt;.bam --out &amp;lt;newSamFile&amp;gt;.sam&lt;br /&gt;
Don&#039;t forget to put in the paths to the executable and your test files.&lt;br /&gt;
&lt;br /&gt;
= Parameters =&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Required Parameters:&lt;br /&gt;
        --in        : the SAM/BAM file to be read&lt;br /&gt;
        --out       : the SAM/BAM file to be written&lt;br /&gt;
    Optional Parameters:&lt;br /&gt;
	--refFile   : reference file name&lt;br /&gt;
        --noeof     : do not expect an EOF block on a bam file.&lt;br /&gt;
        --params    : print the parameter settings&lt;br /&gt;
        --recover   : attempt to recover the input bam file.&lt;br /&gt;
    Optional Sequence Parameters (only specify one):&lt;br /&gt;
	--seqOrig   : Leave the sequence as is (default &amp;amp; used if reference is not specified).&lt;br /&gt;
	--seqBases  : Convert any &#039;=&#039; in the sequence to the appropriate base using the reference (requires --ref).&lt;br /&gt;
	--seqEquals : Convert any bases that match the reference to &#039;=&#039; (requires --ref).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Representation Parameters ==&lt;br /&gt;
The sequence parameters options specify how to represent the sequence if the reference is specified (refFile option).  If the reference is not specified or seqOrig is specified, no modifications are made to the sequence.  If the reference and seqBases is specified, any matches between the sequence and the reference are represented in the sequence as the appropriate base.  If the reference and seqEquals is specified, any matches between the sequence and the reference are represented in the sequence as &#039;=&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AATAA  CTAGA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Bases:  AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AATGA  CTGGA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Bases:  AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Equals: AA=G===GG===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AAT=A  CT=GA   T AGGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AAT=ACT=GATAGGG&lt;br /&gt;
 Sequence with Bases:  AATGACTGGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
 ExtendedCigar: SSMMMDDMMMIMNNNMPMSSS&lt;br /&gt;
 Sequence:      AA===  ===G=   = =GGG&lt;br /&gt;
 Reference:       TAACCCTA ACCCT A&lt;br /&gt;
 Sequence with Orig:   AA======G===GGG&lt;br /&gt;
 Sequence with Bases:  AATAACTAGATAGGG&lt;br /&gt;
 Sequence with Equals: AA======G===GGG&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
 ./bam convert --in &amp;lt;inputFile&amp;gt; --out &amp;lt;outputFile.sam/bam/ubam (ubam is uncompressed bam)&amp;gt; [--refFile &amp;lt;reference filename&amp;gt;] [--seqBases|--seqEquals|--seqOrig] [--noeof] [--params]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Return Value =&lt;br /&gt;
Returns the SamStatus for the reads/writes.&lt;br /&gt;
&lt;br /&gt;
= Example Output =&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Number of records read = 10&lt;br /&gt;
Number of records written = 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=QPLOT&amp;diff=2423</id>
		<title>QPLOT</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=QPLOT&amp;diff=2423"/>
		<updated>2010-11-02T20:33:28Z</updated>

		<summary type="html">&lt;p&gt;Pha: initial copy from internal wiki - needs more edits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The qplot program is to calculate various summary statistics some of which will be plotted in a pdf file which can be used to assess the sequencing quality for illumina sequencing after mapping reads to the reference genome. The main statistics are empirical Phred scores which was calculated based on the background mismatch rate. By background mismatch rate, it means the rate that sequenced bases are different from the reference genome, EXCLUDING dbSNP positions. Other statistics include GC biases, insert size distribution, depth distribution, genome coverage, empirical Q20 count and so on. An example plot and summary text will follow at the end&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The code is now deposited into the pipeline. If you have not seen it in your pipeline, you shall update you pipeline. See [[pipeline and git]].&lt;br /&gt;
&lt;br /&gt;
In the pipeline folder, go to qplot and make will create an executable qplot in the qplot sub-directory. Here is the qplot help page&lt;br /&gt;
&lt;br /&gt;
  wonderland &amp;gt; ./qplot&lt;br /&gt;
  The following parameters are available.  Ones with &amp;quot;[]&amp;quot; are in effect:&lt;br /&gt;
              References : --reference [/data/local/ref/karma.ref/human.g1k.v37.umfa],&lt;br /&gt;
                           --dbsnp [/home/bingshan/data/db/dbSNP/dbSNP130.UCSC.coordinates.tbl],&lt;br /&gt;
                           --gccontent [/home/bingshan/data/db/gcContent/gcContent.hg37.w250.out]&lt;br /&gt;
   Create gcContent file : --create_gc [], --winsize [100]&lt;br /&gt;
            Flag filters : --read1_skip, --read2_skip, --paired_skip,&lt;br /&gt;
                           --unpaired_skip&lt;br /&gt;
          Dup and QCFail : --dup_keep, --qcfail_keep&lt;br /&gt;
         Mapping filters : --minMapQuality [0.00]&lt;br /&gt;
      Records to process : --first_n_record [-1]&lt;br /&gt;
        Lanes to process : --lanes []&lt;br /&gt;
            Output files : --plot [], --stats [], --Rcode []&lt;br /&gt;
             Plot labels : --label [], --bamLabel []&lt;br /&gt;
&lt;br /&gt;
== Input files ==&lt;br /&gt;
&lt;br /&gt;
Three (3) precomputed files are required. Multiple bam/sam files should be appended after all other parameters.&lt;br /&gt;
&lt;br /&gt;
* --reference&lt;br /&gt;
** The reference genome is the same as karma reference genome. If the index files do not exist, qplot will create the index files using the input reference fasta file.&lt;br /&gt;
** Or use the latest karma to generate reference index files using the command: &lt;br /&gt;
 karma create -i reference.fa&lt;br /&gt;
&lt;br /&gt;
* --dbsnp&lt;br /&gt;
This file has two columns. First column is the chromosome name wich have to be consistent with the reference created above&lt;br /&gt;
&lt;br /&gt;
* --gccontent&lt;br /&gt;
&lt;br /&gt;
Although GC content can be calculated on fly each time, it is much more efficient to load a precomputed GC content from a file. To generate the file, use the following command&lt;br /&gt;
 /home/bingshan/code/calcGCContent/genGCContent -r referenceByKarma -w windowSize -o gccontent.out&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note&#039;&#039;: Before running the qplot, it is critical to check how the chromosome numbers are coded. Some bam file use just numbers, others use chr + numbers. &#039;&#039;&#039;You need to make sure that the chromosome numbers from reference and dbsnp are consistent with the bam file.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
&lt;br /&gt;
Most of command line parameters are self explanatory and some of them are described here&lt;br /&gt;
&lt;br /&gt;
*Flag filter&lt;br /&gt;
** By default all reads are processed. If it is desired to check only the first read of a pair, use --read2_skip to ignore the second read. And so on.&lt;br /&gt;
&lt;br /&gt;
*Duplication and QCFile&lt;br /&gt;
** By default reads marked as dup and QCFile are ignored but can be retained by &lt;br /&gt;
 --dup_keep or --qcfail_keep&lt;br /&gt;
&lt;br /&gt;
*Records to process is to try the first n reads to test the bam files and check whether it works.&lt;br /&gt;
&lt;br /&gt;
* Lanes to process&lt;br /&gt;
** If the input bam files have more than one lane and only some of them need to be checked, they can be specified by --lanes 1,3,5 whatever the number of lanes needed.&lt;br /&gt;
** In order for this to work, the lane info has to be encoded in the read name such that lane number is the second field with the delimit of &amp;quot;:&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* Plot filters&lt;br /&gt;
** GC bias plot requires large memory (genome size which is ~3Gb) and if it is not desired to generate it to save memory it can be disabled by &lt;br /&gt;
 --gc_plot_skip&lt;br /&gt;
&lt;br /&gt;
* Region list&lt;br /&gt;
** If the interest of QA is a list of regions, e.g. exons, this can be achieved by providing a list of region. The regions should be in the form of &amp;quot;chr start end label&amp;quot; each line in the file. In order for this option to work, within each chromosome (contig) the regions have to be sorted by starting position, and also the input bam files have to be sorted. &lt;br /&gt;
 1 100 500 region_A&lt;br /&gt;
 1 600 800 region_B&lt;br /&gt;
 2 100 300 region_C&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
* Plot labels&lt;br /&gt;
** Two kinds of labels are enabled. First one is the label for the plot (default is empty), e.g. label on the title of each subplot. Second one is a set of labels for each input bam files, e.g. sample ID (default is numbers 1, 2, ... until the number of input bam files.&lt;br /&gt;
 --label Run100 --bamLabels s1,s2,s3,s4,s5,s6,s7,s8&lt;br /&gt;
&lt;br /&gt;
* Multiple threading&lt;br /&gt;
** Number of concurrent threads running for the input bam files. One bam file will be processed by one thread. Therefore using a number which is dividable by the number of input bam files will make it efficient. One extra thread requires memory about 375Mb on top of around 4Gb memory used to hold reference and GC content file.&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
There are three (optional) output files.&lt;br /&gt;
* --plot qa.pdf&lt;br /&gt;
** This is a pdf file containing 2 pages each with 4 figures. If --pages 1 is specified, only page 1 is output. The plot is generated using Rscript.&lt;br /&gt;
* --stats qa.stats&lt;br /&gt;
** This is a text file containing various summary statistics for each input bam/sam file&lt;br /&gt;
* --Rcode qa.R&lt;br /&gt;
** This is the R code used for plotting the figures in qa.pdf file. If Rscript is not installed in the system the qplot is run, you can use the qa.R to generate the figures in other machines, or extract plotting data from each run and combine multiple runs together to generate more comprehensive plots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example output ==&lt;br /&gt;
&lt;br /&gt;
* Figures&lt;br /&gt;
 https://statgen.sph.umich.edu/w/images/5/53/Sardinia_Run_84_QA.pdf&lt;br /&gt;
&lt;br /&gt;
* Summary statistics text file&lt;br /&gt;
 TotalReads(e6)  75.74   76.37   76.33   76.47   76.76   76.33   76.34   75.30&lt;br /&gt;
 MappingRate(%)  95.27   95.21   95.68   95.64   95.49   95.99   95.72   95.54&lt;br /&gt;
 MapRate_pass(%) 95.27   95.21   95.68   95.64   95.49   95.99   95.72   95.54&lt;br /&gt;
 ZeroMapQual(%)  3.91    3.90    3.86    3.95    3.65    3.44    3.47    3.46&lt;br /&gt;
 MapQual&amp;lt;10(%)   4.15    4.16    4.12    4.22    3.91    3.69    3.72    3.72&lt;br /&gt;
 TargetMapping(%)        0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00&lt;br /&gt;
 PairedReads(%)  100.00  100.00  100.00  100.00  100.00  100.00  100.00  100.00&lt;br /&gt;
 ProperPaired(%) 91.74   90.92   92.53   92.19   91.74   92.64   91.99   92.10&lt;br /&gt;
 MappedBases(e9) 7.62    7.51    7.56    7.52    7.55    7.60    7.62    7.41&lt;br /&gt;
 Q20Bases(e9)    7.41    7.35    7.42    7.37    7.40    7.44    7.47    7.28&lt;br /&gt;
 Q20BasesPct(%)  97.27   97.96   98.16   98.02   98.00   97.99   98.12   98.16&lt;br /&gt;
 MeanDepth       3.01    2.98    3.01    2.99    2.99    3.00    2.99    2.93&lt;br /&gt;
 GenomeCover(%)  88.45   87.92   87.74   87.88   88.00   88.37   88.78   88.21&lt;br /&gt;
 GCBiasMSE       0.02    0.02    0.02    0.02    0.02    0.02    0.02    0.02&lt;br /&gt;
 ISize_mode      242     267     284     282     268     258     260     262&lt;br /&gt;
 ISize_medium    241     268     285     281     269     258     259     262&lt;br /&gt;
 DupRate(%)      1.58    1.55    1.77    1.71    1.46    1.51    1.73    1.95&lt;br /&gt;
 QCFailRate(%)   0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00&lt;br /&gt;
 BaseComp_A(%)   30.3    30.1    30.6    30.3    30.0    30.4    30.4    30.5&lt;br /&gt;
 BaseComp_C(%)   19.9    20.1    19.6    19.9    20.2    19.8    19.8    19.7&lt;br /&gt;
 BaseComp_G(%)   19.9    20.1    19.7    20.0    20.2    19.8    19.9    19.8&lt;br /&gt;
 BaseComp_T(%)   29.9    29.7    30.1    29.8    29.6    30.0    29.9    30.0&lt;br /&gt;
 BaseComp_O(%)   0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1883</id>
		<title>SAM</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1883"/>
		<updated>2010-07-30T17:40:32Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* What is SAM */ second test&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is SAM ==&lt;br /&gt;
The &#039;&#039;&#039;SAM Format&#039;&#039;&#039; is a text format for storing sequence data in a series of tab delimited ASCII columns. &lt;br /&gt;
&lt;br /&gt;
Most often it is generated as a human readable version of its sister [[BAM]] format, which stores the same data in a compressed, indexed, binary form. &lt;br /&gt;
&lt;br /&gt;
Currently, most SAM format data is output from aligners that read FASTQ files and assign the sequences to a position with respect to a known reference genome.  In the future, SAM will also be used to archive unaligned sequence data generated directly from sequencing machines.&lt;br /&gt;
&lt;br /&gt;
The current definition of the format is at [[http://samtools.sourceforge.net/SAM1.pdf BAM/SAM Specification]].&lt;br /&gt;
&lt;br /&gt;
If you are writing software to read SAM or BAM data, our C++ [[C++ Library: libbam|BamFile]] is a good resource to use.&lt;br /&gt;
&lt;br /&gt;
This is a test to see how merges work - will be reverted.  Or Will It?&lt;br /&gt;
&lt;br /&gt;
This is a second test line to see if merges work.&lt;br /&gt;
&lt;br /&gt;
== What Information is in SAM &amp;amp; BAM ==&lt;br /&gt;
SAM files and BAM files contain the same information, but in a different format.  Refer to the specs to see a format description.&lt;br /&gt;
&lt;br /&gt;
Both SAM &amp;amp; BAM files contain a header section and an alignment section.&lt;br /&gt;
The header section may contain information about the entire file and additional information for alignments.  The alignments then associate themselves with specific header information.&lt;br /&gt;
&lt;br /&gt;
The alignment section contains the information for each sequence about where/how it aligns to the reference genome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What Information Does SAM/BAM Have for an Alignment ===&lt;br /&gt;
Each Alignment has:&lt;br /&gt;
* query name, QNAME (SAM)/read_name (BAM).  It is used to group/identify alignments that are together, like paired alignments or a read that appears in multiple alignments.&lt;br /&gt;
* a bitwise set of information describing the alignment, FLAG.  Provides the following information:&lt;br /&gt;
** are there multiple fragments?&lt;br /&gt;
** are all fragments properly aligned?&lt;br /&gt;
** is this fragment unmapped?&lt;br /&gt;
** is the next fragment unmapped?&lt;br /&gt;
** is this query the reverse strand?&lt;br /&gt;
** is the next fragment the reverse strand?&lt;br /&gt;
** is this the 1st fragment?&lt;br /&gt;
** is this the last fragment?&lt;br /&gt;
** is this a secondary alignment?&lt;br /&gt;
** did this read fail quality controls?&lt;br /&gt;
** is this read a PCR or optical duplicate?&lt;br /&gt;
&lt;br /&gt;
Not all alignments contain The rest of the alignment fields may be set to default values if the information is unknown.&lt;br /&gt;
* reference sequence name, RNAME, often contains the Chromosome name.  &lt;br /&gt;
* leftmost position of where this alignment maps to the reference, POS.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* mapping quality, MAPQ, which contains the &amp;quot;phred-scaled posterior probability that the mapping position&amp;quot; is wrong. (from SAM-1.pdf)&lt;br /&gt;
* string indicating alignment information that allows the storing of clipped, [[SAM#What is a CIGAR?|CIGAR]]&lt;br /&gt;
* the reference sequence name of the next alignment in this group, MRNM or RNEXT.  In paired alignments, it is the mate&#039;s reference sequence name. (A group is alignments with the same query name.)&lt;br /&gt;
* leftmost position of where the next alignment in this group maps to the reference, MPOS or PNEXT.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* length of this group from the leftmost position to the rightmost position, ISIZE or TLEN&lt;br /&gt;
* the query sequence for this alignment, SEQ&lt;br /&gt;
* the query quality for this alignment, [[SAM#What is QUAL?|QUAL]], one for each base in the query sequence.&lt;br /&gt;
* Additional optional information is also contained within the alignment, [[SAM#What are TAGs?|TAGs]].  A bunch of different information can be stored here and they appear as key/value pairs.  See the spec for a detailed list of commonly used tags and what they mean.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What is a CIGAR? ====&lt;br /&gt;
You may have heard the term CIGAR, but wondered what it means.  Hopefully this section will help clarify it.&lt;br /&gt;
&lt;br /&gt;
The sequence being aligned to a reference may have additional bases that are not in the reference or may be missing bases that are in the reference.  The CIGAR string is a sequence of of base lengths and the associated operation.  They are used to indicate things like which bases align (either a match/mismatch) with the reference, are deleted from the reference, and are insertions that are not in the reference.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T  G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read: ACTAGAATGGCT&lt;br /&gt;
Aligning these two:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7     8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T     G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read:                   A  C  T  A  G  A  A     T  G  G  C  T&lt;br /&gt;
With the alignment above, you get:&lt;br /&gt;
 POS: 5&lt;br /&gt;
 CIGAR: 3M1I3M1D5M&lt;br /&gt;
&lt;br /&gt;
The POS indicates that the read aligns starting at position 5 on the reference.&lt;br /&gt;
The CIGAR says that the first 3 bases in the read sequence align with the reference.  The next base in the read does not exist in the reference.  Then 3 bases align with the reference.  The next reference base does not exist in the read sequence, then 5 more bases align with the reference.  Note that at position 14, the base in the read is different than the reference, but it still counts as an M since it aligns to that position.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What is QUAL? ====&lt;br /&gt;
QUAL stands for query quality.  It is an indicator for how accurate each base in the query sequence (SEQ) is.  If QUAL is specified, there is a quality value for each base in SEQ.&lt;br /&gt;
&lt;br /&gt;
Quality is calculated based on the probability that a base is wrong, p, using the following formula:&lt;br /&gt;
 &amp;lt;math&amp;gt;quality = -10 \log_{10}p&amp;lt;/math&amp;gt;&lt;br /&gt;
This quality is called the [http://en.wikipedia.org/wiki/Phred_quality_score Phred Quality Score].&lt;br /&gt;
&lt;br /&gt;
Since a human readable format is desired for SAM, 33 is added to the calculated quality in order to make it a printable character ranging from ! - ~.&lt;br /&gt;
&lt;br /&gt;
So, for SAM, the QUAL field is:&lt;br /&gt;
 &amp;lt;math&amp;gt;QUAL = (-10 \log_{10}p) + 33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Phred Quality is also found in a FASTQ file, described here: http://en.wikipedia.org/wiki/FASTQ_format#Quality&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What are TAGs? ====&lt;br /&gt;
TAGs are optional fields on a SAM/BAM Alignment.&lt;br /&gt;
A TAG is comprised of a two character TAG key, they type of the value, and the value: &lt;br /&gt;
 [A-Za-z][A-za-z]:[AifZH]:.*&lt;br /&gt;
&lt;br /&gt;
There are a set of predefined tags that are general used in Alignments.&lt;br /&gt;
&lt;br /&gt;
A user can also use any additional tags to store any information they want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example SAM ==&lt;br /&gt;
=== Example Alignments ===&lt;br /&gt;
This is what the alignment section of a SAM file looks like:&lt;br /&gt;
&lt;br /&gt;
 1:497:R:-272+13M17D24M	113	1	497	37	37M	15	100338662	0	CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG	0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;	XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	99	1	17644	0	37M	=	17919	314	TATGACTGCTAATAATACCTACACATGTTAGAACCAT	&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9	XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	147	1	17919	0	18M2D19M	=	17644	-314	GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT	;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
 9:21597+10M2I25M:R:-209	83	1	21678	0	8M2I27M	=	21469	-244	CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT	&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
&lt;br /&gt;
In this example, the fields are:&lt;br /&gt;
{| style=&amp;quot;margin: 1em 1em 1em 0; background-color: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-style=&amp;quot;background: #f2f2f2; text-align: center;&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Field&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 1&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 2&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 3&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 4&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|QNAME&lt;br /&gt;
|1:497:R:-272+13M17D24M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|9:21597+10M2I25M:R:-209&lt;br /&gt;
|-&lt;br /&gt;
|FLAG&lt;br /&gt;
|113&lt;br /&gt;
|99&lt;br /&gt;
|147&lt;br /&gt;
|83&lt;br /&gt;
|-&lt;br /&gt;
|RNAME&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|POS&lt;br /&gt;
|497&lt;br /&gt;
|17644&lt;br /&gt;
|17919&lt;br /&gt;
|21678&lt;br /&gt;
|-&lt;br /&gt;
|MAPQ&lt;br /&gt;
|37&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|CIGAR&lt;br /&gt;
|37M&lt;br /&gt;
|37M&lt;br /&gt;
|18M2D19M&lt;br /&gt;
|8M2I27M&lt;br /&gt;
|-&lt;br /&gt;
|MRNM/RNEXT&lt;br /&gt;
|15&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|-&lt;br /&gt;
|MPOS/PNEXT&lt;br /&gt;
|100338662&lt;br /&gt;
|17919&lt;br /&gt;
|17644&lt;br /&gt;
|21469&lt;br /&gt;
|-&lt;br /&gt;
|ISIZE/TLEN&lt;br /&gt;
|0&lt;br /&gt;
|314&lt;br /&gt;
|-314&lt;br /&gt;
|-244&lt;br /&gt;
|-&lt;br /&gt;
|SEQ&lt;br /&gt;
|CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG&lt;br /&gt;
|TATGACTGCTAATAATACCTACACATGTTAGAACCAT&lt;br /&gt;
|GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT&lt;br /&gt;
|CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT&lt;br /&gt;
|-&lt;br /&gt;
|QUAL&lt;br /&gt;
|0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
|&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9&lt;br /&gt;
|;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&lt;br /&gt;
|&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|TAGs&lt;br /&gt;
|XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You should now be a SAM expert ;-)&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1881</id>
		<title>SAM</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1881"/>
		<updated>2010-07-30T17:38:12Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* What is SAM */ test edit - revert&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is SAM ==&lt;br /&gt;
The &#039;&#039;&#039;SAM Format&#039;&#039;&#039; is a text format for storing sequence data in a series of tab delimited ASCII columns. &lt;br /&gt;
&lt;br /&gt;
Most often it is generated as a human readable version of its sister [[BAM]] format, which stores the same data in a compressed, indexed, binary form. &lt;br /&gt;
&lt;br /&gt;
Currently, most SAM format data is output from aligners that read FASTQ files and assign the sequences to a position with respect to a known reference genome.  In the future, SAM will also be used to archive unaligned sequence data generated directly from sequencing machines.&lt;br /&gt;
&lt;br /&gt;
The current definition of the format is at [[http://samtools.sourceforge.net/SAM1.pdf BAM/SAM Specification]].&lt;br /&gt;
&lt;br /&gt;
If you are writing software to read SAM or BAM data, our C++ [[C++ Library: libbam|BamFile]] is a good resource to use.&lt;br /&gt;
&lt;br /&gt;
This is a test to see how merges work - will be reverted.&lt;br /&gt;
&lt;br /&gt;
== What Information is in SAM &amp;amp; BAM ==&lt;br /&gt;
SAM files and BAM files contain the same information, but in a different format.  Refer to the specs to see a format description.&lt;br /&gt;
&lt;br /&gt;
Both SAM &amp;amp; BAM files contain a header section and an alignment section.&lt;br /&gt;
The header section may contain information about the entire file and additional information for alignments.  The alignments then associate themselves with specific header information.&lt;br /&gt;
&lt;br /&gt;
The alignment section contains the information for each sequence about where/how it aligns to the reference genome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What Information Does SAM/BAM Have for an Alignment ===&lt;br /&gt;
Each Alignment has:&lt;br /&gt;
* query name, QNAME (SAM)/read_name (BAM).  It is used to group/identify alignments that are together, like paired alignments or a read that appears in multiple alignments.&lt;br /&gt;
* a bitwise set of information describing the alignment, FLAG.  Provides the following information:&lt;br /&gt;
** are there multiple fragments?&lt;br /&gt;
** are all fragments properly aligned?&lt;br /&gt;
** is this fragment unmapped?&lt;br /&gt;
** is the next fragment unmapped?&lt;br /&gt;
** is this query the reverse strand?&lt;br /&gt;
** is the next fragment the reverse strand?&lt;br /&gt;
** is this the 1st fragment?&lt;br /&gt;
** is this the last fragment?&lt;br /&gt;
** is this a secondary alignment?&lt;br /&gt;
** did this read fail quality controls?&lt;br /&gt;
** is this read a PCR or optical duplicate?&lt;br /&gt;
&lt;br /&gt;
Not all alignments contain The rest of the alignment fields may be set to default values if the information is unknown.&lt;br /&gt;
* reference sequence name, RNAME, often contains the Chromosome name.  &lt;br /&gt;
* leftmost position of where this alignment maps to the reference, POS.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* mapping quality, MAPQ, which contains the &amp;quot;phred-scaled posterior probability that the mapping position&amp;quot; is wrong. (from SAM-1.pdf)&lt;br /&gt;
* string indicating alignment information that allows the storing of clipped, [[SAM#What is a CIGAR?|CIGAR]]&lt;br /&gt;
* the reference sequence name of the next alignment in this group, MRNM or RNEXT.  In paired alignments, it is the mate&#039;s reference sequence name. (A group is alignments with the same query name.)&lt;br /&gt;
* leftmost position of where the next alignment in this group maps to the reference, MPOS or PNEXT.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* length of this group from the leftmost position to the rightmost position, ISIZE or TLEN&lt;br /&gt;
* the query sequence for this alignment, SEQ&lt;br /&gt;
* the query quality for this alignment, [[SAM#What is QUAL?|QUAL]], one for each base in the query sequence.&lt;br /&gt;
* Additional optional information is also contained within the alignment, [[SAM#What are TAGs?|TAGs]].  A bunch of different information can be stored here and they appear as key/value pairs.  See the spec for a detailed list of commonly used tags and what they mean.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What is a CIGAR? ====&lt;br /&gt;
You may have heard the term CIGAR, but wondered what it means.  Hopefully this section will help clarify it.&lt;br /&gt;
&lt;br /&gt;
The sequence being aligned to a reference may have additional bases that are not in the reference or may be missing bases that are in the reference.  The CIGAR string is a sequence of of base lengths and the associated operation.  They are used to indicate things like which bases align (either a match/mismatch) with the reference, are deleted from the reference, and are insertions that are not in the reference.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T  G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read: ACTAGAATGGCT&lt;br /&gt;
Aligning these two:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7     8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T     G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read:                   A  C  T  A  G  A  A     T  G  G  C  T&lt;br /&gt;
With the alignment above, you get:&lt;br /&gt;
 POS: 5&lt;br /&gt;
 CIGAR: 3M1I3M1D5M&lt;br /&gt;
&lt;br /&gt;
The POS indicates that the read aligns starting at position 5 on the reference.&lt;br /&gt;
The CIGAR says that the first 3 bases in the read sequence align with the reference.  The next base in the read does not exist in the reference.  Then 3 bases align with the reference.  The next reference base does not exist in the read sequence, then 5 more bases align with the reference.  Note that at position 14, the base in the read is different than the reference, but it still counts as an M since it aligns to that position.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What is QUAL? ====&lt;br /&gt;
QUAL stands for query quality.  It is an indicator for how accurate each base in the query sequence (SEQ) is.  If QUAL is specified, there is a quality value for each base in SEQ.&lt;br /&gt;
&lt;br /&gt;
Quality is calculated based on the probability that a base is wrong, p, using the following formula:&lt;br /&gt;
 &amp;lt;math&amp;gt;quality = -10 \log_{10}p&amp;lt;/math&amp;gt;&lt;br /&gt;
This quality is called the [http://en.wikipedia.org/wiki/Phred_quality_score Phred Quality Score].&lt;br /&gt;
&lt;br /&gt;
Since a human readable format is desired for SAM, 33 is added to the calculated quality in order to make it a printable character ranging from ! - ~.&lt;br /&gt;
&lt;br /&gt;
So, for SAM, the QUAL field is:&lt;br /&gt;
 &amp;lt;math&amp;gt;QUAL = (-10 \log_{10}p) + 33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Phred Quality is also found in a FASTQ file, described here: http://en.wikipedia.org/wiki/FASTQ_format#Quality&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What are TAGs? ====&lt;br /&gt;
TAGs are optional fields on a SAM/BAM Alignment.&lt;br /&gt;
A TAG is comprised of a two character TAG key, they type of the value, and the value: &lt;br /&gt;
 [A-Za-z][A-za-z]:[AifZH]:&lt;br /&gt;
&lt;br /&gt;
There are a set of predefined tags that are general used in Alignments.&lt;br /&gt;
&lt;br /&gt;
A user can also use any additional tags to store any information they want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example SAM ==&lt;br /&gt;
=== Example Alignments ===&lt;br /&gt;
This is what the alignment section of a SAM file looks like:&lt;br /&gt;
&lt;br /&gt;
 1:497:R:-272+13M17D24M	113	1	497	37	37M	15	100338662	0	CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG	0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;	XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	99	1	17644	0	37M	=	17919	314	TATGACTGCTAATAATACCTACACATGTTAGAACCAT	&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9	XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	147	1	17919	0	18M2D19M	=	17644	-314	GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT	;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
 9:21597+10M2I25M:R:-209	83	1	21678	0	8M2I27M	=	21469	-244	CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT	&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
&lt;br /&gt;
In this example, the fields are:&lt;br /&gt;
{| style=&amp;quot;margin: 1em 1em 1em 0; background-color: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-style=&amp;quot;background: #f2f2f2; text-align: center;&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Field&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 1&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 2&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 3&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 4&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|QNAME&lt;br /&gt;
|1:497:R:-272+13M17D24M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|9:21597+10M2I25M:R:-209&lt;br /&gt;
|-&lt;br /&gt;
|FLAG&lt;br /&gt;
|113&lt;br /&gt;
|99&lt;br /&gt;
|147&lt;br /&gt;
|83&lt;br /&gt;
|-&lt;br /&gt;
|RNAME&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|POS&lt;br /&gt;
|497&lt;br /&gt;
|17644&lt;br /&gt;
|17919&lt;br /&gt;
|21678&lt;br /&gt;
|-&lt;br /&gt;
|MAPQ&lt;br /&gt;
|37&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|CIGAR&lt;br /&gt;
|37M&lt;br /&gt;
|37M&lt;br /&gt;
|18M2D19M&lt;br /&gt;
|8M2I27M&lt;br /&gt;
|-&lt;br /&gt;
|MRNM/RNEXT&lt;br /&gt;
|15&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|-&lt;br /&gt;
|MPOS/PNEXT&lt;br /&gt;
|100338662&lt;br /&gt;
|17919&lt;br /&gt;
|17644&lt;br /&gt;
|21469&lt;br /&gt;
|-&lt;br /&gt;
|ISIZE/TLEN&lt;br /&gt;
|0&lt;br /&gt;
|314&lt;br /&gt;
|-314&lt;br /&gt;
|-244&lt;br /&gt;
|-&lt;br /&gt;
|SEQ&lt;br /&gt;
|CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG&lt;br /&gt;
|TATGACTGCTAATAATACCTACACATGTTAGAACCAT&lt;br /&gt;
|GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT&lt;br /&gt;
|CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT&lt;br /&gt;
|-&lt;br /&gt;
|QUAL&lt;br /&gt;
|0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
|&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9&lt;br /&gt;
|;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&lt;br /&gt;
|&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|TAGs&lt;br /&gt;
|XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1879</id>
		<title>SAM</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1879"/>
		<updated>2010-07-30T17:30:02Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* What is SAM */ refer to BamFile c++ library code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is SAM ==&lt;br /&gt;
The &#039;&#039;&#039;SAM Format&#039;&#039;&#039; is a text format for storing sequence data in a series of tab delimited ASCII columns. &lt;br /&gt;
&lt;br /&gt;
Most often it is generated as a human readable version of its sister [[BAM]] format, which stores the same data in a compressed, indexed, binary form. &lt;br /&gt;
&lt;br /&gt;
Currently, most SAM format data is output from aligners that read FASTQ files and assign the sequences to a position with respect to a known reference genome.  In the future, SAM will also be used to archive unaligned sequence data generated directly from sequencing machines.&lt;br /&gt;
&lt;br /&gt;
The current definition of the format is at [[http://samtools.sourceforge.net/SAM1.pdf BAM/SAM Specification]].&lt;br /&gt;
&lt;br /&gt;
If you are writing software to read SAM or BAM data, our C++ [[C++ Library: libbam|BamFile]] is a good resource to use.&lt;br /&gt;
&lt;br /&gt;
== What Information is in SAM &amp;amp; BAM ==&lt;br /&gt;
SAM files and BAM files contain the same information, but in a different format.  Refer to the specs to see a format description.&lt;br /&gt;
&lt;br /&gt;
Both SAM &amp;amp; BAM files contain a header section and an alignment section.&lt;br /&gt;
The header section may contain information about the entire file and additional information for alignments.  The alignments then associate themselves with specific header information.&lt;br /&gt;
&lt;br /&gt;
The alignment section contains the information for each sequence about where/how it aligns to the reference genome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What Information Does SAM/BAM Have for an Alignment ===&lt;br /&gt;
Each Alignment has:&lt;br /&gt;
* query name, QNAME (SAM)/read_name (BAM).  It is used to group/identify alignments that are together, like paired alignments or a read that appears in multiple alignments.&lt;br /&gt;
* a bitwise set of information describing the alignment, FLAG.  Provides the following information:&lt;br /&gt;
** are there multiple fragments?&lt;br /&gt;
** are all fragments properly aligned?&lt;br /&gt;
** is this fragment unmapped?&lt;br /&gt;
** is the next fragment unmapped?&lt;br /&gt;
** is this query the reverse strand?&lt;br /&gt;
** is the next fragment the reverse strand?&lt;br /&gt;
** is this the 1st fragment?&lt;br /&gt;
** is this the last fragment?&lt;br /&gt;
** is this a secondary alignment?&lt;br /&gt;
** did this read fail quality controls?&lt;br /&gt;
** is this read a PCR or optical duplicate?&lt;br /&gt;
&lt;br /&gt;
Not all alignments contain The rest of the alignment fields may be set to default values if the information is unknown.&lt;br /&gt;
* reference sequence name, RNAME, often contains the Chromosome name.  &lt;br /&gt;
* leftmost position of where this alignment maps to the reference, POS.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* mapping quality, MAPQ, which contains the &amp;quot;phred-scaled posterior probability that the mapping position&amp;quot; is wrong. (from SAM-1.pdf)&lt;br /&gt;
* string indicating alignment information that allows the storing of clipped, [[SAM#What is a CIGAR?|CIGAR]]&lt;br /&gt;
* the reference sequence name of the next alignment in this group, MRNM or RNEXT.  In paired alignments, it is the mate&#039;s reference sequence name. (A group is alignments with the same query name.)&lt;br /&gt;
* leftmost position of where the next alignment in this group maps to the reference, MPOS or PNEXT.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* length of this group from the leftmost position to the rightmost position, ISIZE or TLEN&lt;br /&gt;
* the query sequence for this alignment, SEQ&lt;br /&gt;
* the query quality for this alignment, [[SAM#What is QUAL?|QUAL]], one for each base in the query sequence.&lt;br /&gt;
* Additional optional information is also contained within the alignment, [[SAM#What are TAGs?|TAGs]].  A bunch of different information can be stored here and they appear as key/value pairs.  See the spec for a detailed list of commonly used tags and what they mean.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What is a CIGAR? ====&lt;br /&gt;
You may have heard the term CIGAR, but wondered what it means.  Hopefully this section will help clarify it.&lt;br /&gt;
&lt;br /&gt;
The sequence being aligned to a reference may have additional bases that are not in the reference or may be missing bases that are in the reference.  The CIGAR string is a sequence of of base lengths and the associated operation.  They are used to indicate things like which bases align (either a match/mismatch) with the reference, are deleted from the reference, and are insertions that are not in the reference.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T  G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read: ACTAGAATGGCT&lt;br /&gt;
Aligning these two:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7     8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T     G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read:                   A  C  T  A  G  A  A     T  G  G  C  T&lt;br /&gt;
With the alignment above, you get:&lt;br /&gt;
 POS: 5&lt;br /&gt;
 CIGAR: 3M1I3M1D5M&lt;br /&gt;
&lt;br /&gt;
The POS indicates that the read aligns starting at position 5 on the reference.&lt;br /&gt;
The CIGAR says that the first 3 bases in the read sequence align with the reference.  The next base in the read does not exist in the reference.  Then 3 bases align with the reference.  The next reference base does not exist in the read sequence, then 5 more bases align with the reference.  Note that at position 14, the base in the read is different than the reference, but it still counts as an M since it aligns to that position.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== What is QUAL? ====&lt;br /&gt;
QUAL stands for query quality.  It is an indicator for how accurate each base in the query sequence (SEQ) is.  If QUAL is specified, there is a quality value for each base in SEQ.&lt;br /&gt;
&lt;br /&gt;
Quality is calculated based on the probability that a base is wrong, p, using the following formula:&lt;br /&gt;
 &amp;lt;math&amp;gt;quality = -10 \log_{10}p&amp;lt;/math&amp;gt;&lt;br /&gt;
This quality is called the [http://en.wikipedia.org/wiki/Phred_quality_score Phred Quality Score].&lt;br /&gt;
&lt;br /&gt;
Since a human readable format is desired for SAM, 33 is added to the calculated quality in order to make it a printable character ranging from ! - ~.&lt;br /&gt;
&lt;br /&gt;
So, for SAM, the QUAL field is:&lt;br /&gt;
 &amp;lt;math&amp;gt;QUAL = (-10 \log_{10}p) + 33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Phred Quality is also found in a FASTQ file, described here: http://en.wikipedia.org/wiki/FASTQ_format#Quality&lt;br /&gt;
&lt;br /&gt;
==== What are TAGs? ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example SAM ==&lt;br /&gt;
=== Example Alignments ===&lt;br /&gt;
This is what the alignment section of a SAM file looks like:&lt;br /&gt;
&lt;br /&gt;
 1:497:R:-272+13M17D24M	113	1	497	37	37M	15	100338662	0	CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG	0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;	XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	99	1	17644	0	37M	=	17919	314	TATGACTGCTAATAATACCTACACATGTTAGAACCAT	&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9	XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	147	1	17919	0	18M2D19M	=	17644	-314	GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT	;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
 9:21597+10M2I25M:R:-209	83	1	21678	0	8M2I27M	=	21469	-244	CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT	&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
&lt;br /&gt;
In this example, the fields are:&lt;br /&gt;
{| style=&amp;quot;margin: 1em 1em 1em 0; background-color: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-style=&amp;quot;background: #f2f2f2; text-align: center;&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Field&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 1&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 2&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 3&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 4&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|QNAME&lt;br /&gt;
|1:497:R:-272+13M17D24M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|9:21597+10M2I25M:R:-209&lt;br /&gt;
|-&lt;br /&gt;
|FLAG&lt;br /&gt;
|113&lt;br /&gt;
|99&lt;br /&gt;
|147&lt;br /&gt;
|83&lt;br /&gt;
|-&lt;br /&gt;
|RNAME&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|POS&lt;br /&gt;
|497&lt;br /&gt;
|17644&lt;br /&gt;
|17919&lt;br /&gt;
|21678&lt;br /&gt;
|-&lt;br /&gt;
|MAPQ&lt;br /&gt;
|37&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|CIGAR&lt;br /&gt;
|37M&lt;br /&gt;
|37M&lt;br /&gt;
|18M2D19M&lt;br /&gt;
|8M2I27M&lt;br /&gt;
|-&lt;br /&gt;
|MRNM/RNEXT&lt;br /&gt;
|15&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|-&lt;br /&gt;
|MPOS/PNEXT&lt;br /&gt;
|100338662&lt;br /&gt;
|17919&lt;br /&gt;
|17644&lt;br /&gt;
|21469&lt;br /&gt;
|-&lt;br /&gt;
|ISIZE/TLEN&lt;br /&gt;
|0&lt;br /&gt;
|314&lt;br /&gt;
|-314&lt;br /&gt;
|-244&lt;br /&gt;
|-&lt;br /&gt;
|SEQ&lt;br /&gt;
|CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG&lt;br /&gt;
|TATGACTGCTAATAATACCTACACATGTTAGAACCAT&lt;br /&gt;
|GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT&lt;br /&gt;
|CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT&lt;br /&gt;
|-&lt;br /&gt;
|QUAL&lt;br /&gt;
|0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
|&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9&lt;br /&gt;
|;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&lt;br /&gt;
|&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|TAGs&lt;br /&gt;
|XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BAM&amp;diff=1878</id>
		<title>BAM</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BAM&amp;diff=1878"/>
		<updated>2010-07-30T17:28:27Z</updated>

		<summary type="html">&lt;p&gt;Pha: elaborate on details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;BAM Format&#039;&#039;&#039; is a binary format for storing sequence data. &lt;br /&gt;
&lt;br /&gt;
The current definition of the format is at [[http://samtools.sourceforge.net/SAM1.pdf BAM/SAM Specification]].&lt;br /&gt;
&lt;br /&gt;
The corresponding [[SAM Format]] can be used to store sequence data, both aligned as well as unaligned, in a human readable format.&lt;br /&gt;
&lt;br /&gt;
BAM and SAM formats are designed to contain exactly the same information.  The SAM format is more human readable, and easier to process by conventional text based processing programs, such as awk, sed, python, cut and so on.  The BAM format provides binary versions of most of the same data, and is designed to compress reasonably well.&lt;br /&gt;
&lt;br /&gt;
Our [[C++ Library: libbam|BamFile]] library reads both SAM and BAM format files.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1865</id>
		<title>SAM</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=SAM&amp;diff=1865"/>
		<updated>2010-07-29T20:30:44Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* What is SAM */ simplify and elaborate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is SAM ==&lt;br /&gt;
The &#039;&#039;&#039;SAM Format&#039;&#039;&#039; is a text format for storing sequence data in a series of tab delimited ASCII columns. &lt;br /&gt;
&lt;br /&gt;
Most often it is generated as a human readable version of its sister [[BAM]] format, which stores the same data in a compressed, indexed, binary form. &lt;br /&gt;
&lt;br /&gt;
Currently, most SAM format data is output from aligners that read FASTQ files and assign the sequences to a position with respect to a genome.  In the future, SAM will also be used to archive unaligned sequence data generated directly from sequencing machines.&lt;br /&gt;
&lt;br /&gt;
The current definition of the format is at [[http://samtools.sourceforge.net/SAM1.pdf BAM/SAM Specification]].&lt;br /&gt;
&lt;br /&gt;
== What Information is in SAM &amp;amp; BAM ==&lt;br /&gt;
SAM files and BAM files contain the same information, but in a different format.  Refer to the specs to see a format description.&lt;br /&gt;
&lt;br /&gt;
Both SAM &amp;amp; BAM files contain a header section and an alignment section.&lt;br /&gt;
The header section may contain information about the entire file and additional information for alignments.  The alignments then associate themselves with specific header information.&lt;br /&gt;
&lt;br /&gt;
The alignment section contains the information for each sequence about where/how it aligns to the reference genome.&lt;br /&gt;
&lt;br /&gt;
=== What Information Does SAM/BAM Have for an Alignment ===&lt;br /&gt;
Each Alignment has:&lt;br /&gt;
* query name, QNAME (SAM)/read_name (BAM).  It is used to group/identify alignments that are together, like paired alignments or a read that appears in multiple alignments.&lt;br /&gt;
* a bitwise set of information describing the alignment, FLAG.  Provides the following information:&lt;br /&gt;
** are there multiple fragments?&lt;br /&gt;
** are all fragments properly aligned?&lt;br /&gt;
** is this fragment unmapped?&lt;br /&gt;
** is the next fragment unmapped?&lt;br /&gt;
** is this query the reverse strand?&lt;br /&gt;
** is the next fragment the reverse strand?&lt;br /&gt;
** is this the 1st fragment?&lt;br /&gt;
** is this the last fragment?&lt;br /&gt;
** is this a secondary alignment?&lt;br /&gt;
** did this read fail quality controls?&lt;br /&gt;
** is this read a PCR or optical duplicate?&lt;br /&gt;
&lt;br /&gt;
Not all alignments contain The rest of the alignment fields may be set to default values if the information is unknown.&lt;br /&gt;
* reference sequence name, RNAME, often contains the Chromosome name.  &lt;br /&gt;
* leftmost position of where this alignment maps to the reference, POS.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* mapping quality, MAPQ, which contains the &amp;quot;phred-scaled posterior probability that the mapping position&amp;quot; is wrong. (from SAM-1.pdf)&lt;br /&gt;
* string indicating alignment information that allows the storing of clipped, [[SAM#What is a CIGAR?|CIGAR]]&lt;br /&gt;
* the reference sequence name of the next alignment in this group, MRNM or RNEXT.  In paired alignments, it is the mate&#039;s reference sequence name. (A group is alignments with the same query name.)&lt;br /&gt;
* leftmost position of where the next alignment in this group maps to the reference, MPOS or PNEXT.  For SAM, the reference starts at 1, so this value is 1-based, while for BAM the reference starts at 0,so this value is 0-based.  Beware to always use the correct base when referencing positions.&lt;br /&gt;
* length of this group from the leftmost position to the rightmost position, ISIZE or TLEN&lt;br /&gt;
* the query sequence for this alignment, SEQ&lt;br /&gt;
* the query quality for this alignment, QUAL, one for each base in the query sequence.&lt;br /&gt;
* Additional optional information is also contained within the alignment, TAGS.  A bunch of different information can be stored here and they appear as key/value pairs.  See the spec for a detailed list of commonly used tags and what they mean.&lt;br /&gt;
&lt;br /&gt;
==== What is a CIGAR? ====&lt;br /&gt;
You may have heard the term CIGAR, but wondered what it means.  Hopefully this section will help clarify it.&lt;br /&gt;
&lt;br /&gt;
The sequence being aligned to a reference may have additional bases that are not in the reference or may be missing bases that are in the reference.  The CIGAR string is a sequence of of base lengths and the associated operation.  They are used to indicate things like which bases align (either a match/mismatch) with the reference, are deleted from the reference, and are insertions that are not in the reference.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T  G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read: ACTAGAATGGCT&lt;br /&gt;
Aligning these two:&lt;br /&gt;
 RefPos:     1  2  3  4  5  6  7     8  9 10 11 12 13 14 15 16 17 18 19&lt;br /&gt;
 Reference:  C  C  A  T  A  C  T     G  A  A  C  T  G  A  C  T  A  A  C&lt;br /&gt;
 Read:                   A  C  T  A  G  A  A     T  G  G  C  T&lt;br /&gt;
With the alignment above, you get:&lt;br /&gt;
 POS: 5&lt;br /&gt;
 CIGAR: 3M1I3M1D5M&lt;br /&gt;
&lt;br /&gt;
The POS indicates that the read aligns starting at position 5 on the reference.&lt;br /&gt;
The CIGAR says that the first 3 bases in the read sequence align with the reference.  The next base in the read does not exist in the reference.  Then 3 bases align with the reference.  The next reference base does not exist in the read sequence, then 5 more bases align with the reference.  Note that at position 14, the base in the read is different than the reference, but it still counts as an M since it aligns to that position.&lt;br /&gt;
&lt;br /&gt;
== Example SAM ==&lt;br /&gt;
=== Example Alignments ===&lt;br /&gt;
This is what the alignment section of a SAM file looks like:&lt;br /&gt;
&lt;br /&gt;
 1:497:R:-272+13M17D24M	113	1	497	37	37M	15	100338662	0	CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG	0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;	XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	99	1	17644	0	37M	=	17919	314	TATGACTGCTAATAATACCTACACATGTTAGAACCAT	&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9	XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
 19:20389:F:275+18M2D19M	147	1	17919	0	18M2D19M	=	17644	-314	GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT	;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
 9:21597+10M2I25M:R:-209	83	1	21678	0	8M2I27M	=	21469	-244	CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT	&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;	XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
&lt;br /&gt;
In this example, the fields are:&lt;br /&gt;
{| style=&amp;quot;margin: 1em 1em 1em 0; background-color: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-style=&amp;quot;background: #f2f2f2; text-align: center;&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Field&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 1&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 2&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 3&#039;&#039;&#039; !! &#039;&#039;&#039;Alignment 4&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|QNAME&lt;br /&gt;
|1:497:R:-272+13M17D24M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|19:20389:F:275+18M2D19M&lt;br /&gt;
|9:21597+10M2I25M:R:-209&lt;br /&gt;
|-&lt;br /&gt;
|FLAG&lt;br /&gt;
|113&lt;br /&gt;
|99&lt;br /&gt;
|147&lt;br /&gt;
|83&lt;br /&gt;
|-&lt;br /&gt;
|RNAME&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|POS&lt;br /&gt;
|497&lt;br /&gt;
|17644&lt;br /&gt;
|17919&lt;br /&gt;
|21678&lt;br /&gt;
|-&lt;br /&gt;
|MAPQ&lt;br /&gt;
|37&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|CIGAR&lt;br /&gt;
|37M&lt;br /&gt;
|37M&lt;br /&gt;
|18M2D19M&lt;br /&gt;
|8M2I27M&lt;br /&gt;
|-&lt;br /&gt;
|MRNM/RNEXT&lt;br /&gt;
|15&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|=&lt;br /&gt;
|-&lt;br /&gt;
|MPOS/PNEXT&lt;br /&gt;
|100338662&lt;br /&gt;
|17919&lt;br /&gt;
|17644&lt;br /&gt;
|21469&lt;br /&gt;
|-&lt;br /&gt;
|ISIZE/TLEN&lt;br /&gt;
|0&lt;br /&gt;
|314&lt;br /&gt;
|-314&lt;br /&gt;
|-244&lt;br /&gt;
|-&lt;br /&gt;
|SEQ&lt;br /&gt;
|CGGGTCTGACCTGAGGAGAACTGTGCTCCGCCTTCAG&lt;br /&gt;
|TATGACTGCTAATAATACCTACACATGTTAGAACCAT&lt;br /&gt;
|GTAGTACCAACTGTAAGTCCTTATCTTCATACTTTGT&lt;br /&gt;
|CACCACATCACATATACCAAGCCTGGCTGTGTCTTCT&lt;br /&gt;
|-&lt;br /&gt;
|QUAL&lt;br /&gt;
|0;==-==9;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
|&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;4::&amp;gt;&amp;gt;:&amp;lt;9&lt;br /&gt;
|;44999;499&amp;lt;8&amp;lt;8&amp;lt;&amp;lt;&amp;lt;8&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;7&amp;lt;;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&lt;br /&gt;
|&amp;lt;;9&amp;lt;&amp;lt;5&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;lt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;9&amp;gt;&amp;gt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;9&amp;gt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|TAGs&lt;br /&gt;
|XT:A:U	NM:i:0	SM:i:37	AM:i:0	X0:i:1	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:0	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:0	XG:i:0	MD:Z:37&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:4	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:18^CA19&lt;br /&gt;
|XT:A:R	NM:i:2	SM:i:0	AM:i:0	X0:i:5	X1:i:0	XM:i:0	XO:i:1	XG:i:2	MD:Z:35&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1788</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1788"/>
		<updated>2010-07-16T17:06:33Z</updated>

		<summary type="html">&lt;p&gt;Pha: fix indenting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;bamGenotypeCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Download bamGenotypeCheck  ==&lt;br /&gt;
&lt;br /&gt;
To get a copy go to the [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] download page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Build bamGenotypeCheck  ==&lt;br /&gt;
&lt;br /&gt;
Karma (which includes bamGenotypeCheck) is designed to be reasonably portable. &lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, and later, there are likely other portability issues. &lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 and later on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, bamGenotypeCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   bamGenotypeCheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;genome reference in [http://en.wikipedia.org/wiki/Fasta_format simplified FASTA format]&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]   &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]   &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -f [float] &#039;&#039;drop markers with minor allele frequency smaller than [float]&#039;&#039;&lt;br /&gt;
 -F [int]   &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and bamGenotypeCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1787</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1787"/>
		<updated>2010-07-16T17:05:10Z</updated>

		<summary type="html">&lt;p&gt;Pha: add pointer to fresh karma download&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;bamGenotypeCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Download bamGenotypeCheck  =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to the [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] download page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Build bamGenotypeCheck  =&lt;br /&gt;
&lt;br /&gt;
Karma (which includes bamGenotypeCheck) is designed to be reasonably portable. &lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, and later, there are likely other portability issues. &lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 and later on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, bamGenotypeCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   bamGenotypeCheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;genome reference in [http://en.wikipedia.org/wiki/Fasta_format simplified FASTA format]&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]   &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]   &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -f [float] &#039;&#039;drop markers with minor allele frequency smaller than [float]&#039;&#039;&lt;br /&gt;
 -F [int]   &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and bamGenotypeCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1721</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1721"/>
		<updated>2010-06-22T14:57:18Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Input Files */ fix link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;bamGenotypeCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, bamGenotypeCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   bamGenotypeCheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;genome reference in [http://en.wikipedia.org/wiki/Fasta_format simplified FASTA format]&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]   &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]   &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -f [float] &#039;&#039;drop markers with minor allele frequency smaller than [float]&#039;&#039;&lt;br /&gt;
 -F [int]   &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and bamGenotypeCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1720</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1720"/>
		<updated>2010-06-22T14:56:05Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Input Files */ add fasta link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;bamGenotypeCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, bamGenotypeCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   bamGenotypeCheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;genome reference in [[http://en.wikipedia.org/wiki/Fasta_format|simplified FASTA format]]&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]   &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]   &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -f [float] &#039;&#039;drop markers with minor allele frequency smaller than [float]&#039;&#039;&lt;br /&gt;
 -F [int]   &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and bamGenotypeCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1719</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1719"/>
		<updated>2010-06-22T14:54:21Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Input Files */ more detail&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;bamGenotypeCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, bamGenotypeCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   bamGenotypeCheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;FASTA format genome reference&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]   &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]   &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -f [float] &#039;&#039;drop markers with minor allele frequency smaller than [float]&#039;&#039;&lt;br /&gt;
 -F [int]   &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and bamGenotypeCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1718</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1718"/>
		<updated>2010-06-22T14:53:20Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Filtering */ add -f option&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;bamGenotypeCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, bamGenotypeCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   bamGenotypeCheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;FASTA format genome reference&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]   &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]   &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -f [float] &#039;&#039;drop markers with minor allele frequency smaller than [float]&#039;&#039;&lt;br /&gt;
 -F [int]   &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and bamGenotypeCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Main_Page&amp;diff=1717</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Main_Page&amp;diff=1717"/>
		<updated>2010-06-22T14:48:13Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Sequence Analysis Tools */ change name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--        BANNER ACROSS TOP OF PAGE        --&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:#fcfcfc; margin-top:1.2em; border:1px solid #ccc;&amp;quot; |&lt;br /&gt;
 | style=&amp;quot;width:100%; text-align:center; white-space:nowrap; color:#000;&amp;quot; | &lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size:162%; border:none; margin:0; padding:.1em; color:#000;&amp;quot;&amp;gt;Abecasis Group Wiki&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:2009.08_Group_Retreat_Photo.jpg|400px|center|Group Photo]]&lt;br /&gt;
&lt;br /&gt;
== Welcome! ==&lt;br /&gt;
&lt;br /&gt;
Welcome to our brand new wiki!&lt;br /&gt;
&lt;br /&gt;
If you would like to contribute, [[Special:UserLogin|log-in]] or [http://csgwiki.sph.umich.edu/index.php?title=Special:UserLogin&amp;amp;type=signup create an account]. We recommend using your e-mail address or Michigan uniqname as your user id.&lt;br /&gt;
&lt;br /&gt;
For basic instructions, see [http://en.wikipedia.org/wiki/Wikipedia:Tutorial the Wikipedia Tutorial].&lt;br /&gt;
&lt;br /&gt;
== Sequence Analysis Tools ==&lt;br /&gt;
&lt;br /&gt;
We are developing [[Software|software tools]] for the analysis of next generation sequence data. &lt;br /&gt;
&lt;br /&gt;
# Read Mapping with [[Karma]]&lt;br /&gt;
# Variant Calling with [[glfSingle]], [[glfTrio]] and [[glfMultiples]]&lt;br /&gt;
# Variant Annotations using [[vcfCodingSnps]]&lt;br /&gt;
# Quality control using [[C++ Executable: fastQValidator|FastQValidator]], and [[BamGenotypeCheck]]&lt;br /&gt;
# File Readers using [[C++ Library: libbam|BamFile]] and [[C++ Library: libfqf|FastQFile]]&lt;br /&gt;
# File Conversions using [[bam2FastQ]]&lt;br /&gt;
&lt;br /&gt;
== Projects  ==&lt;br /&gt;
&lt;br /&gt;
[[SardiNIA]] - The SardiNIA longitudinal study of aging.&lt;br /&gt;
&lt;br /&gt;
[[1000 Genomes Project Pilot 1 SNP Calling]]&lt;br /&gt;
&lt;br /&gt;
== Learn Genetics ==&lt;br /&gt;
&lt;br /&gt;
Faculty in the group teach in a variety of formal and informal settings. [[Class Notes|Class notes]] and relevant discussion are archived here.&lt;br /&gt;
&lt;br /&gt;
==Abecasis Group Meeting==&lt;br /&gt;
&lt;br /&gt;
2:30-4:00 p.m. on Fridays, room 2610, SPH I.&lt;br /&gt;
Please note April 9, please use room 2690, SPH I.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1716</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1716"/>
		<updated>2010-06-22T14:47:38Z</updated>

		<summary type="html">&lt;p&gt;Pha: rename again&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;bamGenotypeCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, bamGenotypeCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   bamGenotypeCheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;FASTA format genome reference&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]  &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]  &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -F [int]  &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and bamGenotypeCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=GenotypeIDcheck&amp;diff=1715</id>
		<title>GenotypeIDcheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=GenotypeIDcheck&amp;diff=1715"/>
		<updated>2010-06-22T14:46:40Z</updated>

		<summary type="html">&lt;p&gt;Pha: moved GenotypeIDcheck to BamGenotypeCheck:&amp;amp;#32;a better name was suggested&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[BamGenotypeCheck]]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1714</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1714"/>
		<updated>2010-06-22T14:46:40Z</updated>

		<summary type="html">&lt;p&gt;Pha: moved GenotypeIDcheck to BamGenotypeCheck:&amp;amp;#32;a better name was suggested&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;genotypeIdCheck&#039;&#039;&#039; is a program that verifies whether the reads in particular file match previously known genotypes for an individual (or group of individuals).&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
A key step in any genetic analysis is to verify whether data being generated matches expectations. This program checks whether reads in a BAM file match previous genotypes for a specific sample. &lt;br /&gt;
&lt;br /&gt;
Using a mathematical model that relates observed sequence reads to an hypothetical true genotype, genotypeIdCheck tries to decide whether sequence reads match a particular individual or are more likely to be contaminated (including a small proportion of foreign DNA), derived from a closely related individual, or derived from a completely different individual.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is a typical command line:&lt;br /&gt;
&lt;br /&gt;
   genotypeIDcheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;FASTA format genome reference&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;allele Frequency file&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;data file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;map file in [[MERLIN format]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 -k  &#039;&#039;a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]  &#039;&#039;exclude bases with quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]  &#039;&#039;exclude reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -F [int]  &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error base error to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
Each read group in a BAM file is evaluated independently. This means that in file with multiple read groups, problems will be flagged at the read group level (a plus). However, it also means that it might be hard to discern the correct assignment of read groups with very little data.&lt;br /&gt;
&lt;br /&gt;
For each aligned base that overlaps a known genotype, we calculate the probability the probability that it was derived from a particular known genotype. This comparison considers only bases that overlap previously known genotypes and that meet the base quality and mapping quality thresholds.&lt;br /&gt;
&lt;br /&gt;
Each individual in a pedigree has a different combination of genotypes, and genotypeIdCheck will systematically search for the individual whose genotypes best match the observed read data.&lt;br /&gt;
&lt;br /&gt;
For more about the technical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Software&amp;diff=1709</id>
		<title>Software</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Software&amp;diff=1709"/>
		<updated>2010-06-21T15:19:07Z</updated>

		<summary type="html">&lt;p&gt;Pha: change layout a little&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Software Page Overview =&lt;br /&gt;
&lt;br /&gt;
This page points to downloads, documentation, and papers for software that is written here at the [http://genome.sph.umich.edu Center for Statistical Genetics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= [[Read Mapping]] =&lt;br /&gt;
&lt;br /&gt;
==[[Karma|Karma]]==&lt;br /&gt;
Our fast short read aligner, which generates [[Mapping Quality Scores]]&lt;br /&gt;
&lt;br /&gt;
==[[Karma-colorspace|Karma-ColorSpace]]==&lt;br /&gt;
QUICKSTART on mapping color space reads&lt;br /&gt;
&lt;br /&gt;
==[[Examples|Examples]]==&lt;br /&gt;
Sample command lines with discussion&lt;br /&gt;
&lt;br /&gt;
==[[MapabilityScores]]==&lt;br /&gt;
Definitions of various mappability scores adopted at UCSC genome browser.&lt;br /&gt;
&lt;br /&gt;
==Evaluation of Mappers==&lt;br /&gt;
[[baseQualityCheck]] is a mature tool to calculate the observed base quality vs. empirical base quality.&lt;br /&gt;
&lt;br /&gt;
= Variant Calling =&lt;br /&gt;
&lt;br /&gt;
==[[glfSingle]]==&lt;br /&gt;
Variant calling for a single, deeply sequenced individual&lt;br /&gt;
&lt;br /&gt;
==[[glfTrio]]==&lt;br /&gt;
Variant calling for a single, deeply sequenced nuclear family with two parents and one child&lt;br /&gt;
&lt;br /&gt;
==[[glfMultiples]]==&lt;br /&gt;
Variant calling for multiple, unrelated individuals&lt;br /&gt;
&lt;br /&gt;
= Variant Annotation =&lt;br /&gt;
&lt;br /&gt;
==[[vcfCodingSnps]]==&lt;br /&gt;
Annotate coding variants in a VCF file.&lt;br /&gt;
&lt;br /&gt;
= Quality Control Utilities =&lt;br /&gt;
&lt;br /&gt;
== Validators ==&lt;br /&gt;
&lt;br /&gt;
[[C++ Executable: fastQValidator|FastQValidator]] -- Check that a FASTQ file conforms to specification.&lt;br /&gt;
&lt;br /&gt;
[[GenotypeIDcheck]] -- Check that mapped reads are consistent with known genotypes for each individual.&lt;br /&gt;
&lt;br /&gt;
== File Readers ==&lt;br /&gt;
&lt;br /&gt;
[[C++ Library: libbam|BamFile]] -- Reads a BAM/SAM file.  &lt;br /&gt;
&lt;br /&gt;
[[C++ Library: libfqf|FastQFile]] -- Read a FASTQ file sequence by sequence.  Validating the sequence as it is read.&lt;br /&gt;
&lt;br /&gt;
== File Conversion ==&lt;br /&gt;
&lt;br /&gt;
[[bam2FastQ]]  -- Convert BAM files into FastQ files&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= [[Links to Sequence Analysis Tools|Other Useful Links]] =&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1708</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1708"/>
		<updated>2010-06-21T15:06:37Z</updated>

		<summary type="html">&lt;p&gt;Pha: total rewrite - new program&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Why genotypeIDcheck? ==&lt;br /&gt;
&lt;br /&gt;
When sequencing data arrives from the sequencer machines, several types of errors or contaminations can creep in.&lt;br /&gt;
&lt;br /&gt;
The most serious error that can occur is that the actual sample name for the sample gets swapped with a different sample.  In this case, what we think is one person&#039;s sequencing data is actually another.  Although they are confidential, in some cases, they are intended to be part of a family, and such an error causes problems in later analysis.&lt;br /&gt;
&lt;br /&gt;
Also, since we typically genotype the same samples along with running a full sequence of them, we want to know that the genotyping information matches the sequence, otherwise again, we will find errors in later analysis.&lt;br /&gt;
&lt;br /&gt;
Another set of problems occurs when the actual biological sample is contaminated in some way.  It could be the case, for example, that certain common laboratory contaminates will be included in the sequencing data - knowing approximately how much of such contaminants exist (e.g. yeast) is useful.&lt;br /&gt;
&lt;br /&gt;
So, the program genotypeIDcheck was written in order to discover if problems such as these exist, and if so, report them to the user.&lt;br /&gt;
&lt;br /&gt;
To work, genotypeIDcheck needs a) a list of sorted, calibrated BAM files to check, b) a genome reference to check against, c) a pedigree that describes the samples being checked.&lt;br /&gt;
&lt;br /&gt;
On output, genotypeIDcheck shows, for each read group in each BAM file, the individual in the pedigree that comes statistically closest to matching the reads in the read group, and the degree to how close that relationship is.  In addition, marker coverage of three different classes of markers is shown for that individual as well.&lt;br /&gt;
&lt;br /&gt;
== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of how genotypeIDcheck works:&lt;br /&gt;
&lt;br /&gt;
   genotypeIDcheck  -r /data/local/ref/karma.ref/human.g1k.v37.fa \&lt;br /&gt;
              -k BAMfiles.txt -p test.ped -d test.dat -m test.map&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 -r  &#039;&#039;KARMA genome reference&#039;&#039;&lt;br /&gt;
 -k  &#039;&#039;a filename that contains a list of BAM files to check&#039;&#039;&lt;br /&gt;
 -a  &#039;&#039;pedigree Allele Frequency file&#039;&#039;&lt;br /&gt;
 -p  &#039;&#039;pedigree .ped file&#039;&#039;&lt;br /&gt;
 -d  &#039;&#039;pedigree .dat file&#039;&#039;&lt;br /&gt;
 -m  &#039;&#039;pedigree .map file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Output Options ===&lt;br /&gt;
&lt;br /&gt;
 -c [int]  &#039;&#039;stop after reading [int] filtered sequence reads&#039;&#039;&lt;br /&gt;
 -C [int]  &#039;&#039;stop after reading [int] reads, filtered or not&#039;&#039;&lt;br /&gt;
 -v  &#039;&#039;verbose output&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering ===&lt;br /&gt;
&lt;br /&gt;
 -b [int]  &#039;&#039;exclude marker positions with base quality less than [int]&#039;&#039;&lt;br /&gt;
 -M [int]  &#039;&#039;exclude all reads with map quality less than [int]&#039;&#039;&lt;br /&gt;
 -F [int]  &#039;&#039;set custom BAM flags filter (not implemented at the moment)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 -e [float] &#039;&#039; set minimum error estimate to [float]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Principle of Operation ==&lt;br /&gt;
&lt;br /&gt;
For computational and output purposes, we consider each read group sample in each BAM file to be distinct from all others.&lt;br /&gt;
&lt;br /&gt;
For each aligned sample, we calculate the probability that the sample is from each individual in the pedigree according to five different probabilities of being identical by descent.  So from the base quality (again, assuming calibrated base qualities), the given base in the read, the marker corresponding reference base and genotype chip read data, you can compute the probability of that individual being the one in the sample for the given probability of IBD.&lt;br /&gt;
&lt;br /&gt;
What you actually want is the multiple of theses probabilities taken across all reads in the sample.  This becomes impractically small, so we instead sum the logs of the probabilities.&lt;br /&gt;
&lt;br /&gt;
After the sample is read, the sample in the pedigree that contains the highest log-sum of computed Pibd values is assumed to have the strongest relationship to that sample.  The ID of the corresponding pedigree sample name is printed, the sample name indicated in the read group is printed, and coverage information is also printed.&lt;br /&gt;
&lt;br /&gt;
For more about the mathematical details, see the page [[Verifying Sample Identities - Implementation]]&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Main_Page&amp;diff=1707</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Main_Page&amp;diff=1707"/>
		<updated>2010-06-21T14:23:59Z</updated>

		<summary type="html">&lt;p&gt;Pha: rename BAMidentity check to genotypeIDcheck to match new program name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--        BANNER ACROSS TOP OF PAGE        --&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%; background:#fcfcfc; margin-top:1.2em; border:1px solid #ccc;&amp;quot; |&lt;br /&gt;
 | style=&amp;quot;width:100%; text-align:center; white-space:nowrap; color:#000;&amp;quot; | &lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size:162%; border:none; margin:0; padding:.1em; color:#000;&amp;quot;&amp;gt;Abecasis Group Wiki&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:2009.08_Group_Retreat_Photo.jpg|400px|center|Group Photo]]&lt;br /&gt;
&lt;br /&gt;
== Welcome! ==&lt;br /&gt;
&lt;br /&gt;
Welcome to our brand new wiki!&lt;br /&gt;
&lt;br /&gt;
If you would like to contribute, [[Special:UserLogin|log-in]] or [http://csgwiki.sph.umich.edu/index.php?title=Special:UserLogin&amp;amp;type=signup create an account]. We recommend using your e-mail address or Michigan uniqname as your user id.&lt;br /&gt;
&lt;br /&gt;
For basic instructions, see [http://en.wikipedia.org/wiki/Wikipedia:Tutorial the Wikipedia Tutorial].&lt;br /&gt;
&lt;br /&gt;
== Sequence Analysis Tools ==&lt;br /&gt;
&lt;br /&gt;
We are developing [[Software|software tools]] for the analysis of next generation sequence data. &lt;br /&gt;
&lt;br /&gt;
# Read Mapping with [[Karma]]&lt;br /&gt;
# Variant Calling with [[glfSingle]], [[glfTrio]] and [[glfMultiples]]&lt;br /&gt;
# Variant Annotations using [[vcfCodingSnps]]&lt;br /&gt;
# Quality control using [[C++ Executable: fastQValidator|FastQValidator]], and [[GenotypeIDcheck]]&lt;br /&gt;
# File Readers using [[C++ Library: libbam|BamFile]] and [[C++ Library: libfqf|FastQFile]]&lt;br /&gt;
# File Conversions using [[bam2FastQ]]&lt;br /&gt;
&lt;br /&gt;
== Projects  ==&lt;br /&gt;
&lt;br /&gt;
[[SardiNIA]] - The SardiNIA longitudinal study of aging.&lt;br /&gt;
&lt;br /&gt;
[[1000 Genomes Project Pilot 1 SNP Calling]]&lt;br /&gt;
&lt;br /&gt;
== Learn Genetics ==&lt;br /&gt;
&lt;br /&gt;
Faculty in the group teach in a variety of formal and informal settings. [[Class Notes|Class notes]] and relevant discussion are archived here.&lt;br /&gt;
&lt;br /&gt;
==Abecasis Group Meeting==&lt;br /&gt;
&lt;br /&gt;
2:30-4:00 p.m. on Fridays, room 2610, SPH I.&lt;br /&gt;
Please note April 9, please use room 2690, SPH I.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamIdentityCheck&amp;diff=1706</id>
		<title>BamIdentityCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamIdentityCheck&amp;diff=1706"/>
		<updated>2010-06-21T14:22:32Z</updated>

		<summary type="html">&lt;p&gt;Pha: moved BamIdentityCheck to GenotypeIDcheck:&amp;amp;#32;now matches the new program name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[GenotypeIDcheck]]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1705</id>
		<title>BamGenotypeCheck</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BamGenotypeCheck&amp;diff=1705"/>
		<updated>2010-06-21T14:22:32Z</updated>

		<summary type="html">&lt;p&gt;Pha: moved BamIdentityCheck to GenotypeIDcheck:&amp;amp;#32;now matches the new program name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic Usage Example ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of how laneCheck&amp;amp;nbsp;works:&lt;br /&gt;
&lt;br /&gt;
   lanecheck  --referencegenome NCBI36.fa --dbSNPfile dbSNP.txt &lt;br /&gt;
              --lanefile lane.lst --pedfile test.ped --datfile test.dat --mapfile test.map &lt;br /&gt;
              --prefix result&lt;br /&gt;
&lt;br /&gt;
== Command Line Options ==&lt;br /&gt;
&lt;br /&gt;
=== Input Files ===&lt;br /&gt;
&lt;br /&gt;
 --referencegenome &#039;&#039;referencegenome file&#039;&#039;&lt;br /&gt;
 --dbSNPfile       &#039;&#039;optional&#039;&#039; &#039;&#039;two-column&#039;&#039; &#039;&#039;dbsnp position file, will provide more accurate background mismatch rate if excluding dbSNP positions (e.g. 5 123456)&#039;&#039;&lt;br /&gt;
 --lanefile        &#039;&#039;a list of lane file with path&#039;&#039;&lt;br /&gt;
 --pedfile         &#039;&#039;genotype information of the samples for checking &#039;&#039;&lt;br /&gt;
 --datfile         &#039;&#039;a companion data file for pedigree file (each row: M snpname, e.g. M rs1234)&#039;&#039;&lt;br /&gt;
 --mapfile         &#039;&#039;a companion data file for pedigree file (each row: chr snpname pos, e.g. 5 rs1234 56789)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Basic Output Options ===&lt;br /&gt;
&lt;br /&gt;
 --prefix &#039;&#039;specify the prefix name of the output file&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Filtering&amp;amp;nbsp; ===&lt;br /&gt;
&lt;br /&gt;
 --minmapquality   &#039;&#039;reads with with mapquality falling below this threshold will be excluded&#039;&#039;&lt;br /&gt;
 --genocount       &#039;&#039;the maximum number of genotypes compared&#039;&#039; &lt;br /&gt;
 --verbose         &#039;&#039;print out detailed information for each hapmap position compared&#039;&#039;&lt;br /&gt;
 --coverage        &#039;&#039;print out the proportion of markers in the map file covered by at least one read&#039;&#039; &lt;br /&gt;
 --countbysite     &#039;&#039;print out detailed mismatch counts for each base compared&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Options ===&lt;br /&gt;
&lt;br /&gt;
 --memorymap &#039;&#039;use memory map technique for efficient memory sharing of reference genome file&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Principle of Operation: ==&lt;br /&gt;
&lt;br /&gt;
The overall procedure is that the genotype identity checking program compares internal evidence from the sequence reads themselves to reference genotype information for a panel of candidate individuals. In the case of 1000 Genomes pilot data, these are HapMap genotypes from the same Coriell cell lines that are being sequenced. For each combination of [sequencing run x candidate individual] the program calculates the observed rate of mismatches at both &amp;quot;informative&amp;quot; and &amp;quot;background&amp;quot; locations and reports as &amp;quot;excess mismatch rate&amp;quot;&lt;br /&gt;
&lt;br /&gt;
            excess rate  =  (informative rate  -  background rate).&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Informative&amp;quot; locations are those where the candidate individual is homozygous, according to the HapMap genotype information, and base calls are compared to the HapMap homozygous allele, rather than to the genome reference sequence. &amp;quot;Background&amp;quot; locations are all sites not known to be polymorphic and not recorded in dbSNP if provided. &amp;amp;nbsp;A relative high background rate suggests possible problems in sample preparation or read mapping process.&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
1. Separate the results by &amp;quot;Read group classifier&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The mapped .bam file may contains sequence data from different instrument runs.&amp;amp;nbsp;The read identifiers often are dot or colon-separated strings of the form &#039;run_name&amp;amp;lt;sep&amp;amp;gt;read_number&#039;. The &#039;run_name&#039; may be either an SRR / ERR identifier or the sequencing center&#039;s own alpha-numeric internal run identifier. Allow users to input&amp;amp;nbsp;extended regular expression such as &#039;\(^[^.:]+\)[.:].*&#039;&amp;amp;nbsp;hich matches just the part of each read identifier that is common to all reads from one instrument run and which differs between instrument runs.&lt;br /&gt;
&lt;br /&gt;
2. Use model based approach to calculate probability of lane coming from the claimed individual in the index file given a pool of individuals. &amp;amp;nbsp;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=BAM_Review_Action_Items&amp;diff=1662</id>
		<title>BAM Review Action Items</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=BAM_Review_Action_Items&amp;diff=1662"/>
		<updated>2010-06-08T13:49:07Z</updated>

		<summary type="html">&lt;p&gt;Pha: add new name options, spelling corrections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Move the examples from the SamFile wiki page to their own page&lt;br /&gt;
** include links from the main library page and the SamFile page.&lt;br /&gt;
** look into why the one example have two if checks on SamIn status&lt;br /&gt;
* Create 1 library for all of our library code rather than having libcsg, libbam, libfqf separated.&lt;br /&gt;
** What should this library be called?&lt;br /&gt;
*** libdna&lt;br /&gt;
*** libdna++&lt;br /&gt;
*** libsequence++&lt;br /&gt;
*** libDNA&lt;br /&gt;
*** libgenotype&lt;br /&gt;
* Add an option by class that says whether or not to abort on failure.  (or even an option on each method)&lt;br /&gt;
** This allows calling code to set that option and then not have to check for failures since the code it calls would abort on a failure.&lt;br /&gt;
** Could/should this be achieved using exceptions?  User can decide to catch them or let them terminate the program.&lt;br /&gt;
*SamFile add a constructor that takes the filename.&lt;br /&gt;
** Also takes a flag to indicate open for read/write.&lt;br /&gt;
** Also have 2 subclasses one that opens for read, one for write: SamReadFile, SamWriteFile?  Or SamFileRead, SamFileWrite?&lt;br /&gt;
* Add a function that says: skipInvalidRecords, validateRecords, etc.&lt;br /&gt;
** That way, ReadRecord will keep reading records until a valid/parseable one is found.&lt;br /&gt;
*SamFileHeader::setTag - instead of having separate ones for PG, RG, etc, have a generic one that takes as a parameter which one it is.&lt;br /&gt;
** KeyID, then Value as parameters....(keyID first, then value)&lt;br /&gt;
* SamFileHEader::setProgramName, etc...have specific methods for setting fields so users don&#039;t need to know the specific tags, etc used for certain values in the header.&lt;br /&gt;
** KeyID, then Value as parameters....(keyID first, then value)&lt;br /&gt;
* BAM write utility could add a PG field with default settings (user could specify alternate settings) when it writes a file.&lt;br /&gt;
* Future methods to add:&lt;br /&gt;
** SamFile::setReadSection(const std::string&amp;amp; refName) - take in the reference name by string since that is what most people will know.&lt;br /&gt;
*** &amp;quot;&amp;quot; would indicate the ones not associated with a reference.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1165</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1165"/>
		<updated>2010-04-20T18:18:06Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Mathematical Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can will &lt;br /&gt;
describe the probability of a matching of mismatching base using the&lt;br /&gt;
following notation:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;A/A&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;ibd&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Then, the probabilities of interest are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P_{ibd} (1 - \epsilon) + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(no match) = P_{ibd} \epsilon + (1 - P_{ibd}) \epsilon = \epsilon ?&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For now, genotypeIDcheck uses:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(no match) = 1 - P(match)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we also wish to use heterozygous sites, rather than limiting our comparison to reference homozygous sites, we could use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P(no match) = P_{ibd} 0.5 + (1.0 - P_{ibd}) P_A&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any given value of &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt; we can calculate this quantity for each read that overlaps a site with a known homozygous genotype. In addition, we can take the product of this quantity across all sites examined -- because this product is likely to be very small, we actually sum the &amp;lt;math&amp;gt;log&amp;lt;/math&amp;gt;s of the appropriate quantities rather than multiplying them together.&lt;br /&gt;
&lt;br /&gt;
To decide if we have sequenced the correct sample, we should do the following:&lt;br /&gt;
&lt;br /&gt;
a) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 1.0&amp;lt;/math&amp;gt;. This assumes that we have sequenced the target sample.&lt;br /&gt;
&lt;br /&gt;
b) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.0&amp;lt;/math&amp;gt;. This assumes we sequenced a different sample, unrelated to the target.&lt;br /&gt;
&lt;br /&gt;
c) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.5&amp;lt;/math&amp;gt;. This assumes we sequenced a sample that shares half the genome with the target sample, perhaps because it is a sibling or parent of the target sample.&lt;br /&gt;
&lt;br /&gt;
d) If desired, evaluate the same log-sum for other intermediate values of &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt;. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.95&amp;lt;/math&amp;gt; to allow for 5% of reads that are derived from a different sample, for example, due to contamination. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.05&amp;lt;/math&amp;gt; to consider more distant relatives.&lt;br /&gt;
&lt;br /&gt;
Once the result of evaluating a), b), c) and d) are available, we can decide if the target sample has been sequenced. Sequencing the target sample will mean that the log-sum in a) is the largest. Sequencing a parent or offspring of the target sample will maximize c). Sequencing a completely incorrect sample will maximize b).&lt;br /&gt;
&lt;br /&gt;
If all the log-sums are very similar, then we don&#039;t have enough information to make a clear cut decision. Typically, we thousands of genetic markers from a typical SNP chip and whole genome shotgun sequence data, most decisions should be very clear cut.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
After loading genotypes, we generate a genome mask for each position. There are three outcomes of interest:&lt;br /&gt;
&lt;br /&gt;
; Known Genotypes&lt;br /&gt;
: These are sites where we have a previously observed a genotype call and where we will be evaluating match / mismatch rates to determine sample identity.&lt;br /&gt;
&lt;br /&gt;
; dbSNP sites&lt;br /&gt;
: These are sites that are known to vary among individuals, but for which a known genotype is not available.&lt;br /&gt;
&lt;br /&gt;
; Background sites&lt;br /&gt;
: These are all other sites and can be used to estimate the &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; error rate parameter.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1074</id>
		<title>C++ Class: Pedigree Example</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1074"/>
		<updated>2010-04-13T20:37:06Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Pedigree.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char ** argv);&lt;br /&gt;
  {&lt;br /&gt;
  Pedigree ped;&lt;br /&gt;
&lt;br /&gt;
  // The data file contains a description of the contents of the&lt;br /&gt;
  // pedigree file, including for example, a list of marker and &lt;br /&gt;
  // trait names&lt;br /&gt;
  ped.Prepare(&amp;quot;pedigree.dat&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  // The pedigree file contains a list of individuals, stored one&lt;br /&gt;
  // per row, with specific information about each individual as&lt;br /&gt;
  // detailed in the data file.&lt;br /&gt;
  ped.Load(&amp;quot;pedigree.ped&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  printf(&amp;quot;Loaded %d individuals\n&amp;quot;, ped.count);&lt;br /&gt;
  printf(&amp;quot;Loaded %d markers\n&amp;quot;, ped.markerCount);&lt;br /&gt;
&lt;br /&gt;
  // Print out names of the first 10 individuals&lt;br /&gt;
  for (int i = 0; i &amp;lt; max(ped.count, 10); i++)&lt;br /&gt;
     printf(&amp;quot;Individual #1 is labeled %s\n&amp;quot;, (const char *) ped[i].pid);&lt;br /&gt;
&lt;br /&gt;
  if (ped.markerCount == 0) &lt;br /&gt;
     {&lt;br /&gt;
     printf(&amp;quot;No marker data available!\n&amp;quot;);&lt;br /&gt;
     return 0;&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
  // Estimate allele frequencies for all markers&lt;br /&gt;
  ped.EstimateAlleleFrequencies();&lt;br /&gt;
&lt;br /&gt;
  // Get some genotype statistics for the first marker&lt;br /&gt;
  printf(&amp;quot;Statistics for marker %s\n&amp;quot;, (const char *) ped.markerNames[0]); &lt;br /&gt;
&lt;br /&gt;
  // Get information on the first marker&lt;br /&gt;
  MarkerInfo * info = ped.GetMarkerInfo(0);&lt;br /&gt;
&lt;br /&gt;
  // Get information on marker rs12345&lt;br /&gt;
  MarkerInfo * rs12345 = ped.GetMarkerInfo(&amp;quot;rs12345&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  // Number of alleles for the first marker&lt;br /&gt;
  int alleleCount = info.GetAlleleCount();&lt;br /&gt;
&lt;br /&gt;
  // Frequency of the first allele&lt;br /&gt;
  int freq1 = info.freq[1];&lt;br /&gt;
&lt;br /&gt;
  // Name of the first allele, typically &amp;quot;A&amp;quot;, &amp;quot;C&amp;quot;, &amp;quot;G&amp;quot; or &amp;quot;T&amp;quot; for SNPs&lt;br /&gt;
  String label = info.GetAlleleLabel(1); &lt;br /&gt;
&lt;br /&gt;
  // Genotype for a specific individual at a specific marker&lt;br /&gt;
  ped[0].markers[0].isKnown();      // Test if genotype is known&lt;br /&gt;
  ped[0].markers[0].isHomozygous(); // Test if genotype is homozygous&lt;br /&gt;
  ped[0].markers[0][0];             // Index of first allele&lt;br /&gt;
  ped[0].markers[0][1];             // Index of second allele&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1073</id>
		<title>C++ Class: Pedigree Example</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1073"/>
		<updated>2010-04-13T20:35:20Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Pedigree.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char ** argv);&lt;br /&gt;
  {&lt;br /&gt;
  Pedigree ped;&lt;br /&gt;
&lt;br /&gt;
  // The data file contains a description of the contents of the&lt;br /&gt;
  // pedigree file, including for example, a list of marker and &lt;br /&gt;
  // trait names&lt;br /&gt;
  ped.Prepare(&amp;quot;pedigree.dat&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  // The pedigree file contains a list of individuals, stored one&lt;br /&gt;
  // per row, with specific information about each individual as&lt;br /&gt;
  // detailed in the data file.&lt;br /&gt;
  ped.Load(&amp;quot;pedigree.ped&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  printf(&amp;quot;Loaded %d individuals\n&amp;quot;, ped.count);&lt;br /&gt;
  printf(&amp;quot;Loaded %d markers\n&amp;quot;, ped.markerCount);&lt;br /&gt;
&lt;br /&gt;
  // Print out names of the first 10 individuals&lt;br /&gt;
  for (int i = 0; i &amp;lt; max(ped.count, 10); i++)&lt;br /&gt;
     printf(&amp;quot;Individual #1 is labeled %s\n&amp;quot;, (const char *) ped[i].pid);&lt;br /&gt;
&lt;br /&gt;
  if (ped.markerCount == 0) &lt;br /&gt;
     {&lt;br /&gt;
     printf(&amp;quot;No marker data available!\n&amp;quot;);&lt;br /&gt;
     return 0;&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
  // Estimate allele frequencies for all markers&lt;br /&gt;
  ped.EstimateAlleleFrequencies();&lt;br /&gt;
&lt;br /&gt;
  // Get some genotype statistics for the first marker&lt;br /&gt;
  printf(&amp;quot;Statistics for marker %s\n&amp;quot;, (const char *) ped.markerNames[0]); &lt;br /&gt;
&lt;br /&gt;
  // Get information on the first marker&lt;br /&gt;
  MarkerInfo * info = ped.GetMarkerInfo(0);&lt;br /&gt;
&lt;br /&gt;
  // Get information on marker rs12345&lt;br /&gt;
  MarkerInfo * rs12345 = ped.GetMarkerInfo(&amp;quot;rs12345&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  // Number of alleles for the first marker&lt;br /&gt;
  int alleleCount = info.GetAlleleCount();&lt;br /&gt;
&lt;br /&gt;
  // Frequency of the first allele&lt;br /&gt;
  int freq1 = info.freq[1];&lt;br /&gt;
&lt;br /&gt;
  // Name of the first allele, typically &amp;quot;A&amp;quot;, &amp;quot;C&amp;quot;, &amp;quot;G&amp;quot; or &amp;quot;T&amp;quot; for SNPs&lt;br /&gt;
  String label = info.GetAlleleLabel(1); &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1072</id>
		<title>C++ Class: Pedigree Example</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1072"/>
		<updated>2010-04-13T20:31:59Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Pedigree.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char ** argv);&lt;br /&gt;
  {&lt;br /&gt;
  Pedigree ped;&lt;br /&gt;
&lt;br /&gt;
  // The data file contains a description of the contents of the&lt;br /&gt;
  // pedigree file, including for example, a list of marker and &lt;br /&gt;
  // trait names&lt;br /&gt;
  ped.Prepare(&amp;quot;pedigree.dat&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  // The pedigree file contains a list of individuals, stored one&lt;br /&gt;
  // per row, with specific information about each individual as&lt;br /&gt;
  // detailed in the data file.&lt;br /&gt;
  ped.Load(&amp;quot;pedigree.ped&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  printf(&amp;quot;Loaded %d individuals\n&amp;quot;, ped.count);&lt;br /&gt;
  printf(&amp;quot;Loaded %d markers\n&amp;quot;, ped.markerCount);&lt;br /&gt;
&lt;br /&gt;
  // Print out names of the first 10 individuals&lt;br /&gt;
  for (int i = 0; i &amp;lt; max(ped.count, 10); i++)&lt;br /&gt;
     printf(&amp;quot;Individual #1 is labeled %s\n&amp;quot;, (const char *) ped[i].pid);&lt;br /&gt;
&lt;br /&gt;
  if (ped.markerCount == 0) &lt;br /&gt;
     {&lt;br /&gt;
     printf(&amp;quot;No marker data available!\n&amp;quot;);&lt;br /&gt;
     return 0;&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
  // Get some genotype statistics for the first marker&lt;br /&gt;
  printf(&amp;quot;Statistics for marker %s\n&amp;quot;, (const char *) ped.markerNames[0]); &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1071</id>
		<title>C++ Class: Pedigree Example</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=C%2B%2B_Class:_Pedigree_Example&amp;diff=1071"/>
		<updated>2010-04-13T20:31:14Z</updated>

		<summary type="html">&lt;p&gt;Pha: Created page with &amp;#039;== Example ==  &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  #include &amp;quot;Pedigree.h&amp;quot;  int main(int argc, char ** argv);   {   Pedigree ped;    // The data file contains a description of the contents of the…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;Pedigree.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char ** argv);&lt;br /&gt;
  {&lt;br /&gt;
  Pedigree ped;&lt;br /&gt;
&lt;br /&gt;
  // The data file contains a description of the contents of the&lt;br /&gt;
  // pedigree file, including for example, a list of marker and &lt;br /&gt;
  // trait names&lt;br /&gt;
  ped.Prepare(&amp;quot;pedigree.dat&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  // The pedigree file contains a list of individuals, stored one&lt;br /&gt;
  // per row, with specific information about each individual as&lt;br /&gt;
  // detailed in the data file.&lt;br /&gt;
  ped.Load(&amp;quot;pedigree.ped&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  printf(&amp;quot;Loaded %d individuals\n&amp;quot;, ped.count);&lt;br /&gt;
  printf(&amp;quot;Loaded %d markers\n&amp;quot;, ped.markerCount);&lt;br /&gt;
&lt;br /&gt;
  // Print out names of the first 10 individuals&lt;br /&gt;
  for (int i = 0; i &amp;lt; max(ped.count, 10); i++)&lt;br /&gt;
     printf(&amp;quot;Individual #1 is labeled %s\n&amp;quot;, (const char *) ped[i].pid);&lt;br /&gt;
&lt;br /&gt;
  if (ped.markerCount == 0) &lt;br /&gt;
     {&lt;br /&gt;
     printf(&amp;quot;No marker data available!\n&amp;quot;);&lt;br /&gt;
     return 0;&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
  // Get some genotype statistics for the first marker&lt;br /&gt;
  printf(&amp;quot;Statistics for marker %s\n&amp;quot;, (const char *) ped.markerNames[0]);&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1070</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1070"/>
		<updated>2010-04-13T20:24:18Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Mathematical Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can will &lt;br /&gt;
describe the probability of a matching of mismatching base using the&lt;br /&gt;
following notation:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;A/A&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;ibd&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Then, the probabilities of interest are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P_{ibd} (1 - \epsilon) + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(no match) = P_{ibd} \epsilon + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we also wish to use heterozygous sites, rather than limiting our comparison to reference homozygous sites, we could use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P(no match) = P_{ibd} 0.5 + (1.0 - P_{ibd}) P_A&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any given value of &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt; we can calculate this quantity for each read that overlaps a site with a known homozygous genotype. In addition, we can take the product of this quantity across all sites examined -- because this product is likely to be very small, we actually sum the &amp;lt;math&amp;gt;log&amp;lt;/math&amp;gt;s of the appropriate quantities rather than multiplying them together.&lt;br /&gt;
&lt;br /&gt;
To decide if we have sequenced the correct sample, we should do the following:&lt;br /&gt;
&lt;br /&gt;
a) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 1.0&amp;lt;/math&amp;gt;. This assumes that we have sequenced the target sample.&lt;br /&gt;
&lt;br /&gt;
b) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.0&amp;lt;/math&amp;gt;. This assumes we sequenced a different sample, unrelated to the target.&lt;br /&gt;
&lt;br /&gt;
c) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.5&amp;lt;/math&amp;gt;. This assumes we sequenced a sample that shares half the genome with the target sample, perhaps because it is a sibling or parent of the target sample.&lt;br /&gt;
&lt;br /&gt;
d) If desired, evaluate the same log-sum for other intermediate values of &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt;. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.95&amp;lt;/math&amp;gt; to allow for 5% of reads that are derived from a different sample, for example, due to contamination. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.05&amp;lt;/math&amp;gt; to consider more distant relatives.&lt;br /&gt;
&lt;br /&gt;
Once the result of evaluating a), b), c) and d) are available, we can decide if the target sample has been sequenced. Sequencing the target sample will mean that the log-sum in a) is the largest. Sequencing a parent or offspring of the target sample will maximize c). Sequencing a completely incorrect sample will maximize b).&lt;br /&gt;
&lt;br /&gt;
If all the log-sums are very similar, then we don&#039;t have enough information to make a clear cut decision. Typically, we thousands of genetic markers from a typical SNP chip and whole genome shotgun sequence data, most decisions should be very clear cut.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
After loading genotypes, we generate a genome mask for each position. There are three outcomes of interest:&lt;br /&gt;
&lt;br /&gt;
; Known Genotypes&lt;br /&gt;
: These are sites where we have a previously observed a genotype call and where we will be evaluating match / mismatch rates to determine sample identity.&lt;br /&gt;
&lt;br /&gt;
; dbSNP sites&lt;br /&gt;
: These are sites that are known to vary among individuals, but for which a known genotype is not available.&lt;br /&gt;
&lt;br /&gt;
; Background sites&lt;br /&gt;
: These are all other sites and can be used to estimate the &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; error rate parameter.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1069</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1069"/>
		<updated>2010-04-13T20:20:51Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Mathematical Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can will &lt;br /&gt;
describe the probability of a matching of mismatching base using the&lt;br /&gt;
following notation:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;A/A&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;ibd&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Then, the probabilities of interest are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P_{ibd} (1 - \epsilon) + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(no match) = P_{ibd} \epsilon + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any given value of &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt; we can calculate this quantity for each read that overlaps a site with a known homozygous genotype. In addition, we can take the product of this quantity across all sites examined -- because this product is likely to be very small, we actually sum the &amp;lt;math&amp;gt;log&amp;lt;/math&amp;gt;s of the appropriate quantities rather than multiplying them together.&lt;br /&gt;
&lt;br /&gt;
To decide if we have sequenced the correct sample, we should do the following:&lt;br /&gt;
&lt;br /&gt;
a) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 1.0&amp;lt;/math&amp;gt;. This assumes that we have sequenced the target sample.&lt;br /&gt;
&lt;br /&gt;
b) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.0&amp;lt;/math&amp;gt;. This assumes we sequenced a different sample, unrelated to the target.&lt;br /&gt;
&lt;br /&gt;
c) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.5&amp;lt;/math&amp;gt;. This assumes we sequenced a sample that shares half the genome with the target sample, perhaps because it is a sibling or parent of the target sample.&lt;br /&gt;
&lt;br /&gt;
d) If desired, evaluate the same log-sum for other intermediate values of &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt;. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.95&amp;lt;/math&amp;gt; to allow for 5% of reads that are derived from a different sample, for example, due to contamination. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.05&amp;lt;/math&amp;gt; to consider more distant relatives.&lt;br /&gt;
&lt;br /&gt;
Once the result of evaluating a), b), c) and d) are available, we can decide if the target sample has been sequenced. Sequencing the target sample will mean that the log-sum in a) is the largest. Sequencing a parent or offspring of the target sample will maximize c). Sequencing a completely incorrect sample will maximize b).&lt;br /&gt;
&lt;br /&gt;
If all the log-sums are very similar, then we don&#039;t have enough information to make a clear cut decision. Typically, we thousands of genetic markers from a typical SNP chip and whole genome shotgun sequence data, most decisions should be very clear cut.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
After loading genotypes, we generate a genome mask for each position. There are three outcomes of interest:&lt;br /&gt;
&lt;br /&gt;
; Known Genotypes&lt;br /&gt;
: These are sites where we have a previously observed a genotype call and where we will be evaluating match / mismatch rates to determine sample identity.&lt;br /&gt;
&lt;br /&gt;
; dbSNP sites&lt;br /&gt;
: These are sites that are known to vary among individuals, but for which a known genotype is not available.&lt;br /&gt;
&lt;br /&gt;
; Background sites&lt;br /&gt;
: These are all other sites and can be used to estimate the &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; error rate parameter.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1068</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1068"/>
		<updated>2010-04-13T20:09:19Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Mathematical Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can will &lt;br /&gt;
describe the probability of a matching of mismatching base using the&lt;br /&gt;
following notation:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;A/A&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;ibd&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Then, the probabilities of interest are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P_{ibd} (1 - \epsilon) + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(no match) = P_{ibd} \epsilon + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any given value of &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt; we can calculate this quantity for each read that overlaps a site with a known homozygous genotype. In addition, we can take the product of this quantity across all sites examined -- because this product is likely to be very small, we actually sum the &amp;lt;math&amp;gt;log&amp;lt;/math&amp;gt;s of the appropriate quantities rather than multiplying them together.&lt;br /&gt;
&lt;br /&gt;
To decide if we have sequenced the correct sample, we should do the following:&lt;br /&gt;
&lt;br /&gt;
a) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 1.0&amp;lt;/math&amp;gt;. This assumes that we have sequenced the target sample.&lt;br /&gt;
&lt;br /&gt;
b) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.0&amp;lt;/math&amp;gt;. This assumes we sequenced a different sample, unrelated to the target.&lt;br /&gt;
&lt;br /&gt;
c) Evaluate this log-sum assuming &amp;lt;math&amp;gt;P_{ibd} = 0.5&amp;lt;/math&amp;gt;. This assumes we sequenced a sample that shares half the genome with the target sample, perhaps because it is a sibling or parent of the target sample.&lt;br /&gt;
&lt;br /&gt;
d) If desired, evaluate the same log-sum for other intermediate values of P_{ibd}. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.95&amp;lt;/math&amp;gt; to allow for 5% of reads that are derived from a different sample, for example, due to contamination. It may be interesting to set &amp;lt;math&amp;gt;P_{ibd} = 0.05&amp;lt;/math&amp;gt; to consider more distant relatives.&lt;br /&gt;
&lt;br /&gt;
Once the result of evaluating a), b), c) and d) are available, we can decide if the target sample has been sequenced. Sequencing the target sample will mean that the log-sum in a) is the largest. Sequencing a parent or offspring of the target sample will maximize c). Sequencing a completely incorrect sample will maximize b).&lt;br /&gt;
&lt;br /&gt;
If all the log-sums are very similar, then we don&#039;t have enough information to make a clear cut decision. Typically, we thousands of genetic markers from a typical SNP chip and whole genome shotgun sequence data, most decisions should be very clear cut.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1067</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1067"/>
		<updated>2010-04-13T20:03:43Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Mathematical Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can will &lt;br /&gt;
describe the probability of a matching of mismatching base using the&lt;br /&gt;
following notation:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;A/A&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;ibd&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Then, the probabilities of interest are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P_{ibd} (1 - \epsilon) + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(no match) = P_{ibd} \epsilon + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For any given value of P_{ibd} we can calculate this quantity for each read that overlaps a site with a known homozygous genotype. In addition, we can take the product of this quantity across all sites examined -- because this product is likely to be very small, we actually sum the &amp;lt;math&amp;gt;log&amp;lt;/math&amp;gt;s of the appropriate quantities rather than multiplying them together.&lt;br /&gt;
&lt;br /&gt;
To decide if we have sequenced the correct sample, we should do the following:&lt;br /&gt;
&lt;br /&gt;
a) Evaluate this log-sum assuming P_{ibd} = 1.0. This assumes that we have sequenced the target sample.&lt;br /&gt;
&lt;br /&gt;
b) Evaluate this log-sum assuming P_{ibd} = 0.0. This assumes we sequenced a different sample, unrelated to the target.&lt;br /&gt;
&lt;br /&gt;
c) Evalute this log-sum assuming P_{ibd} = 0.5. This assumes we sequenced a sample that shares half the genome with the target sample, perhaps because it is a sibling or parent of the target sample.&lt;br /&gt;
&lt;br /&gt;
d) If desired, evaluate the same log-sum for other intermediate values of P_{ibd}. It may be interesting to set P_{ibd} = 0.95 to allow for 5% of reads that are derived from a different sample, for example, due to contamination. It may be interesting to set P_{ibd} = 0.05 to consider more distant relatives.&lt;br /&gt;
&lt;br /&gt;
Once the result of evaluating a), b), c) and d) are available, we can decide if the target sample has been sequenced. Sequencing the target sample will mean that the log-sum in a) is the largest. Sequencing a parent or offspring of the target sample will maximize c). Sequencing a completely incorrect sample will maximize b).&lt;br /&gt;
&lt;br /&gt;
If all the log-sums are very similar, then we don&#039;t have enough information to make a clear cut decision. Typically, we thousands of genetic markers from a typical SNP chip and whole genome shotgun sequence data, most decisions should be very clear cut.&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1066</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1066"/>
		<updated>2010-04-13T19:52:58Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Mathematical Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can will &lt;br /&gt;
describe the probability of a matching of mismatching base using the&lt;br /&gt;
following notation:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;A/A&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;ibd&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Then, the probabilities of interest are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
P(match) = P_{ibd} (1 - \epsilon) + (1 - P_{ibd}) \epsilon&lt;br /&gt;
P(no match) = P_{ibd} \epsilon + (1 - P_{ibd}) \epsilon&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1065</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1065"/>
		<updated>2010-04-13T19:49:48Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Mathematical Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can calculate the probability of a match or mismatch at each base as: &lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| A/A &lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;ibd&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1064</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1064"/>
		<updated>2010-04-13T19:49:15Z</updated>

		<summary type="html">&lt;p&gt;Pha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can calculate the probability of a match or mismatch at each base as: &lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation &lt;br /&gt;
|-&lt;br /&gt;
| Variable &lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| A/A &lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;A&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;span class=&amp;quot;texhtml&amp;quot;&amp;gt;&#039;&#039;P&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;i&#039;&#039;&#039;&#039;b&#039;&#039;&#039;&#039;d&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; &lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1063</id>
		<title>Verifying Sample Identities - Implementation</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Verifying_Sample_Identities_-_Implementation&amp;diff=1063"/>
		<updated>2010-04-13T19:47:09Z</updated>

		<summary type="html">&lt;p&gt;Pha: Created page with &amp;#039;== Principle  ==  We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been s…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Principle  ==&lt;br /&gt;
&lt;br /&gt;
We should be able to verify that the right sample has been sequenced by comparing base calls in a read to known genotypes for a sample. If the sample has been sequenced correctly, the base calls should match previously known genotypes. If the wrong sample has been sequenced, we will see quite a bit more mismatches. &lt;br /&gt;
&lt;br /&gt;
== Mathematical Details  ==&lt;br /&gt;
&lt;br /&gt;
For each sample, we would like to calculate the likelihood of a set of reads assuming that we sequenced the correct sample, assuming we sequenced a sample related to the correct sample, or assuming we sequenced an incorrect sample. We would then like to flag samples where it appears likely that the wrong sample has been sequenced. &lt;br /&gt;
&lt;br /&gt;
If we have a list of bases that overlap a known genotype, we can calculate the probability of a match or mismatch at each base as: &lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;200&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; summary=&amp;quot;Summary of Variables Used Below&amp;quot;&lt;br /&gt;
|+ Notation&lt;br /&gt;
|-&lt;br /&gt;
| Variable&lt;br /&gt;
| Definition&lt;br /&gt;
|-&lt;br /&gt;
| A/A&lt;br /&gt;
| Previously known genotype; we only consider homozygous sites.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;P_A&amp;lt;/math&amp;gt;&lt;br /&gt;
| Frequency of allele A in the population&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;P_{ibd}&amp;lt;/math&amp;gt;&lt;br /&gt;
| Probability that the sequenced sample and the target sample share a chromosome. This should be 1.0 when we have sequenced the correct sample and 0.0 if we sequence an unrelated sample. If we sequence a related sample (e.g. a parent or sibling of the target sample), we will see intermediate values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;math&amp;gt;\{epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
| Estimate error rate for the current base in the sequence data.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1047</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1047"/>
		<updated>2010-04-09T14:30:09Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Karma CHANGELOG */ fill in 0.9.0 changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as those generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
Primary features:&lt;br /&gt;
&lt;br /&gt;
# High performance, high sensitivity&lt;br /&gt;
# Large and small gap detection by default&lt;br /&gt;
# Multiple gaps per read by default&lt;br /&gt;
# Single or paired end reads&lt;br /&gt;
# No read length limit&lt;br /&gt;
# Quality scores are used to assess quality of maps&lt;br /&gt;
# All potential locations are examined exhaustively, none are omitted&lt;br /&gt;
# Reasonable memory per CPU ratio on high core count machines&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not currently supported.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
Karma is designed to be reasonably portable.&lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, there are likely other portability issues.&lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Karma requires that the following debian packages be installed on the host Linux machine:&lt;br /&gt;
&lt;br /&gt;
# libssl-dev&lt;br /&gt;
# zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
Without these installed, Karma will not build.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Assuming the karma tar file is named karma.tgz, do the following&lt;br /&gt;
&lt;br /&gt;
 tar xvzf karma.tgz&lt;br /&gt;
 cd karma-0.9&lt;br /&gt;
 make&lt;br /&gt;
 mkdir ~/bin&lt;br /&gt;
 cp karma/karma ~/bin&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you want to share the karma binary install it in /usr/local/bin/karma.&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index array, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once exceeded, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is instead combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.  These are then used when that pattern is found in a read.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
# command line help is muddled up - UserOptions.h needs work&lt;br /&gt;
# color space read handling needs to be re-integrated and tested&lt;br /&gt;
# LS 454 needs to be tested, and the code adapted&lt;br /&gt;
# pre-process some number of records to establish an appropriate max insert size&lt;br /&gt;
# finish reference header view/edit code&lt;br /&gt;
# investigate and document maximum memory use during &#039;&#039;create&#039;&#039; sub-command&lt;br /&gt;
# finish and improve check and test commands&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
* Karma 0.9.0&lt;br /&gt;
 * reference may now contain an arbitrary number of chromosomes &lt;br /&gt;
 * local re-alignment is drastically improved (handle small and large gaps better)&lt;br /&gt;
 * command line is re-vamped - now easier to use&lt;br /&gt;
 * create/naming/using reference index and hashes is easier&lt;br /&gt;
* Karma 0.8.8S&lt;br /&gt;
 * add first version of local re-alignment&lt;br /&gt;
 * bump max number of chromosomes to 200&lt;br /&gt;
 * we no longer do Smith-Waterman on each candidate location&lt;br /&gt;
* Karma 0.8.8&lt;br /&gt;
* Karma 0.8.6&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligners] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1046</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1046"/>
		<updated>2010-04-09T14:01:41Z</updated>

		<summary type="html">&lt;p&gt;Pha: add TODO items and begin listing change history&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as those generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
Primary features:&lt;br /&gt;
&lt;br /&gt;
# High performance, high sensitivity&lt;br /&gt;
# Large and small gap detection by default&lt;br /&gt;
# Multiple gaps per read by default&lt;br /&gt;
# Single or paired end reads&lt;br /&gt;
# No read length limit&lt;br /&gt;
# Quality scores are used to assess quality of maps&lt;br /&gt;
# All potential locations are examined exhaustively, none are omitted&lt;br /&gt;
# Reasonable memory per CPU ratio on high core count machines&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not currently supported.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
Karma is designed to be reasonably portable.&lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, there are likely other portability issues.&lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Karma requires that the following debian packages be installed on the host Linux machine:&lt;br /&gt;
&lt;br /&gt;
# libssl-dev&lt;br /&gt;
# zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
Without these installed, Karma will not build.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Assuming the karma tar file is named karma.tgz, do the following&lt;br /&gt;
&lt;br /&gt;
 tar xvzf karma.tgz&lt;br /&gt;
 cd karma-0.9&lt;br /&gt;
 make&lt;br /&gt;
 mkdir ~/bin&lt;br /&gt;
 cp karma/karma ~/bin&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you want to share the karma binary install it in /usr/local/bin/karma.&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index array, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once exceeded, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is instead combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.  These are then used when that pattern is found in a read.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
# command line help is muddled up - UserOptions.h needs work&lt;br /&gt;
# color space read handling needs to be re-integrated and tested&lt;br /&gt;
# LS 454 needs to be tested, and the code adapted&lt;br /&gt;
# pre-process some number of records to establish an appropriate max insert size&lt;br /&gt;
# finish reference header view/edit code&lt;br /&gt;
# investigate and document maximum memory use during &#039;&#039;create&#039;&#039; sub-command&lt;br /&gt;
# finish and improve check and test commands&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
* Karma 0.9.0&lt;br /&gt;
* Karma 0.8.8S&lt;br /&gt;
* Karma 0.8.8&lt;br /&gt;
* Karma 0.8.6&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligners] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1044</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1044"/>
		<updated>2010-04-08T19:22:27Z</updated>

		<summary type="html">&lt;p&gt;Pha: add features/benefits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as those generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
Primary features:&lt;br /&gt;
&lt;br /&gt;
# High performance, high sensitivity&lt;br /&gt;
# Large and small gap detection by default&lt;br /&gt;
# Multiple gaps per read by default&lt;br /&gt;
# Single or paired end reads&lt;br /&gt;
# No read length limit&lt;br /&gt;
# Quality scores are used to assess quality of maps&lt;br /&gt;
# All potential locations are examined exhaustively, none are omitted&lt;br /&gt;
# Reasonable memory per CPU ratio on high core count machines&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not currently supported.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
Karma is designed to be reasonably portable.&lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, there are likely other portability issues.&lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Karma requires that the following debian packages be installed on the host Linux machine:&lt;br /&gt;
&lt;br /&gt;
# libssl-dev&lt;br /&gt;
# zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
Without these installed, Karma will not build.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Assuming the karma tar file is named karma.tgz, do the following&lt;br /&gt;
&lt;br /&gt;
 tar xvzf karma.tgz&lt;br /&gt;
 cd karma-0.9&lt;br /&gt;
 make&lt;br /&gt;
 mkdir ~/bin&lt;br /&gt;
 cp karma/karma ~/bin&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you want to share the karma binary install it in /usr/local/bin/karma.&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index array, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once exceeded, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is instead combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.  These are then used when that pattern is found in a read.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligners] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1043</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1043"/>
		<updated>2010-04-08T19:13:57Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Other useful links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as those generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not currently supported.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
Karma is designed to be reasonably portable.&lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, there are likely other portability issues.&lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Karma requires that the following debian packages be installed on the host Linux machine:&lt;br /&gt;
&lt;br /&gt;
# libssl-dev&lt;br /&gt;
# zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
Without these installed, Karma will not build.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Assuming the karma tar file is named karma.tgz, do the following&lt;br /&gt;
&lt;br /&gt;
 tar xvzf karma.tgz&lt;br /&gt;
 cd karma-0.9&lt;br /&gt;
 make&lt;br /&gt;
 mkdir ~/bin&lt;br /&gt;
 cp karma/karma ~/bin&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you want to share the karma binary install it in /usr/local/bin/karma.&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index array, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once exceeded, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is instead combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.  These are then used when that pattern is found in a read.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligners] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1042</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1042"/>
		<updated>2010-04-08T19:13:01Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Karma Performance Tuning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as those generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not currently supported.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
Karma is designed to be reasonably portable.&lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, there are likely other portability issues.&lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Karma requires that the following debian packages be installed on the host Linux machine:&lt;br /&gt;
&lt;br /&gt;
# libssl-dev&lt;br /&gt;
# zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
Without these installed, Karma will not build.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Assuming the karma tar file is named karma.tgz, do the following&lt;br /&gt;
&lt;br /&gt;
 tar xvzf karma.tgz&lt;br /&gt;
 cd karma-0.9&lt;br /&gt;
 make&lt;br /&gt;
 mkdir ~/bin&lt;br /&gt;
 cp karma/karma ~/bin&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you want to share the karma binary install it in /usr/local/bin/karma.&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index array, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once exceeded, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is instead combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.  These are then used when that pattern is found in a read.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1041</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1041"/>
		<updated>2010-04-08T19:11:14Z</updated>

		<summary type="html">&lt;p&gt;Pha: fill in build info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as those generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not currently supported.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
Karma is designed to be reasonably portable.&lt;br /&gt;
&lt;br /&gt;
However, since development occurs only on Ubuntu 9.10 x86 and x64 platforms, there are likely other portability issues.&lt;br /&gt;
&lt;br /&gt;
We support Karma only on Ubuntu 9.10 on 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Karma requires that the following debian packages be installed on the host Linux machine:&lt;br /&gt;
&lt;br /&gt;
# libssl-dev&lt;br /&gt;
# zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
Without these installed, Karma will not build.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Assuming the karma tar file is named karma.tgz, do the following&lt;br /&gt;
&lt;br /&gt;
 tar xvzf karma.tgz&lt;br /&gt;
 cd karma-0.9&lt;br /&gt;
 make&lt;br /&gt;
 mkdir ~/bin&lt;br /&gt;
 cp karma/karma ~/bin&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you want to share the karma binary install it in /usr/local/bin/karma.&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once crossed, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is now combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1040</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1040"/>
		<updated>2010-04-08T19:05:38Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Dependencies */ fill em in&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not working.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
Karma requires that the following debian packages be installed on the host Linux machine:&lt;br /&gt;
&lt;br /&gt;
# libssl-dev&lt;br /&gt;
# zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
Without these installed, Karma will not build.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once crossed, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is now combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1039</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1039"/>
		<updated>2010-04-08T19:03:00Z</updated>

		<summary type="html">&lt;p&gt;Pha: fill in performance details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not working.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the build tree subdirectory named &#039;&#039;karma&#039;&#039;, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Karma Performance Tuning =&lt;br /&gt;
&lt;br /&gt;
There are four components to the Karma index and hash.  A pure index, based on an N-mer word index.  This is used as a pointer into a word positions table, which is an ordered list of genome positions in which that N-mer word appears.  There is a cap called the &#039;&#039;occurrence cutoff&#039;&#039;, which once crossed, causes that index word to be marked as a high repeat pattern.  Once marked as high repeat, the N-mer word is now combined with both the N-mer word preceding it, as well as the N-mer word succeeding it to create a 2 * N-mer word hash key.  Two hash tables are populated, a left and a right hash.&lt;br /&gt;
&lt;br /&gt;
== Index Word Size ==&lt;br /&gt;
&lt;br /&gt;
Choosing an appropriate word size for larger genome is critical to performance.  The easiest case is for Illumina base space reads with the human genome (3Gbases), where the default 15-mer word size is fine.&lt;br /&gt;
&lt;br /&gt;
For smaller genomes, consider using a smaller word size.  Genomes smaller than a few million bases should be perfectly fine with a word size of 11 or 12.&lt;br /&gt;
&lt;br /&gt;
Since the primary index table into the word positions table is 2^(wordsize) * 4 bytes, it can grow large rapidly.  All else being equal, a smaller word size leads to longer sets of word positions for each index value.  Each increment of word size approximately quadruples storage requirements, and halves runtime.  Similarly, each decrement of word size reduces the index table size by 75%, and doubles runtime.  These approximations are old, but serve a useful rule of thumb.&lt;br /&gt;
&lt;br /&gt;
For ABI SOLiD reads, the word size is critical, due to the shorter length of reads as compared to Illumina or LS 454.&lt;br /&gt;
&lt;br /&gt;
The optimal minimum word size is chosen such that it is 1/4 the minimum expected average read length.  It also must be chosen to be 1/2 the minimum expected read length, since at least 2 full words must exist in the read.&lt;br /&gt;
&lt;br /&gt;
So for 48-mer reads, a reasonable value of word size is 12.  Although the base space default of 15 is fine, too, Karma is able to take advantage of a higher number of index words per read, yielding substantial speedups even with the shorter read.  Similarly, 52-mer reads would map better with a 13-mer word size, and 56-mer reads would map best with a 14-mer word size.&lt;br /&gt;
&lt;br /&gt;
== Occurrence Cutoff ==&lt;br /&gt;
&lt;br /&gt;
The occurrence cutoff value determines how quickly an N-mer pattern is declared to be &#039;&#039;high repeat&#039;&#039; and left out of the index in favor of a hash.  The default value of 5000 seems adequate for Illumina reads with the human genome.  If ultimate performance is necessary, some experimentation is called for with this value.&lt;br /&gt;
&lt;br /&gt;
== Shared Memory ==&lt;br /&gt;
&lt;br /&gt;
Karma uses memory mapped files to share the potentially large reference index and hash data structures.&lt;br /&gt;
&lt;br /&gt;
Karma uses this to great effect on our 8 processors with hyperthreading enabled.  16 copies of karma can share one reference index and hash, yielding a very acceptable memory per CPU ratio of around 1GB/CPU.&lt;br /&gt;
&lt;br /&gt;
A problem with large reference index and hash data structures is that they are more prone to being paged out.  On a shared machine that is being used extensively even just simple disk I/O, memory pages are being reclaimed such that Karma will become swapped out.&lt;br /&gt;
&lt;br /&gt;
While Karma can recover on its own, it is best to either run in a production manner on dedicated machines, or to run a program such as the utility &#039;&#039;mapfile&#039;&#039; found in the utilities sub-folder.  This program continually touches each page of the data structures in sequential order, forcing them to the head of the disk buffer pool, so they don&#039;t get aged out of the queue.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: This feature is not yet complete&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1038</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1038"/>
		<updated>2010-04-08T18:36:26Z</updated>

		<summary type="html">&lt;p&gt;Pha: add mapping examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not working.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the subdirectory named karma, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference [http://en.wikipedia.org/wiki/FASTA_format FASTA] file, you may have either a color or base space binary reference, as well as either color or base space index/hash files, any in varying word sizes or occurrence cutoffs.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference index and hash ==&lt;br /&gt;
&lt;br /&gt;
 -r &#039;&#039;reference&#039;&#039;          Reference file in [http://en.wikipedia.org/wiki/FASTA_format FASTA] format&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
Since Karma uses the word size and occurrence cutoff to help construct the actual index and hash filenames, you must specify them the same way you did when you created the reference index and hash.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
= Modifying the Reference Header =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the binary version of the reference.  The header can be viewed and edited using the header subcommands here.&lt;br /&gt;
&lt;br /&gt;
To view the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
To view and edit the header:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa -e&lt;br /&gt;
&lt;br /&gt;
= Other test and check capabilities =&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
= Karma File structure  =&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Karma TODO List =&lt;br /&gt;
&lt;br /&gt;
= Karma CHANGELOG =&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1037</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1037"/>
		<updated>2010-04-08T18:25:15Z</updated>

		<summary type="html">&lt;p&gt;Pha: populate alignment section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  &lt;br /&gt;
&lt;br /&gt;
Color space and LS454 sequence alignments are not working.  These features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the subdirectory named karma, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;&#039;karma create&#039;&#039;, then align reads using &#039;&#039;karma map&#039;&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build reference index and hash  =&lt;br /&gt;
&lt;br /&gt;
Building a reference index and hash with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in FASTA format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference FASTA file, you may have either a color or base space binary reference, as well as either color or base space index/hash files.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference ==&lt;br /&gt;
&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Aligning Reads =&lt;br /&gt;
&lt;br /&gt;
Aligning reads to the reference is easy:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX.fastq&lt;br /&gt;
&lt;br /&gt;
or for paired reads:&lt;br /&gt;
&lt;br /&gt;
 karma map -r phiX.fa -w 11 phiX-mate1.fastq phiX-mate2.fastq&lt;br /&gt;
&lt;br /&gt;
In both of the above examples, the -r option names the reference originally used to build the index/hash, and the -w 11 specifies that we are using the index/hash built for 11-mer words.  Although you can use the default word size of 15 for phiX, the index is 4^15 * 4 = 4GBytes, so a shorter word size is prudent.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (Illumina) ==&lt;br /&gt;
&lt;br /&gt;
Karma is set up so that the default options work well for mapping Illumina reads to the Human genome.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (ABI SOLiD) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align color space reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Aligning Reads (LS 454) ==&lt;br /&gt;
&lt;br /&gt;
Karma has been designed to align LS 454 reads.  However, in Karma 0.9.0, this functionality is not working.&lt;br /&gt;
&lt;br /&gt;
== Options  ==&lt;br /&gt;
&lt;br /&gt;
Command line &lt;br /&gt;
&lt;br /&gt;
Usage: &lt;br /&gt;
&lt;br /&gt;
Karma expects the sub command to be the first argument on the command line.  Currently, this includes: map, create, header, check and test.&lt;br /&gt;
&lt;br /&gt;
To align reads, you first create an index:&lt;br /&gt;
 karma create [options...] somereference.fa&lt;br /&gt;
&lt;br /&gt;
A simple example is:&lt;br /&gt;
 karma create -i phiX.fa&lt;br /&gt;
&lt;br /&gt;
To actually align reads, use the map command:&lt;br /&gt;
 karma map [options...] mate1.fastq.gz [mate2.fastq.gz]&lt;br /&gt;
&lt;br /&gt;
A simple example is:&lt;br /&gt;
 karma map -r phiX.fa -o phiX.sam mate1.fastq.gz mate2.fastq.gz&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the reference.  The header can be viewed and edited using the header subcommand:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
== File structure  ==&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Align Illumina Reads =&lt;br /&gt;
&lt;br /&gt;
Command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
karma map -r reference.fa -o output.sam read1.fastq read2.fastq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Align ABI SOLiD Reads = &lt;br /&gt;
&lt;br /&gt;
Command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
karma map -r reference.fa -c -o output.sam read1.fastq read2.fastq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://www.broadinstitute.org/files/shared/mpg/nextgen2010/nextgen_li.pdf Introduction of BWA usage] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1036</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1036"/>
		<updated>2010-04-08T18:07:48Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Testing the build */ more detail&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  This version does not map color space reads, nor does it reliably map LS454 reads.  Both of those features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the subdirectory named karma, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any differences greater than that are an error and need to be fixed by the author.&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;karma create&#039;, then align reads using &#039;karma map&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build Reference  =&lt;br /&gt;
&lt;br /&gt;
Building a reference with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in FASTA format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference FASTA file, you may have either a color or base space binary reference, as well as either color or base space index/hash files.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference ==&lt;br /&gt;
&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Options  ==&lt;br /&gt;
&lt;br /&gt;
Command line &lt;br /&gt;
&lt;br /&gt;
Usage: &lt;br /&gt;
&lt;br /&gt;
Karma expects the sub command to be the first argument on the command line.  Currently, this includes: map, create, header, check and test.&lt;br /&gt;
&lt;br /&gt;
To align reads, you first create an index:&lt;br /&gt;
 karma create [options...] somereference.fa&lt;br /&gt;
&lt;br /&gt;
A simple example is:&lt;br /&gt;
 karma create -i phiX.fa&lt;br /&gt;
&lt;br /&gt;
To actually align reads, use the map command:&lt;br /&gt;
 karma map [options...] mate1.fastq.gz [mate2.fastq.gz]&lt;br /&gt;
&lt;br /&gt;
A simple example is:&lt;br /&gt;
 karma map -r phiX.fa -o phiX.sam mate1.fastq.gz mate2.fastq.gz&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the reference.  The header can be viewed and edited using the header subcommand:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
== File structure  ==&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Align Illumina Reads =&lt;br /&gt;
&lt;br /&gt;
Command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
karma map -r reference.fa -o output.sam read1.fastq read2.fastq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Align ABI SOLiD Reads = &lt;br /&gt;
&lt;br /&gt;
Command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
karma map -r reference.fa -c -o output.sam read1.fastq read2.fastq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://www.broadinstitute.org/files/shared/mpg/nextgen2010/nextgen_li.pdf Introduction of BWA usage] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
	<entry>
		<id>http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1035</id>
		<title>Karma</title>
		<link rel="alternate" type="text/html" href="http://genome.sph.umich.edu/w/index.php?title=Karma&amp;diff=1035"/>
		<updated>2010-04-08T18:07:05Z</updated>

		<summary type="html">&lt;p&gt;Pha: /* Testing the build */ flesh it out&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Software]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;K-tuple Alignment with Rapid Matching Algorithm&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Karma uses an existing reference to align short reads, such as generated by Illumina sequencers.&lt;br /&gt;
&lt;br /&gt;
The current version, 0.9.0, is optimized to rapidly map base space reads from Illumina sequencers.  This version does not map color space reads, nor does it reliably map LS454 reads.  Both of those features will return in Karma 0.9.1.&lt;br /&gt;
&lt;br /&gt;
= Download Karma =&lt;br /&gt;
&lt;br /&gt;
To get a copy go to [http://www.sph.umich.edu/csg/pha/karma/download/ Karma Download] &lt;br /&gt;
&lt;br /&gt;
= Build Karma =&lt;br /&gt;
&lt;br /&gt;
== Dependencies ==&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
== Testing the build ==&lt;br /&gt;
&lt;br /&gt;
To test karma, go to the subdirectory named karma, and type the command:&lt;br /&gt;
&lt;br /&gt;
 make test&lt;br /&gt;
&lt;br /&gt;
The test script builds a reference for the small phiX genome, then runs single end as well as paired end alignments.  It compares the results of that with known results.  Differences are printed to the console, and currently look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff phiX.sam.good phiX.sam &lt;br /&gt;
3c3&lt;br /&gt;
&amp;lt; @RG	DT:2010-04-08T17:29Z	ID:boingboing	SM:NA12345&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; @RG	DT:2010-04-08T18:13Z	ID:boingboing	SM:NA12345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Normal Workflow =&lt;br /&gt;
&lt;br /&gt;
Karma works using a set of index and hash files created from an existing reference.  Once created, this set of reference index and hash files must always be specified in the command line when aligning reads.&lt;br /&gt;
&lt;br /&gt;
In concept, the simplest workflow is to first create a reference index using &#039;karma create&#039;, then align reads using &#039;karma map&#039;.  You only have to build the index and hash once.&lt;br /&gt;
&lt;br /&gt;
Because the reference can be large, and because Karma will share the reference among many running instances of Karma, it is useful to put well known references in a common location readily accessible to you and your collaborators.&lt;br /&gt;
&lt;br /&gt;
= Build Reference  =&lt;br /&gt;
&lt;br /&gt;
Building a reference with Karma is straightforward, but because it is time consuming for longer genomes, you typically save the reference index between runs.&lt;br /&gt;
&lt;br /&gt;
The simplest example for creating a reference and index using a wordsize of 11-mer words is:&lt;br /&gt;
&lt;br /&gt;
 karma create -i -w 11 phiX.fa&lt;br /&gt;
&lt;br /&gt;
More generally, three primary parameters are necessary for building a Karma reference index:&lt;br /&gt;
&lt;br /&gt;
# a boolean flag indicating base or color space&lt;br /&gt;
# the index table word occurrence cutoff value&lt;br /&gt;
# the word size&lt;br /&gt;
&lt;br /&gt;
Although the input reference is always expected to be base space and in FASTA format, the binary version of the reference, and the corresponding index and hash files, can be in either color space (ABI SOLiD) or base space (Illumina or LS454).  For a given reference FASTA file, you may have either a color or base space binary reference, as well as either color or base space index/hash files.&lt;br /&gt;
&lt;br /&gt;
Because the index and hash files are dependent on the occurrence cutoff parameter and the word size, the output files created by karma have those values in the file name.  This allows you to create a variety of index/hash tables, depending on your expected use (ABI SOLiD, in particular, is sensitive to read length).&lt;br /&gt;
&lt;br /&gt;
== Options for building reference ==&lt;br /&gt;
&lt;br /&gt;
 -w &#039;&#039;word size&#039;&#039;          Word size for index and hash (default 15, typically 10-16)&lt;br /&gt;
 -O &#039;&#039;occurrence cutoff&#039;&#039;  Upper count of number of word positions to store in word positions table (default 5000)&lt;br /&gt;
 -c                        Creates a color space reference and index/hash&lt;br /&gt;
 -i                        Create the index and hash as well as the binary reference&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Options  ==&lt;br /&gt;
&lt;br /&gt;
Command line &lt;br /&gt;
&lt;br /&gt;
Usage: &lt;br /&gt;
&lt;br /&gt;
Karma expects the sub command to be the first argument on the command line.  Currently, this includes: map, create, header, check and test.&lt;br /&gt;
&lt;br /&gt;
To align reads, you first create an index:&lt;br /&gt;
 karma create [options...] somereference.fa&lt;br /&gt;
&lt;br /&gt;
A simple example is:&lt;br /&gt;
 karma create -i phiX.fa&lt;br /&gt;
&lt;br /&gt;
To actually align reads, use the map command:&lt;br /&gt;
 karma map [options...] mate1.fastq.gz [mate2.fastq.gz]&lt;br /&gt;
&lt;br /&gt;
A simple example is:&lt;br /&gt;
 karma map -r phiX.fa -o phiX.sam mate1.fastq.gz mate2.fastq.gz&lt;br /&gt;
&lt;br /&gt;
To facilitate SAM RG values being set automatically in a production environment, we keep a header in the reference.  The header can be viewed and edited using the header subcommand:&lt;br /&gt;
&lt;br /&gt;
 karma header -r phiX.fa&lt;br /&gt;
&lt;br /&gt;
Due to the size and complexity of Karma input, output and index files, various checks and tests are useful, so we include some diagnostics capabilities:&lt;br /&gt;
&lt;br /&gt;
Tests for external files:&lt;br /&gt;
&lt;br /&gt;
 karma check [options...] file.bam file.fastq file.sam file.fa file.umfa&lt;br /&gt;
&lt;br /&gt;
Tests internal to Karma:&lt;br /&gt;
 karma test [options...]&lt;br /&gt;
 -d -&amp;gt; debug&lt;br /&gt;
 -s [int] -&amp;gt; set random number seed [12345]&lt;br /&gt;
&lt;br /&gt;
== File structure  ==&lt;br /&gt;
&lt;br /&gt;
Upon successfully building references, you will obtain a list of reference files like below: &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 571px; height: 288px&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; width=&amp;quot;571&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
Base Space &lt;br /&gt;
&lt;br /&gt;
| Color Space&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Reference genome &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.umfa &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.umfa&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Index &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-bs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-cs.15.5000.umwiwp &lt;br /&gt;
&lt;br /&gt;
NCBI37-cs.15.5000.umwihi &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Left) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhl &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhl&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Word Hash (Right) &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
NCBI37-bs.15.5000.umwhr &lt;br /&gt;
&lt;br /&gt;
| NCBI37-cs.15.5000.umwhr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= Align Illumina Reads =&lt;br /&gt;
&lt;br /&gt;
Command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
karma map -r reference.fa -o output.sam read1.fastq read2.fastq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Align ABI SOLiD Reads = &lt;br /&gt;
&lt;br /&gt;
Command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
karma map -r reference.fa -c -o output.sam read1.fastq read2.fastq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other useful links =&lt;br /&gt;
&lt;br /&gt;
[http://www.broadinstitute.org/files/shared/mpg/nextgen2010/nextgen_li.pdf Introduction of BWA usage] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/bioinfo.shtml Heng Li&#039;s thoughts about aligner] &lt;br /&gt;
&lt;br /&gt;
[http://lh3lh3.users.sourceforge.net/udb.shtml Benchmark of Dictionary Structures]&lt;/div&gt;</summary>
		<author><name>Pha</name></author>
	</entry>
</feed>