[med-svn] [bowtie2] 03/04: Imported Upstream version 2.2.4

Andreas Tille tille at debian.org
Sun Oct 26 06:15:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository bowtie2.

commit ba2b9b4409cfdf8865f9ac684e407ccef69116e1
Author: Andreas Tille <tille at debian.org>
Date:   Sun Oct 26 07:15:33 2014 +0100

    Imported Upstream version 2.2.4
---
 MANUAL          |  21 ++-
 MANUAL.markdown |  25 ++-
 Makefile        |  15 +-
 NEWS            |   9 +
 VERSION         |   2 +-
 aligner_seed.h  | 110 ++++++++----
 bowtie2         |  11 +-
 bt2_search.cpp  |  41 ++++-
 doc/manual.html | 546 ++++++++++++++++++--------------------------------------
 pat.cpp         |   3 +-
 read.h          |   6 +
 sam.cpp         |  16 ++
 sam.h           |   7 +-
 13 files changed, 380 insertions(+), 432 deletions(-)

diff --git a/MANUAL b/MANUAL
index 23c6999..9a01b37 100644
--- a/MANUAL
+++ b/MANUAL
@@ -588,7 +588,7 @@ most cases.  Most users expect Bowtie to produce the same output when run twice
 on the same input.
 
 However, when the user specifies the `--non-deterministic` option, Bowtie 2
-will use the current time to re-intiailize the pseud-random number generator.
+will use the current time to re-initialize the pseudo-random number generator.
 When this is specified, Bowtie 2 might report different alignments for identical
 reads.  This is counter-intuitive for some users, but might be more appropriate
 in situations where the input consists of many identical reads.
@@ -1134,7 +1134,7 @@ descending order by alignment score. The alignment score for a paired-end
 alignment equals the sum of the alignment scores of the individual mates. Each
 reported read or pair alignment beyond the first has the SAM 'secondary' bit
 (which equals 256) set in its FLAGS field.  For reads that have more than
-`<int>` distinct, valid alignments, `bowtie2` does not gaurantee that the
+`<int>` distinct, valid alignments, `bowtie2` does not guarantee that the
 `<int>` alignments reported are the best possible in terms of alignment score. 
 `-k` is mutually exclusive with `-a`.
 
@@ -1259,24 +1259,27 @@ This is printed to the "standard error" ("stderr") filehandle.  Default: off.
     --un <path>
     --un-gz <path>
     --un-bz2 <path>
+    --un-lz4 <path>
 
 Write unpaired reads that fail to align to file at `<path>`.  These reads
 correspond to the SAM records with the FLAGS `0x4` bit set and neither the
 `0x40` nor `0x80` bits set.  If `--un-gz` is specified, output will be gzip
-compressed. If `--un-bz2` is specified, output will be bzip2 compressed.  Reads
-written in this way will appear exactly as they did in the input file, without
-any modification (same sequence, same name, same quality string, same quality
-encoding).  Reads will not necessarily appear in the same order as they did in
-the input.
+compressed. If `--un-bz2` or `--un-lz4` is specified, output will be bzip2 or 
+lz4 compressed. Reads written in this way will appear exactly as they did in 
+the input file, without any modification (same sequence, same name, same quality 
+string, same quality encoding). Reads will not necessarily appear in the same 
+order as they did in the input.
 
     --al <path>
     --al-gz <path>
     --al-bz2 <path>
+    --al-lz4 <path>
 
 Write unpaired reads that align at least once to file at `<path>`.  These reads
 correspond to the SAM records with the FLAGS `0x4`, `0x40`, and `0x80` bits
 unset.  If `--al-gz` is specified, output will be gzip compressed. If `--al-bz2`
-is specified, output will be bzip2 compressed.  Reads written in this way will
+is specified, output will be bzip2 compressed. Similarly if `--al-lz4` is specified, 
+output will be lz4 compressed.  Reads written in this way will
 appear exactly as they did in the input file, without any modification (same
 sequence, same name, same quality string, same quality encoding).  Reads will
 not necessarily appear in the same order as they did in the input.
@@ -1284,6 +1287,7 @@ not necessarily appear in the same order as they did in the input.
     --un-conc <path>
     --un-conc-gz <path>
     --un-conc-bz2 <path>
+    --un-conc-lz4 <path>
 
 Write paired-end reads that fail to align concordantly to file(s) at `<path>`.
 These reads correspond to the SAM records with the FLAGS `0x4` bit set and
@@ -1300,6 +1304,7 @@ the same order as they did in the inputs.
     --al-conc <path>
     --al-conc-gz <path>
     --al-conc-bz2 <path>
+    --al-conc-lz4 <path>
 
 Write paired-end reads that align concordantly at least once to file(s) at
 `<path>`. These reads correspond to the SAM records with the FLAGS `0x4` bit
diff --git a/MANUAL.markdown b/MANUAL.markdown
index 76074ca..ce02c84 100644
--- a/MANUAL.markdown
+++ b/MANUAL.markdown
@@ -601,7 +601,7 @@ most cases.  Most users expect Bowtie to produce the same output when run twice
 on the same input.
 
 However, when the user specifies the [`--non-deterministic`] option, Bowtie 2
-will use the current time to re-intiailize the pseud-random number generator.
+will use the current time to re-initialize the pseudo-random number generator.
 When this is specified, Bowtie 2 might report different alignments for identical
 reads.  This is counter-intuitive for some users, but might be more appropriate
 in situations where the input consists of many identical reads.
@@ -1486,7 +1486,7 @@ descending order by alignment score. The alignment score for a paired-end
 alignment equals the sum of the alignment scores of the individual mates. Each
 reported read or pair alignment beyond the first has the SAM 'secondary' bit
 (which equals 256) set in its FLAGS field.  For reads that have more than
-`<int>` distinct, valid alignments, `bowtie2` does not gaurantee that the
+`<int>` distinct, valid alignments, `bowtie2` does not guarantee that the
 `<int>` alignments reported are the best possible in terms of alignment score. 
 `-k` is mutually exclusive with [`-a`].
 
@@ -1719,21 +1719,23 @@ This is printed to the "standard error" ("stderr") filehandle.  Default: off.
 [`--un`]: #bowtie2-options-un
 [`--un-gz`]: #bowtie2-options-un
 [`--un-bz2`]: #bowtie2-options-un
+[`--un-lz4`]: #bowtie2-options-un
 
     --un <path>
     --un-gz <path>
     --un-bz2 <path>
+    --un-lz4 <path>
 
 </td><td>
 
 Write unpaired reads that fail to align to file at `<path>`.  These reads
 correspond to the SAM records with the FLAGS `0x4` bit set and neither the
 `0x40` nor `0x80` bits set.  If `--un-gz` is specified, output will be gzip
-compressed. If `--un-bz2` is specified, output will be bzip2 compressed.  Reads
-written in this way will appear exactly as they did in the input file, without
-any modification (same sequence, same name, same quality string, same quality
-encoding).  Reads will not necessarily appear in the same order as they did in
-the input.
+compressed. If `--un-bz2` or `--un-lz4` is specified, output will be bzip2 or 
+lz4 compressed. Reads written in this way will appear exactly as they did in 
+the input file, without any modification (same sequence, same name, same quality 
+string, same quality encoding). Reads will not necessarily appear in the same 
+order as they did in the input.
 
 </td></tr>
 <tr><td id="bowtie2-options-al">
@@ -1741,17 +1743,20 @@ the input.
 [`--al`]: #bowtie2-options-al
 [`--al-gz`]: #bowtie2-options-al
 [`--al-bz2`]: #bowtie2-options-al
+[`--al-lz4`]: #bowtie2-options-al
 
     --al <path>
     --al-gz <path>
     --al-bz2 <path>
+    --al-lz4 <path>
 
 </td><td>
 
 Write unpaired reads that align at least once to file at `<path>`.  These reads
 correspond to the SAM records with the FLAGS `0x4`, `0x40`, and `0x80` bits
 unset.  If `--al-gz` is specified, output will be gzip compressed. If `--al-bz2`
-is specified, output will be bzip2 compressed.  Reads written in this way will
+is specified, output will be bzip2 compressed. Similarly if `--al-lz4` is specified, 
+output will be lz4 compressed.  Reads written in this way will
 appear exactly as they did in the input file, without any modification (same
 sequence, same name, same quality string, same quality encoding).  Reads will
 not necessarily appear in the same order as they did in the input.
@@ -1762,10 +1767,12 @@ not necessarily appear in the same order as they did in the input.
 [`--un-conc`]: #bowtie2-options-un-conc
 [`--un-conc-gz`]: #bowtie2-options-un-conc
 [`--un-conc-bz2`]: #bowtie2-options-un-conc
+[`--un-conc-lz4`]: #bowtie2-options-un-conc
 
     --un-conc <path>
     --un-conc-gz <path>
     --un-conc-bz2 <path>
+    --un-conc-lz4 <path>
 
 </td><td>
 
@@ -1787,10 +1794,12 @@ the same order as they did in the inputs.
 [`--al-conc`]: #bowtie2-options-al-conc
 [`--al-conc-gz`]: #bowtie2-options-al-conc
 [`--al-conc-bz2`]: #bowtie2-options-al-conc
+[`--al-conc-lz4`]: #bowtie2-options-al-conc
 
     --al-conc <path>
     --al-conc-gz <path>
     --al-conc-bz2 <path>
+    --al-conc-lz4 <path>
 
 </td><td>
 
diff --git a/Makefile b/Makefile
index abd4155..d74f7c8 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,12 @@ ifneq (,$(findstring Darwin,$(shell uname)))
 	MACOS = 1
 endif
 
+ifneq (,$(findstring 13,$(shell uname -r)))
+	CPP = clang++
+	CC = clang
+	EXTRA_FLAGS += -stdlib=libstdc++
+endif
+
 POPCNT_CAPABILITY ?= 1
 ifeq (1, $(POPCNT_CAPABILITY))
     EXTRA_FLAGS += -DPOPCNT_CAPABILITY
@@ -166,7 +172,6 @@ BOWTIE2_BIN_LIST_AUX = bowtie2-build-s-debug \
 
 GENERAL_LIST = $(wildcard scripts/*.sh) \
                $(wildcard scripts/*.pl) \
-               $(wildcard third_party/*) \
                doc/manual.html \
                doc/README \
                doc/style.css \
@@ -188,6 +193,7 @@ GENERAL_LIST = $(wildcard scripts/*.sh) \
 
 ifeq (1,$(WINDOWS))
 	BOWTIE2_BIN_LIST := $(BOWTIE2_BIN_LIST) bowtie2.bat bowtie2-build.bat bowtie2-inspect.bat 
+	EXTRA_FLAGS += -static-libgcc -static-libstdc++
 endif
 
 # This is helpful on Windows under MinGW/MSYS, where Make might go for
@@ -198,11 +204,16 @@ SRC_PKG_LIST = $(wildcard *.h) \
                $(wildcard *.hh) \
                $(wildcard *.c) \
                $(wildcard *.cpp) \
+               $(wildcard third_party/*) \
                doc/strip_markdown.pl \
                Makefile \
                $(GENERAL_LIST)
 
-BIN_PKG_LIST = $(GENERAL_LIST)
+ifeq (1,$(WINDOWS))
+	BIN_PKG_LIST = $(GENERAL_LIST) bowtie2.bat bowtie2-build.bat bowtie2-inspect.bat 
+else
+	BIN_PKG_LIST = $(GENERAL_LIST)
+endif
 
 .PHONY: all allall both both-debug
 
diff --git a/NEWS b/NEWS
index f9a7a96..ee6c178 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,15 @@ Please report any issues using the Sourceforge bug tracker:
 Version Release History
 =======================
 
+Version 2.2.4 - Oct 22, 2014
+   * Fixed a Mavericks OSX specific bug caused by some linkage ambiguities.
+   * Added lz4 compression option for the wrapper.
+   * Fixed the vanishing --no-unal help line.
+   * Added the static linkage for MinGW builds.
+   * Added extra seed-hit output.
+   * Fixed missing 0-length read in fastq --passthrough output.
+   * Fixed an issue that would cause different output in -a mode depending on random seed.
+
 Version 2.2.3 - May 30, 2014
    * Fixed a bug that made loading an index into memory crash sometimes.
    * Fixed a silent failure to warn the user in case the -x option is missing.
diff --git a/VERSION b/VERSION
index 5859406..530cdd9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.3
+2.2.4
diff --git a/aligner_seed.h b/aligner_seed.h
index 44965f3..89bbe6c 100644
--- a/aligner_seed.h
+++ b/aligner_seed.h
@@ -670,6 +670,11 @@ public:
 		numRanges_ += qv.numRanges();
 		if(qv.numRanges() > 0) {
 			nonzTot_++;
+			if(qv.numRanges() == 1 and qv.numElts() == 1) {
+				uniTot_++;
+			} else {
+				repTot_++;
+			}
 		}
 		assert(repOk(&ac));
 	}
@@ -724,6 +729,8 @@ public:
 		seqFw_.clear();
 		seqRc_.clear();
 		nonzTot_ = 0;
+		uniTot_ = 0;
+		repTot_ = 0;
 		nonzFw_ = 0;
 		nonzRc_ = 0;
 		numOffs_ = 0;
@@ -811,6 +818,20 @@ public:
 	float averageHitsPerSeed() const {
 		return (float)numElts_ / (float)nonzTot_;
 	}
+
+	/**
+	 * Return fraction of seeds that align uniquely.
+	 */
+	size_t numUniqueSeeds() const {
+		return uniTot_;
+	}
+
+	/**
+	 * Return fraction of seeds that align repetitively.
+	 */
+	size_t numRepeatSeeds() const {
+		return repTot_;
+	}
 	
 	/**
 	 * Return median of all the non-zero per-seed # hits
@@ -975,43 +996,64 @@ public:
 	 * that are more unique) will be tried first and QVals with more elements
 	 * (i.e. seed sequences
 	 */
-	void rankSeedHits(RandomSource& rnd) {
-		while(rankOffs_.size() < nonzTot_) {
-			TIndexOffU minsz = MAX_U32;
-			uint32_t minidx = 0;
-			bool minfw = true;
-			// Rank seed-hit positions in ascending order by number of elements
-			// in all BW ranges
-			bool rb = rnd.nextBool();
-			assert(rb == 0 || rb == 1);
-			for(int fwi = 0; fwi <= 1; fwi++) {
-				bool fw = (fwi == (rb ? 1 : 0));
-				EList<QVal>& rrs = (fw ? hitsFw_ : hitsRc_);
-				EList<bool>& sorted = (fw ? sortedFw_ : sortedRc_);
-				uint32_t i = (rnd.nextU32() % (uint32_t)numOffs_);
-				for(uint32_t ii = 0; ii < numOffs_; ii++) {
-					if(rrs[i].valid() &&         // valid QVal
-					   rrs[i].numElts() > 0 &&   // non-empty
-					   !sorted[i] &&             // not already sorted
-					   rrs[i].numElts() < minsz) // least elts so far?
-					{
-						minsz = rrs[i].numElts();
-						minidx = i;
-						minfw = (fw == 1);
-					}
-					if((++i) == numOffs_) {
-						i = 0;
+	void rankSeedHits(RandomSource& rnd, bool all) {
+		if(all) {
+			for(uint32_t i = 1; i < numOffs_; i++) {
+				for(int fwi = 0; fwi <= 1; fwi++) {
+					bool fw = fwi == 0;
+					EList<QVal>& rrs = (fw ? hitsFw_ : hitsRc_);
+					if(rrs[i].valid() && rrs[i].numElts() > 0) {
+						rankOffs_.push_back(i);
+						rankFws_.push_back(fw);
 					}
 				}
 			}
-			assert_neq(MAX_U32, minsz);
-			if(minfw) {
-				sortedFw_[minidx] = true;
-			} else {
-				sortedRc_[minidx] = true;
+			if(hitsFw_[0].valid() && hitsFw_[0].numElts() > 0) {
+				rankOffs_.push_back(0);
+				rankFws_.push_back(true);
+			}
+			if(hitsRc_[0].valid() && hitsRc_[0].numElts() > 0) {
+				rankOffs_.push_back(0);
+				rankFws_.push_back(false);
+			}
+		} else {
+			while(rankOffs_.size() < nonzTot_) {
+				TIndexOffU minsz = MAX_U32;
+				uint32_t minidx = 0;
+				bool minfw = true;
+				// Rank seed-hit positions in ascending order by number of elements
+				// in all BW ranges
+				bool rb = rnd.nextBool();
+				assert(rb == 0 || rb == 1);
+				for(int fwi = 0; fwi <= 1; fwi++) {
+					bool fw = (fwi == (rb ? 1 : 0));
+					EList<QVal>& rrs = (fw ? hitsFw_ : hitsRc_);
+					EList<bool>& sorted = (fw ? sortedFw_ : sortedRc_);
+					uint32_t i = (rnd.nextU32() % (uint32_t)numOffs_);
+					for(uint32_t ii = 0; ii < numOffs_; ii++) {
+						if(rrs[i].valid() &&         // valid QVal
+						   rrs[i].numElts() > 0 &&   // non-empty
+						   !sorted[i] &&             // not already sorted
+						   rrs[i].numElts() < minsz) // least elts so far?
+						{
+							minsz = rrs[i].numElts();
+							minidx = i;
+							minfw = (fw == 1);
+						}
+						if((++i) == numOffs_) {
+							i = 0;
+						}
+					}
+				}
+				assert_neq(MAX_U32, minsz);
+				if(minfw) {
+					sortedFw_[minidx] = true;
+				} else {
+					sortedRc_[minidx] = true;
+				}
+				rankOffs_.push_back(minidx);
+				rankFws_.push_back(minfw);
 			}
-			rankOffs_.push_back(minidx);
-			rankFws_.push_back(minfw);
 		}
 		assert_eq(rankOffs_.size(), rankFws_.size());
 		sorted_ = true;
@@ -1286,6 +1328,8 @@ protected:
 	EList<bool>         sortedFw_;    // true iff fw QVal was sorted/ranked
 	EList<bool>         sortedRc_;    // true iff rc QVal was sorted/ranked
 	size_t              nonzTot_;     // # offsets with non-zero size
+	size_t              uniTot_;      // # offsets unique hit
+	size_t              repTot_;      // # offsets repetitive hit
 	size_t              nonzFw_;      // # offsets into fw read with non-0 size
 	size_t              nonzRc_;      // # offsets into rc read with non-0 size
 	size_t              numRanges_;   // # ranges added
diff --git a/bowtie2 b/bowtie2
index 497a851..31e2ac3 100755
--- a/bowtie2
+++ b/bowtie2
@@ -182,7 +182,7 @@ for(my $i = 0; $i < scalar(@bt2_args); $i++) {
 		$bt2_args[$i] = undef;
 	}
 	for my $rarg ("un-conc", "al-conc", "un", "al") {
-		if($arg =~ /^--${rarg}$/ || $arg =~ /^--${rarg}-gz$/ || $arg =~ /^--${rarg}-bz2$/) {
+		if($arg =~ /^--${rarg}$/ || $arg =~ /^--${rarg}-gz$/ || $arg =~ /^--${rarg}-bz2$/ || $arg =~ /^--${rarg}-lz4$/) {
 			$bt2_args[$i] = undef;
 			if(scalar(@args) > 1 && $args[1] ne "") {
 				$read_fns{$rarg} = $args[1];
@@ -194,6 +194,7 @@ for(my $i = 0; $i < scalar(@bt2_args); $i++) {
 			$read_compress{$rarg} = "";
 			$read_compress{$rarg} = "gzip"  if $arg eq "--${rarg}-gz";
 			$read_compress{$rarg} = "bzip2" if $arg eq "--${rarg}-bz2";
+			$read_compress{$rarg} = "lz4" if $arg eq "--${rarg}-lz4";
 			last;
 		}
 	}
@@ -277,6 +278,9 @@ sub cat_file($$) {
 	} elsif($ifn =~ /\.bz2/) {
 		open($ifh, "bzip2 -dc $ifn |") ||
 			Fail("Could not open bzip2ed read file: $ifn \n");
+	} elsif($ifn =~ /\.lz4/) {
+		open($ifh, "lz4 -dc $ifn |") ||
+			Fail("Could not open lz4ed read file: $ifn \n");
 	} else {
 		open($ifh, $ifn) || Fail("Could not open read file: $ifn \n");
 	}
@@ -289,7 +293,7 @@ sub cat_file($$) {
 sub wrapInput($$$) {
 	my ($unps, $mate1s, $mate2s) = @_;
 	for my $fn (@$unps, @$mate1s, @$mate2s) {
-		return 1 if $fn =~ /\.gz$/ || $fn =~ /\.bz2$/;
+		return 1 if $fn =~ /\.gz$/ || $fn =~ /\.bz2$/ || $fn =~ /\.lz4$/;
 	}
 	return 0;
 }
@@ -491,8 +495,10 @@ if(defined($cap_out)) {
 				my ($redir1, $redir2) = (">$fn1", ">$fn2");
 				$redir1 = "| gzip -c $redir1"  if $read_compress{$i} eq "gzip";
 				$redir1 = "| bzip2 -c $redir1" if $read_compress{$i} eq "bzip2";
+				$redir1 = "| lz4 -c $redir1" if $read_compress{$i} eq "lz4";
 				$redir2 = "| gzip -c $redir2"  if $read_compress{$i} eq "gzip";
 				$redir2 = "| bzip2 -c $redir2" if $read_compress{$i} eq "bzip2";
+				$redir2 = "| lz4 -c $redir2" if $read_compress{$i} eq "lz4";
 				open($read_fhs{$i}{1}, $redir1) || Fail("Could not open --$i mate-1 output file '$fn1'\n");
 				open($read_fhs{$i}{2}, $redir2) || Fail("Could not open --$i mate-2 output file '$fn2'\n");
 				push @fhs_to_close, $read_fhs{$i}{1};
@@ -504,6 +510,7 @@ if(defined($cap_out)) {
 			    }
 				$redir = "| gzip -c $redir"  if $read_compress{$i} eq "gzip";
 				$redir = "| bzip2 -c $redir" if $read_compress{$i} eq "bzip2";
+				$redir = "| lz4 -c $redir" if $read_compress{$i} eq "lz4";
 				open($read_fhs{$i}, $redir) || Fail("Could not open --$i output file '$read_fns{$i}'\n");
 				push @fhs_to_close, $read_fhs{$i};
 			}
diff --git a/bt2_search.cpp b/bt2_search.cpp
index 434efbd..f8a0c80 100644
--- a/bt2_search.cpp
+++ b/bt2_search.cpp
@@ -157,6 +157,7 @@ static bool sam_print_zm;
 static bool sam_print_zi;
 static bool sam_print_zp;
 static bool sam_print_zu;
+static bool sam_print_zt;
 static bool bwaSwLike;
 static float bwaSwLikeC;
 static float bwaSwLikeT;
@@ -345,6 +346,7 @@ static void resetOptions() {
 	sam_print_zi            = false;
 	sam_print_zp            = false;
 	sam_print_zu            = false;
+	sam_print_zt            = false;
 	bwaSwLike               = false;
 	bwaSwLikeC              = 5.5f;
 	bwaSwLikeT              = 20.0f;
@@ -778,7 +780,7 @@ static void printUsage(ostream& out) {
 		<< "  --met-stderr       send metrics to stderr (off)" << endl
 		<< "  --met <int>        report internal counters & metrics every <int> secs (1)" << endl
 	// Following is supported in the wrapper instead
-	//  << "  --no-unal          supppress SAM records for unaligned reads" << endl
+	    << "  --no-unal          supppress SAM records for unaligned reads" << endl
 	    << "  --no-head          supppress header lines, i.e. lines starting with @" << endl
 	    << "  --no-sq            supppress @SQ header lines" << endl
 	    << "  --rg-id <text>     set read group id, reflected in @RG line and RG:Z: opt field" << endl
@@ -1156,8 +1158,10 @@ static void parseOption(int next_option, const char *arg) {
 		case ARG_REORDER: reorder = true; break;
 		case ARG_MAPQ_EX: {
 			sam_print_zp = true;
+			// TODO: remove next line
 			sam_print_xss = true;
 			sam_print_yn = true;
+			sam_print_zt = true;
 			break;
 		}
 		case ARG_SHOW_RAND_SEED: {
@@ -3494,10 +3498,14 @@ static void multiseedSearchWorker(void *vp) {
 					nrounds[0] = min<size_t>(nrounds[0], interval[0]);
 					nrounds[1] = min<size_t>(nrounds[1], interval[1]);
 					Constraint gc = Constraint::penaltyFuncBased(scoreMin);
+					size_t seedsTried = 0;
+					size_t nUniqueSeeds = 0, nRepeatSeeds = 0, seedHitTot = 0;
 					for(size_t roundi = 0; roundi < nSeedRounds; roundi++) {
 						ca.nextRead(); // Clear cache in preparation for new search
 						shs[0].clearSeeds();
 						shs[1].clearSeeds();
+						assert(shs[0].empty());
+						assert(shs[1].empty());
 						assert(shs[0].repOk(&ca.current()));
 						assert(shs[1].repOk(&ca.current()));
 						//if(roundi > 0) {
@@ -3559,6 +3567,7 @@ static void multiseedSearchWorker(void *vp) {
 								done[mate] = true;
 								break;
 							}
+							seedsTried += (inst.first + inst.second);
 							// Align seeds
 							al.searchAllSeeds(
 								*seeds[mate],     // search seeds
@@ -3577,6 +3586,15 @@ static void multiseedSearchWorker(void *vp) {
 								break;
 							}
 						}
+						// shs contain what we need to know to update our seed
+						// summaries for this seeding
+						for(size_t mate = 0; mate < 2; mate++) {
+							if(!shs[mate].empty()) {
+								nUniqueSeeds += shs[mate].numUniqueSeeds();
+								nRepeatSeeds += shs[mate].numRepeatSeeds();
+								seedHitTot += shs[mate].numElts();
+							}
+						}
 						double uniqFactor[2] = { 0.0f, 0.0f };
 						for(size_t i = 0; i < 2; i++) {
 							if(!shs[i].empty()) {
@@ -3608,7 +3626,7 @@ static void multiseedSearchWorker(void *vp) {
 									continue; // on to the next mate
 								}
 								// Sort seed hits into ranks
-								shs[mate].rankSeedHits(rnd);
+								shs[mate].rankSeedHits(rnd, msinkwrap.allHits());
 								int ret = 0;
 								if(pair) {
 									// Paired-end dynamic programming driver
@@ -3737,7 +3755,23 @@ static void multiseedSearchWorker(void *vp) {
 								done[mate] = true;
 							}
 						}
+					} // end loop over reseeding rounds
+					if(seedsTried != 0) {
+						prm.seedPctUnique = (float)nUniqueSeeds / seedsTried;
+						prm.seedPctRep = (float)nRepeatSeeds / seedsTried;
+						prm.seedHitAvg = (float)seedHitTot / seedsTried;
+					}
+					size_t totnucs = 0;
+					for(size_t mate = 0; mate < (pair ? 2:1); mate++) {
+						if(filt[mate]) {
+							size_t len = rdlens[mate];
+							if(!nofw[mate] && !norc[mate]) {
+								len *= 2;
+							}
+							totnucs += len;
+						}
 					}
+					prm.seedsPerNuc = (float)seedsTried / totnucs;
 					for(size_t i = 0; i < 2; i++) {
 						assert_leq(prm.nExIters, mxIter[i]);
 						assert_leq(prm.nExDps,   mxDp[i]);
@@ -4423,7 +4457,8 @@ static void driver(
 			sam_print_zm,
 			sam_print_zi,
 			sam_print_zp,
-			sam_print_zu);
+			sam_print_zu,
+			sam_print_zt);
 		// Set up hit sink; if sanityCheck && !os.empty() is true,
 		// then instruct the sink to "retain" hits in a vector in
 		// memory so that we can easily sanity check them later on
diff --git a/doc/manual.html b/doc/manual.html
index 78141cd..34821f8 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -5,6 +5,7 @@
   <meta http-equiv="Content-Style-Type" content="text/css" />
   <meta name="generator" content="pandoc" />
   <title>Bowtie 2 Manual - </title>
+  <style type="text/css">code{white-space: pre;}</style>
   <link rel="stylesheet" href="style.css" type="text/css" />
 </head>
 <body>
@@ -62,20 +63,7 @@
 <li><a href="#setting-function-options">Setting function options</a></li>
 <li><a href="#usage">Usage</a></li>
 <li><a href="#main-arguments">Main arguments</a></li>
-<li><a href="#options">Options</a><ul>
-<li><a href="#input-options">Input options</a></li>
-<li><a href="#preset-options-in---end-to-end-mode">Preset options in <code>--end-to-end</code> mode</a></li>
-<li><a href="#preset-options-in---local-mode">Preset options in <code>--local</code> mode</a></li>
-<li><a href="#alignment-options">Alignment options</a></li>
-<li><a href="#scoring-options">Scoring options</a></li>
-<li><a href="#reporting-options">Reporting options</a></li>
-<li><a href="#effort-options">Effort options</a></li>
-<li><a href="#paired-end-options">Paired-end options</a></li>
-<li><a href="#output-options">Output options</a></li>
-<li><a href="#sam-options">SAM options</a></li>
-<li><a href="#performance-options">Performance options</a></li>
-<li><a href="#other-options">Other options</a></li>
-</ul></li>
+<li><a href="#options">Options</a></li>
 </ul></li>
 <li><a href="#sam-output">SAM output</a></li>
 </ul></li>
@@ -106,12 +94,12 @@
  ! of this text document, or see the HTML manual online.
  ! -->
 
-<h1 id="introduction"><a href="#TOC">Introduction</a></h1>
-<h2 id="what-is-bowtie-2"><a href="#TOC">What is Bowtie 2?</a></h2>
+<h1 id="introduction">Introduction</h1>
+<h2 id="what-is-bowtie-2">What is Bowtie 2?</h2>
 <p><a href="http://bowtie-bio.sf.net/bowtie2">Bowtie 2</a> is an ultrafast and memory-efficient tool for aligning sequencing reads to long reference sequences. It is particularly good at aligning reads of about 50 up to 100s or 1,000s of characters to relatively long (e.g. mammalian) genomes. Bowtie 2 indexes the genome with an <a href="http://portal.acm.org/citation.cfm?id=796543">FM Index</a> (based on the <a href="http://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler [...]
 <p><a href="http://bowtie-bio.sf.net/bowtie2">Bowtie 2</a> is often the first step in pipelines for comparative genomics, including for variation calling, ChIP-seq, RNA-seq, BS-seq. <a href="http://bowtie-bio.sf.net/bowtie2">Bowtie 2</a> and <a href="http://bowtie-bio.sf.net">Bowtie</a> (also called "<a href="http://bowtie-bio.sf.net">Bowtie 1</a>" here) are also tightly integrated into some tools, including <a href="http://tophat.cbcb.umd.edu/">TopHat</a>: a fast splice juncti [...]
 <p>If you use <a href="http://bowtie-bio.sf.net/bowtie2">Bowtie 2</a> for your published research, please cite the <a href="http://genomebiology.com/2009/10/3/R25">Bowtie paper</a>. Thank you!</p>
-<h2 id="how-is-bowtie-2-different-from-bowtie-1"><a href="#TOC">How is Bowtie 2 different from Bowtie 1?</a></h2>
+<h2 id="how-is-bowtie-2-different-from-bowtie-1">How is Bowtie 2 different from Bowtie 1?</h2>
 <p>Bowtie 1 was released in 2009 and was geared toward aligning the relatively short sequencing reads (up to 25-50 nucleotides) prevalent at the time. Since then, technology has improved both sequencing throughput (more nucleotides produced per sequencer per day) and read length (more nucleotides per read).</p>
 <p>The chief differences between Bowtie 1 and Bowtie 2 are:</p>
 <ol style="list-style-type: decimal">
@@ -126,22 +114,22 @@
 <li><p>Bowtie 2 does not align colorspace reads.</p></li>
 </ol>
 <p>Bowtie 2 is not a "drop-in" replacement for Bowtie 1. Bowtie 2's command-line arguments and genome index format are both different from Bowtie 1's.</p>
-<h2 id="what-isnt-bowtie-2"><a href="#TOC">What isn't Bowtie 2?</a></h2>
+<h2 id="what-isnt-bowtie-2">What isn't Bowtie 2?</h2>
 <p>Bowtie 1 and Bowtie 2 are not general-purpose alignment tools like <a href="http://mummer.sourceforge.net/">MUMmer</a>, <a href="http://blast.ncbi.nlm.nih.gov/Blast.cgi">BLAST</a> or <a href="http://www.vmatch.de/">Vmatch</a>. Bowtie 2 works best when aligning to large genomes, though it supports arbitrarily small reference sequences (e.g. amplicons). It handles very long reads (i.e. upwards of 10s or 100s of kilobases), but it is optimized for the read lengths and error modes yielded [...]
 <p>If your goal is to align two very large sequences (e.g. two genomes), consider using <a href="http://mummer.sourceforge.net/">MUMmer</a>. If your goal is very sensitive alignment to a relatively short reference sequence (e.g. a bacterial genome), this can be done with Bowtie 2 but you may want to consider using tools like <a href="http://mummer.sourceforge.net/manual/#nucmer">NUCmer</a>, <a href="http://genome.ucsc.edu/cgi-bin/hgBlat?command=start">BLAT</a>, or <a href="http://blast.n [...]
 <p>Bowtie 2 does not support alignment of colorspace reads. This might be supported in future versions.</p>
-<h2 id="what-does-it-mean-that-some-older-bowtie-2-versions-are-beta"><a href="#TOC">What does it mean that some older Bowtie 2 versions are "beta"?</a></h2>
+<h2 id="what-does-it-mean-that-some-older-bowtie-2-versions-are-beta">What does it mean that some older Bowtie 2 versions are "beta"?</h2>
 <p>We said those Bowtie 2 versions were in "beta" to convey that it was not as polished as a tool that had been around for a while, and was still in flux. Since version 2.0.1, we declared Bowtie 2 was no longer "beta".</p>
-<h1 id="obtaining-bowtie-2"><a href="#TOC">Obtaining Bowtie 2</a></h1>
+<h1 id="obtaining-bowtie-2">Obtaining Bowtie 2</h1>
 <p>Download Bowtie 2 sources and binaries from the <a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie2/">Download</a> section of the Sourceforge site. Binaries are available for the Intel <code>x86_64</code> architecture running Linux, Mac OS X, and Windows. If you plan to compile Bowtie 2 yourself, make sure to get the source package, i.e., the filename that ends in "-source.zip".</p>
-<h2 id="building-from-source"><a href="#TOC">Building from source</a></h2>
+<h2 id="building-from-source">Building from source</h2>
 <p>Building Bowtie 2 from source requires a GNU-like environment with GCC, GNU Make and other basics. It should be possible to build Bowtie 2 on most vanilla Linux installations or on a Mac installation with <a href="http://developer.apple.com/xcode/">Xcode</a> installed. Bowtie 2 can also be built on Windows using a 64-bit MinGW distribution and MSYS. In order to simplify the MinGW setup it might be worth investigating popular MinGW personal builds since these are coming already prepare [...]
 <p>First, download the source package from the <a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie2/">sourceforge site</a>. Make sure you're getting the source package; the file downloaded should end in <code>-source.zip</code>. Unzip the file, change to the unzipped directory, and build the Bowtie 2 tools by running GNU <code>make</code> (usually with the command <code>make</code>, but sometimes with <code>gmake</code>) with no arguments. If building with MinGW, run <code> [...]
 <p>Bowtie 2 is using the multithreading software model in order to speed up execution times on SMP architectures where this is possible. On POSIX platforms (like linux, Mac OS, etc) it needs the pthread library. Although it is possible to use pthread library on non-POSIX platform like Windows, due to performance reasons bowtie 2 will try to use Windows native multithreading if possible.</p>
-<h2 id="adding-to-path"><a href="#TOC">Adding to PATH</a></h2>
+<h2 id="adding-to-path">Adding to PATH</h2>
 <p>By adding your new Bowtie 2 directory to your <a href="http://en.wikipedia.org/wiki/PATH_(variable)">PATH environment variable</a>, you ensure that whenever you run <code>bowtie2</code>, <code>bowtie2-build</code> or <code>bowtie2-inspect</code> from the command line, you will get the version you just installed without having to specify the entire path. This is recommended for most users. To do this, follow your operating system's instructions for adding the directory to your <a href= [...]
 <p>If you would like to install Bowtie 2 by copying the Bowtie 2 executable files to an existing directory in your <a href="http://en.wikipedia.org/wiki/PATH_(variable)">PATH</a>, make sure that you copy all the executables, including <code>bowtie2</code>, <code>bowtie2-align-s</code>, <code>bowtie2-align-l</code>, <code>bowtie2-build</code>, <code>bowtie2-build-s</code>, <code>bowtie2-build-l</code>, <code>bowtie2-inspect</code>, <code>bowtie2-inspect-s</code> and <code>bowtie2-inspect- [...]
-<h1 id="the-bowtie2-aligner"><a href="#TOC">The <code>bowtie2</code> aligner</a></h1>
+<h1 id="the-bowtie2-aligner">The <code>bowtie2</code> aligner</h1>
 <p><code>bowtie2</code> takes a Bowtie 2 index and a set of sequencing read files and outputs a set of alignments in SAM format.</p>
 <p>"Alignment" is the process by which we discover how and where the read sequences are similar to the reference sequence. An "alignment" is a result from this process, specifically: an alignment is a way of "lining up" some or all of the characters in the read with some characters from the reference in a way that reveals how they're similar. For example:</p>
 <pre><code>  Read:      GACTGGGCGATCTCGACTTCG
@@ -149,10 +137,10 @@
   Reference: GACTG--CGATCTCGACATCG</code></pre>
 <p>Where dash symbols represent gaps and vertical bars show where aligned characters match.</p>
 <p>We use alignment to make an educated guess as to where a read originated with respect to the reference genome. It's not always possible to determine this with certainty. For instance, if the reference genome contains several long stretches of As (<code>AAAAAAAAA</code> etc) and the read sequence is a short stretch of As (<code>AAAAAAA</code>), we cannot know for certain exactly where in the sea of <code>A</code>s the read originated.</p>
-<h2 id="end-to-end-alignment-versus-local-alignment"><a href="#TOC">End-to-end alignment versus local alignment</a></h2>
+<h2 id="end-to-end-alignment-versus-local-alignment">End-to-end alignment versus local alignment</h2>
 <p>By default, Bowtie 2 performs end-to-end read alignment. That is, it searches for alignments involving all of the read characters. This is also called an "untrimmed" or "unclipped" alignment.</p>
 <p>When the --local option is specified, Bowtie 2 performs local read alignment. In this mode, Bowtie 2 might "trim" or "clip" some read characters from one or both ends of the alignment if doing so maximizes the alignment score.</p>
-<h3 id="end-to-end-alignment-example"><a href="#TOC">End-to-end alignment example</a></h3>
+<h3 id="end-to-end-alignment-example">End-to-end alignment example</h3>
 <p>The following is an "end-to-end" alignment because it involves all the characters in the read. Such an alignment can be produced by Bowtie 2 in either end-to-end mode or in local mode.</p>
 <pre><code>Read:      GACTGGGCGATCTCGACTTCG
 Reference: GACTGCGATCTCGACATCG
@@ -161,7 +149,7 @@ Alignment:
   Read:      GACTGGGCGATCTCGACTTCG
              |||||  |||||||||| |||
   Reference: GACTG--CGATCTCGACATCG</code></pre>
-<h3 id="local-alignment-example"><a href="#TOC">Local alignment example</a></h3>
+<h3 id="local-alignment-example">Local alignment example</h3>
 <p>The following is a "local" alignment because some of the characters at the ends of the read do not participate. In this case, 4 characters are omitted (or "soft trimmed" or "soft clipped") from the beginning and 3 characters are omitted from the end. This sort of alignment can be produced by Bowtie 2 only in local mode.</p>
 <pre><code>Read:      ACGGTTGCGTTAATCCGCCACG
 Reference: TAACTTGCGTTAAATCCGCCTGG
@@ -170,42 +158,42 @@ Alignment:
   Read:      ACGGTTGCGTTAA-TCCGCCACG
                  ||||||||| ||||||
   Reference: TAACTTGCGTTAAATCCGCCTGG</code></pre>
-<h2 id="scores-higher-more-similar"><a href="#TOC">Scores: higher = more similar</a></h2>
+<h2 id="scores-higher-more-similar">Scores: higher = more similar</h2>
 <p>An alignment score quantifies how similar the read sequence is to the reference sequence aligned to. The higher the score, the more similar they are. A score is calculated by subtracting penalties for each difference (mismatch, gap, etc) and, in local alignment mode, adding bonuses for each match.</p>
 <p>The scores can be configured with the <a href="#bowtie2-options-ma"><code>--ma</code></a> (match bonus), <a href="#bowtie2-options-mp"><code>--mp</code></a> (mismatch penalty), <a href="#bowtie2-options-np"><code>--np</code></a> (penalty for having an N in either the read or the reference), <a href="#bowtie2-options-rdg"><code>--rdg</code></a> (affine read gap penalty) and <a href="#bowtie2-options-rfg"><code>--rfg</code></a> (affine reference gap penalty) options.</p>
-<h3 id="end-to-end-alignment-score-example"><a href="#TOC">End-to-end alignment score example</a></h3>
+<h3 id="end-to-end-alignment-score-example">End-to-end alignment score example</h3>
 <p>A mismatched base at a high-quality position in the read receives a penalty of -6 by default. A length-2 read gap receives a penalty of -11 by default (-5 for the gap open, -3 for the first extension, -3 for the second extension). Thus, in end-to-end alignment mode, if the read is 50 bp long and it matches the reference exactly except for one mismatch at a high-quality position and one length-2 read gap, then the overall score is -(6 + 11) = -17.</p>
 <p>The best possible alignment score in end-to-end mode is 0, which happens when there are no differences between the read and the reference.</p>
-<h3 id="local-alignment-score-example"><a href="#TOC">Local alignment score example</a></h3>
+<h3 id="local-alignment-score-example">Local alignment score example</h3>
 <p>A mismatched base at a high-quality position in the read receives a penalty of -6 by default. A length-2 read gap receives a penalty of -11 by default (-5 for the gap open, -3 for the first extension, -3 for the second extension). A base that matches receives a bonus of +2 be default. Thus, in local alignment mode, if the read is 50 bp long and it matches the reference exactly except for one mismatch at a high-quality position and one length-2 read gap, then the overall score equals t [...]
 <p>The best possible score in local mode equals the match bonus times the length of the read. This happens when there are no differences between the read and the reference.</p>
-<h3 id="valid-alignments-meet-or-exceed-the-minimum-score-threshold"><a href="#TOC">Valid alignments meet or exceed the minimum score threshold</a></h3>
+<h3 id="valid-alignments-meet-or-exceed-the-minimum-score-threshold">Valid alignments meet or exceed the minimum score threshold</h3>
 <p>For an alignment to be considered "valid" (i.e. "good enough") by Bowtie 2, it must have an alignment score no less than the minimum score threshold. The threshold is configurable and is expressed as a function of the read length. In end-to-end alignment mode, the default minimum score threhsold is <code>-0.6 + -0.6 * L</code>, where <code>L</code> is the read length. In local alignment mdoe, the default minimum score threshold is <code>20 + 8.0 * ln(L)</code>, whe [...]
-<h2 id="mapping-quality-higher-more-unique"><a href="#TOC">Mapping quality: higher = more unique</a></h2>
+<h2 id="mapping-quality-higher-more-unique">Mapping quality: higher = more unique</h2>
 <p>The aligner cannot always assign a read to its point of origin with high confidence. For instance, a read that originated inside a repeat element might align equally well to many occurrences of the element throughout the genome, leaving the aligner with no basis for preferring one over the others.</p>
 <p>Aligners characterize their degree of confidence in the point of origin by reporting a mapping quality: a non-negative integer Q = -10 log10 p, where p is an estimate of the probability that the alignment does not correspond to the read's true point of origin. Mapping quality is sometimes abbreviated MAPQ, and is recorded in the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM</a> <code>MAPQ</code> field.</p>
 <p>Mapping quality is related to "uniqueness." We say an alignment is unique if it has a much higher alignment score than all the other possible alignments. The bigger the gap between the best alignment's score and the second-best alignment's score, the more unique the best alignment, and the higher its mapping quality should be.</p>
 <p>Accurate mapping qualities are useful for downstream tools like variant callers. For instance, a variant caller might choose to ignore evidence from alignments with mapping quality less than, say, 10. A mapping quality of 10 or less indicates that there is at least a 1 in 10 chance that the read truly originated elsewhere.</p>
-<h2 id="aligning-pairs"><a href="#TOC">Aligning pairs</a></h2>
+<h2 id="aligning-pairs">Aligning pairs</h2>
 <p>A "paired-end" or "mate-pair" read consists of pair of mates, called mate 1 and mate 2. Pairs come with a prior expectation about (a) the relative orientation of the mates, and (b) the distance separating them on the original DNA molecule. Exactly what expectations hold for a given dataset depends on the lab procedures used to generate the data. For example, a common lab procedure for producing pairs is Illumina's Paired-end Sequencing Assay, which yields pairs wit [...]
 <p>For simplicity, this manual uses the term "paired-end" to refer to any pair of reads with some expected relative orientation and distance. Depending on the protocol, these might actually be referred to as "paired-end" or "mate-paired." Also, we always refer to the individual sequences making up the pair as "mates."</p>
-<h3 id="paired-inputs"><a href="#TOC">Paired inputs</a></h3>
+<h3 id="paired-inputs">Paired inputs</h3>
 <p>Pairs are often stored in a pair of files, one file containing the mate 1s and the other containing the mates 2s. The first mate in the file for mate 1 forms a pair with the first mate in the file for mate 2, the second with the second, and so on. When aligning pairs with Bowtie 2, specify the file with the mate 1s mates using the <a href="#bowtie2-options-1"><code>-1</code></a> argument and the file with the mate 2s using the <a href="#bowtie2-options-2"><code>-2</code></a> argument. [...]
-<h3 id="paired-sam-output"><a href="#TOC">Paired SAM output</a></h3>
+<h3 id="paired-sam-output">Paired SAM output</h3>
 <p>When Bowtie 2 prints a SAM alignment for a pair, it prints two records (i.e. two lines of output), one for each mate. The first record describes the alignment for mate 1 and the second record describes the alignment for mate 2. In both records, some of the fields of the SAM record describe various properties of the alignment; for instance, the 7th and 8th fields (<code>RNEXT</code> and <code>PNEXT</code> respectively) indicate the reference name and position where the other mate align [...]
-<h3 id="concordant-pairs-match-pair-expectations-discordant-pairs-dont"><a href="#TOC">Concordant pairs match pair expectations, discordant pairs don't</a></h3>
+<h3 id="concordant-pairs-match-pair-expectations-discordant-pairs-dont">Concordant pairs match pair expectations, discordant pairs don't</h3>
 <p>A pair that aligns with the expected relative mate orientation and with the expected range of distances between mates is said to align "concordantly". If both mates have unique alignments, but the alignments do not match paired-end expectations (i.e. the mates aren't in the expcted relative orientation, or aren't within the expected disatance range, or both), the pair is said to align "discordantly". Discordant alignments may be of particular interest, for instance [...]
 <p>The expected relative orientation of the mates is set using the <a href="#bowtie2-options-fr"><code>--ff</code></a>, <a href="#bowtie2-options-fr"><code>--fr</code></a>, or <a href="#bowtie2-options-fr"><code>--rf</code></a> options. The expected range of inter-mates distances (as measured from the furthest extremes of the mates; also called "outer distance") is set with the <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a> [...]
 <p>To declare that a pair aligns discordantly, Bowtie 2 requires that both mates align uniquely. This is a conservative threshold, but this is often desirable when seeking structural variants.</p>
 <p>By default, Bowtie 2 searches for both concordant and discordant alignments, though searching for discordant alignments can be disabled with the <a href="#bowtie2-options-no-discordant"><code>--no-discordant</code></a> option.</p>
-<h3 id="mixed-mode-paired-where-possible-unpaired-otherwise"><a href="#TOC">Mixed mode: paired where possible, unpaired otherwise</a></h3>
+<h3 id="mixed-mode-paired-where-possible-unpaired-otherwise">Mixed mode: paired where possible, unpaired otherwise</h3>
 <p>If Bowtie 2 cannot find a paired-end alignment for a pair, by default it will go on to look for unpaired alignments for the constituent mates. This is called "mixed mode." To disable mixed mode, set the <a href="#bowtie2-options-no-mixed"><code>--no-mixed</code></a> option.</p>
 <p>Bowtie 2 runs a little faster in <code>--no-mixed</code> mode, but will only consider alignment status of pairs per se, not individual mates.</p>
-<h3 id="some-sam-flags-describe-paired-end-properties"><a href="#TOC">Some SAM FLAGS describe paired-end properties</a></h3>
+<h3 id="some-sam-flags-describe-paired-end-properties">Some SAM FLAGS describe paired-end properties</h3>
 <p>The SAM <code>FLAGS</code> field, the second field in a SAM record, has multiple bits that describe the paired-end nature of the read and alignment. The first (least significant) bit (1 in decimal, 0x1 in hexidecimal) is set if the read is part of a pair. The second bit (2 in decimal, 0x2 in hexidecimal) is set if the read is part of a pair that aligned in a paired-end fashion. The fourth bit (8 in decimal, 0x8 in hexidecimal) is set if the read is part of a pair and the other mate in [...]
-<h3 id="some-sam-optional-fields-describe-more-paired-end-properties"><a href="#TOC">Some SAM optional fields describe more paired-end properties</a></h3>
+<h3 id="some-sam-optional-fields-describe-more-paired-end-properties">Some SAM optional fields describe more paired-end properties</h3>
 <p>The last severeal fields of each SAM record usually contain SAM optional fields, which are simply tab-separated strings conveying additional information about the reads and alignments. A SAM optional field is formatted like this: "XP:i:1" where "XP" is the <code>TAG</code>, "i" is the <code>TYPE</code> ("integer" in this case), and "1" is the <code>VALUE</code>. See the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM specificati [...]
-<h3 id="mates-can-overlap-contain-or-dovetail-each-other"><a href="#TOC">Mates can overlap, contain, or dovetail each other</a></h3>
+<h3 id="mates-can-overlap-contain-or-dovetail-each-other">Mates can overlap, contain, or dovetail each other</h3>
 <p>The fragment and read lengths might be such that alignments for the two mates from a pair overlap each other. Consider this example:</p>
 <p>(For these examples, assume we expect mate 1 to align to the left of mate 2.)</p>
 <pre><code>Mate 1:    GCAGATTATATGAGTCAGCTACGATATTGTT
@@ -225,40 +213,40 @@ Mate 2:            TATGAGTCAGCTACGATATTGTTTGGGGTGACACAT
 Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pre>
 <p>In some situations, it's desirable for the aligner to consider all these cases as "concordant" as long as other paired-end constraints are not violated. Bowtie 2's default behavior is to consider overlapping and containing as being consistent with concordant alignment. By default, dovetailing is considered inconsistent with concordant alignment.</p>
 <p>These defaults can be overridden. Setting <a href="#bowtie2-options-no-overlap"><code>--no-overlap</code></a> causes Bowtie 2 to consider overlapping mates as non-concordant. Setting <a href="#bowtie2-options-no-contain"><code>--no-contain</code></a> causes Bowtie 2 to consider cases where one mate alignment contains the other as non-concordant. Setting <a href="#bowtie2-options-dovetail"><code>--dovetail</code></a> causes Bowtie 2 to consider cases where the mate alignments dovetail  [...]
-<h2 id="reporting"><a href="#TOC">Reporting</a></h2>
+<h2 id="reporting">Reporting</h2>
 <p>The reporting mode governs how many alignments Bowtie 2 looks for, and how to report them. Bowtie 2 has three distinct reporting modes. The default reporting mode is similar to the default reporting mode of many other read alignment tools, including <a href="http://bio-bwa.sourceforge.net/">BWA</a>. It is also similar to Bowtie 1's <code>-M</code> alignment mode.</p>
 <p>In general, when we say that a read has an alignment, we mean that it has a <a href="#valid-alignments-meet-or-exceed-the-minimum-score-threshold">valid alignment</a>. When we say that a read has multiple alignments, we mean that it has multiple alignments that are valid and distinct from one another.</p>
-<h3 id="distinct-alignments-map-a-read-to-different-places"><a href="#TOC">Distinct alignments map a read to different places</a></h3>
+<h3 id="distinct-alignments-map-a-read-to-different-places">Distinct alignments map a read to different places</h3>
 <p>Two alignments for the same individual read are "distinct" if they map the same read to different places. Specifically, we say that two alignments are distinct if there are no alignment positions where a particular read offset is aligned opposite a particular reference offset in both alignments with the same orientation. E.g. if the first alignment is in the forward orientation and aligns the read character at read offset 10 to the reference character at chromosome 3, offset [...]
 <p>Two alignments for the same pair are distinct if either the mate 1s in the two paired-end alignments are distinct or the mate 2s in the two alignments are distinct or both.</p>
-<h3 id="default-mode-search-for-multiple-alignments-report-the-best-one"><a href="#TOC">Default mode: search for multiple alignments, report the best one</a></h3>
+<h3 id="default-mode-search-for-multiple-alignments-report-the-best-one">Default mode: search for multiple alignments, report the best one</h3>
 <p>By default, Bowtie 2 searches for distinct, valid alignments for each read. When it finds a valid alignment, it generally will continue to look for alignments that are nearly as good or better. It will eventually stop looking, either because it exceeded a limit placed on search effort (see <a href="#bowtie2-options-D"><code>-D</code></a> and <a href="#bowtie2-options-R"><code>-R</code></a>) or because it already knows all it needs to know to report an alignment. Information from the b [...]
 <p>See also: <a href="#bowtie2-options-D"><code>-D</code></a>, which puts an upper limit on the number of dynamic programming problems (i.e. seed extensions) that can "fail" in a row before Bowtie 2 stops searching. Increasing <a href="#bowtie2-options-D"><code>-D</code></a> makes Bowtie 2 slower, but increases the likelihood that it will report the correct alignment for a read that aligns many places.</p>
 <p>See also: <a href="#bowtie2-options-R"><code>-R</code></a>, which sets the maximum number of times Bowtie 2 will "re-seed" when attempting to align a read with repetitive seeds. Increasing <a href="#bowtie2-options-R"><code>-R</code></a> makes Bowtie 2 slower, but increases the likelihood that it will report the correct alignment for a read that aligns many places.</p>
-<h3 id="k-mode-search-for-one-or-more-alignments-report-each"><a href="#TOC">-k mode: search for one or more alignments, report each</a></h3>
+<h3 id="k-mode-search-for-one-or-more-alignments-report-each">-k mode: search for one or more alignments, report each</h3>
 <p>In <a href="#bowtie2-options-k"><code>-k</code></a> mode, Bowtie 2 searches for up to N distinct, valid alignments for each read, where N equals the integer specified with the <code>-k</code> parameter. That is, if <code>-k 2</code> is specified, Bowtie 2 will search for at most 2 distinct alignments. It reports all alignments found, in descending order by alignment score. The alignment score for a paired-end alignment equals the sum of the alignment scores of the individual mates. Ea [...]
 <p>Bowtie 2 does not "find" alignments in any specific order, so for reads that have more than N distinct, valid alignments, Bowtie 2 does not gaurantee that the N alignments reported are the best possible in terms of alignment score. Still, this mode can be effective and fast in situations where the user cares more about whether a read aligns (or aligns a certain number of times) than where exactly it originated.</p>
-<h3 id="a-mode-search-for-and-report-all-alignments"><a href="#TOC">-a mode: search for and report all alignments</a></h3>
+<h3 id="a-mode-search-for-and-report-all-alignments">-a mode: search for and report all alignments</h3>
 <p><a href="#bowtie2-options-a"><code>-a</code></a> mode is similar to <a href="#bowtie2-options-k"><code>-k</code></a> mode except that there is no upper limit on the number of alignments Bowtie 2 should report. Alignments are reported in descending order by alignment score. The alignment score for a paired-end alignment equals the sum of the alignment scores of the individual mates. Each reported read or pair alignment beyond the first has the SAM 'secondary' bit (which equals 256) set [...]
 <p>Some tools are designed with this reporting mode in mind. Bowtie 2 is not! For very large genomes, this mode is very slow.</p>
-<h3 id="randomness-in-bowtie-2"><a href="#TOC">Randomness in Bowtie 2</a></h3>
+<h3 id="randomness-in-bowtie-2">Randomness in Bowtie 2</h3>
 <p>Bowtie 2's search for alignments for a given read is "randomized." That is, when Bowtie 2 encouters a set of equally-good choices, it uses a pseudo-random number to choose. For example, if Bowtie 2 discovers a set of 3 equally-good alignments and wants to decide which to report, it picks a pseudo-random integer 0, 1 or 2 and reports the corresponding alignment. Abitrary choices can crop up at various points during alignment.</p>
 <p>The pseudo-random number generator is re-initialized for every read, and the seed used to initialize it is a function of the read name, nucleotide string, quality string, and the value specified with <a href="#bowtie2-options-seed"><code>--seed</code></a>. If you run the same version of Bowtie 2 on two reads with identical names, nucleotide strings, and quality strings, and if <a href="#bowtie2-options-seed"><code>--seed</code></a> is set the same for both runs, Bowtie 2 will produce  [...]
-<p>However, when the user specifies the <a href="#bowtie2-options-non-deterministic"><code>--non-deterministic</code></a> option, Bowtie 2 will use the current time to re-intiailize the pseud-random number generator. When this is specified, Bowtie 2 might report different alignments for identical reads. This is counter-intuitive for some users, but might be more appropriate in situations where the input consists of many identical reads.</p>
-<h2 id="multiseed-heuristic"><a href="#TOC">Multiseed heuristic</a></h2>
+<p>However, when the user specifies the <a href="#bowtie2-options-non-deterministic"><code>--non-deterministic</code></a> option, Bowtie 2 will use the current time to re-initialize the pseudo-random number generator. When this is specified, Bowtie 2 might report different alignments for identical reads. This is counter-intuitive for some users, but might be more appropriate in situations where the input consists of many identical reads.</p>
+<h2 id="multiseed-heuristic">Multiseed heuristic</h2>
 <p>To rapidly narrow the number of possible alignments that must be considered, Bowtie 2 begins by extracting substrings ("seeds") from the read and its reverse complement and aligning them in an ungapped fashion with the help of the <a href="http://portal.acm.org/citation.cfm?id=796543">FM Index</a>. This is "multiseed alignment" and it is similar to what <a href="http://genomebiology.com/2009/10/3/R25">Bowtie 1 does</a>, except Bowtie 1 attempts to align the entire  [...]
 <p>This initial step makes Bowtie 2 much faster than it would be without such a filter, but at the expense of missing some valid alignments. For instance, it is possible for a read to have a valid overall alignment but to have no valid seed alignments because each potential seed alignment is interruped by too many mismatches or gaps.</p>
 <p>The tradeoff between speed and sensitivity/accuracy can be adjusted by setting the seed length (<a href="#bowtie2-options-L"><code>-L</code></a>), the interval between extracted seeds (<a href="#bowtie2-options-I"><code>-i</code></a>), and the number of mismatches permitted per seed (<a href="#bowtie2-options-N"><code>-N</code></a>). For more sensitive alignment, set these parameters to (a) make the seeds closer together, (b) make the seeds shorter, and/or (c) allow more mismatches. Y [...]
 <p><a href="#bowtie2-options-D"><code>-D</code></a> and <a href="#bowtie2-options-R"><code>-R</code></a> are also options that adjust the tradeoff between speed and sensitivity/accuracy.</p>
-<h3 id="fm-index-memory-footprint"><a href="#TOC">FM Index memory footprint</a></h3>
+<h3 id="fm-index-memory-footprint">FM Index memory footprint</h3>
 <p>Bowtie 2 uses the <a href="http://portal.acm.org/citation.cfm?id=796543">FM Index</a> to find ungapped alignments for seeds. This step accounts for the bulk of Bowtie 2's memory footprint, as the <a href="http://portal.acm.org/citation.cfm?id=796543">FM Index</a> itself is typically the largest data structure used. For instance, the memory footprint of the <a href="http://portal.acm.org/citation.cfm?id=796543">FM Index</a> for the human genome is about 3.2 gigabytes of RAM.</p>
-<h2 id="ambiguous-characters"><a href="#TOC">Ambiguous characters</a></h2>
+<h2 id="ambiguous-characters">Ambiguous characters</h2>
 <p>Non-whitespace characters besides A, C, G or T are considered "ambiguous." N is a common ambiguous character that appears in reference sequences. Bowtie 2 considers all ambiguous characters in the reference (including <a href="http://www.bioinformatics.org/sms/iupac.html">IUPAC nucleotide codes</a>) to be Ns.</p>
 <p>Bowtie 2 allows alignments to overlap ambiguous characters in the reference. An alignment position that contains an ambiguous character in the read, reference, or both, is penalized according to <a href="#bowtie2-options-np"><code>--np</code></a>. <a href="#bowtie2-options-n-ceil"><code>--n-ceil</code></a> sets an upper limit on the number of positions that may contain ambiguous reference characters in a valid alignment. The optional field <a href="#bowtie2-build-opt-fields-xn"><code> [...]
 <p>Note that the <a href="#multiseed-heuristic">multiseed heuristic</a> cannot find <em>seed</em> alignments that overlap ambiguous reference characters. For an alignment overlapping an ambiguous reference character to be found, it must have one or more seed alignments that do not overlap ambiguous reference characters.</p>
-<h2 id="presets-setting-many-settings-at-once"><a href="#TOC">Presets: setting many settings at once</a></h2>
+<h2 id="presets-setting-many-settings-at-once">Presets: setting many settings at once</h2>
 <p>Bowtie 2 comes with some useful combinations of parameters packaged into shorter "preset" parameters. For example, running Bowtie 2 with the <code>--very-sensitive</code> option is the same as running with options: <code>-D 20 -R 3 -N 0 -L 20 -i S,1,0.50</code>. The preset options that come with Bowtie 2 are designed to cover a wide area of the speed/sensitivity/accuracy tradeoff space, with the presets ending in <code>fast</code> generally being faster but less sensitive an [...]
-<h2 id="filtering"><a href="#TOC">Filtering</a></h2>
+<h2 id="filtering">Filtering</h2>
 <p>Some reads are skipped or "filtered out" by Bowtie 2. For example, reads may be filtered out because they are extremely short or have a high proportion of ambiguous nucleotides. Bowtie 2 will still print a SAM record for such a read, but no alignment will be reported and and the <code>YF:i</code> SAM optional field will be set to indicate the reason the read was filtered.</p>
 <ul>
 <li><code>YF:Z:LN</code>: the read was filtered becuase it had length less than or equal to the number of seed mismatches set with the <a href="#bowtie2-options-N"><code>-N</code></a> option.</li>
@@ -267,7 +255,7 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <li><code>YF:Z:QC</code>: the read was filtered because it was marked as failing quality control and the user specified the <a href="#bowtie2-options-qc-filter"><code>--qc-filter</code></a> option. This only happens when the input is in Illumina's QSEQ format (i.e. when <a href="#bowtie2-options-qseq"><code>--qseq</code></a> is specified) and the last (11th) field of the read's QSEQ record contains <code>1</code>.</li>
 </ul>
 <p>If a read could be filtered for more than one reason, the value <code>YF:Z</code> flag will reflect only one of those reasons.</p>
-<h2 id="alignment-summmary"><a href="#TOC">Alignment summmary</a></h2>
+<h2 id="alignment-summmary">Alignment summmary</h2>
 <p>When Bowtie 2 finishes running, it prints messages summarizing what happened. These messages are printed to the "standard error" ("stderr") filehandle. For datasets consisting of unpaired reads, the summary might look like this:</p>
 <pre><code>20000 reads; of these:
   20000 (100.00%) were unpaired; of these:
@@ -292,12 +280,12 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
         1 (0.08%) aligned >1 times
 96.70% overall alignment rate</code></pre>
 <p>The indentation indicates how subtotals relate to totals.</p>
-<h2 id="wrapper-scripts"><a href="#TOC">Wrapper scripts</a></h2>
+<h2 id="wrapper-scripts">Wrapper scripts</h2>
 <p>The <code>bowtie2</code>, <code>bowtie2-build</code> and <code>bowtie2-inspect</code> executables are actually wrapper scripts that call binary programs as appropriate. The wrappers shield users from having to distinguish between "small" and "large" index formats, discussed briefly in the following section. Also, the <code>bowtie2</code> wrapper provides some key functionality, like the ability to handle compressed inputs, and the fucntionality for <a href="#bowtie [...]
 <p>It is recommended that you always run the bowtie2 wrappers and not run the binaries directly.</p>
-<h2 id="small-and-large-indexes"><a href="#TOC">Small and large indexes</a></h2>
+<h2 id="small-and-large-indexes">Small and large indexes</h2>
 <p><code>bowtie2-build</code> can index reference genomes of any size. For genomes less than about 4 billion nucleotides in length, <code>bowtie2-build</code> builds a "small" index using 32-bit numbers in various parts of the index. When the genome is longer, <code>bowtie2-build</code> builds a "large" index using 64-bit numbers. Small indexes are stored in files with the <code>.bt2</code> extension, and large indexes are stored in files with the <code>.bt2l</code> e [...]
-<h2 id="performance-tuning"><a href="#TOC">Performance tuning</a></h2>
+<h2 id="performance-tuning">Performance tuning</h2>
 <ol style="list-style-type: decimal">
 <li><p>If your computer has multiple processors/cores, use <code>-p</code></p>
 <p>The <a href="#bowtie2-options-p"><code>-p</code></a> option causes Bowtie 2 to launch a specified number of parallel search threads. Each thread runs on a different processor/core and all threads find alignments in parallel, increasing alignment throughput by approximately a multiple of the number of threads (though in practice, speedup is somewhat worse than linear).</p></li>
@@ -306,66 +294,54 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <li><p>If <code>bowtie2</code> "thrashes", try increasing <code>bowtie2-build --offrate</code></p>
 <p>If <code>bowtie2</code> runs very slowly on a relatively low-memory computer, try setting <a href="#bowtie2-options-o"><code>-o</code>/<code>--offrate</code></a> to a <em>larger</em> value when building the index. This decreases the memory footprint of the index.</p></li>
 </ol>
-<h2 id="command-line"><a href="#TOC">Command Line</a></h2>
-<h3 id="setting-function-options"><a href="#TOC">Setting function options</a></h3>
+<h2 id="command-line">Command Line</h2>
+<h3 id="setting-function-options">Setting function options</h3>
 <p>Some Bowtie 2 options specify a function rather than an individual number or setting. In these cases the user specifies three parameters: (a) a function type <code>F</code>, (b) a constant term <code>B</code>, and (c) a coefficient <code>A</code>. The available function types are constant (<code>C</code>), linear (<code>L</code>), square-root (<code>S</code>), and natural log (<code>G</code>). The parameters are specified as <code>F,B,A</code> - that is, the function type, the constan [...]
 <p>For example, if the function specification is <code>L,-0.4,-0.6</code>, then the function defined is:</p>
 <pre><code>f(x) = -0.4 + -0.6 * x</code></pre>
 <p>If the function specification is <code>G,1,5.4</code>, then the function defined is:</p>
 <pre><code>f(x) = 1.0 + 5.4 * ln(x)</code></pre>
 <p>See the documentation for the option in question to learn what the parameter <code>x</code> is for. For example, in the case if the <a href="#bowtie2-options-score-min"><code>--score-min</code></a> option, the function <code>f(x)</code> sets the minimum alignment score necessary for an alignment to be considered valid, and <code>x</code> is the read length.</p>
-<h3 id="usage"><a href="#TOC">Usage</a></h3>
+<h3 id="usage">Usage</h3>
 <pre><code>bowtie2 [options]* -x <bt2-idx> {-1 <m1> -2 <m2> | -U <r>} -S [<hit>]</code></pre>
-<h3 id="main-arguments"><a href="#TOC">Main arguments</a></h3>
+<h3 id="main-arguments">Main arguments</h3>
 <table><tr><td>
 
-
-
 <pre><code>-x <bt2-idx></code></pre>
 </td><td>
 
 <p>The basename of the index for the reference genome. The basename is the name of any of the index files up to but not including the final <code>.1.bt2</code> / <code>.rev.1.bt2</code> / etc. <code>bowtie2</code> looks for the specified index first in the current directory, then in the directory specified in the <code>BOWTIE2_INDEXES</code> environment variable.</p>
 </td></tr><tr><td>
 
-
-
 <pre><code>-1 <m1></code></pre>
 </td><td>
 
 <p>Comma-separated list of files containing mate 1s (filename usually includes <code>_1</code>), e.g. <code>-1 flyA_1.fq,flyB_1.fq</code>. Sequences specified with this option must correspond file-for-file and read-for-read with those specified in <code><m2></code>. Reads may be a mix of different lengths. If <code>-</code> is specified, <code>bowtie2</code> will read the mate 1s from the "standard in" or "stdin" filehandle.</p>
 </td></tr><tr><td>
 
-
-
 <pre><code>-2 <m2></code></pre>
 </td><td>
 
 <p>Comma-separated list of files containing mate 2s (filename usually includes <code>_2</code>), e.g. <code>-2 flyA_2.fq,flyB_2.fq</code>. Sequences specified with this option must correspond file-for-file and read-for-read with those specified in <code><m1></code>. Reads may be a mix of different lengths. If <code>-</code> is specified, <code>bowtie2</code> will read the mate 2s from the "standard in" or "stdin" filehandle.</p>
 </td></tr><tr><td>
 
-
-
 <pre><code>-U <r></code></pre>
 </td><td>
 
 <p>Comma-separated list of files containing unpaired reads to be aligned, e.g. <code>lane1.fq,lane2.fq,lane3.fq,lane4.fq</code>. Reads may be a mix of different lengths. If <code>-</code> is specified, <code>bowtie2</code> gets the reads from the "standard in" or "stdin" filehandle.</p>
 </td></tr><tr><td>
 
-
-
 <pre><code>-S <hit></code></pre>
 </td><td>
 
 <p>File to write SAM alignments to. By default, alignments are written to the "standard out" or "stdout" filehandle (i.e. the console).</p>
 </td></tr></table>
 
-<h3 id="options"><a href="#TOC">Options</a></h3>
-<h4 id="input-options"><a href="#TOC">Input options</a></h4>
+<h3 id="options">Options</h3>
+<h4 id="input-options">Input options</h4>
 <table>
 <tr><td id="bowtie2-options-q">
 
-
-
 <pre><code>-q</code></pre>
 </td><td>
 
@@ -373,8 +349,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-qseq">
 
-
-
 <pre><code>--qseq</code></pre>
 </td><td>
 
@@ -382,8 +356,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-f">
 
-
-
 <pre><code>-f</code></pre>
 </td><td>
 
@@ -391,8 +363,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-r">
 
-
-
 <pre><code>-r</code></pre>
 </td><td>
 
@@ -400,8 +370,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-c">
 
-
-
 <pre><code>-c</code></pre>
 </td><td>
 
@@ -409,9 +377,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-s">
 
-
-
-
 <pre><code>-s/--skip <int></code></pre>
 </td><td>
 
@@ -419,9 +384,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-u">
 
-
-
-
 <pre><code>-u/--qupto <int></code></pre>
 </td><td>
 
@@ -429,9 +391,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-5">
 
-
-
-
 <pre><code>-5/--trim5 <int></code></pre>
 </td><td>
 
@@ -439,17 +398,12 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-3">
 
-
-
-
 <pre><code>-3/--trim3 <int></code></pre>
 </td><td>
 
 <p>Trim <code><int></code> bases from 3' (right) end of each read before alignment (default: 0).</p>
 </td></tr><tr><td id="bowtie2-options-phred33-quals">
 
-
-
 <pre><code>--phred33</code></pre>
 </td><td>
 
@@ -457,8 +411,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-phred64-quals">
 
-
-
 <pre><code>--phred64</code></pre>
 </td><td>
 
@@ -466,8 +418,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-solexa-quals">
 
-
-
 <pre><code>--solexa-quals</code></pre>
 </td><td>
 
@@ -475,20 +425,16 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-int-quals">
 
-
-
 <pre><code>--int-quals</code></pre>
 </td><td>
 
 <p>Quality values are represented in the read input file as space-separated ASCII integers, e.g., <code>40 40 30 40</code>..., rather than ASCII characters, e.g., <code>II?I</code>.... Integers are treated as being on the <a href="http://en.wikipedia.org/wiki/Phred_quality_score">Phred quality</a> scale unless <a href="#bowtie2-options-solexa-quals"><code>--solexa-quals</code></a> is also specified. Default: off.</p>
 </td></tr></table>
 
-<h4 id="preset-options-in---end-to-end-mode"><a href="#TOC">Preset options in <code>--end-to-end</code> mode</a></h4>
+<h4 id="preset-options-in---end-to-end-mode">Preset options in <code>--end-to-end</code> mode</h4>
 <table>
 <tr><td id="bowtie2-options-very-fast">
 
-
-
 <pre><code>--very-fast</code></pre>
 </td><td>
 
@@ -496,8 +442,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-fast">
 
-
-
 <pre><code>--fast</code></pre>
 </td><td>
 
@@ -505,8 +449,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-sensitive">
 
-
-
 <pre><code>--sensitive</code></pre>
 </td><td>
 
@@ -514,8 +456,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-very-sensitive">
 
-
-
 <pre><code>--very-sensitive</code></pre>
 </td><td>
 
@@ -523,12 +463,10 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 </table>
 
-<h4 id="preset-options-in---local-mode"><a href="#TOC">Preset options in <code>--local</code> mode</a></h4>
+<h4 id="preset-options-in---local-mode">Preset options in <code>--local</code> mode</h4>
 <table>
 <tr><td id="bowtie2-options-very-fast-local">
 
-
-
 <pre><code>--very-fast-local</code></pre>
 </td><td>
 
@@ -536,8 +474,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-fast-local">
 
-
-
 <pre><code>--fast-local</code></pre>
 </td><td>
 
@@ -545,8 +481,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-sensitive-local">
 
-
-
 <pre><code>--sensitive-local</code></pre>
 </td><td>
 
@@ -554,8 +488,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-very-sensitive-local">
 
-
-
 <pre><code>--very-sensitive-local</code></pre>
 </td><td>
 
@@ -563,13 +495,11 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 </table>
 
-<h4 id="alignment-options"><a href="#TOC">Alignment options</a></h4>
+<h4 id="alignment-options">Alignment options</h4>
 <table>
 
 <tr><td id="bowtie2-options-N">
 
-
-
 <pre><code>-N <int></code></pre>
 </td><td>
 
@@ -577,8 +507,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-L">
 
-
-
 <pre><code>-L <int></code></pre>
 </td><td>
 
@@ -586,8 +514,6 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 </td></tr>
 <tr><td id="bowtie2-options-i">
 
-
-
 <pre><code>-i <func></code></pre>
 </td><td>
 
@@ -605,8 +531,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-n-ceil">
 
-
-
 <pre><code>--n-ceil <func></code></pre>
 </td><td>
 
@@ -614,8 +538,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-dpad">
 
-
-
 <pre><code>--dpad <int></code></pre>
 </td><td>
 
@@ -623,8 +545,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-gbar">
 
-
-
 <pre><code>--gbar <int></code></pre>
 </td><td>
 
@@ -632,8 +552,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-ignore-quals">
 
-
-
 <pre><code>--ignore-quals</code></pre>
 </td><td>
 
@@ -641,8 +559,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-nofw">
 
-
-
 <pre><code>--nofw/--norc</code></pre>
 </td><td>
 
@@ -650,16 +566,12 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-no-1mm-upfront">
 
-
-
 <pre><code>--no-1mm-upfront</code></pre>
 </td><td>
 
 <p>By default, Bowtie 2 will attempt to find either an exact or a 1-mismatch end-to-end alignment for the read <em>before</em> trying the <a href="#multiseed-heuristic">multiseed heuristic</a>. Such alignments can be found very quickly, and many short read alignments have exact or near-exact end-to-end alignments. However, this can lead to unexpected alignments when the user also sets options governing the <a href="#multiseed-heuristic">multiseed heuristic</a>, like <a href="#bowtie2-opt [...]
 </td></tr><tr><td id="bowtie2-options-end-to-end">
 
-
-
 <pre><code>--end-to-end</code></pre>
 </td><td>
 
@@ -667,8 +579,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-local">
 
-
-
 <pre><code>--local</code></pre>
 </td><td>
 
@@ -676,13 +586,11 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 </table>
 
-<h4 id="scoring-options"><a href="#TOC">Scoring options</a></h4>
+<h4 id="scoring-options">Scoring options</h4>
 <table>
 
 <tr><td id="bowtie2-options-ma">
 
-
-
 <pre><code>--ma <int></code></pre>
 </td><td>
 
@@ -690,8 +598,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-mp">
 
-
-
 <pre><code>--mp MX,MN</code></pre>
 </td><td>
 
@@ -699,8 +605,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-np">
 
-
-
 <pre><code>--np <int></code></pre>
 </td><td>
 
@@ -708,8 +612,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-rdg">
 
-
-
 <pre><code>--rdg <int1>,<int2></code></pre>
 </td><td>
 
@@ -717,8 +619,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-rfg">
 
-
-
 <pre><code>--rfg <int1>,<int2></code></pre>
 </td><td>
 
@@ -726,8 +626,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-score-min">
 
-
-
 <pre><code>--score-min <func></code></pre>
 </td><td>
 
@@ -735,24 +633,20 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 </table>
 
-<h4 id="reporting-options"><a href="#TOC">Reporting options</a></h4>
+<h4 id="reporting-options">Reporting options</h4>
 <table>
 
 <tr><td id="bowtie2-options-k">
 
-
-
 <pre><code>-k <int></code></pre>
 </td><td>
 
 <p>By default, <code>bowtie2</code> searches for distinct, valid alignments for each read. When it finds a valid alignment, it continues looking for alignments that are nearly as good or better. The best alignment found is reported (randomly selected from among best if tied). Information about the best alignments is used to estimate mapping quality and to set SAM optional fields, such as <a href="#bowtie2-build-opt-fields-as"><code>AS:i</code></a> and <a href="#bowtie2-build-opt-fields-x [...]
-<p>When <code>-k</code> is specified, however, <code>bowtie2</code> behaves differently. Instead, it searches for at most <code><int></code> distinct, valid alignments for each read. The search terminates when it can't find more distinct valid alignments, or when it finds <code><int></code>, whichever happens first. All alignments found are reported in descending order by alignment score. The alignment score for a paired-end alignment equals the sum of the alignment scores of [...]
+<p>When <code>-k</code> is specified, however, <code>bowtie2</code> behaves differently. Instead, it searches for at most <code><int></code> distinct, valid alignments for each read. The search terminates when it can't find more distinct valid alignments, or when it finds <code><int></code>, whichever happens first. All alignments found are reported in descending order by alignment score. The alignment score for a paired-end alignment equals the sum of the alignment scores of [...]
 <p>Note: Bowtie 2 is not designed with large values for <code>-k</code> in mind, and when aligning reads to long, repetitive genomes large <code>-k</code> can be very, very slow.</p>
 </td></tr>
 <tr><td id="bowtie2-options-a">
 
-
-
 <pre><code>-a</code></pre>
 </td><td>
 
@@ -761,13 +655,11 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 </table>
 
-<h4 id="effort-options"><a href="#TOC">Effort options</a></h4>
+<h4 id="effort-options">Effort options</h4>
 <table>
 
 <tr><td id="bowtie2-options-D">
 
-
-
 <pre><code>-D <int></code></pre>
 </td><td>
 
@@ -775,8 +667,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-R">
 
-
-
 <pre><code>-R <int></code></pre>
 </td><td>
 
@@ -784,14 +674,11 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 </table>
 
-<h4 id="paired-end-options"><a href="#TOC">Paired-end options</a></h4>
+<h4 id="paired-end-options">Paired-end options</h4>
 <table>
 
 <tr><td id="bowtie2-options-I">
 
-
-
-
 <pre><code>-I/--minins <int></code></pre>
 </td><td>
 
@@ -801,9 +688,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-X">
 
-
-
-
 <pre><code>-X/--maxins <int></code></pre>
 </td><td>
 
@@ -813,11 +697,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-fr">
 
-
-
-
-
-
 <pre><code>--fr/--rf/--ff</code></pre>
 </td><td>
 
@@ -825,8 +704,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-no-mixed">
 
-
-
 <pre><code>--no-mixed</code></pre>
 </td><td>
 
@@ -834,8 +711,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-no-discordant">
 
-
-
 <pre><code>--no-discordant</code></pre>
 </td><td>
 
@@ -843,8 +718,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-dovetail">
 
-
-
 <pre><code>--dovetail</code></pre>
 </td><td>
 
@@ -852,8 +725,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-no-contain">
 
-
-
 <pre><code>--no-contain</code></pre>
 </td><td>
 
@@ -861,22 +732,17 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-no-overlap">
 
-
-
 <pre><code>--no-overlap</code></pre>
 </td><td>
 
 <p>If one mate alignment overlaps the other at all, consider that to be non-concordant. See also: <a href="#mates-can-overlap-contain-or-dovetail-each-other">Mates can overlap, contain or dovetail each other</a>. Default: mates can overlap in a concordant alignment.</p>
 </td></tr></table>
 
-<h4 id="output-options"><a href="#TOC">Output options</a></h4>
+<h4 id="output-options">Output options</h4>
 <table>
 
 <tr><td id="bowtie2-options-t">
 
-
-
-
 <pre><code>-t/--time</code></pre>
 </td><td>
 
@@ -884,60 +750,46 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-un">
 
-
-
-
-
 <pre><code>--un <path>
 --un-gz <path>
---un-bz2 <path></code></pre>
+--un-bz2 <path>
+--un-lz4 <path></code></pre>
 </td><td>
 
-<p>Write unpaired reads that fail to align to file at <code><path></code>. These reads correspond to the SAM records with the FLAGS <code>0x4</code> bit set and neither the <code>0x40</code> nor <code>0x80</code> bits set. If <code>--un-gz</code> is specified, output will be gzip compressed. If <code>--un-bz2</code> is specified, output will be bzip2 compressed. Reads written in this way will appear exactly as they did in the input file, without any modification (same sequence, sam [...]
+<p>Write unpaired reads that fail to align to file at <code><path></code>. These reads correspond to the SAM records with the FLAGS <code>0x4</code> bit set and neither the <code>0x40</code> nor <code>0x80</code> bits set. If <code>--un-gz</code> is specified, output will be gzip compressed. If <code>--un-bz2</code> or <code>--un-lz4</code> is specified, output will be bzip2 or lz4 compressed. Reads written in this way will appear exactly as they did in the input file, without any  [...]
 </td></tr>
 <tr><td id="bowtie2-options-al">
 
-
-
-
-
 <pre><code>--al <path>
 --al-gz <path>
---al-bz2 <path></code></pre>
+--al-bz2 <path>
+--al-lz4 <path></code></pre>
 </td><td>
 
-<p>Write unpaired reads that align at least once to file at <code><path></code>. These reads correspond to the SAM records with the FLAGS <code>0x4</code>, <code>0x40</code>, and <code>0x80</code> bits unset. If <code>--al-gz</code> is specified, output will be gzip compressed. If <code>--al-bz2</code> is specified, output will be bzip2 compressed. Reads written in this way will appear exactly as they did in the input file, without any modification (same sequence, same name, same q [...]
+<p>Write unpaired reads that align at least once to file at <code><path></code>. These reads correspond to the SAM records with the FLAGS <code>0x4</code>, <code>0x40</code>, and <code>0x80</code> bits unset. If <code>--al-gz</code> is specified, output will be gzip compressed. If <code>--al-bz2</code> is specified, output will be bzip2 compressed. Similarly if <code>--al-lz4</code> is specified, output will be lz4 compressed. Reads written in this way will appear exactly as they d [...]
 </td></tr>
 <tr><td id="bowtie2-options-un-conc">
 
-
-
-
-
 <pre><code>--un-conc <path>
 --un-conc-gz <path>
---un-conc-bz2 <path></code></pre>
+--un-conc-bz2 <path>
+--un-conc-lz4 <path></code></pre>
 </td><td>
 
 <p>Write paired-end reads that fail to align concordantly to file(s) at <code><path></code>. These reads correspond to the SAM records with the FLAGS <code>0x4</code> bit set and either the <code>0x40</code> or <code>0x80</code> bit set (depending on whether it's mate #1 or #2). <code>.1</code> and <code>.2</code> strings are added to the filename to distinguish which file contains mate #1 and mate #2. If a percent symbol, <code>%</code>, is used in <code><path></code>, the p [...]
 </td></tr>
 <tr><td id="bowtie2-options-al-conc">
 
-
-
-
-
 <pre><code>--al-conc <path>
 --al-conc-gz <path>
---al-conc-bz2 <path></code></pre>
+--al-conc-bz2 <path>
+--al-conc-lz4 <path></code></pre>
 </td><td>
 
 <p>Write paired-end reads that align concordantly at least once to file(s) at <code><path></code>. These reads correspond to the SAM records with the FLAGS <code>0x4</code> bit unset and either the <code>0x40</code> or <code>0x80</code> bit set (depending on whether it's mate #1 or #2). <code>.1</code> and <code>.2</code> strings are added to the filename to distinguish which file contains mate #1 and mate #2. If a percent symbol, <code>%</code>, is used in <code><path></code [...]
 </td></tr>
 <tr><td id="bowtie2-options-quiet">
 
-
-
 <pre><code>--quiet</code></pre>
 </td><td>
 
@@ -945,8 +797,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-met-file">
 
-
-
 <pre><code>--met-file <path></code></pre>
 </td><td>
 
@@ -954,8 +804,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-met-stderr">
 
-
-
 <pre><code>--met-stderr <path></code></pre>
 </td><td>
 
@@ -963,8 +811,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-met">
 
-
-
 <pre><code>--met <int></code></pre>
 </td><td>
 
@@ -972,13 +818,11 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 </table>
 
-<h4 id="sam-options"><a href="#TOC">SAM options</a></h4>
+<h4 id="sam-options">SAM options</h4>
 <table>
 
 <tr><td id="bowtie2-options-no-unal">
 
-
-
 <pre><code>--no-unal</code></pre>
 </td><td>
 
@@ -986,8 +830,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-no-hd">
 
-
-
 <pre><code>--no-hd</code></pre>
 </td><td>
 
@@ -995,8 +837,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-no-sq">
 
-
-
 <pre><code>--no-sq</code></pre>
 </td><td>
 
@@ -1004,8 +844,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-rg-id">
 
-
-
 <pre><code>--rg-id <text></code></pre>
 </td><td>
 
@@ -1013,8 +851,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-rg">
 
-
-
 <pre><code>--rg <text></code></pre>
 </td><td>
 
@@ -1022,8 +858,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-omit-sec-seq">
 
-
-
 <pre><code>--omit-sec-seq</code></pre>
 </td><td>
 
@@ -1033,15 +867,11 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 
 </table>
 
-<h4 id="performance-options"><a href="#TOC">Performance options</a></h4>
+<h4 id="performance-options">Performance options</h4>
 <table><tr>
 
 <td id="bowtie2-options-o">
 
-
-
-
-
 <pre><code>-o/--offrate <int></code></pre>
 </td><td>
 
@@ -1049,9 +879,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-p">
 
-
-
-
 <pre><code>-p/--threads NTHREADS</code></pre>
 </td><td>
 
@@ -1059,8 +886,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-reorder">
 
-
-
 <pre><code>--reorder</code></pre>
 </td><td>
 
@@ -1068,20 +893,16 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-mm">
 
-
-
 <pre><code>--mm</code></pre>
 </td><td>
 
 <p>Use memory-mapped I/O to load the index, rather than typical file I/O. Memory-mapping allows many concurrent <code>bowtie</code> processes on the same computer to share the same memory image of the index (i.e. you pay the memory overhead just once). This facilitates memory-efficient parallelization of <code>bowtie</code> in situations where using <a href="#bowtie2-options-p"><code>-p</code></a> is not possible or not preferable.</p>
 </td></tr></table>
 
-<h4 id="other-options"><a href="#TOC">Other options</a></h4>
+<h4 id="other-options">Other options</h4>
 <table>
 <tr><td id="bowtie2-options-qc-filter">
 
-
-
 <pre><code>--qc-filter</code></pre>
 </td><td>
 
@@ -1089,8 +910,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-seed">
 
-
-
 <pre><code>--seed <int></code></pre>
 </td><td>
 
@@ -1098,8 +917,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-non-deterministic">
 
-
-
 <pre><code>--non-deterministic</code></pre>
 </td><td>
 
@@ -1107,8 +924,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-options-version">
 
-
-
 <pre><code>--version</code></pre>
 </td><td>
 
@@ -1122,7 +937,7 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <p>Print usage information and quit.</p>
 </td></tr></table>
 
-<h2 id="sam-output"><a href="#TOC">SAM output</a></h2>
+<h2 id="sam-output">SAM output</h2>
 <p>Following is a brief description of the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM</a> format as output by <code>bowtie2</code>. For more details, see the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM format specification</a>.</p>
 <p>By default, <code>bowtie2</code> prints a SAM header with <code>@HD</code>, <code>@SQ</code> and <code>@PG</code> lines. When one or more <a href="#bowtie2-options-rg"><code>--rg</code></a> arguments are specified, <code>bowtie2</code> will also print an <code>@RG</code> line that includes all user-specified <a href="#bowtie2-options-rg"><code>--rg</code></a> tokens separated by tabs.</p>
 <p>Each subsequnt line describes an alignment or, if the read failed to align, a read. Each line is a collection of at least 12 fields separated by tabs; from left to right, the fields are:</p>
@@ -1193,131 +1008,137 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <li><p>Optional fields. Fields are tab-separated. <code>bowtie2</code> outputs zero or more of these optional fields for each alignment, depending on the type of the alignment:</p>
 <table>
 <tr><td id="bowtie2-build-opt-fields-as">
+</li>
+</ol>
+<pre><code>    AS:i:<N>
 
+</td>
+<td>
 
+Alignment score.  Can be negative.  Can be greater than 0 in [`--local`]
+mode (but not in [`--end-to-end`] mode).  Only present if SAM record is for
+an aligned read.
 
-<pre><code>AS:i:<N></code></pre>
-</td>
-<td>
-
-<p>Alignment score. Can be negative. Can be greater than 0 in <a href="#bowtie2-options-local"><code>--local</code></a> mode (but not in <a href="#bowtie2-options-end-to-end"><code>--end-to-end</code></a> mode). Only present if SAM record is for an aligned read.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xs">
-
-
-
-<pre><code>XS:i:<N></code></pre>
-</td>
-<td>
-
-<p>Alignment score for the best-scoring alignment found other than the alignment reported. Can be negative. Can be greater than 0 in <a href="#bowtie2-options-local"><code>--local</code></a> mode (but not in <a href="#bowtie2-options-end-to-end"><code>--end-to-end</code></a> mode). Only present if the SAM record is for an aligned read and more than one alignment was found for the read. Note that, when the read is part of a concordantly-aligned pair, this score could be greater than <a hr [...]
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-ys">
-
-
-
-<pre><code>YS:i:<N></code></pre>
-</td>
-<td>
-
-<p>Alignment score for opposite mate in the paired-end alignment. Only present if the SAM record is for a read that aligned as part of a paired-end alignment.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xn">
-
-
-
-<pre><code>XN:i:<N></code></pre>
-</td>
-<td>
-
-<p>The number of ambiguous bases in the reference covering this alignment. Only present if SAM record is for an aligned read.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xm">
-
-
-
-<pre><code>XM:i:<N></code></pre>
-</td>
-<td>
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-xs"></code></pre>
+<pre><code>    XS:i:<N>
 
-<p>The number of mismatches in the alignment. Only present if SAM record is for an aligned read.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xo">
+</td>
+<td>
 
+Alignment score for the best-scoring alignment found other than the
+alignment reported.  Can be negative.  Can be greater than 0 in [`--local`]
+mode (but not in [`--end-to-end`] mode).  Only present if the SAM record is
+for an aligned read and more than one alignment was found for the read.
+Note that, when the read is part of a concordantly-aligned pair, this score
+could be greater than [`AS:i`].
 
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-ys"></code></pre>
+<pre><code>    YS:i:<N>
 
-<pre><code>XO:i:<N></code></pre>
-</td>
-<td>
-
-<p>The number of gap opens, for both read and reference gaps, in the alignment. Only present if SAM record is for an aligned read.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xg">
+</td>
+<td>
 
+Alignment score for opposite mate in the paired-end alignment.  Only present
+if the SAM record is for a read that aligned as part of a paired-end
+alignment.
 
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-xn"></code></pre>
+<pre><code>    XN:i:<N>
 
-<pre><code>XG:i:<N></code></pre>
-</td>
-<td>
+</td>
+<td>
 
-<p>The number of gap extensions, for both read and reference gaps, in the alignment. Only present if SAM record is for an aligned read.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-nm">
+The number of ambiguous bases in the reference covering this alignment. 
+Only present if SAM record is for an aligned read.
 
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-xm"></code></pre>
+<pre><code>    XM:i:<N>
 
+</td>
+<td>
 
-<pre><code>NM:i:<N></code></pre>
-</td>
-<td>
+The number of mismatches in the alignment.  Only present if SAM record is
+for an aligned read.
 
-<p>The edit distance; that is, the minimal number of one-nucleotide edits (substitutions, insertions and deletions) needed to transform the read string into the reference string. Only present if SAM record is for an aligned read.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-yf">
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-xo"></code></pre>
+<pre><code>    XO:i:<N>
 
+</td>
+<td>
 
+The number of gap opens, for both read and reference gaps, in the alignment.
+Only present if SAM record is for an aligned read.
 
-<pre><code>YF:Z:<S></code></pre>
-</td><td>
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-xg"></code></pre>
+<pre><code>    XG:i:<N>
 
-<p>String indicating reason why the read was filtered out. See also: <a href="#filtering">Filtering</a>. Only appears for reads that were filtered out.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-yt">
+</td>
+<td>
 
+The number of gap extensions, for both read and reference gaps, in the
+alignment. Only present if SAM record is for an aligned read.
 
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-nm"></code></pre>
+<pre><code>    NM:i:<N>
 
-<pre><code>YT:Z:<S></code></pre>
-</td><td>
+</td>
+<td>
 
-<p>Value of <code>UU</code> indicates the read was not part of a pair. Value of <code>CP</code> indicates the read was part of a pair and the pair aligned concordantly. Value of <code>DP</code> indicates the read was part of a pair and the pair aligned discordantly. Value of <code>UP</code> indicates the read was part of a pair but the pair failed to aligned either concordantly or discordantly.</p>
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-md">
+The edit distance; that is, the minimal number of one-nucleotide edits
+(substitutions, insertions and deletions) needed to transform the read
+string into the reference string.  Only present if SAM record is for an
+aligned read.
 
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-yf"></code></pre>
+<pre><code>    YF:Z:<S>
 
+</td><td>
 
-<pre><code>MD:Z:<S></code></pre>
-</td><td>
+String indicating reason why the read was filtered out.  See also:
+[Filtering].  Only appears for reads that were filtered out.
 
-<p>A string representation of the mismatched reference bases in the alignment. See <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM</a> format specification for details. Only present if SAM record is for an aligned read.</p>
-</td></tr>
-</table>
+</td></tr>
+<tr><td id="bowtie2-build-opt-fields-yt"></code></pre>
+<pre><code>    YT:Z:<S>
 
+</td><td>
 
+Value of `UU` indicates the read was not part of a pair.  Value of `CP`
+indicates the read was part of a pair and the pair aligned concordantly.
+Value of `DP` indicates the read was part of a pair and the pair aligned
+discordantly.  Value of `UP` indicates the read was part of a pair but the
+pair failed to aligned either concordantly or discordantly.</code></pre>
+<pre><code></td></tr>
+<tr><td id="bowtie2-build-opt-fields-md"></code></pre>
+<pre><code>    MD:Z:<S>
 
+</td><td>
 
+A string representation of the mismatched reference bases in the alignment. 
+See [SAM] format specification for details.  Only present if SAM record is
+for an aligned read.
 
-</li>
-</ol>
-<h1 id="the-bowtie2-build-indexer"><a href="#TOC">The <code>bowtie2-build</code> indexer</a></h1>
+</td></tr>
+</table></code></pre>
+<h1 id="the-bowtie2-build-indexer">The <code>bowtie2-build</code> indexer</h1>
 <p><code>bowtie2-build</code> builds a Bowtie index from a set of DNA sequences. <code>bowtie2-build</code> outputs a set of 6 files with suffixes <code>.1.bt2</code>, <code>.2.bt2</code>, <code>.3.bt2</code>, <code>.4.bt2</code>, <code>.rev.1.bt2</code>, and <code>.rev.2.bt2</code>. In the case of a large index these suffixes will have a <code>bt2l</code> termination. These files together constitute the index: they are all that is needed to align reads to that reference. The original se [...]
 <p>Bowtie 2's <code>.bt2</code> index format is different from Bowtie 1's <code>.ebwt</code> format, and they are not compatible with each other.</p>
 <p>Use of Karkkainen's <a href="http://portal.acm.org/citation.cfm?id=1314852">blockwise algorithm</a> allows <code>bowtie2-build</code> to trade off between running time and memory usage. <code>bowtie2-build</code> has three options governing how it makes this trade: <a href="#bowtie2-build-options-p"><code>-p</code>/<code>--packed</code></a>, <a href="#bowtie2-build-options-bmax"><code>--bmax</code></a>/<a href="#bowtie2-build-options-bmaxdivn"><code>--bmaxdivn</code></a>, and <a href= [...]
 <p>The indexer provides options pertaining to the "shape" of the index, e.g. <a href="#bowtie2-build-options-o"><code>--offrate</code></a> governs the fraction of <a href="http://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler</a> rows that are "marked" (i.e., the density of the suffix-array sample; see the original <a href="http://portal.acm.org/citation.cfm?id=796543">FM Index</a> paper for details). All of these options are potentially profitable t [...]
 <p><code>bowtie2-build</code> can generate either <a href="#small-and-large-indexes">small or large indexes</a>. The wrapper will decide which based on the length of the input genome. If the reference does not exceed 4 billion characters but a large index is preferred, the user can specify <a href="#bowtie2-build-options-large-index"><code>--large-index</code></a> to force <code>bowtie2-build</code> to build a large index instead.</p>
 <p>The Bowtie 2 index is based on the <a href="http://portal.acm.org/citation.cfm?id=796543">FM Index</a> of Ferragina and Manzini, which in turn is based on the <a href="http://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler</a> transform. The algorithm used to build the index is based on the <a href="http://portal.acm.org/citation.cfm?id=1314852">blockwise algorithm</a> of Karkkainen.</p>
-<h2 id="command-line-1"><a href="#TOC">Command Line</a></h2>
+<h2 id="command-line-1">Command Line</h2>
 <p>Usage:</p>
 <pre><code>bowtie2-build [options]* <reference_in> <bt2_base></code></pre>
-<h3 id="main-arguments-1"><a href="#TOC">Main arguments</a></h3>
+<h3 id="main-arguments-1">Main arguments</h3>
 <table><tr><td>
 
 <pre><code><reference_in></code></pre>
@@ -1332,7 +1153,7 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <p>The basename of the index files to write. By default, <code>bowtie2-build</code> writes files named <code>NAME.1.bt2</code>, <code>NAME.2.bt2</code>, <code>NAME.3.bt2</code>, <code>NAME.4.bt2</code>, <code>NAME.rev.1.bt2</code>, and <code>NAME.rev.2.bt2</code>, where <code>NAME</code> is <code><bt2_base></code>.</p>
 </td></tr></table>
 
-<h3 id="options-1"><a href="#TOC">Options</a></h3>
+<h3 id="options-1">Options</h3>
 <table><tr><td>
 
 <pre><code>-f</code></pre>
@@ -1348,8 +1169,6 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 </td></tr><tr><td id="bowtie2-build-options-large-index">
 
-
-
 <pre><code>--large-index</code></pre>
 </td><td>
 
@@ -1357,49 +1176,36 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td></tr>
 <tr><td id="bowtie2-build-options-a">
 
-
-
 <pre><code>-a/--noauto</code></pre>
 </td><td>
 
 <p>Disable the default behavior whereby <code>bowtie2-build</code> automatically selects values for the <a href="#bowtie2-build-options-bmax"><code>--bmax</code></a>, <a href="#bowtie2-build-options-dcv"><code>--dcv</code></a> and <a href="#bowtie2-build-options-p"><code>--packed</code></a> parameters according to available memory. Instead, user may specify values for those parameters. If memory is exhausted during indexing, an error message will be printed; it is up to the user to try n [...]
 </td></tr><tr><td id="bowtie2-build-options-p">
 
-
-
-
 <pre><code>-p/--packed</code></pre>
 </td><td>
 
 <p>Use a packed (2-bits-per-nucleotide) representation for DNA strings. This saves memory but makes indexing 2-3 times slower. Default: off. This is configured automatically by default; use <a href="#bowtie2-build-options-a"><code>-a</code>/<code>--noauto</code></a> to configure manually.</p>
 </td></tr><tr><td id="bowtie2-build-options-bmax">
 
-
-
 <pre><code>--bmax <int></code></pre>
 </td><td>
 
 <p>The maximum number of suffixes allowed in a block. Allowing more suffixes per block makes indexing faster, but increases peak memory usage. Setting this option overrides any previous setting for <a href="#bowtie2-build-options-bmax"><code>--bmax</code></a>, or <a href="#bowtie2-build-options-bmaxdivn"><code>--bmaxdivn</code></a>. Default (in terms of the <a href="#bowtie2-build-options-bmaxdivn"><code>--bmaxdivn</code></a> parameter) is <a href="#bowtie2-build-options-bmaxdivn"><code> [...]
 </td></tr><tr><td id="bowtie2-build-options-bmaxdivn">
 
-
-
 <pre><code>--bmaxdivn <int></code></pre>
 </td><td>
 
 <p>The maximum number of suffixes allowed in a block, expressed as a fraction of the length of the reference. Setting this option overrides any previous setting for <a href="#bowtie2-build-options-bmax"><code>--bmax</code></a>, or <a href="#bowtie2-build-options-bmaxdivn"><code>--bmaxdivn</code></a>. Default: <a href="#bowtie2-build-options-bmaxdivn"><code>--bmaxdivn</code></a> 4. This is configured automatically by default; use <a href="#bowtie2-build-options-a"><code>-a</code>/<code>-- [...]
 </td></tr><tr><td id="bowtie2-build-options-dcv">
 
-
-
 <pre><code>--dcv <int></code></pre>
 </td><td>
 
 <p>Use <code><int></code> as the period for the difference-cover sample. A larger period yields less memory overhead, but may make suffix sorting slower, especially if repeats are present. Must be a power of 2 no greater than 4096. Default: 1024. This is configured automatically by default; use <a href="#bowtie2-build-options-a"><code>-a</code>/<code>--noauto</code></a> to configure manually.</p>
 </td></tr><tr><td id="bowtie2-build-options-nodc">
 
-
-
 <pre><code>--nodc</code></pre>
 </td><td>
 
@@ -1460,12 +1266,12 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <p>Print version information and quit.</p>
 </td></tr></table>
 
-<h1 id="the-bowtie2-inspect-index-inspector"><a href="#TOC">The <code>bowtie2-inspect</code> index inspector</a></h1>
+<h1 id="the-bowtie2-inspect-index-inspector">The <code>bowtie2-inspect</code> index inspector</h1>
 <p><code>bowtie2-inspect</code> extracts information from a Bowtie index about what kind of index it is and what reference sequences were used to build it. When run without any options, the tool will output a FASTA file containing the sequences of the original references (with all non-<code>A</code>/<code>C</code>/<code>G</code>/<code>T</code> characters converted to <code>N</code>s). It can also be used to extract just the reference sequence names using the <a href="#bowtie2-inspect-opt [...]
-<h2 id="command-line-2"><a href="#TOC">Command Line</a></h2>
+<h2 id="command-line-2">Command Line</h2>
 <p>Usage:</p>
 <pre><code>bowtie2-inspect [options]* <bt2_base></code></pre>
-<h3 id="main-arguments-2"><a href="#TOC">Main arguments</a></h3>
+<h3 id="main-arguments-2">Main arguments</h3>
 <table><tr><td>
 
 <pre><code><bt2_base></code></pre>
@@ -1474,7 +1280,7 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <p>The basename of the index to be inspected. The basename is name of any of the index files but with the <code>.X.bt2</code> or <code>.rev.X.bt2</code> suffix omitted. <code>bowtie2-inspect</code> first looks in the current directory for the index files, then in the directory specified in the <code>BOWTIE2_INDEXES</code> environment variable.</p>
 </td></tr></table>
 
-<h3 id="options-2"><a href="#TOC">Options</a></h3>
+<h3 id="options-2">Options</h3>
 <table><tr><td>
 
 <pre><code>-a/--across <int></code></pre>
@@ -1483,16 +1289,12 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <p>When printing FASTA output, output a newline character every <code><int></code> bases (default: 60).</p>
 </td></tr><tr><td id="bowtie2-inspect-options-n">
 
-
-
 <pre><code>-n/--names</code></pre>
 </td><td>
 
 <p>Print reference sequence names, one per line, and quit.</p>
 </td></tr><tr><td id="bowtie2-inspect-options-s">
 
-
-
 <pre><code>-s/--summary</code></pre>
 </td><td>
 
@@ -1525,15 +1327,15 @@ Sequence-N  <name>  <len></code></pre>
 <p>Print usage information and quit.</p>
 </td></tr></table>
 
-<h1 id="getting-started-with-bowtie-2-lambda-phage-example"><a href="#TOC">Getting started with Bowtie 2: Lambda phage example</a></h1>
+<h1 id="getting-started-with-bowtie-2-lambda-phage-example">Getting started with Bowtie 2: Lambda phage example</h1>
 <p>Bowtie 2 comes with some example files to get you started. The example files are not scientifically significant; we use the <a href="http://en.wikipedia.org/wiki/Lambda_phage">Lambda phage</a> reference genome simply because it's short, and the reads were generated by a computer program, not a sequencer. However, these files will let you start running Bowtie 2 and downstream tools right away.</p>
 <p>First follow the manual instructions to <a href="#obtaining-bowtie-2">obtain Bowtie 2</a>. Set the <code>BT2_HOME</code> environment variable to point to the new Bowtie 2 directory containing the <code>bowtie2</code>, <code>bowtie2-build</code> and <code>bowtie2-inspect</code> binaries. This is important, as the <code>BT2_HOME</code> variable is used in the commands below to refer to that directory.</p>
-<h2 id="indexing-a-reference-genome"><a href="#TOC">Indexing a reference genome</a></h2>
+<h2 id="indexing-a-reference-genome">Indexing a reference genome</h2>
 <p>To create an index for the <a href="http://en.wikipedia.org/wiki/Lambda_phage">Lambda phage</a> reference genome included with Bowtie 2, create a new temporary directory (it doesn't matter where), change into that directory, and run:</p>
 <pre><code>$BT2_HOME/bowtie2-build $BT2_HOME/example/reference/lambda_virus.fa lambda_virus</code></pre>
 <p>The command should print many lines of output then quit. When the command completes, the current directory will contain four new files that all start with <code>lambda_virus</code> and end with <code>.1.bt2</code>, <code>.2.bt2</code>, <code>.3.bt2</code>, <code>.4.bt2</code>, <code>.rev.1.bt2</code>, and <code>.rev.2.bt2</code>. These files constitute the index - you're done!</p>
 <p>You can use <code>bowtie2-build</code> to create an index for a set of FASTA files obtained from any source, including sites such as <a href="http://genome.ucsc.edu/cgi-bin/hgGateway">UCSC</a>, <a href="http://www.ncbi.nlm.nih.gov/sites/genome">NCBI</a>, and <a href="http://www.ensembl.org/">Ensembl</a>. When indexing multiple FASTA files, specify all the files using commas to separate file names. For more details on how to create an index with <code>bowtie2-build</code>, see the <a h [...]
-<h2 id="aligning-example-reads"><a href="#TOC">Aligning example reads</a></h2>
+<h2 id="aligning-example-reads">Aligning example reads</h2>
 <p>Stay in the directory created in the previous step, which now contains the <code>lambda_virus</code> index files. Next, run:</p>
 <pre><code>$BT2_HOME/bowtie2 -x lambda_virus -U $BT2_HOME/example/reads/reads_1.fq -S eg1.sam</code></pre>
 <p>This runs the Bowtie 2 aligner, which aligns a set of unpaired reads to the <a href="http://en.wikipedia.org/wiki/Lambda_phage">Lambda phage</a> reference genome using the index generated in the previous step. The alignment results in SAM format are written to the file <code>eg1.sam</code>, and a short alignment summary is written to the console. (Actually, the summary is written to the "standard error" or "stderr" filehandle, which is typically printed to the cons [...]
@@ -1551,15 +1353,15 @@ r5  0   gi|9626243|ref|NC_001416.1| 48010   42  138M    *   0   0   GTCAGGAAAGTG
 r6  16  gi|9626243|ref|NC_001416.1| 41607   42  72M2D119M   *   0   0   TCGATTTGCAAATACCGGAACATCTCGGTAACTGCATATTCTGCATTAAAAAATCAACGCAAAAAATCGGACGCCTGCAAAGATGAGGAGGGATTGCAGCGTGTTTTTAATGAGGTCATCACGGGATNCCATGTGCGTGACGGNCATCGGGAAACGCCAAAGGAGATTATGTACCGAGGAAGAATGTCGCT 1H#G;H"$E*E#&"*)2%66?=9/9'=;4)4/>@%+5#@#$4A*!<D=="8#1*A9BA=:(1+#C&.#(3#H=9E)AC*5,AC#E'536*2?)H14?>9'B=7(3H/B:+A:8%1-+#(E%&$$&14"76D?>7(&20H5%*&CF8!G5B+A4F$7(:&q [...]
 r7  16  gi|9626243|ref|NC_001416.1| 4692    42  143M    *   0   0   TCAGCCGGACGCGGGCGCTGCAGCCGTACTCGGGGATGACCGGTTACAACGGCATTATCGCCCGTCTGCAACAGGCTGCCAGCGATCCGATGGTGGACAGCATTCTGCTCGATATGGACANGCCCGGCGGGATGGTGGCGGGG -"/@*7A0)>2,AAH@&"%B)*5*23B/,)90.B@%=FE,E063C9?,:26$-0:,.,1849'4.;F>FA;76+5&$<C":$!A*,<B,<)@<'85D%C*:)30 at 85;?.B$05=@95DCDH<53!8G:F:B7/A.E':434> AS:i:-6 XN:i:0  XM:i:2  XO:i:0  XG:i:0  NM:i:2  MD:Z:98G21C22   YT:Z:UU</code></pre>
 <p>The first few lines (beginning with <code>@</code>) are SAM header lines, and the rest of the lines are SAM alignments, one line per read or mate. See the <a href="#sam-output">Bowtie 2 manual section on SAM output</a> and the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM specification</a> for details about how to interpret the SAM file format.</p>
-<h2 id="paired-end-example"><a href="#TOC">Paired-end example</a></h2>
+<h2 id="paired-end-example">Paired-end example</h2>
 <p>To align paired-end reads included with Bowtie 2, stay in the same directory and run:</p>
 <pre><code>$BT2_HOME/bowtie2 -x lambda_virus -1 $BT2_HOME/example/reads/reads_1.fq -2 $BT2_HOME/example/reads/reads_2.fq -S eg2.sam</code></pre>
 <p>This aligns a set of paired-end reads to the reference genome, with results written to the file <code>eg2.sam</code>.</p>
-<h2 id="local-alignment-example-1"><a href="#TOC">Local alignment example</a></h2>
+<h2 id="local-alignment-example-1">Local alignment example</h2>
 <p>To use <a href="#end-to-end-alignment-versus-local-alignment">local alignment</a> to align some longer reads included with Bowtie 2, stay in the same directory and run:</p>
 <pre><code>$BT2_HOME/bowtie2 --local -x lambda_virus -U $BT2_HOME/example/reads/longreads.fq -S eg3.sam</code></pre>
 <p>This aligns the long reads to the reference genome using local alignment, with results written to the file <code>eg3.sam</code>.</p>
-<h2 id="using-samtoolsbcftools-downstream"><a href="#TOC">Using SAMtools/BCFtools downstream</a></h2>
+<h2 id="using-samtoolsbcftools-downstream">Using SAMtools/BCFtools downstream</h2>
 <p><a href="http://samtools.sourceforge.net/">SAMtools</a> is a collection of tools for manipulating and analyzing SAM and BAM alignment files. <a href="http://samtools.sourceforge.net/mpileup.shtml">BCFtools</a> is a collection of tools for calling variants and manipulating VCF and BCF files, and it is typically distributed with <a href="http://samtools.sourceforge.net/">SAMtools</a>. Using these tools together allows you to get from alignments in SAM format to variant calls in VCF form [...]
 <p>Run the paired-end example:</p>
 <pre><code>$BT2_HOME/bowtie2 -x $BT2_HOME/example/index/lambda_virus -1 $BT2_HOME/example/reads/reads_1.fq -2 $BT2_HOME/example/reads/reads_2.fq -S eg2.sam</code></pre>
diff --git a/pat.cpp b/pat.cpp
index 0969a2b..f9167e0 100644
--- a/pat.cpp
+++ b/pat.cpp
@@ -950,8 +950,9 @@ bool FastqPatternSource::read(
 	// Chew up the optional name on the '+' line
 	ASSERT_ONLY(int pk =) peekToEndOfLine(fb_);
 	if(charsRead == 0) {
-		assert_eq('@', pk);
+		assert(pk == '@' || pk == -1);
 		fb_.get();
+		r.readOrigBuf.install(fb_.lastN(), fb_.lastNLen());
 		fb_.resetLastN();
 		rdid = endid = readCnt_;
 		readCnt_++;
diff --git a/read.h b/read.h
index f7e6f98..7fe26ef 100644
--- a/read.h
+++ b/read.h
@@ -449,6 +449,7 @@ struct PerReadMetrics {
 		seedMedian = seedMean = 0;
 		bestLtMinscMate1 =
 		bestLtMinscMate2 = std::numeric_limits<TAlScore>::min();
+		seedPctUnique = seedPctRep = seedsPerNuc = seedHitAvg = 0.0f;
 		fmString.reset();
 	}
 
@@ -517,6 +518,11 @@ struct PerReadMetrics {
 	TAlScore bestLtMinscMate1; // best invalid score observed for mate 1
 	TAlScore bestLtMinscMate2; // best invalid score observed for mate 2
 	
+	float seedPctUnique; // % of read covered by unique seed hits
+	float seedPctRep;    // % of read covered by repetitive seed hits
+	float seedHitAvg;    // avg # seed hits per hitting seed
+	float seedsPerNuc;   // # seeds tried / # alignable nucleotides
+	
 	// For collecting information to go into an FM string
 	bool doFmString;
 	FmString fmString;
diff --git a/sam.cpp b/sam.cpp
index 358dba5..278b8be 100644
--- a/sam.cpp
+++ b/sam.cpp
@@ -135,6 +135,22 @@ void SamConfig::printAlignedOptFlags(
 {
 	char buf[1024];
 	assert(summ.best(rd.mate < 2).valid());
+	if(print_zt_) {
+		// ZT:Z: Extra features for MAPQ estimation
+		WRITE_SEP();
+		o.append("ZT:Z:");
+		itoa10<TAlScore>((int)(prm.seedsPerNuc * 1000), buf);
+		o.append(buf);
+		o.append(",");
+		itoa10<TAlScore>((int)(prm.seedPctUnique * 1000), buf);
+		o.append(buf);
+		o.append(",");
+		itoa10<TAlScore>((int)(prm.seedPctRep * 1000), buf);
+		o.append(buf);
+		o.append(",");
+		itoa10<TAlScore>((int)(prm.seedHitAvg + 0.5), buf);
+		o.append(buf);
+	}
 	if(print_as_) {
 		// AS:i: Alignment score generated by aligner
 		itoa10<TAlScore>(res.score().score(), buf);
diff --git a/sam.h b/sam.h
index 2c6e921..9e2d77e 100644
--- a/sam.h
+++ b/sam.h
@@ -104,7 +104,8 @@ public:
 		bool print_zm, // FM Index op string for best-first search
 		bool print_zi, // # seed extend loop iters
 		bool print_zp,
-		bool print_zu) :
+		bool print_zu,
+		bool print_zt) :
 		truncQname_(truncQname),
 		omitsec_(omitsec),
 		noUnal_(noUnal),
@@ -151,7 +152,8 @@ public:
 		print_zm_(print_zm), // FM Index op string for best-first search
 		print_zi_(print_zi), // # seed extend loop iters
 		print_zp_(print_zp), // # seed extend loop iters
-		print_zu_(print_zu)  // # seed extend loop iters
+		print_zu_(print_zu), // # seed extend loop iters
+		print_zt_(print_zt)  // extra features for MAPQ estimation
 	{
 		assert_eq(refnames_.size(), reflens_.size());
 	}
@@ -384,6 +386,7 @@ protected:
 	bool print_zi_; // ZI:i: # extend loop iters
 	bool print_zp_; // ZP:i: Score of best/second-best paired-end alignment
 	bool print_zu_; // ZU:i: Score of best/second-best unpaired alignment
+	bool print_zt_; // ZT:Z: Extra features for MAPQ estimation
 };
 
 #endif /* SAM_H_ */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/bowtie2.git



More information about the debian-med-commit mailing list