STEPS:
1.compile.
make

2.build index.

Before performing alignments, you have to build a new index. The index is stored on disk and will be loaded when performing alignments. The WHAM tarball comes with a sample sequence containing the first 100,000 bases of Human Genome Chromosome 1. As an example, we issue the following command to build a index on the sample sequence. If you see an error “command not found”, add ./ before wham-build.

wham-build -l 60 -v 2 --mask sequences/chr1_100k.fa indexes/idx

The options -l 60 and -v 2 specify that the index is used for aligning 60bps reads with up to 2 mismatches. This command prints the message “Complete” if the index is built successfully. The directory indexes should contain four new files: idx.head.whm, idx.interval.whm, idx.sequence.whm, and idx.i0.whm.

3.align reads.

With the pre-built index, we can use WHAM aligner to align reads. The WHAM tarball includes a sample single-end read file sample.fq and a pair of paired-end read files. We show the following examples to demonstrate how to use WHAM aligner. If you see an error “command not found”, add ./ before wham, i.e. type in “./wham”.

Example 1
wham reads/sample.fq indexes/idx output 

This command aligns all reads in the file reads/sample.fq, and prints out one alignment per read into the file output. WHAM finds three alignments as shown below. The first alignment is on the forward strand (+) and has 1 mismatch (C⇒T). The second alignment is an exact match on the forward strand. The last match is on the reverse strand (-).

+ chr1 51614 CCAGCACTTTGGGAGGCCGAGGCGGGTGGATCACGAGGTCAGGAGATCGAGACCATCCTG 26:C>T
+ chr1 83977 GAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAA
- chr1 17446 CACAGCGTGCACTGTGGGGTCCCAGGCCTCCCGAGCCGAGCCACCCGTCACCCCCTGGCT

Example 2
wham -a --best reads/sample.fq indexes/idx output

Specifying -a instructs WHAM to report all valid alignments for each read. Option –best results in a best-to-worst order on the reported alignments. WHAM finds 2 alignments for the first read, 6 alignments for the second read, and 1 alignment for the third read. All alignments are printed in a sorted order.

+ chr1 51614 CCAGCACTTTGGGAGGCCGAGGCGGGTGGATCACGAGGTCAGGAGATCGAGACCATCCTG 26:C>T
- chr1 62070 CAGGATGGTCTCGATCTCCTGACCTCGTGATCCACCCGCCTCGGCCTCCCAAAGTGCTGG 22:T>G,41:T>C
+ chr1 83977 GAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAA
+ chr1 83981 GAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAA
- chr1 54712 TTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTC
+ chr1 83973 GAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAA 0:A>G
- chr1 54716 TTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTC 1:C>T
- chr1 54708 TTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTC 56:T>C,58:A>T
- chr1 17446 CACAGCGTGCACTGTGGGGTCCCAGGCCTCCCGAGCCGAGCCACCCGTCACCCCCTGGCT

Example 3
wham -k 3 -m 5 reads/sample.fq indexes/idx output 

Specifying -k 3 instructs WHAM to report up to 3 valid alignments per read. Specifying -m 5 instructs WHAM to refrain from reporting any alignments for reads that have more than 5 valid alignments. In this case, a total of 3 valid alignments exist. All alignments of the third read are discarded.

+ chr1 51614 CCAGCACTTTGGGAGGCCGAGGCGGGTGGATCACGAGGTCAGGAGATCGAGACCATCCTG 26:C>T
- chr1 62070 CAGGATGGTCTCGATCTCCTGACCTCGTGATCCACCCGCCTCGGCCTCCCAAAGTGCTGG 22:T>G,41:T>C
- chr1 17446 CACAGCGTGCACTGTGGGGTCCCAGGCCTCCCGAGCCGAGCCACCCGTCACCCCCTGGCT

Example 4
wham -v 3 reads/sample.fq indexes/idx output

Specifying -v 3 instructs WHAM to report alignments with up to 3 mismatches. However, WHAM does not guarantee that it can find all valid alignments with three mismatches. Note that since the index “idx” is built with the option -v 2 (see the command for building the index), all alignments with up to 2 mismatches can be found by WHAM. In this case, WHAM reports one more alignment for the fourth read with 3 mismatches.

+ chr1 51614 CCAGCACTTTGGGAGGCCGAGGCGGGTGGATCACGAGGTCAGGAGATCGAGACCATCCTG 26:C>T
+ chr1 83977 GAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAA
- chr1 17446 CACAGCGTGCACTGTGGGGTCCCAGGCCTCCCGAGCCGAGCCACCCGTCACCCCCTGGCT
- chr1 17962 GCGGGTGCGTCTATGCAGGCCAGGGTCCTGGGCGCCCGTGAAGATGGAGCCATAGTCCTG 5:T>G,47:C>A,54:G>T

Example 5
wham -a -e 60 reads/sample.fq indexes/idx output

Specifying -e 60 instructs WHAM to report alignments with up to 2 mismatches. In addition, the sum of the Phred quality scores at all mismatched positions cannot exceed 60. Compared with the results of Example 2, most of the alignments with mismatches are filtered out by the option -e 60.

+ chr1 51614 CCAGCACTTTGGGAGGCCGAGGCGGGTGGATCACGAGGTCAGGAGATCGAGACCATCCTG 26:C>T
+ chr1 83977 GAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAA
+ chr1 83981 GAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAAGAAA
- chr1 54712 TTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTCTTTC
- chr1 17446 CACAGCGTGCACTGTGGGGTCCCAGGCCTCCCGAGCCGAGCCACCCGTCACCCCCTGGCT

Example 6
wham -1 reads/sample_pair_1.fq -2 reads/sample_pair_2.fq indexes/idx output
This command takes paired-end reads from the two files, and outputs valid alignments to the file “output”.

Example 7
wham -t 16 reads/sample.fq indexes/idx output
Specifying -t 16 instructs WHAM to align reads with 16 concurrent threads. The output is exactly same as that of Example 1.

-------------------------------------------------------
WHAM INDEX BUILDER
Usage:
  wham-build [options]* -l <int> <ref_sequence> <basepath>
  -l <int>         specify the length of short reads
  <ref_sequence>   comma-separated list of fiels with ref sequences
  <basepath>       write wham data to files with this dir/basename
Options:
  -v <int>         report hits with <=v errors (0-5), ignore qualities
  -p <int>         specify the number of fragments for alignments
  -m <int>         discard substring appearing more than <int> times (default: 100).
  -b <int>         specify the number of buckets
  --mask           keep masked characters in the sequences (default: on)
  --unmask         discard masked characters in the sequences. Masks are treated as Ns
  --version        print version information
  -h/--help        print this usage message


WHAM ALIGNER
Usage:
  wham [options]* {<readfile> | -1 <m1file> -2 <m2file>} <basepath> <output>
  <readfile>         comma-separated list of files containing unpaired reads
  <m1file>           comma-separated list of files containing upstream mates
  <m2file>           comma-separated list of files containing downstream mates
  <basepath>         write wham data to files with this dir/basename
  <output>           file to write alignments to
Input options:
  -l <int>           use first <int> bases in each read
Alignment options:
  -v <int>           specify the max number of errors in a reported alignment.
  -g/--gap <int>     specify the max number of gaps in a reported alignment.
  -e/--maqerr <int>  max sum of mismatch quals across alignment
  --nofw/--norc      do not align to forward/reverse-complement ref strand
  --nofr/--norf      do not align to mate1/mate2 strand: fw/rev, rev/fw.
  -I/--minins <int>  minimum insert size for paired-end alignment (default: 0).
  -X/--maxins <int>  maximum insert size for paired-end alignment (default: 250).
Reporting options:
  -k <int>           report up to <int> valid alignemtns per read (default: 1).
  -a/--all           report all valid alignments per read.
  --best             reprot valid alignments in a sorted order of quality.
  -m <int>           discard reads with more than <int> valid alignmetns.
Output options:
  -S/--sam           write alignment in SAM format
  --al <fname>       wirte aligned reads/pairs to file(s) <fname>
  --un <fname>       write unaligned reads/pairs to file(s) <fname>
Performance options:
  --step <int>       specify the number of indexes that fit into memory.
Other options:
  --version          print version information
  -h/--help          print this usage message
