[med-svn] [bowtie2] 01/06: New upstream version 2.3.2

Alex Mestiashvili malex-guest at moszumanska.debian.org
Wed May 24 20:33:28 UTC 2017


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

malex-guest pushed a commit to branch master
in repository bowtie2.

commit 36f3b27851af48195b60f1eeb2820ca2be87ba6c
Author: Alexandre Mestiashvili <alex at biotec.tu-dresden.de>
Date:   Wed May 24 09:46:38 2017 +0200

    New upstream version 2.3.2
---
 .travis.yml                  |    1 +
 MANUAL                       |   58 +-
 MANUAL.markdown              |   58 +-
 Makefile                     |    4 +-
 NEWS                         |   23 +-
 VERSION                      |    2 +-
 aligner_bt.cpp               |    6 +-
 aligner_result.cpp           |   46 +-
 aligner_result.h             |  299 +++++----
 aligner_seed.cpp             |    5 +-
 aligner_seed.h               |   30 +-
 aligner_seed2.h              |    2 +
 aligner_sw.cpp               |    9 +-
 aligner_sw_driver.cpp        |    9 +-
 aligner_swsse_ee_i16.cpp     |    2 +
 aligner_swsse_ee_u8.cpp      |    2 +
 aligner_swsse_loc_i16.cpp    |    2 +
 aligner_swsse_loc_u8.cpp     |    2 +
 aln_sink.cpp                 |  255 +++++++-
 aln_sink.h                   |   19 +-
 bowtie2                      |    4 +-
 bowtie_main.cpp              |  241 +------
 bt2_search.cpp               |   59 +-
 doc/manual.html              |   54 +-
 doc/website/manual.ssi       | 1480 +++++++++++++++++++++++-------------------
 doc/website/recent_news.ssi  |   11 +
 doc/website/rhsidebar.ssi    |    4 +-
 pat.cpp                      |   18 +-
 read.h                       |   12 +-
 sam.cpp                      |  132 ++--
 scripts/test/simple_tests.pl |   14 +-
 unique.h                     |   26 +-
 32 files changed, 1624 insertions(+), 1265 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index e855a60..1381f64 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,6 +14,7 @@ branches:
   - batch_parsing
   - no-io
   - rel2.3
+  - v2.3.2
 script: make allall && make simple-test
 notifications:
   slack:
diff --git a/MANUAL b/MANUAL
index b1395ac..b82d8bf 100644
--- a/MANUAL
+++ b/MANUAL
@@ -24,7 +24,7 @@ including for variation calling, ChIP-seq, RNA-seq, BS-seq.  [Bowtie 2] and
 tools, including [TopHat]: a fast splice junction mapper for RNA-seq reads,
 [Cufflinks]: a tool for transcriptome assembly and isoform quantitiation from
 RNA-seq reads, [Crossbow]: a cloud-enabled software tool for analyzing
-reseuqncing data, and [Myrna]: a cloud-enabled software tool for aligning
+resequencing data, and [Myrna]: a cloud-enabled software tool for aligning
 RNA-seq reads and measuring differential gene expression.
 
 If you use [Bowtie 2] for your published research, please cite the [Bowtie
@@ -59,6 +59,7 @@ The chief differences between Bowtie 1 and Bowtie 2 are:
 1. For reads longer than about 50 bp Bowtie 2 is generally faster, more
 sensitive, and uses less memory than Bowtie 1.  For relatively short reads (e.g.
 less than 50 bp) Bowtie 1 is sometimes faster and/or more sensitive.
+B
 
 2. Bowtie 2 supports gapped alignment with affine gap penalties. Number of gaps
 and gap lengths are not restricted, except by way of the configurable scoring
@@ -85,7 +86,7 @@ alignments lie along a continuous spectrum of alignment scores where the
 not align in a paired fashion, Bowtie 2 attempts to find unpaired alignments for
 each mate.
 
-8. Bowtie 2 reports a spectrum of mapping qualities, in contrast fo Bowtie 1
+8. Bowtie 2 reports a spectrum of mapping qualities, in contrast for Bowtie 1
 which reports either 0 or high.
 
 9. Bowtie 2 does not align colorspace reads.
@@ -113,8 +114,7 @@ you may want to consider using tools like [NUCmer], [BLAT], or [BLAST].  These
 tools can be extremely slow when the reference genome is long, but are often
 adequate when the reference is short.
 
-Bowtie 2 does not support alignment of colorspace reads.  This might be
-supported in future versions.
+Bowtie 2 does not support alignment of colorspace reads.
 
 [MUMmer]: http://mummer.sourceforge.net/
 [NUCmer]: http://mummer.sourceforge.net/manual/#nucmer
@@ -158,14 +158,14 @@ from the MSYS environment.
 +Bowtie 2 is using the multithreading software model in order to
 +speed up execution times on SMP architectures where this is possible.
 +The Threading Building Blocks library, TBB, is now the default
-+threading library in bowtie2. On POSIX platforms (like linux, Mac
-+OS, etc) if TBB is not available the pthread library will be used.
++threading library in Bowtie 2. On POSIX platforms (like Linux, Mac
++OS, etc.) if TBB is not available the pthread library will be used.
 +Although it is possible to use pthread library on Windows, a non-POSIX
-+platform, due to performance reasons bowtie 2 will try to use Windows
++platform, due to performance reasons Bowtie 2 will try to use Windows
 +native multithreading if possible. We recommend that you first
 +install the [Threading Building Blocks library], but if unable to
 +do so please specify `make NO_TBB=1`. TBB comes installed by default
-+on many popular linux distros. Please note, packages built without
++on many popular Linux distros. Please note, packages built without
 +TBB will have _-legacy_ appended to the name.
 
 [MinGW]:    http://www.mingw.org/
@@ -218,7 +218,7 @@ characters match.
 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 (`AAAAAAAAA` etc) and the read sequence is a short stretch of As
+stretches of As (`AAAAAAAAA` etc.) and the read sequence is a short stretch of As
 (`AAAAAAA`), we cannot know for certain exactly where in the sea of `A`s the
 read originated.
 
@@ -268,7 +268,7 @@ Scores: higher = more similar
 
 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)
+is calculated by subtracting penalties for each difference (mismatch, gap, etc.)
 and, in local alignment mode, adding bonuses for each match.
 
 The scores can be configured with the `--ma` (match bonus), `--mp` (mismatch
@@ -437,7 +437,7 @@ a pair.  See the [SAM specification] for a more detailed description of the
 
 ### Some SAM optional fields describe more paired-end properties
 
-The last severeal fields of each SAM record usually contain SAM optional fields,
+The last several 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 `TAG`, "i" is the `TYPE` ("integer" in this case), and "1" is
@@ -552,7 +552,7 @@ beyond the first has the SAM 'secondary' bit (which equals 256) set in its FLAGS
 field.  See the [SAM specification] for details.
 
 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 garantee that
+have more than N distinct, valid alignments, Bowtie 2 does not guarantee 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
@@ -581,7 +581,7 @@ Bowtie 2's search for alignments for a given read is "randomized."  That is,
 when Bowtie 2 encounters 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
+0, 1 or 2 and reports the corresponding alignment.  Arbitrary choices can crop up
 at various points during alignment.
 
 The pseudo-random number generator is re-initialized for every read, and the
@@ -612,18 +612,18 @@ does], except Bowtie 1 attempts to align the entire read this way.
 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
+seed alignments because each potential seed alignment is interrupted by too many
 mismatches or gaps.
 
-The tradeoff between speed and sensitivity/accuracy can be adjusted by setting
+The trade-off between speed and sensitivity/accuracy can be adjusted by setting
 the seed length (`-L`), the interval between extracted seeds (`-i`), and the
 number of mismatches permitted per seed (`-N`).  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.  You can adjust these options
 one-by-one, though Bowtie 2 comes with some useful combinations of options
-pre-packaged as "[preset options]."
+prepackaged as "[preset options]."
 
-`-D` and `-R` are also options that adjust the tradeoff between speed and
+`-D` and `-R` are also options that adjust the trade-off between speed and
 sensitivity/accuracy.
 
 ### FM Index memory footprint
@@ -667,7 +667,7 @@ Bowtie 2 comes with some useful combinations of parameters packaged into shorter
 "preset" parameters.  For example, running Bowtie 2 with the `--very-sensitive`
 option is the same as running with options: `-D 20 -R 3 -N 0 -L 20 -i S,1,0.50`.
  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 `fast`
+the speed/sensitivity/accuracy trade-off space, with the presets ending in `fast`
 generally being faster but less sensitive and less accurate, and the presets
 ending in `sensitive` generally being slower but more sensitive and more
 accurate.  See the [documentation for the preset options] for details.
@@ -678,7 +678,7 @@ Filtering
 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 `YF:i` SAM optional field will be
+but no alignment will be reported and the `YF:i` SAM optional field will be
 set to indicate the reason the read was filtered.
 
 * `YF:Z:LN`: the read was filtered because it had length less than or equal to
@@ -697,7 +697,7 @@ and the last (11th) field of the read's QSEQ record contains `1`.
 If a read could be filtered for more than one reason, the value `YF:Z` flag will
 reflect only one of those reasons.
 
-Alignment summmary
+Alignment summary
 ------------------
 
 When Bowtie 2 finishes running, it prints messages summarizing what happened. 
@@ -739,7 +739,7 @@ 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 `bowtie2` wrapper
 provides some key functionality, like the ability to handle compressed inputs,
-and the fucntionality for `--un`, `--al` and related options.
+and the functionality for `--un`, `--al` and related options.
 
 It is recommended that you always run the bowtie2 wrappers and not run the
 binaries directly.
@@ -1205,7 +1205,7 @@ be valid in that case.  If trimming options `-3` or `-5` are also used, the
 `-I` constraint is applied with respect to the untrimmed mates.
 
 The larger the difference between `-I` and `-X`, the slower Bowtie 2 will
-run.  This is because larger differences bewteen `-I` and `-X` require that
+run.  This is because larger differences between `-I` and `-X` require that
 Bowtie 2 scan a larger window to determine if a concordant alignment exists.
 For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very
 efficient.
@@ -1223,7 +1223,7 @@ constraint is applied with respect to the untrimmed mates, not the trimmed
 mates.
 
 The larger the difference between `-I` and `-X`, the slower Bowtie 2 will
-run.  This is because larger differences bewteen `-I` and `-X` require that
+run.  This is because larger differences between `-I` and `-X` require that
 Bowtie 2 scan a larger window to determine if a concordant alignment exists.
 For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very
 efficient.
@@ -1398,7 +1398,7 @@ Spec][SAM].  Specify `--rg` multiple times to set multiple fields.  See the
     --omit-sec-seq
 
 When printing secondary alignments, Bowtie 2 by default will write out the `SEQ`
-and `QUAL` strings.  Specifying this option causes Bowtie 2 to print an asterix
+and `QUAL` strings.  Specifying this option causes Bowtie 2 to print an asterisk
 in those fields instead.
 
 #### Performance options
@@ -1493,7 +1493,9 @@ left to right, the fields are:
     Note that the [SAM specification] disallows whitespace in the read name.
 	If the read name contains any whitespace characters, Bowtie 2 will truncate
 	the name at the first whitespace character.  This is similar to the
-	behavior of other tools.
+	behavior of other tools. The standard behavior of truncating at the first
+    whitespace can be suppressed with `--sam-noqname-trunc` at the expense of
+    generating non-standard SAM.
 
 2.  Sum of all applicable flags.  Flags relevant to Bowtie are:
 
@@ -1996,21 +1998,21 @@ Run the paired-end example:
 
     $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
 
-Use `samtools view` to convert the SAM file into a BAM file.  BAM is a the
+Use `samtools view` to convert the SAM file into a BAM file.  BAM is the
 binary format corresponding to the SAM text format.  Run:
 
     samtools view -bS eg2.sam > eg2.bam
 
 Use `samtools sort` to convert the BAM file to a sorted BAM file.
 
-    samtools sort eg2.bam eg2.sorted
+    samtools sort eg2.bam -o eg2.sorted.bam
 
 We now have a sorted BAM file called `eg2.sorted.bam`. Sorted BAM is a useful
 format because the alignments are (a) compressed, which is convenient for
 long-term storage, and (b) sorted, which is conveneint for variant discovery.
 To generate variant calls in VCF format, run:
 
-    samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -bvcg - > eg2.raw.bcf
+    samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -Ov - > eg2.raw.bcf
 
 Then to view the variants, run:
 
diff --git a/MANUAL.markdown b/MANUAL.markdown
index 7378b1a..e3604a1 100644
--- a/MANUAL.markdown
+++ b/MANUAL.markdown
@@ -29,7 +29,7 @@ including for variation calling, ChIP-seq, RNA-seq, BS-seq.  [Bowtie 2] and
 tools, including [TopHat]: a fast splice junction mapper for RNA-seq reads,
 [Cufflinks]: a tool for transcriptome assembly and isoform quantitiation from
 RNA-seq reads, [Crossbow]: a cloud-enabled software tool for analyzing
-reseuqncing data, and [Myrna]: a cloud-enabled software tool for aligning
+resequencing data, and [Myrna]: a cloud-enabled software tool for aligning
 RNA-seq reads and measuring differential gene expression.
 
 If you use [Bowtie 2] for your published research, please cite the [Bowtie
@@ -64,6 +64,7 @@ The chief differences between Bowtie 1 and Bowtie 2 are:
 1. For reads longer than about 50 bp Bowtie 2 is generally faster, more
 sensitive, and uses less memory than Bowtie 1.  For relatively short reads (e.g.
 less than 50 bp) Bowtie 1 is sometimes faster and/or more sensitive.
+B
 
 2. Bowtie 2 supports gapped alignment with affine gap penalties. Number of gaps
 and gap lengths are not restricted, except by way of the configurable scoring
@@ -90,7 +91,7 @@ alignments lie along a continuous spectrum of alignment scores where the
 not align in a paired fashion, Bowtie 2 attempts to find unpaired alignments for
 each mate.
 
-8. Bowtie 2 reports a spectrum of mapping qualities, in contrast fo Bowtie 1
+8. Bowtie 2 reports a spectrum of mapping qualities, in contrast for Bowtie 1
 which reports either 0 or high.
 
 9. Bowtie 2 does not align colorspace reads.
@@ -123,8 +124,7 @@ you may want to consider using tools like [NUCmer], [BLAT], or [BLAST].  These
 tools can be extremely slow when the reference genome is long, but are often
 adequate when the reference is short.
 
-Bowtie 2 does not support alignment of colorspace reads.  This might be
-supported in future versions.
+Bowtie 2 does not support alignment of colorspace reads.
 
 [MUMmer]: http://mummer.sourceforge.net/
 [NUCmer]: http://mummer.sourceforge.net/manual/#nucmer
@@ -168,14 +168,14 @@ from the MSYS environment.
 +Bowtie 2 is using the multithreading software model in order to
 +speed up execution times on SMP architectures where this is possible.
 +The Threading Building Blocks library, TBB, is now the default
-+threading library in bowtie2. On POSIX platforms (like linux, Mac
-+OS, etc) if TBB is not available the pthread library will be used.
++threading library in Bowtie 2. On POSIX platforms (like Linux, Mac
++OS, etc.) if TBB is not available the pthread library will be used.
 +Although it is possible to use pthread library on Windows, a non-POSIX
-+platform, due to performance reasons bowtie 2 will try to use Windows
++platform, due to performance reasons Bowtie 2 will try to use Windows
 +native multithreading if possible. We recommend that you first
 +install the [Threading Building Blocks library], but if unable to
 +do so please specify `make NO_TBB=1`. TBB comes installed by default
-+on many popular linux distros. Please note, packages built without
++on many popular Linux distros. Please note, packages built without
 +TBB will have _-legacy_ appended to the name.
 
 [MinGW]:    http://www.mingw.org/
@@ -228,7 +228,7 @@ characters match.
 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 (`AAAAAAAAA` etc) and the read sequence is a short stretch of As
+stretches of As (`AAAAAAAAA` etc.) and the read sequence is a short stretch of As
 (`AAAAAAA`), we cannot know for certain exactly where in the sea of `A`s the
 read originated.
 
@@ -278,7 +278,7 @@ Scores: higher = more similar
 
 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)
+is calculated by subtracting penalties for each difference (mismatch, gap, etc.)
 and, in local alignment mode, adding bonuses for each match.
 
 The scores can be configured with the [`--ma`] (match bonus), [`--mp`] (mismatch
@@ -449,7 +449,7 @@ a pair.  See the [SAM specification] for a more detailed description of the
 
 ### Some SAM optional fields describe more paired-end properties
 
-The last severeal fields of each SAM record usually contain SAM optional fields,
+The last several 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 `TAG`, "i" is the `TYPE` ("integer" in this case), and "1" is
@@ -565,7 +565,7 @@ beyond the first has the SAM 'secondary' bit (which equals 256) set in its FLAGS
 field.  See the [SAM specification] for details.
 
 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 garantee that
+have more than N distinct, valid alignments, Bowtie 2 does not guarantee 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
@@ -594,7 +594,7 @@ Bowtie 2's search for alignments for a given read is "randomized."  That is,
 when Bowtie 2 encounters 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
+0, 1 or 2 and reports the corresponding alignment.  Arbitrary choices can crop up
 at various points during alignment.
 
 The pseudo-random number generator is re-initialized for every read, and the
@@ -625,18 +625,18 @@ does], except Bowtie 1 attempts to align the entire read this way.
 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
+seed alignments because each potential seed alignment is interrupted by too many
 mismatches or gaps.
 
-The tradeoff between speed and sensitivity/accuracy can be adjusted by setting
+The trade-off between speed and sensitivity/accuracy can be adjusted by setting
 the seed length ([`-L`]), the interval between extracted seeds ([`-i`]), and the
 number of mismatches permitted per seed ([`-N`]).  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.  You can adjust these options
 one-by-one, though Bowtie 2 comes with some useful combinations of options
-pre-packaged as "[preset options]."
+prepackaged as "[preset options]."
 
-[`-D`] and [`-R`] are also options that adjust the tradeoff between speed and
+[`-D`] and [`-R`] are also options that adjust the trade-off between speed and
 sensitivity/accuracy.
 
 [preset options]: #presets-setting-many-settings-at-once
@@ -683,7 +683,7 @@ Bowtie 2 comes with some useful combinations of parameters packaged into shorter
 "preset" parameters.  For example, running Bowtie 2 with the `--very-sensitive`
 option is the same as running with options: `-D 20 -R 3 -N 0 -L 20 -i S,1,0.50`.
  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 `fast`
+the speed/sensitivity/accuracy trade-off space, with the presets ending in `fast`
 generally being faster but less sensitive and less accurate, and the presets
 ending in `sensitive` generally being slower but more sensitive and more
 accurate.  See the [documentation for the preset options] for details.
@@ -696,7 +696,7 @@ Filtering
 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 `YF:i` SAM optional field will be
+but no alignment will be reported and the `YF:i` SAM optional field will be
 set to indicate the reason the read was filtered.
 
 * `YF:Z:LN`: the read was filtered because it had length less than or equal to
@@ -715,7 +715,7 @@ and the last (11th) field of the read's QSEQ record contains `1`.
 If a read could be filtered for more than one reason, the value `YF:Z` flag will
 reflect only one of those reasons.
 
-Alignment summmary
+Alignment summary
 ------------------
 
 When Bowtie 2 finishes running, it prints messages summarizing what happened. 
@@ -757,7 +757,7 @@ 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 `bowtie2` wrapper
 provides some key functionality, like the ability to handle compressed inputs,
-and the fucntionality for [`--un`], [`--al`] and related options.
+and the functionality for [`--un`], [`--al`] and related options.
 
 It is recommended that you always run the bowtie2 wrappers and not run the
 binaries directly.
@@ -1617,7 +1617,7 @@ be valid in that case.  If trimming options [`-3`] or [`-5`] are also used, the
 [`-I`] constraint is applied with respect to the untrimmed mates.
 
 The larger the difference between [`-I`] and [`-X`], the slower Bowtie 2 will
-run.  This is because larger differences bewteen [`-I`] and [`-X`] require that
+run.  This is because larger differences between [`-I`] and [`-X`] require that
 Bowtie 2 scan a larger window to determine if a concordant alignment exists.
 For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very
 efficient.
@@ -1643,7 +1643,7 @@ constraint is applied with respect to the untrimmed mates, not the trimmed
 mates.
 
 The larger the difference between [`-I`] and [`-X`], the slower Bowtie 2 will
-run.  This is because larger differences bewteen [`-I`] and [`-X`] require that
+run.  This is because larger differences between [`-I`] and [`-X`] require that
 Bowtie 2 scan a larger window to determine if a concordant alignment exists.
 For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very
 efficient.
@@ -1991,7 +1991,7 @@ Spec][SAM].  Specify `--rg` multiple times to set multiple fields.  See the
 </td><td>
 
 When printing secondary alignments, Bowtie 2 by default will write out the `SEQ`
-and `QUAL` strings.  Specifying this option causes Bowtie 2 to print an asterix
+and `QUAL` strings.  Specifying this option causes Bowtie 2 to print an asterisk
 in those fields instead.
 
 </td></tr>
@@ -2160,7 +2160,9 @@ left to right, the fields are:
     Note that the [SAM specification] disallows whitespace in the read name.
 	If the read name contains any whitespace characters, Bowtie 2 will truncate
 	the name at the first whitespace character.  This is similar to the
-	behavior of other tools.
+	behavior of other tools. The standard behavior of truncating at the first
+    whitespace can be suppressed with `--sam-noqname-trunc` at the expense of
+    generating non-standard SAM.
 
 2.  Sum of all applicable flags.  Flags relevant to Bowtie are:
 
@@ -2911,21 +2913,21 @@ Run the paired-end example:
 
     $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
 
-Use `samtools view` to convert the SAM file into a BAM file.  BAM is a the
+Use `samtools view` to convert the SAM file into a BAM file.  BAM is the
 binary format corresponding to the SAM text format.  Run:
 
     samtools view -bS eg2.sam > eg2.bam
 
 Use `samtools sort` to convert the BAM file to a sorted BAM file.
 
-    samtools sort eg2.bam eg2.sorted
+    samtools sort eg2.bam -o eg2.sorted.bam
 
 We now have a sorted BAM file called `eg2.sorted.bam`. Sorted BAM is a useful
 format because the alignments are (a) compressed, which is convenient for
 long-term storage, and (b) sorted, which is conveneint for variant discovery.
 To generate variant calls in VCF format, run:
 
-    samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -bvcg - > eg2.raw.bcf
+    samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -Ov - > eg2.raw.bcf
 
 Then to view the variants, run:
 
diff --git a/Makefile b/Makefile
index cca55fb..f85df39 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ prefix = /usr/local
 bindir = $(prefix)/bin
 
 INC =
-LIBS = -lreadline -ltermcap -lz
+LIBS = -lz
 GCC_PREFIX = $(shell dirname `which gcc`)
 GCC_SUFFIX =
 CC ?= $(GCC_PREFIX)/gcc$(GCC_SUFFIX)
@@ -499,7 +499,7 @@ perl-deps:
 		mkdir .perllib.tmp ; \
 		$$DL http://cpanmin.us | perl - -l $(CURDIR)/.perllib.tmp App::cpanminus local::lib ; \
 		eval `perl -I $(CURDIR)/.perllib.tmp/lib/perl5 -Mlocal::lib=$(CURDIR)/.perllib.tmp` ; \
-		cpanm Math::Random Clone Test::Deep Sys::Info ; \
+		cpanm --force Math::Random Clone Test::Deep Sys::Info ; \
 	fi
 
 .PHONY: test
diff --git a/NEWS b/NEWS
index de7e1a6..03506ba 100644
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,7 @@ Bowtie 2 NEWS
 
 Bowtie 2 is now available for download from the project website,
 http://bowtie-bio.sf.net/bowtie2.  2.0.0-beta1 is the first version released to
-the public and 2.3.1 is the latest version.  Bowtie 2 is licensed under
+the public and 2.3.2 is the latest version.  Bowtie 2 is licensed under
 the GPLv3 license.  See `LICENSE' file for details.
 
 Reporting Issues
@@ -16,6 +16,27 @@ Please report any issues using the Sourceforge bug tracker:
 Version Release History
 =======================
 
+Version 2.3.2 - May 05, 2017
+    * Added support for interleaved paired-end FASTQ inputs
+      (--interleaved)
+    * Now reports MREVERSE SAM flag for unaligned end when only one
+      end of a pair aligns
+    * Fixed issue where first character of some read names was
+      omitted from SAM output when using tabbed input formats
+    * Added --sam-no-qname-trunc option, which causes entire read
+      name, including spaces, to be written to SAM output.  This
+      violates SAM specification, but can be useful in applications
+      that immediately postprocess the SAM.
+    * Fixed compilation error caused by pointer comparison issue
+      in aligner_result.cpp
+    * Removed termcap and readline dependencies introduced in v2.3.1
+    * Fixed compilation issues caused by gzbuffer function when
+      compiling with zlib v1.2.3.5 and earlier. Users compiling against
+      these libraries will use the zlib default buffer size of 8Kb
+      when decompressing read files.
+    * Fixed issue that would cause Bowtie 2 hang when aligning FASTA
+      inputs with more than one thread
+
 Version 2.3.1 - Mar 04, 2017
 Please note that as of this release Bowtie 2 now has dependencies on zlib and readline libraries.
 Make sure that all dependencies are met before attempting to build from source.
diff --git a/VERSION b/VERSION
index 2bf1c1c..f90b1af 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.3.1
+2.3.2
diff --git a/aligner_bt.cpp b/aligner_bt.cpp
index 6247dd4..64ae15f 100644
--- a/aligner_bt.cpp
+++ b/aligner_bt.cpp
@@ -1595,13 +1595,15 @@ int BtBranchTracer::trySolution(
 		return BT_REJECTED_CORE_DIAG;
 	}
 	off = br->leftmostCol();
+	size_t trimBeg = br->uppermostRow();
+	size_t trimEnd = prob_.qrylen_ - prob_.row_ - 1;
 	score.score_ = prob_.targ_;
+	score.basesAligned_ = (int)(prob_.qrylen_ - trimBeg - trimEnd - ned.size());
+	score.edits_ = (int)ned.size();
 	score.ns_    = ns;
 	score.gaps_  = ngap;
 	res.alres.setScore(score);
 	res.alres.setRefNs(nrefns);
-	size_t trimBeg = br->uppermostRow();
-	size_t trimEnd = prob_.qrylen_ - prob_.row_ - 1;
 	assert_leq(trimBeg, prob_.qrylen_);
 	assert_leq(trimEnd, prob_.qrylen_);
 	TRefOff refoff = off + prob_.refoff_ + prob_.rect_->refl;
diff --git a/aligner_result.cpp b/aligner_result.cpp
index 2e8ebba..6697b97 100644
--- a/aligner_result.cpp
+++ b/aligner_result.cpp
@@ -930,7 +930,7 @@ void RedundantAlns::add(const AlnRes& res) {
 	assert(!cells_.empty());
 	TRefOff left = res.refoff(), right;
 	const size_t len = res.readExtentRows();
-        const size_t alignmentStart = res.trimmedLeft(true);
+	const size_t alignmentStart = res.trimmedLeft(true);
 	if(!res.fw()) {
 		const_cast<AlnRes&>(res).invertEdits();
 	}
@@ -981,7 +981,7 @@ bool RedundantAlns::overlap(const AlnRes& res) {
 	assert(!cells_.empty());
 	TRefOff left = res.refoff(), right;
 	const size_t len = res.readExtentRows();
-        const size_t alignmentStart = res.trimmedLeft(true);
+	const size_t alignmentStart = res.trimmedLeft(true);
 	if(!res.fw()) {
 		const_cast<AlnRes&>(res).invertEdits();
 	}
@@ -1050,11 +1050,11 @@ void AlnSetSumm::init(
 {
 	assert(rd1 != NULL || rd2 != NULL);
 	assert((rs1 == NULL) == (rs2 == NULL));
-	AlnScore best[2], secbest[2], bestPaired, secbestPaired;
+	AlnScore best[2], bestPaired;
 	size_t szs[2];
-	best[0].invalidate();    secbest[0].invalidate();
-	best[1].invalidate();    secbest[1].invalidate();
-	bestPaired.invalidate(); secbestPaired.invalidate();
+	best[0].invalidate();
+	best[1].invalidate();
+	bestPaired.invalidate();
 	bool paired = (rs1 != NULL && rs2 != NULL);
 	szs[0] = szs[1] = 0;
 	// Set bestPaired and secbestPaired
@@ -1063,20 +1063,6 @@ void AlnSetSumm::init(
 		assert_eq(rs1->size(), rs2->size());
 		szs[0] = szs[1] = rs1->size();
 		assert_gt(szs[0], 0);
-		for(size_t i = 0; i < rs1->size(); i++) {
-			// Combine mate scores into a concordant alignment score by
-			// summing them
-			AlnScore sc = (*rs1)[i].score() + (*rs2)[i].score();
-			if(sc > bestPaired) {
-				secbestPaired = bestPaired;
-				bestPaired = sc;
-				assert(VALID_AL_SCORE(bestPaired));
-			} else if(sc > secbestPaired) {
-				secbestPaired = sc;
-				assert(VALID_AL_SCORE(bestPaired));
-				assert(VALID_AL_SCORE(secbestPaired));
-			}
-		}
 	}
 	// Set best[] and secbest[]
 	for(int j = 0; j < 2; j++) {
@@ -1085,27 +1071,9 @@ void AlnSetSumm::init(
 			continue;
 		}
 		szs[j] = rs->size();
-		for(size_t i = 0; i < rs->size(); i++) {
-			AlnScore sc = (*rs)[i].score();
-			if(sc > best[j]) {
-				secbest[j] = best[j];
-				best[j] = sc;
-				assert(VALID_AL_SCORE(best[j]));
-			} else if(sc > secbest[j]) {
-				secbest[j] = sc;
-				assert(VALID_AL_SCORE(best[j]));
-				assert(VALID_AL_SCORE(secbest[j]));
-			}
-		}
 	}
 	if(szs[0] > 0 || szs[1] > 0) {
 		init(
-			best[0],
-			secbest[0],
-			best[1],
-			secbest[1],
-			bestPaired,
-			secbestPaired,
 			(szs[0] == 0) ? 0 : (szs[0] - 1),
 			(szs[1] == 0) ? 0 : (szs[1] - 1),
 			paired,
@@ -1130,7 +1098,7 @@ bool AlnFlags::printYF(BTString& o, bool first) const {
 	else if(!nfilt_  ) flag = "NS";
 	else if(!scfilt_ ) flag = "SC";
 	else if(!qcfilt_ ) flag = "QC";
-	if(flag > 0) {
+	if(flag[0] != '\0') {
 		if(!first) o.append('\t');
 		o.append("YF:Z:");
 		o.append(flag);
diff --git a/aligner_result.h b/aligner_result.h
index 203999e..ae47d94 100644
--- a/aligner_result.h
+++ b/aligner_result.h
@@ -63,8 +63,10 @@ public:
 	/**
 	 * Gapped scores are invalid until proven valid.
 	 */
-	inline AlnScore(TAlScore score, TAlScore ns, TAlScore gaps) {
+	inline AlnScore(TAlScore score, int basesAligned, int edits, TAlScore ns, TAlScore gaps) {
 		score_ = score;
+		basesAligned_ = basesAligned;
+		edits_ = edits;
 		ns_ = ns;
 		gaps_ = gaps;
 		assert(valid());
@@ -74,7 +76,7 @@ public:
 	 * Reset the score.
 	 */
 	void reset() {
-		score_ = ns_ = gaps_ = 0;
+		score_ = basesAligned_ = edits_ = ns_ = gaps_ = 0;
 	}
 
 	/**
@@ -99,6 +101,8 @@ public:
 	 */
 	inline void invalidate() {
 		score_ = MIN_I64;
+		edits_ = basesAligned_ = std::numeric_limits<int>::min();
+		ns_ = gaps_ = 0;
 		assert(!valid());
 	}
 	
@@ -139,7 +143,9 @@ public:
 	inline AlnScore& operator=(const AlnScore& o) {
 		// Profiling shows many cache misses on following lines
 		gaps_  = o.gaps_;
+		basesAligned_ = o.basesAligned_;
 		ns_    = o.ns_;
+		edits_ = o.edits_;
 		score_ = o.score_;
 		assert_lt(ns_, 0x7fffffff);
 		return *this;
@@ -187,33 +193,15 @@ public:
 	}
 
 	/**
-	 * Return true iff this score is <= score o.
-	 */
-	inline bool operator<=(const AlnScore& o) const {
-		return !operator>(o);
-	}
-
-	/**
-	 * Calculate difference between two SwScores.
-	 */
-	inline AlnScore operator-(const AlnScore& o) const {
-		if(!VALID_AL_SCORE(*this)) return *this;
-		AlnScore s; 
-		s.gaps_ = gaps_ - o.gaps_;
-		s.ns_ = ns_;
-		s.score_ = score_ - o.score_;
-		assert_lt(s.ns_, 0x7fffffff);
-		return s;
-	}
-
-	/**
 	 * Calculate sum of two SwScores.
 	 */
 	inline AlnScore operator+(const AlnScore& o) const {
 		if(!VALID_AL_SCORE(*this)) return *this;
 		AlnScore s;
 		s.gaps_ = gaps_ + o.gaps_;
-		s.ns_ = ns_;
+		s.basesAligned_ = basesAligned_ + o.basesAligned_;
+		s.ns_ = ns_ + o.ns_;
+		s.edits_ = edits_ + o.edits_;
 		s.score_ = score_ + o.score_;
 		assert_lt(s.ns_, 0x7fffffff);
 		return s;
@@ -225,50 +213,30 @@ public:
 	inline AlnScore operator+=(const AlnScore& o) {
 		if(VALID_AL_SCORE(*this)) {
 			gaps_ += o.gaps_;
+			basesAligned_ += o.basesAligned_;
 			score_ += o.score_;
+			edits_ += o.edits_;
+			ns_ += o.ns_;
 		}
 		return (*this);
 	}
 
-	/**
-	 * Subtract given SwScore from this one.
-	 */
-	inline AlnScore operator-=(const AlnScore& o) {
-		if(VALID_AL_SCORE(*this)) {
-			gaps_ -= o.gaps_;
-			score_ -= o.score_;
-		}
-		return (*this);
-	}
-
-	/**
-	 * Calculate difference between two SwScores.
-	 */
-	inline AlnScore operator-(int o) const {
-		return (*this) + -o;
-	}
-
-	/**
-	 * Calculate sum of a SwScore and an integer.
-	 */
-	inline AlnScore operator+(int o) const {
-		if(!VALID_AL_SCORE(*this)) return *this;
-		AlnScore s;
-		s.gaps_ = gaps_;
-		s.ns_ = ns_;
-		s.score_ = score_ + o;
-		assert_lt(s.ns_, 0x7fffffff);
-		return s;
-	}
-
 	TAlScore score()   const { return  score_; }
 	TAlScore penalty() const { return -score_; }
 	TAlScore gaps()    const { return  gaps_;  }
 	TAlScore ns()      const { return  ns_;    }
+	int basesAligned() const { return  basesAligned_; }
+	int nedit()        const { return  edits_; }
 
 	// Score accumulated so far (penalties are subtracted starting at 0)
 	TAlScore score_;
 	
+	// Number of bases matching between the read and reference
+	int basesAligned_;
+	
+	// Edit distance
+	int edits_;
+	
 	// Ns accumulated so far.  An N opposite a non-gap counts as 1 N
 	// (even if it's N-to-N)
 	TAlScore ns_;
@@ -378,6 +346,7 @@ public:
 		mixedMode_  = mixedMode;
 		primary_    = primary;
 		oppAligned_ = oppAligned;
+		oppFw_     = oppFw;
 	}
 
 	/**
@@ -447,7 +416,7 @@ public:
 	inline bool isMixedMode() const {
 		return mixedMode_;
 	}
-	
+
 	/**
 	 * Return true iff the alignment params are such that it's possible for a
 	 * read to be suppressed for being repetitive.
@@ -526,6 +495,10 @@ public:
 		return oppAligned_;
 	}
 
+	inline bool isOppFw() const {
+		return oppFw_;
+	}
+
 protected:
 
 	// See ALN_FLAG_PAIR_* above
@@ -557,6 +530,9 @@ protected:
 
 	// True iff the opposite mate aligned
 	bool oppAligned_;
+
+	// True if opposite mate aligned in the forward direction
+	bool oppFw_;
 };
 
 static inline ostream& operator<<(ostream& os, const AlnScore& o) {
@@ -1708,12 +1684,6 @@ public:
 	}
 
 	explicit AlnSetSumm(
-		AlnScore best1,
-		AlnScore secbest1,
-		AlnScore best2,
-		AlnScore secbest2,
-		AlnScore bestPaired,
-		AlnScore secbestPaired,
 		TNumAlns other1,
 		TNumAlns other2,
 		bool     paired,
@@ -1723,12 +1693,6 @@ public:
 		TRefOff  orefoff)
 	{
 		init(
-			best1,
-			secbest1,
-			best2,
-			secbest2,
-			bestPaired,
-			secbestPaired,
 			other1,
 			other2,
 			paired,
@@ -1742,12 +1706,22 @@ public:
 	 * Set to uninitialized state.
 	 */
 	void reset() {
-		best1_.invalidate();
-		secbest1_.invalidate();
-		best2_.invalidate();
-		secbest2_.invalidate();
-		bestPaired_.invalidate();
-		secbestPaired_.invalidate();
+		bestUScore_.invalidate();
+		bestP1Score_.invalidate();
+		bestP2Score_.invalidate();
+		bestCScore_.invalidate();
+		bestUDist_.invalidate();
+		bestP1Dist_.invalidate();
+		bestP2Dist_.invalidate();
+		bestCDist_.invalidate();
+		bestUnchosenUScore_.invalidate();
+		bestUnchosenP1Score_.invalidate();
+		bestUnchosenP2Score_.invalidate();
+		bestUnchosenCScore_.invalidate();
+		bestUnchosenUDist_.invalidate();
+		bestUnchosenP1Dist_.invalidate();
+		bestUnchosenP2Dist_.invalidate();
+		bestUnchosenCDist_.invalidate();
 		other1_ = other2_ = 0;
 		paired_ = false;
 		exhausted1_ = exhausted2_ = false;
@@ -1771,12 +1745,6 @@ public:
 	 * Initialize given fields.  See constructor for how fields are set.
 	 */
 	void init(
-		AlnScore best1,
-		AlnScore secbest1,
-		AlnScore best2,
-		AlnScore secbest2,
-		AlnScore bestPaired,
-		AlnScore secbestPaired,
 		TNumAlns other1,
 		TNumAlns other2,
 		bool     paired,
@@ -1785,12 +1753,6 @@ public:
 		TRefId   orefid,
 		TRefOff  orefoff)
 	{
-		best1_         = best1;
-		secbest1_      = secbest1;
-		best2_         = best2;
-		secbest2_      = secbest2;
-		bestPaired_    = bestPaired;
-		secbestPaired_ = secbestPaired;
 		other1_        = other1;
 		other2_        = other2;
 		paired_        = paired;
@@ -1806,7 +1768,7 @@ public:
 	 */
 	bool empty() const {
 		assert(repOk());
-		return !VALID_AL_SCORE(best1_);
+		return !VALID_AL_SCORE(bestScore(true));
 	}
 	
 #ifndef NDEBUG
@@ -1814,20 +1776,10 @@ public:
 	 * Check that the summary is internally consistent.
 	 */
 	bool repOk() const {
-		assert(other1_ == 0 ||  VALID_AL_SCORE(secbest1_));
-		assert(other1_ != 0 || !VALID_AL_SCORE(secbest1_));
-		assert(other2_ == 0 ||  VALID_AL_SCORE(secbest2_));
-		assert(other2_ != 0 || !VALID_AL_SCORE(secbest2_));
 		return true;
 	}
 #endif
 	
-	AlnScore best1()         const { return best1_;         }
-	AlnScore secbest1()      const { return secbest1_;      }
-	AlnScore best2()         const { return best2_;         }
-	AlnScore secbest2()      const { return secbest2_;      }
-	AlnScore bestPaired()    const { return bestPaired_;    }
-	AlnScore secbestPaired() const { return secbestPaired_; }
 	TNumAlns other1()        const { return other1_;        }
 	TNumAlns other2()        const { return other2_;        }
 	bool     paired()        const { return paired_;        }
@@ -1835,15 +1787,53 @@ public:
 	bool     exhausted2()    const { return exhausted2_;    }
 	TRefId   orefid()        const { return orefid_;        }
 	TRefOff  orefoff()       const { return orefoff_;       }
-	AlnScore bestUnchosen1() const { return bestUnchosen1_; }
-	AlnScore bestUnchosen2() const { return bestUnchosen2_; }
-	AlnScore bestUnchosenC() const { return bestUnchosenC_; }
+	
+	AlnScore bestUScore()  const { return bestUScore_;  }
+	AlnScore bestP1Score() const { return bestP1Score_; }
+	AlnScore bestP2Score() const { return bestP2Score_; }
+	AlnScore bestCScore()  const { return bestCScore_;  }
+	AlnScore bestUDist()   const { return bestUDist_;  }
+	AlnScore bestP1Dist()  const { return bestP1Dist_; }
+	AlnScore bestP2Dist()  const { return bestP2Dist_; }
+	AlnScore bestCDist()   const { return bestCDist_;  }
+
+	AlnScore bestUnchosenUScore()  const { return bestUnchosenUScore_;  }
+	AlnScore bestUnchosenP1Score() const { return bestUnchosenP1Score_; }
+	AlnScore bestUnchosenP2Score() const { return bestUnchosenP2Score_; }
+	AlnScore bestUnchosenCScore()  const { return bestUnchosenCScore_;  }
+	AlnScore bestUnchosenUDist()   const { return bestUnchosenUDist_;  }
+	AlnScore bestUnchosenP1Dist()  const { return bestUnchosenP1Dist_; }
+	AlnScore bestUnchosenP2Dist()  const { return bestUnchosenP2Dist_; }
+	AlnScore bestUnchosenCDist()   const { return bestUnchosenCDist_;  }
 
 	/**
-	 * Return best alignment score for 
+	 * Return best unchosen alignment score for end 1 or 2 of a pair.
 	 */
-	AlnScore bestUnchosen(bool mate1) const {
-		return mate1 ? bestUnchosen1_ : bestUnchosen2_;
+	AlnScore bestUnchosenPScore(bool mate1) const {
+		return mate1 ? bestUnchosenP1Score_ : bestUnchosenP2Score_;
+	}
+
+	/**
+	 * Return best unchosen edit distance for end 1 or 2 of a pair.
+	 */
+	AlnScore bestUnchosenPDist(bool mate1) const {
+		return mate1 ? bestUnchosenP1Dist_ : bestUnchosenP2Dist_;
+	}
+	
+	/**
+	 * Return best unchosen alignment score for end 1 or 2 whether
+	 * the read is a pair or not.
+	 */
+	AlnScore bestUnchosenScore(bool mate1) const {
+		return paired_ ? (mate1 ? bestUnchosenP1Score_ : bestUnchosenP2Score_) : bestUnchosenUScore();
+	}
+
+	/**
+	 * Return best unchosen edit distance for end 1 or 2 whether
+	 * the read is a pair or not.
+	 */
+	AlnScore bestUnchosenDist(bool mate1) const {
+		return paired_ ? (mate1 ? bestUnchosenP1Dist_ : bestUnchosenP2Dist_) : bestUnchosenUDist();
 	}
 
 	bool exhausted(bool mate1) const {
@@ -1851,47 +1841,76 @@ public:
 	}
 	
 	/**
-	 * Return best alignment score for mate 1 or mate 2, depending on argument.
+	 * Return best alignment score for end 1 or 2 whether the read is
+	 * a pair or not.
 	 */
-	AlnScore best(bool mate1) const {
-		return mate1 ? best1_ : best2_;
+	AlnScore bestScore(bool mate1) const {
+		return paired_ ? (mate1 ? bestP1Score_ : bestP2Score_) : bestUScore_;
 	}
-	
+
 	/**
-	 * Return the second-best score for the specified mate.  If the alignment
-	 * is paired and the specified mate aligns uniquely, return an invalid
-	 * second-best score.  This allows us to treat mates separately, so that
-	 * repetitive paired-end alignments don't trump potentially unique unpaired
-	 * alignments.
+	 * Return best edit distance for end 1 or 2 whether the read is
+	 * a pair or not.
 	 */
-	AlnScore secbest(bool mate1) const {
-		return mate1 ? secbest1_ : secbest2_;
+	AlnScore bestDist(bool mate1) const {
+		return paired_ ? (mate1 ? bestP1Dist_ : bestP2Dist_) : bestUDist_;
 	}
 	
 	/**
 	 * Add information about unchosen alignments to the summary.  This is
-	 * helpful for concordant alignments; when calculating mapping quality,
-	 * we might like to know about how good the unchosen mate and pair
-	 * alignments were.
-	 */
-	void setUnchosen(
-		AlnScore bestUnchosen1,
-		AlnScore bestUnchosen2,
-		AlnScore bestUnchosenC)
+	 * in its own "setter" function because it's not known until we've
+	 * picked which alignment to report, which is after we've initially
+	 * constructed the summary.
+	 *
+	 * Info about unchosen alignments is used for predicting mapping
+	 * quality.
+	 */
+	void setBest(
+		AlnScore bestUScore,
+		AlnScore bestUDist,
+		AlnScore bestP1Score,
+		AlnScore bestP1Dist,
+		AlnScore bestP2Score,
+		AlnScore bestP2Dist,
+		AlnScore bestCScore,
+		AlnScore bestCDist,
+		AlnScore bestUnchosenUScore,
+		AlnScore bestUnchosenUDist,
+		AlnScore bestUnchosenP1Score,
+		AlnScore bestUnchosenP1Dist,
+		AlnScore bestUnchosenP2Score,
+		AlnScore bestUnchosenP2Dist,
+		AlnScore bestUnchosenCScore,
+		AlnScore bestUnchosenCDist)
 	{
-		bestUnchosen1_ = bestUnchosen1;
-		bestUnchosen2_ = bestUnchosen2;
-		bestUnchosenC_ = bestUnchosenC;
+		assert(bestUScore.valid() == bestUDist.valid());
+		assert(bestP1Score.valid() == bestP1Dist.valid());
+		assert(bestP2Score.valid() == bestP2Dist.valid());
+		assert(bestCScore.valid() == bestCDist.valid());
+		assert(bestUnchosenUScore.valid() == bestUnchosenUDist.valid());
+		assert(bestUnchosenP1Score.valid() == bestUnchosenP1Dist.valid());
+		assert(bestUnchosenP2Score.valid() == bestUnchosenP2Dist.valid());
+		assert(bestUnchosenCScore.valid() == bestUnchosenCDist.valid());
+		bestUScore_ = bestUScore;
+		bestUDist_ = bestUDist;
+		bestP1Score_ = bestP1Score;
+		bestP1Dist_ = bestP1Dist;
+		bestP2Score_ = bestP2Score;
+		bestP2Dist_ = bestP2Dist;
+		bestCScore_ = bestCScore;
+		bestCDist_ = bestCDist;
+		bestUnchosenUScore_ = bestUnchosenUScore;
+		bestUnchosenUDist_ = bestUnchosenUDist;
+		bestUnchosenP1Score_ = bestUnchosenP1Score;
+		bestUnchosenP1Dist_ = bestUnchosenP1Dist;
+		bestUnchosenP2Score_ = bestUnchosenP2Score;
+		bestUnchosenP2Dist_ = bestUnchosenP2Dist;
+		bestUnchosenCScore_ = bestUnchosenCScore;
+		bestUnchosenCDist_ = bestUnchosenCDist;
 	}
 	
 protected:
 	
-	AlnScore bestPaired_;    // best full-alignment score found for this read
-	AlnScore secbestPaired_; // second-best
-	AlnScore best1_;         // best full-alignment score found for this read
-	AlnScore secbest1_;      // second-best
-	AlnScore best2_;         // best full-alignment score found for this read
-	AlnScore secbest2_;      // second-best
 	TNumAlns other1_;        // # more alignments within N points of second-best
 	TNumAlns other2_;        // # more alignments within N points of second-best
 	bool     paired_;        // results are paired
@@ -1900,9 +1919,23 @@ protected:
 	TRefId   orefid_;
 	TRefOff  orefoff_;
 
-	AlnScore bestUnchosen1_;
-	AlnScore bestUnchosen2_;
-	AlnScore bestUnchosenC_;
+	AlnScore bestUScore_;
+	AlnScore bestUDist_;
+	AlnScore bestP1Score_;
+	AlnScore bestP1Dist_;
+	AlnScore bestP2Score_;
+	AlnScore bestP2Dist_;
+	AlnScore bestCScore_;
+	AlnScore bestCDist_;
+
+	AlnScore bestUnchosenUScore_;
+	AlnScore bestUnchosenUDist_;
+	AlnScore bestUnchosenP1Score_;
+	AlnScore bestUnchosenP1Dist_;
+	AlnScore bestUnchosenP2Score_;
+	AlnScore bestUnchosenP2Dist_;
+	AlnScore bestUnchosenCScore_;
+	AlnScore bestUnchosenCDist_;
 };
 
 #endif
diff --git a/aligner_seed.cpp b/aligner_seed.cpp
index 7050a5a..04006e0 100644
--- a/aligner_seed.cpp
+++ b/aligner_seed.cpp
@@ -379,7 +379,9 @@ pair<int, int> SeedAligner::instantiateSeeds(
 	bool norc,                 // don't align revcomp read
 	AlignmentCacheIface& cache,// holds some seed hits from previous reads
 	SeedResults& sr,           // holds all the seed hits
-	SeedSearchMetrics& met)    // metrics
+	SeedSearchMetrics& met,    // metrics
+	pair<int, int>& instFw,
+	pair<int, int>& instRc)
 {
 	assert(!seeds.empty());
 	assert_gt(read.length(), 0);
@@ -445,6 +447,7 @@ pair<int, int> SeedAligner::instantiateSeeds(
 				{
 					// Can we fill this seed hit in from the cache?
 					ret.first++;
+					if(fwi == 0) { instFw.first++; } else { instRc.first++; }
 				} else {
 					// Seed may fail to instantiate if there are Ns
 					// that prevent it from matching
diff --git a/aligner_seed.h b/aligner_seed.h
index 89bbe6c..8d6a6c8 100644
--- a/aligner_seed.h
+++ b/aligner_seed.h
@@ -670,10 +670,12 @@ public:
 		numRanges_ += qv.numRanges();
 		if(qv.numRanges() > 0) {
 			nonzTot_++;
-			if(qv.numRanges() == 1 and qv.numElts() == 1) {
+			if(qv.numRanges() == 1 && qv.numElts() == 1) {
 				uniTot_++;
+				uniTotS_[seedFw ? 0 : 1]++;
 			} else {
 				repTot_++;
+				repTotS_[seedFw ? 0 : 1]++;
 			}
 		}
 		assert(repOk(&ac));
@@ -729,8 +731,8 @@ public:
 		seqFw_.clear();
 		seqRc_.clear();
 		nonzTot_ = 0;
-		uniTot_ = 0;
-		repTot_ = 0;
+		uniTot_ = uniTotS_[0] = uniTotS_[1] = 0;
+		repTot_ = repTotS_[0] = repTotS_[1] = 0;
 		nonzFw_ = 0;
 		nonzRc_ = 0;
 		numOffs_ = 0;
@@ -827,11 +829,25 @@ public:
 	}
 
 	/**
-	 * Return fraction of seeds that align repetitively.
+	 * Return fraction of seeds that aligned uniquely on the given strand.
+	 */
+	size_t numUniqueSeedsStrand(bool fw) const {
+		return uniTotS_[fw ? 0 : 1];
+	}
+
+	/**
+	 * Return fraction of seeds that align repetitively on the given strand.
 	 */
 	size_t numRepeatSeeds() const {
 		return repTot_;
 	}
+
+	/**
+	 * Return fraction of seeds that align repetitively.
+	 */
+	size_t numRepeatSeedsStrand(bool fw) const {
+		return repTotS_[fw ? 0 : 1];
+	}
 	
 	/**
 	 * Return median of all the non-zero per-seed # hits
@@ -1329,7 +1345,9 @@ protected:
 	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              uniTotS_[2];  // # offsets unique hit on each strand
 	size_t              repTot_;      // # offsets repetitive hit
+	size_t              repTotS_[2];  // # offsets repetitive hit on each strand
 	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
@@ -1473,7 +1491,9 @@ public:
 		bool norc,                  // don't align revcomp read
 		AlignmentCacheIface& cache, // holds some seed hits from previous reads
 		SeedResults& sr,            // holds all the seed hits
-		SeedSearchMetrics& met);    // metrics
+		SeedSearchMetrics& met,     // metrics
+		std::pair<int, int>& instFw,
+		std::pair<int, int>& instRc);
 
 	/**
 	 * Iterate through the seeds that cover the read and initiate a
diff --git a/aligner_seed2.h b/aligner_seed2.h
index b184dbb..4e7c927 100644
--- a/aligner_seed2.h
+++ b/aligner_seed2.h
@@ -2235,6 +2235,8 @@ public:
 		}
 		AlnScore asc(
 			-dr.sink().bestPenalty(),  // numeric score
+			dr.query().length() - edits.size(),
+			(int)edits.size(),         // # edits
 			ns,                        // # Ns
 			ngap);                     // # gaps
 		rs.init(
diff --git a/aligner_sw.cpp b/aligner_sw.cpp
index d3d3855..3f7a484 100644
--- a/aligner_sw.cpp
+++ b/aligner_sw.cpp
@@ -431,7 +431,6 @@ int SwAligner::ungappedAlign(
 		// Got a result!  Fill in the rest of the result object.  
 	}
 	// Now fill in the edits
-	res.alres.setScore(AlnScore(score, ns, 0));
 	assert_geq(rowf, rowi);
 	EList<Edit>& ned = res.alres.ned();
 	size_t refns = 0;
@@ -450,6 +449,9 @@ int SwAligner::ungappedAlign(
 			}
 		}
 	}
+	res.alres.setScore(AlnScore(score,
+								(int)(rd.length() - ned.size()),
+								(int)ned.size(), ns, 0));
 	assert(Edit::repOk(ned, rd));
 	bool fw = coord.fw();
 	assert_leq(rowf, len-1);
@@ -1020,7 +1022,10 @@ bool SwAligner::nextAlignment(
 					// differences in how they handle marking cells as
 					// reported-through.
 					assert(cural_ > 0 || !ret || ret == ret2);
-					assert(cural_ > 0 || !ret || res.alres == res2.alres);
+					// TODO: I find that sometimes there is disagreement here
+					// where the alignments are in the same place with
+					// identical scores, but one is more soft-trimmed than the other
+					//assert(cural_ > 0 || !ret || res.alres == res2.alres);
 				}
 				if(!checkpointed && sse16succ_) {
 					SwResult res2;
diff --git a/aligner_sw_driver.cpp b/aligner_sw_driver.cpp
index 918b71d..c46db61 100644
--- a/aligner_sw_driver.cpp
+++ b/aligner_sw_driver.cpp
@@ -1003,7 +1003,9 @@ int SwDriver::extendSeeds(
 					resEe_.alres.reset();
 					const EEHit& h = eehits_[i];
 					assert_leq(h.score, perfectScore);
-					resEe_.alres.setScore(AlnScore(h.score, h.ns(), 0));
+					resEe_.alres.setScore(AlnScore(h.score,
+						(int)(rdlen - h.mms()),
+						h.mms(), h.ns(), 0));
 					resEe_.alres.setShape(
 						refcoord.ref(),  // ref id
 						refcoord.off(),  // 0-based ref offset
@@ -1706,7 +1708,10 @@ int SwDriver::extendSeedsPaired(
 					resEe_.alres.reset();
 					const EEHit& h = eehits_[i];
 					assert_leq(h.score, perfectScore);
-					resEe_.alres.setScore(AlnScore(h.score, h.ns(), 0));
+					resEe_.alres.setScore(AlnScore(
+						h.score,
+						(int)(rdlen - h.mms()),
+						h.mms(), h.ns(), 0));
 					resEe_.alres.setShape(
 						refcoord.ref(),  // ref id
 						refcoord.off(),  // 0-based ref offset
diff --git a/aligner_swsse_ee_i16.cpp b/aligner_swsse_ee_i16.cpp
index f329364..c49199f 100644
--- a/aligner_swsse_ee_i16.cpp
+++ b/aligner_swsse_ee_i16.cpp
@@ -1853,6 +1853,8 @@ bool SwAligner::backtraceNucleotidesEnd2EndSseI16(
 	off = col;
 	assert_lt(col + (size_t)rfi_, (size_t)rff_);
 	score.gaps_ = gaps;
+	score.edits_ = (int)ned.size();
+	score.basesAligned_ = (int)(rdf_ - rdi_ - trimBeg - trimEnd - score.edits_);
 	res.alres.setScore(score);
 	res.alres.setShape(
 		refidx_,                  // ref id
diff --git a/aligner_swsse_ee_u8.cpp b/aligner_swsse_ee_u8.cpp
index 6f68a47..a309f78 100644
--- a/aligner_swsse_ee_u8.cpp
+++ b/aligner_swsse_ee_u8.cpp
@@ -1845,6 +1845,8 @@ bool SwAligner::backtraceNucleotidesEnd2EndSseU8(
 	off = col;
 	assert_lt(col + (size_t)rfi_, (size_t)rff_);
 	score.gaps_ = gaps;
+	score.edits_ = (int)ned.size();
+	score.basesAligned_ = (int)(rdf_ - rdi_ - trimBeg - trimEnd - score.edits_);
 	res.alres.setScore(score);
 	res.alres.setShape(
 		refidx_,                  // ref id
diff --git a/aligner_swsse_loc_i16.cpp b/aligner_swsse_loc_i16.cpp
index 1887bd5..9330aa2 100644
--- a/aligner_swsse_loc_i16.cpp
+++ b/aligner_swsse_loc_i16.cpp
@@ -2219,6 +2219,8 @@ bool SwAligner::backtraceNucleotidesLocalSseI16(
 	off = col;
 	assert_lt(col + (size_t)rfi_, (size_t)rff_);
 	score.gaps_ = gaps;
+	score.edits_ = (int)ned.size();
+	score.basesAligned_ = (int)(rdf_ - rdi_ - trimBeg - trimEnd - score.edits_);
 	res.alres.setScore(score);
 	res.alres.setShape(
 		refidx_,                  // ref id
diff --git a/aligner_swsse_loc_u8.cpp b/aligner_swsse_loc_u8.cpp
index 9c31e27..b8d8360 100644
--- a/aligner_swsse_loc_u8.cpp
+++ b/aligner_swsse_loc_u8.cpp
@@ -2212,6 +2212,8 @@ bool SwAligner::backtraceNucleotidesLocalSseU8(
 	off = col;
 	assert_lt(col + (size_t)rfi_, (size_t)rff_);
 	score.gaps_ = gaps;
+	score.edits_ = (int)ned.size();
+	score.basesAligned_ = (int)(rdf_ - rdi_ - trimBeg - trimEnd - score.edits_);
 	res.alres.setScore(score);
 	res.alres.setShape(
 		refidx_,                  // ref id
diff --git a/aln_sink.cpp b/aln_sink.cpp
index d3afd9f..de65b64 100644
--- a/aln_sink.cpp
+++ b/aln_sink.cpp
@@ -715,16 +715,52 @@ void AlnSinkWrap::finishRead(
 				rd1_, rd2_, &rs1_, &rs2_, &rs1u_, &rs2u_,
 				exhaust1, exhaust2, -1, -1);
 			// Sort by score then pick from low to high
-			AlnScore bestUnchosen1, bestUnchosen2, bestUnchosenC;
+			AlnScore bestUScore, bestP1Score, bestP2Score, bestCScore;
+			AlnScore bestUDist, bestP1Dist, bestP2Dist, bestCDist;
+			AlnScore bestUnchosenUScore, bestUnchosenP1Score, bestUnchosenP2Score, bestUnchosenCScore;
+			AlnScore bestUnchosenUDist, bestUnchosenP1Dist, bestUnchosenP2Dist, bestUnchosenCDist;
+			// TODO: should probably package these variables up so it's not
+			// such a pain to pass them around
 			size_t off = selectByScore(
 				&rs1_, &rs2_,
 				nconcord, select1_,
 				&rs1u_, &rs2u_,
-				bestUnchosen1, bestUnchosen2, bestUnchosenC,
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist,
 				rnd);
-			concordSumm.setUnchosen(bestUnchosen1, bestUnchosen2, bestUnchosenC);
-			assert(concordSumm.best(true).valid());
-			assert(concordSumm.best(false).valid());
+			concordSumm.setBest(
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist);
+			assert(concordSumm.bestScore(true).valid());
+			assert(concordSumm.bestScore(false).valid());
 			assert_lt(off, rs1_.size());
 			const AlnRes *rs1 = &rs1_[off];
 			const AlnRes *rs2 = &rs2_[off];
@@ -848,13 +884,48 @@ void AlnSinkWrap::finishRead(
 				assert(rs1_[i].isFraglenSet() == rs2_[i].isFraglenSet());
 				assert(!rs1_[i].isFraglenSet() || abs(rs1_[i].fragmentLength()) == abs(rs2_[i].fragmentLength()));
 			}
-			AlnScore bestUnchosen1, bestUnchosen2, bestUnchosenC;
+			AlnScore bestUScore, bestP1Score, bestP2Score, bestCScore;
+			AlnScore bestUDist, bestP1Dist, bestP2Dist, bestCDist;
+			AlnScore bestUnchosenUScore, bestUnchosenP1Score, bestUnchosenP2Score, bestUnchosenCScore;
+			AlnScore bestUnchosenUDist, bestUnchosenP1Dist, bestUnchosenP2Dist, bestUnchosenCDist;
 			ASSERT_ONLY(size_t off =) selectByScore(
 				&rs1_, &rs2_,
 				ndiscord, select1_,
 				&rs1u_, &rs2u_,
-				bestUnchosen1, bestUnchosen2, bestUnchosenC,
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist,
 				rnd);
+			discordSumm.setBest(
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist);
 			assert_eq(0, off);
 			assert(!select1_.empty());
 			g_.reportHits(
@@ -984,9 +1055,46 @@ void AlnSinkWrap::finishRead(
 				rd1_, NULL, NULL, NULL, &rs1u_, NULL,
 				exhaust1, exhaust2, -1, -1);
 			// Sort by score then pick from low to high
-			AlnScore tmp;
+			AlnScore bestUScore, bestP1Score, bestP2Score, bestCScore;
+			AlnScore bestUDist, bestP1Dist, bestP2Dist, bestCDist;
+			AlnScore bestUnchosenUScore, bestUnchosenP1Score, bestUnchosenP2Score, bestUnchosenCScore;
+			AlnScore bestUnchosenUDist, bestUnchosenP1Dist, bestUnchosenP2Dist, bestUnchosenCDist;
 			size_t off = selectByScore(
-				&rs1u_, NULL, nunpair1, select1_, NULL, NULL, tmp, tmp, tmp, rnd);
+				&rs1u_, NULL, nunpair1, select1_, NULL, NULL,
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist,
+				rnd);
+			summ1.setBest(
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist);
 			repRs1 = &rs1u_[off];
 		} else if(rd1_ != NULL) {
 			// Mate 1 failed to align - don't do anything yet.  First we want
@@ -1000,9 +1108,46 @@ void AlnSinkWrap::finishRead(
 				NULL, rd2_, NULL, NULL, NULL, &rs2u_,
 				exhaust1, exhaust2, -1, -1);
 			// Sort by score then pick from low to high
-			AlnScore tmp;
+			AlnScore bestUScore, bestP1Score, bestP2Score, bestCScore;
+			AlnScore bestUDist, bestP1Dist, bestP2Dist, bestCDist;
+			AlnScore bestUnchosenUScore, bestUnchosenP1Score, bestUnchosenP2Score, bestUnchosenCScore;
+			AlnScore bestUnchosenUDist, bestUnchosenP1Dist, bestUnchosenP2Dist, bestUnchosenCDist;
 			size_t off = selectByScore(
-				&rs2u_, NULL, nunpair2, select2_, NULL, NULL, tmp, tmp, tmp, rnd);
+				&rs2u_, NULL, nunpair2, select2_, NULL, NULL,
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist,
+				rnd);
+			summ2.setBest(
+				bestUScore,
+				bestUDist,
+				bestP1Score,
+				bestP1Dist,
+				bestP2Score,
+				bestP2Dist,
+				bestCScore,
+				bestCDist,
+				bestUnchosenUScore,
+				bestUnchosenUDist,
+				bestUnchosenP1Score,
+				bestUnchosenP1Dist,
+				bestUnchosenP2Score,
+				bestUnchosenP2Dist,
+				bestUnchosenCScore,
+				bestUnchosenCDist);
 			repRs2 = &rs2u_[off];
 		} else if(rd2_ != NULL) {
 			// Mate 2 failed to align - don't do anything yet.  First we want
@@ -1317,9 +1462,22 @@ size_t AlnSinkWrap::selectByScore(
 	EList<size_t>&       select, // prioritized list to put results in
 	const EList<AlnRes>* rs1u,   // alignments to select from (mate 1)
 	const EList<AlnRes>* rs2u,   // alignments to select from (mate 2, or NULL)
-	AlnScore&            bestUnchosen1,
-	AlnScore&            bestUnchosen2,
-	AlnScore&            bestUnchosenC,
+	AlnScore&            bestUScore,
+	AlnScore&            bestUDist,
+	AlnScore&            bestP1Score,
+	AlnScore&            bestP1Dist,
+	AlnScore&            bestP2Score,
+	AlnScore&            bestP2Dist,
+	AlnScore&            bestCScore,
+	AlnScore&            bestCDist,
+	AlnScore&            bestUnchosenUScore,
+	AlnScore&            bestUnchosenUDist,
+	AlnScore&            bestUnchosenP1Score,
+	AlnScore&            bestUnchosenP1Dist,
+	AlnScore&            bestUnchosenP2Score,
+	AlnScore&            bestUnchosenP2Dist,
+	AlnScore&            bestUnchosenCScore,
+	AlnScore&            bestUnchosenCDist,
 	RandomSource&        rnd)
 	const
 {
@@ -1327,11 +1485,26 @@ size_t AlnSinkWrap::selectByScore(
 	assert(repOk());
 	assert_gt(num, 0);
 	assert(rs1 != NULL);
-	
-	if(rs2 != NULL) {
-		assert(rs1u != NULL);
-		assert(rs2u != NULL);
-	}
+	assert(rs2 == NULL || rs1u != NULL);
+	assert(rs2 == NULL || rs2u != NULL);
+
+	bestUScore.invalidate();
+	bestUDist.invalidate();
+	bestUnchosenUScore.invalidate();
+	bestUnchosenUDist.invalidate();
+
+	bestCScore.invalidate();
+	bestP1Score.invalidate();
+	bestP2Score.invalidate();
+	bestCDist.invalidate();
+	bestP1Dist.invalidate();
+	bestP2Dist.invalidate();
+	bestUnchosenCScore.invalidate();
+	bestUnchosenP1Score.invalidate();
+	bestUnchosenP2Score.invalidate();
+	bestUnchosenCDist.invalidate();
+	bestUnchosenP1Dist.invalidate();
+	bestUnchosenP2Dist.invalidate();
 	
 	size_t sz = rs1->size(); // sz = # alignments found
 	assert_leq(num, sz);
@@ -1375,27 +1548,57 @@ size_t AlnSinkWrap::selectByScore(
 		buf.shufflePortion(buf.size() - streak, streak, rnd);
 	}
 	
+	// Copy the permutation into the 'select' list
 	for(size_t i = 0; i < num; i++) { select[i] = buf[i].second; }
 	
+	if(rs2 == NULL) {
+		bestUScore = bestUDist = (*rs1)[select[0]].score();
+	}
+	
+	// For paired-end read, find best alignment score among end
+	// alignments not chosen, for both ends
 	if(rs2 != NULL) {
+		bestCScore = bestCDist = (*rs1)[select[0]].score() + (*rs2)[select[0]].score();
+		bestP1Score = bestP1Dist = (*rs1)[select[0]].score();
+		bestP2Score = bestP2Dist = (*rs2)[select[0]].score();
 		for(size_t i = 0; i < rs1u->size(); i++) {
 			if((*rs1u)[i].refcoord() == (*rs1)[select[0]].refcoord()) {
 				continue;
 			}
-			if((*rs1u)[i].score() > bestUnchosen1) {
-				bestUnchosen1 = (*rs1u)[i].score();
+			if((*rs1u)[i].score() > bestUnchosenP1Score) {
+				bestUnchosenP1Score = (*rs1u)[i].score();
+			}
+			if((*rs1u)[i].score().basesAligned() > bestUnchosenP1Dist.basesAligned()) {
+				bestUnchosenP1Dist = (*rs1u)[i].score();
 			}
 		}
 		for(size_t i = 0; i < rs2u->size(); i++) {
 			if((*rs2u)[i].refcoord() == (*rs2)[select[0]].refcoord()) {
 				continue;
 			}
-			if((*rs2u)[i].score() > bestUnchosen2) {
-				bestUnchosen2 = (*rs2u)[i].score();
+			if((*rs2u)[i].score() > bestUnchosenP2Score) {
+				bestUnchosenP2Score = (*rs2u)[i].score();
+			}
+			if((*rs2u)[i].score().basesAligned() > bestUnchosenP2Dist.basesAligned()) {
+				bestUnchosenP2Dist = (*rs2u)[i].score();
 			}
 		}
 		if(buf.size() > 1) {
-			bestUnchosenC = buf[1].first;
+			bestUnchosenCScore = buf[1].first;
+			for(size_t i = 1; i < buf.size(); i++) {
+				AlnScore dist = (*rs1)[buf[i].second].score() +
+				                (*rs2)[buf[i].second].score();
+				if(dist.basesAligned() > bestUnchosenCDist.basesAligned()) {
+					bestUnchosenCDist = dist;
+				}
+			}
+		}
+	} else if(buf.size() > 1) {
+		bestUnchosenUScore = (*rs1)[buf[1].second].score();
+		for(size_t i = 1; i < buf.size(); i++) {
+			if((*rs1)[buf[1].second].score().basesAligned() > bestUnchosenUDist.basesAligned()) {
+				bestUnchosenUDist = (*rs1)[buf[1].second].score();
+			}
 		}
 	}
 	
@@ -1707,8 +1910,8 @@ void AlnSinkSam::appendMate(
 		}
 		fl |= (flags.readMate1() ?
 			SAM_FLAG_FIRST_IN_PAIR : SAM_FLAG_SECOND_IN_PAIR);
-		if(flags.mateAligned() && rso != NULL) {
-			if(!rso->fw()) {
+		if(flags.mateAligned()) {
+			if(!flags.isOppFw()) {
 				fl |= SAM_FLAG_MATE_STRAND;
 			}
 		}
diff --git a/aln_sink.h b/aln_sink.h
index 0bb0e84..64a26fa 100644
--- a/aln_sink.h
+++ b/aln_sink.h
@@ -1232,9 +1232,22 @@ protected:
 		EList<size_t>&       select, // prioritized list to put results in
 		const EList<AlnRes>* rs1u,   // alignments to select from (mate 1)
 		const EList<AlnRes>* rs2u,   // alignments to select from (mate 2, or NULL)
-		AlnScore&            bestUnchosen1,
-		AlnScore&            bestUnchosen2,
-		AlnScore&            bestUnchosenC,
+		AlnScore&            bestUScore,
+		AlnScore&            bestUDist,
+		AlnScore&            bestP1Score,
+		AlnScore&            bestP1Dist,
+		AlnScore&            bestP2Score,
+		AlnScore&            bestP2Dist,
+		AlnScore&            bestCScore,
+		AlnScore&            bestCDist,
+		AlnScore&            bestUnchosenUScore,
+		AlnScore&            bestUnchosenUDist,
+		AlnScore&            bestUnchosenP1Score,
+		AlnScore&            bestUnchosenP1Dist,
+		AlnScore&            bestUnchosenP2Score,
+		AlnScore&            bestUnchosenP2Dist,
+		AlnScore&            bestUnchosenCScore,
+		AlnScore&            bestUnchosenCDist,
 		RandomSource&        rnd)
 		const;
 
diff --git a/bowtie2 b/bowtie2
index 16a0175..7f25561 100755
--- a/bowtie2
+++ b/bowtie2
@@ -550,8 +550,8 @@ if(defined($cap_out)) {
 			my $fl = substr($_, $tab1_i, $tab2_i - $tab1_i);
 			my $unal = ($fl & 4) != 0;
 			$filt = 1 if $no_unal && $unal;
-			if($passthru && ($fl & 256) == 0) {
-				if(scalar(keys %read_fhs) == 0) {
+			if($passthru) {
+				if(scalar(keys %read_fhs) == 0 || ($fl & 256) != 0) {
 					# Next line is read with some whitespace escaped
 					my $l = <BT>;
 				} else {
diff --git a/bowtie_main.cpp b/bowtie_main.cpp
index 3e39acf..844c8ca 100644
--- a/bowtie_main.cpp
+++ b/bowtie_main.cpp
@@ -19,23 +19,10 @@
 
 #include <iostream>
 #include <fstream>
-#include <sstream>
-#include <iomanip>
 #include <string.h>
 #include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
 #include "tokenize.h"
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <vector>
-#include <iterator>
-#include <algorithm>
-#include <readline/readline.h>
-#include <readline/history.h>
+#include "ds.h"
 
 using namespace std;
 
@@ -52,237 +39,23 @@ extern "C" {
  * per line, and will dispatch each batch of arguments one at a time to
  * bowtie.
  */
-
-static volatile sig_atomic_t done = false;
-
-static const char *options[] = {
-"--al",                 "--al-conc",               "--dpad",            "--end-to-end",
-"--fast",               "--fast-local",            "--fr",              "--gbar",
-"--ignore-quals",       "--int-quals",             "--local",           "--ma",
-"--met",                "--met-file",              "--met-stderr",      "--mm",
-"--mp",                 "--n-ceil",                "--no-1mm-upfront",  "--no-contain",
-"--no-discordant",      "--no-dovetail",           "--no-head",         "--no-mixed",
-"--no-overlap",         "--no-sq",                 "--no-unal",         "--nofw",
-"--non-deterministic",  "--norc",                  "--np",              "--omit-sec-seq",
-"--phred33",            "--phred64",               "--qc-filter",       "--qseq",
-"--quiet",              "--rdg",                   "--reorder",         "--rfg",
-"--rg",                 "--rg-id",                 "--score-min",       "--seed",
-"--sensitive",          "--sensitive-local",       "--un",              "--un-conc",
-"--un-gz",              "--version",               "--very-fast",       "--very-fast-local",
-"--very-sensitive",     "--very-sensitive-local",  "-3",                "-5",
-"-D",                   "-I",                      "-L",                "-N",
-"-R",                   "-X",                      "-a",                "-c",
-"-f",                   "-h",                      "-i",                "-k",
-"-p",                   "-q",                      "-r",                "-s",
-"-t",                   "-u",                      "-1",                "-2",
-"-S",                   "-U",                      "--all",             "--ff",
-"--help",               "--maxins",                "--minins",          "--rf",
-"--skip",               "--threads",               "--time",            "--trim3",
-"--trim5",              "--upto",                  NULL
-};
-
-
-static bool isdirectory(const char *path) {
-	struct stat statbuf;
-	if(stat(path, &statbuf) != 0) {
-		perror("stat");
-		return true;
-	}
-	return S_ISDIR(statbuf.st_mode);
-}
-
-static char *optgen(const char *text, int state) {
-	static int list_index, len;
-	const char *name = NULL;
-
-	if (!state) {
-		list_index = 0;
-		len = strlen(text);
-	}
-
-	name = rl_filename_completion_function(text, state);
-	if (name != NULL) {
-		rl_completion_append_character = isdirectory(name) ? '/': ' ';
-		return strdup(name);
-	}
-
-	if (text[0] == '-') {
-		while ((name = options[list_index++])) {
-			if (strncmp(name, text, len) == 0) {
-				return strdup(name);
-			}
-		}
-	}
-	return NULL;
-}
-
-static char **optcomplete(const char *text, int start, int end) {
-	rl_attempted_completion_over = 1;
-	return rl_completion_matches(text, optgen);
-}
-
-static void rlinit() {
-	rl_attempted_completion_function = optcomplete;
-}
-
-static void handler(int sig) {
-	done = true;
-}
-
-static int _getline(istream *in, char *buf, size_t len) {
-	if (in == &cin) {
-		char *input = readline("bowtie2> ");
-		if (!input) {
-			buf[0] = '\0';
-		}
-		else {
-			strncpy(buf, input, len-1);
-			add_history(buf);
-			free(input);
-		}
-	}
-	else {
-		in->getline(buf, len-1);
-		if (!in->good())
-			buf[0] = '\0';
-	}
-	buf[len-1] = '\0';
-	return strlen(buf);
-}
-
-static int createfifo(vector<char *>& v) {
-	const char *pattern = "/tmp/btfifo.XX";
-	char *fn = (char *)malloc(strlen(pattern)+1);
-	memset(fn, 0, strlen(pattern)+1);
-	strcpy(fn, pattern);
-	mktemp(fn);
-
-	if (mkfifo(fn, S_IRUSR | S_IWUSR) == -1) {
-		perror("mkfifo");
-		return 1;
-	}
-	v.push_back(fn);
-	return 0; 
-}
-
-void printargs(const char **args, size_t size) {
-	copy(args, args+size, ostream_iterator<string>(cout, " "));
-	cout << endl;
-}
-
-bool called_from_wrapper(int argc, const char **argv) {
-	if (argc > 2 && strcmp(argv[1], "--wrapper") == 0
-			&& strcmp(argv[2], "basic-0") == 0)
-		return true;
-	return false;
-}
-
 int main(int argc, const char **argv) {
-	int offset = called_from_wrapper(argc, argv) ? 3 : 1;
-
-	if(argc > offset + 1 && strcmp(argv[offset], "-A") == 0) {
-		const char *file = argv[offset+1];
+	if(argc > 2 && strcmp(argv[1], "-A") == 0) {
+		const char *file = argv[2];
 		ifstream in;
-		istream *inptr = ∈
-		if (strcmp(file, "-") == 0) {
-			inptr = &cin;
-		}
-		else {
-			in.open(file);
-		}
+		in.open(file);
 		char buf[4096];
 		int lastret = -1;
-
-		rlinit();
-		while(_getline(inptr, buf, 4096)) {
-			done = false;
-			vector<string> args;
+		while(in.getline(buf, 4095)) {
+			EList<string> args;
 			args.push_back(string(argv[0]));
-
-			if (offset > 1) {
-				args.push_back(string(argv[1]));
-				args.push_back(string(argv[2]));
-			}
-
 			tokenize(buf, " \t", args);
 			const char **myargs = (const char**)malloc(sizeof(char*)*args.size());
-			vector<char *> fifonames;
-			int sam_outfile_pos = -1;
-
 			for(size_t i = 0; i < args.size(); i++) {
-				if (args[i] == "_") {
-					if (i > 0 && args[i-1] == "-S") {
-						sam_outfile_pos = i;
-					}
-					else {
-						createfifo(fifonames);
-						args[i] = fifonames.back();
-					}
-				}
 				myargs[i] = args[i].c_str();
 			}
 			if(args.size() == 1) continue;
-
-			if (fifonames.size() > 0) {
-				struct sigaction sa;
-				sigemptyset(&sa.sa_mask);
-				sa.sa_flags = 0;
-				sa.sa_handler = handler;
-
-				if (sigaction(SIGINT, &sa, NULL) == -1
-						|| signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
-					perror("sigaction");
-					exit(EXIT_FAILURE);
-				}
-
-				struct pollfd *pollfds = (struct pollfd *)calloc(fifonames.size(), sizeof(struct pollfd));
-				if (pollfds == NULL) {
-					perror("calloc");
-					exit(EXIT_FAILURE);
-				}
-
-				for (size_t i = 0; i < fifonames.size(); i++) {
-					pollfds[i].fd = open(fifonames[i], O_NONBLOCK | O_EXCL);
-					pollfds[i].events = POLLIN;
-				}
-
-				printargs(myargs, args.size());
-
-				for (int count = 0;; count++) {
-					size_t r = poll(pollfds, fifonames.size(), -1);
-					// wait until all fifos are ready
-					if (r != fifonames.size()) {
-						if (done)
-							break;
-						continue;
-					}
-					if (sam_outfile_pos >= 0) {
-						ostringstream os;
-						os << "out" << getpid() << "_" << setfill('0') << setw(3) << count << ".sam"; 
-						myargs[sam_outfile_pos] = os.str().c_str();
-						printargs(myargs, args.size());
-					}
-
-					lastret = bowtie((int)args.size(), myargs);
-
-					// replace the args shuffled by getopt
-					for (size_t i = 0; i < args.size(); i++) {
-						myargs[i] = args[i].c_str();
-					}
-				}
-
-				for (size_t i = 0; i < fifonames.size(); i++) {
-					if (close(pollfds[i].fd))
-						perror("close");
-					if (remove(fifonames[i]))
-						perror("remove");
-					free(fifonames[i]);
-				}
-				free(pollfds);
-			}
-			else {
-				lastret = bowtie((int)args.size(), myargs);
-			}
+			lastret = bowtie((int)args.size(), myargs);
 			free(myargs);
 		}
 		if(lastret == -1) {
diff --git a/bt2_search.cpp b/bt2_search.cpp
index e5e02c6..7decf9b 100644
--- a/bt2_search.cpp
+++ b/bt2_search.cpp
@@ -660,7 +660,7 @@ static void printUsage(ostream& out) {
 		tool_name = "bowtie2";
 	}
 	out << "Usage: " << endl
-	    << "  " << tool_name.c_str() << " [options]* -x <bt2-idx> {-1 <m1> -2 <m2> | -U <r>} [-S <sam>]" << endl
+	    << "  " << tool_name.c_str() << " [options]* -x <bt2-idx> {-1 <m1> -2 <m2> | -U <r> | --interleaved <i>} [-S <sam>]" << endl
 	    << endl
 		<<     "  <bt2-idx>  Index filename prefix (minus trailing .X." + gEbwt_ext + ")." << endl
 		<<     "             NOTE: Bowtie 1 and Bowtie 2 indexes are not compatible." << endl
@@ -676,6 +676,10 @@ static void printUsage(ostream& out) {
 	if(wrapper == "basic-0") {
 		out << "             Could be gzip'ed (extension: .gz) or bzip2'ed (extension: .bz2)." << endl;
 	}
+	out <<     "  <i>        Files with interleaved paired-end FASTQ reads" << endl;
+	if(wrapper == "basic-0") {
+		out << "             Could be gzip'ed (extension: .gz) or bzip2'ed (extension: .bz2)." << endl;
+	}
 	out <<     "  <sam>      File for SAM output (default: stdout)" << endl
 	    << endl
 	    << "  <m1>, <m2>, <r> can be comma-separated lists (no whitespace) and can be" << endl
@@ -686,7 +690,6 @@ static void printUsage(ostream& out) {
 		<< endl
 	    << " Input:" << endl
 	    << "  -q                 query input files are FASTQ .fq/.fastq (default)" << endl
-		<< "  --interleaved      query input files are interleaved paired-end FASTQ reads" << endl
 		<< "  --tab5             query input files are TAB5 .tab5" << endl
 		<< "  --tab6             query input files are TAB6 .tab6" << endl
 	    << "  --qseq             query input files are in Illumina's qseq format" << endl
@@ -767,10 +770,10 @@ static void printUsage(ostream& out) {
 	//}
 	out << "  -t/--time          print wall-clock time taken by search phases" << endl;
 	if(wrapper == "basic-0") {
-	out << "  --un <path>           write unpaired reads that didn't align to <path>" << endl
-	    << "  --al <path>           write unpaired reads that aligned at least once to <path>" << endl
-	    << "  --un-conc <path>      write pairs that didn't align concordantly to <path>" << endl
-	    << "  --al-conc <path>      write pairs that aligned concordantly at least once to <path>" << endl
+	out << "  --un <path>        write unpaired reads that didn't align to <path>" << endl
+	    << "  --al <path>        write unpaired reads that aligned at least once to <path>" << endl
+	    << "  --un-conc <path>   write pairs that didn't align concordantly to <path>" << endl
+	    << "  --al-conc <path>   write pairs that aligned concordantly at least once to <path>" << endl
 	    << "  (Note: for --un, --al, --un-conc, or --al-conc, add '-gz' to the option name, e.g." << endl
 		<< "  --un-gz <path>, to gzip compress output, or add '-bz2' to bzip2 compress output.)" << endl;
 	}
@@ -787,6 +790,8 @@ static void printUsage(ostream& out) {
 	    << "  --rg <text>        add <text> (\"lab:value\") to @RG line of SAM header." << endl
 	    << "                     Note: @RG line only printed when --rg-id is set." << endl
 	    << "  --omit-sec-seq     put '*' in SEQ and QUAL fields for secondary alignments." << endl
+	    << "  --sam-noqname-trunc Suppress standard behavior of truncating readname at first whitespace " << endl
+	    << "                      at the expense of generating non-standard SAM." << endl
 		<< endl
 	    << " Performance:" << endl
 	//    << "  -o/--offrate <int> override offrate of index; must be >= index's offrate" << endl
@@ -3196,7 +3201,7 @@ static void multiseedSearchWorker(void *vp) {
 				// Whether we're done with mate1 / mate2
 				bool done[2] = { !filt[0], !filt[1] };
 				size_t nelt[2] = {0, 0};
-									
+
 					// Find end-to-end exact alignments for each read
 					if(doExactUpFront) {
 						for(size_t matei = 0; matei < (paired ? 2:1); matei++) {
@@ -3376,6 +3381,7 @@ static void multiseedSearchWorker(void *vp) {
 							}
 						}
 					}
+
 					// 1-mismatch
 					if(do1mmUpFront && !seedSumm) {
 						for(size_t matei = 0; matei < (paired ? 2:1); matei++) {
@@ -3562,7 +3568,11 @@ static void multiseedSearchWorker(void *vp) {
 					nrounds[1] = min<size_t>(nrounds[1], interval[1]);
 					Constraint gc = Constraint::penaltyFuncBased(scoreMin);
 					size_t seedsTried = 0;
+					size_t seedsTriedMS[] = {0, 0, 0, 0};
 					size_t nUniqueSeeds = 0, nRepeatSeeds = 0, seedHitTot = 0;
+					size_t nUniqueSeedsMS[] = {0, 0, 0, 0};
+					size_t nRepeatSeedsMS[] = {0, 0, 0, 0};
+					size_t seedHitTotMS[] = {0, 0, 0, 0};
 					for(size_t roundi = 0; roundi < nSeedRounds; roundi++) {
 						ca.nextRead(); // Clear cache in preparation for new search
 						shs[0].clearSeeds();
@@ -3612,6 +3622,7 @@ static void multiseedSearchWorker(void *vp) {
 								continue;
 							}
 							// Instantiate the seeds
+							std::pair<int, int> instFw, instRc;
 							std::pair<int, int> inst = al.instantiateSeeds(
 								*seeds[mate],   // search seeds
 								offset,         // offset to begin extracting
@@ -3622,7 +3633,9 @@ static void multiseedSearchWorker(void *vp) {
 								norc[mate],     // don't align revcomp read
 								ca,             // holds some seed hits from previous reads
 								shs[mate],      // holds all the seed hits
-								sdm);           // metrics
+								sdm,            // metrics
+								instFw,
+								instRc);
 							assert(shs[mate].repOk(&ca.current()));
 							if(inst.first + inst.second == 0) {
 								// No seed hits!  Done with this mate.
@@ -3631,6 +3644,8 @@ static void multiseedSearchWorker(void *vp) {
 								break;
 							}
 							seedsTried += (inst.first + inst.second);
+							seedsTriedMS[mate * 2 + 0] = instFw.first + instFw.second;
+							seedsTriedMS[mate * 2 + 1] = instRc.first + instRc.second;
 							// Align seeds
 							al.searchAllSeeds(
 								*seeds[mate],     // search seeds
@@ -3654,8 +3669,14 @@ static void multiseedSearchWorker(void *vp) {
 						for(size_t mate = 0; mate < 2; mate++) {
 							if(!shs[mate].empty()) {
 								nUniqueSeeds += shs[mate].numUniqueSeeds();
+								nUniqueSeedsMS[mate * 2 + 0] += shs[mate].numUniqueSeedsStrand(true);
+								nUniqueSeedsMS[mate * 2 + 1] += shs[mate].numUniqueSeedsStrand(false);
 								nRepeatSeeds += shs[mate].numRepeatSeeds();
+								nRepeatSeedsMS[mate * 2 + 0] += shs[mate].numRepeatSeedsStrand(true);
+								nRepeatSeedsMS[mate * 2 + 1] += shs[mate].numRepeatSeedsStrand(false);
 								seedHitTot += shs[mate].numElts();
+								seedHitTotMS[mate * 2 + 0] += shs[mate].numEltsFw();
+								seedHitTotMS[mate * 2 + 1] += shs[mate].numEltsRc();
 							}
 						}
 						double uniqFactor[2] = { 0.0f, 0.0f };
@@ -3819,10 +3840,25 @@ static void multiseedSearchWorker(void *vp) {
 							}
 						}
 					} // end loop over reseeding rounds
-					if(seedsTried != 0) {
+					if(seedsTried > 0) {
 						prm.seedPctUnique = (float)nUniqueSeeds / seedsTried;
 						prm.seedPctRep = (float)nRepeatSeeds / seedsTried;
 						prm.seedHitAvg = (float)seedHitTot / seedsTried;
+					} else {
+						prm.seedPctUnique = -1.0f;
+						prm.seedPctRep = -1.0f;
+						prm.seedHitAvg = -1.0f;
+					}
+					for(int i = 0; i < 4; i++) {
+						if(seedsTriedMS[i] > 0) {
+							prm.seedPctUniqueMS[i] = (float)nUniqueSeedsMS[i] / seedsTriedMS[i];
+							prm.seedPctRepMS[i] = (float)nRepeatSeedsMS[i] / seedsTriedMS[i];
+							prm.seedHitAvgMS[i] = (float)seedHitTotMS[i] / seedsTriedMS[i];
+						} else {
+							prm.seedPctUniqueMS[i] = -1.0f;
+							prm.seedPctRepMS[i] = -1.0f;
+							prm.seedHitAvgMS[i] = -1.0f;
+						}
 					}
 					size_t totnucs = 0;
 					for(size_t mate = 0; mate < (paired ? 2:1); mate++) {
@@ -3834,7 +3870,10 @@ static void multiseedSearchWorker(void *vp) {
 							totnucs += len;
 						}
 					}
-					prm.seedsPerNuc = (float)seedsTried / totnucs;
+					prm.seedsPerNuc = totnucs > 0 ? ((float)seedsTried / totnucs) : -1;
+					for(int i = 0; i < 4; i++) {
+						prm.seedsPerNucMS[i] = totnucs > 0 ? ((float)seedsTriedMS[i] / totnucs) : -1;
+					}
 					for(size_t i = 0; i < 2; i++) {
 						assert_leq(prm.nExIters, mxIter[i]);
 						assert_leq(prm.nExDps,   mxDp[i]);
diff --git a/doc/manual.html b/doc/manual.html
index fade3a3..4685a18 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -55,7 +55,7 @@
 <li><a href="#ambiguous-characters">Ambiguous characters</a></li>
 <li><a href="#presets-setting-many-settings-at-once">Presets: setting many settings at once</a></li>
 <li><a href="#filtering">Filtering</a></li>
-<li><a href="#alignment-summmary">Alignment summmary</a></li>
+<li><a href="#alignment-summary">Alignment summary</a></li>
 <li><a href="#wrapper-scripts">Wrapper scripts</a></li>
 <li><a href="#small-and-large-indexes">Small and large indexes</a></li>
 <li><a href="#performance-tuning">Performance tuning</a></li>
@@ -96,27 +96,27 @@
 <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><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">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">
-<li><p>For reads longer than about 50 bp Bowtie 2 is generally faster, more sensitive, and uses less memory than Bowtie 1. For relatively short reads (e.g. less than 50 bp) Bowtie 1 is sometimes faster and/or more sensitive.</p></li>
+<li><p>For reads longer than about 50 bp Bowtie 2 is generally faster, more sensitive, and uses less memory than Bowtie 1. For relatively short reads (e.g. less than 50 bp) Bowtie 1 is sometimes faster and/or more sensitive. B</p></li>
 <li><p>Bowtie 2 supports gapped alignment with affine gap penalties. Number of gaps and gap lengths are not restricted, except by way of the configurable scoring scheme. Bowtie 1 finds just ungapped alignments.</p></li>
 <li><p>Bowtie 2 supports <a href="#end-to-end-alignment-versus-local-alignment">local alignment</a>, which doesn't require reads to align end-to-end. Local alignments might be "trimmed" ("soft clipped") at one or both extremes in a way that optimizes alignment score. Bowtie 2 also supports <a href="#end-to-end-alignment-versus-local-alignment">end-to-end alignment</a> which, like Bowtie 1, requires that the read align entirely.</p></li>
 <li><p>There is no upper limit on read length in Bowtie 2. Bowtie 1 had an upper limit of around 1000 bp.</p></li>
 <li><p>Bowtie 2 allows alignments to <a href="#ambiguous-characters">overlap ambiguous characters</a> (e.g. <code>N</code>s) in the reference. Bowtie 1 does not.</p></li>
 <li><p>Bowtie 2 does away with Bowtie 1's notion of alignment "stratum", and its distinction between "Maq-like" and "end-to-end" modes. In Bowtie 2 all alignments lie along a continuous spectrum of alignment scores where the <a href="#scores-higher-more-similar">scoring scheme</a>, similar to <a href="http://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm">Needleman-Wunsch</a> and <a href="http://en.wikipedia.org/wiki/Smith_waterman">Smith-Waterman</a>.</p></li>
 <li><p>Bowtie 2's <a href="#aligning-pairs">paired-end alignment</a> is more flexible. E.g. for pairs that do not align in a paired fashion, Bowtie 2 attempts to find unpaired alignments for each mate.</p></li>
-<li><p>Bowtie 2 reports a spectrum of mapping qualities, in contrast fo Bowtie 1 which reports either 0 or high.</p></li>
+<li><p>Bowtie 2 reports a spectrum of mapping qualities, in contrast for Bowtie 1 which reports either 0 or high.</p></li>
 <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">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>
+<p>Bowtie 2 does not support alignment of colorspace reads.</p>
 <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">Obtaining Bowtie 2</h1>
@@ -124,7 +124,7 @@
 <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. +The Threading Building Blocks library, TBB, is now the default +threading library in bowtie2. On POSIX platforms (like linux, Mac +OS, etc) if TBB is not available the pthread library will be used. +Although it is possible to use pthread library on Windows, a non-POSIX +platform, due to performance reasons bowtie 2 will try to use Windows +native mul [...]
+<p>+Bowtie 2 is using the multithreading software model in order to +speed up execution times on SMP architectures where this is possible. +The Threading Building Blocks library, TBB, is now the default +threading library in Bowtie 2. On POSIX platforms (like Linux, Mac +OS, etc.) if TBB is not available the pthread library will be used. +Although it is possible to use pthread library on Windows, a non-POSIX +platform, due to performance reasons Bowtie 2 will try to use Windows +native m [...]
 <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- [...]
@@ -135,7 +135,7 @@
              |||||  |||||||||| |||
   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>
+<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">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>
@@ -158,7 +158,7 @@ Alignment:
                  ||||||||| ||||||
   Reference: TAACTTGCGTTAAATCCGCCTGG</code></pre>
 <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>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">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>
@@ -191,7 +191,7 @@ Alignment:
 <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 hexadecimal) is set if the read is part of a pair. The second bit (2 in decimal, 0x2 in hexadecimal) 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 hexadecimal) 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">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 [...]
+<p>The last several 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 specificatio [...]
 <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>
@@ -224,19 +224,19 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <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">-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 garantee 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>
+<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 guarantee 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 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">Randomness in Bowtie 2</h3>
-<p>Bowtie 2's search for alignments for a given read is "randomized." That is, when Bowtie 2 encounters 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>Bowtie 2's search for alignments for a given read is "randomized." That is, when Bowtie 2 encounters 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. Arbitrary 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-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>
+<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 interrupted by too many mismatches or gaps.</p>
+<p>The trade-off 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.  [...]
+<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 trade-off between speed and sensitivity/accuracy.</p>
 <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">Ambiguous characters</h2>
@@ -244,9 +244,9 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <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">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 [...]
+<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 trade-off space, with the presets ending in <code>fast</code> generally being faster but less sensitive a [...]
 <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>
+<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 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 because 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>
 <li><code>YF:Z:NS</code>: the read was filtered because it contains a number of ambiguous characters (usually <code>N</code> or <code>.</code>) greater than the ceiling specified with <a href="#bowtie2-options-n-ceil"><code>--n-ceil</code></a>.</li>
@@ -254,7 +254,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">Alignment summmary</h2>
+<h2 id="alignment-summary">Alignment summary</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:
@@ -280,7 +280,7 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 96.70% overall alignment rate</code></pre>
 <p>The indentation indicates how subtotals relate to totals.</p>
 <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>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 functionality 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">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 [...]
@@ -370,7 +370,7 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <pre><code>--tab5</code></pre>
 </td>
 <td>
-<p>Each read or pair is on a single line. An unpaired read line is [name]. A paired-end read line is [name]. An input file can be a mix of unpaired and paired-end reads and Bowtie 2 recognizes each according to the number of fields, handling each as it should.</p>
+<p>Each read or pair is on a single line. An unpaired read line is [name]\t[seq]\t[qual]\n. A paired-end read line is [name]\t[seq1]\t[qual1]\t[seq2]\t[qual2]\n. An input file can be a mix of unpaired and paired-end reads and Bowtie 2 recognizes each according to the number of fields, handling each as it should.</p>
 </td>
 </tr>
 <tr>
@@ -378,7 +378,7 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <pre><code>--tab6</code></pre>
 </td>
 <td>
-<p>Similar to <a href="#bowtie2-options-tab5"><code>--tab5</code></a> except, for paired-end reads, the second end can have a different name from the first: [name1]</p>
+<p>Similar to <a href="#bowtie2-options-tab5"><code>--tab5</code></a>  except, for paired-end reads, the second end can have a different name from the first: [name1]\t[seq1]\t[qual1]\t[name2]\t[seq2]\t[qual2]\n</p>
 </td>
 </tr>
 <tr>
@@ -749,7 +749,7 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td>
 <td>
 <p>The minimum fragment length for valid paired-end alignments. E.g. if <code>-I 60</code> is specified and a paired-end alignment consists of two 20-bp alignments in the appropriate orientation with a 20-bp gap between them, that alignment is considered valid (as long as <a href="#bowtie2-options-X"><code>-X</code></a> is also satisfied). A 19-bp gap would not be valid in that case. If trimming options <a href="#bowtie2-options-3"><code>-3</code></a> or <a href="#bowtie2-options-5"><cod [...]
-<p>The larger the difference between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a>, the slower Bowtie 2 will run. This is because larger differences bewteen <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a> require that Bowtie 2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very efficient.</p>
+<p>The larger the difference between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a>, the slower Bowtie 2 will run. This is because larger differences between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a> require that Bowtie 2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very efficient.</p>
 <p>Default: 0 (essentially imposing no minimum)</p>
 </td>
 </tr>
@@ -759,7 +759,7 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 </td>
 <td>
 <p>The maximum fragment length for valid paired-end alignments. E.g. if <code>-X 100</code> is specified and a paired-end alignment consists of two 20-bp alignments in the proper orientation with a 60-bp gap between them, that alignment is considered valid (as long as <a href="#bowtie2-options-I"><code>-I</code></a> is also satisfied). A 61-bp gap would not be valid in that case. If trimming options <a href="#bowtie2-options-3"><code>-3</code></a> or <a href="#bowtie2-options-5"><code>-5 [...]
-<p>The larger the difference between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a>, the slower Bowtie 2 will run. This is because larger differences bewteen <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a> require that Bowtie 2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very efficient.</p>
+<p>The larger the difference between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a>, the slower Bowtie 2 will run. This is because larger differences between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a> require that Bowtie 2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very efficient.</p>
 <p>Default: 500.</p>
 </td>
 </tr>
@@ -946,7 +946,7 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <pre><code>--omit-sec-seq</code></pre>
 </td>
 <td>
-<p>When printing secondary alignments, Bowtie 2 by default will write out the <code>SEQ</code> and <code>QUAL</code> strings. Specifying this option causes Bowtie 2 to print an asterix in those fields instead.</p>
+<p>When printing secondary alignments, Bowtie 2 by default will write out the <code>SEQ</code> and <code>QUAL</code> strings. Specifying this option causes Bowtie 2 to print an asterisk in those fields instead.</p>
 </td>
 </tr>
 </table>
@@ -1034,7 +1034,7 @@ Seed 4 rc:                   TTATGCATGA</code></pre>
 <p>Each subsequent 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>
 <ol style="list-style-type: decimal">
 <li><p>Name of read that aligned.</p>
-<p>Note that the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM specification</a> disallows whitespace in the read name. If the read name contains any whitespace characters, Bowtie 2 will truncate the name at the first whitespace character. This is similar to the behavior of other tools.</p></li>
+<p>Note that the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM specification</a> disallows whitespace in the read name. If the read name contains any whitespace characters, Bowtie 2 will truncate the name at the first whitespace character. This is similar to the behavior of other tools. The standard behavior of truncating at the first whitespace can be suppressed with <code>--sam-noqname-trunc</code> at the expense of generating non-standard SAM.</p></li>
 <li><p>Sum of all applicable flags. Flags relevant to Bowtie are:</p>
 <table>
 <tr>
@@ -1526,12 +1526,12 @@ r7  16  gi|9626243|ref|NC_001416.1| 4692    42  143M    *   0   0   TCAGCCGGACGC
 <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>
-<p>Use <code>samtools view</code> to convert the SAM file into a BAM file. BAM is a the binary format corresponding to the SAM text format. Run:</p>
+<p>Use <code>samtools view</code> to convert the SAM file into a BAM file. BAM is the binary format corresponding to the SAM text format. Run:</p>
 <pre><code>samtools view -bS eg2.sam > eg2.bam</code></pre>
 <p>Use <code>samtools sort</code> to convert the BAM file to a sorted BAM file.</p>
-<pre><code>samtools sort eg2.bam eg2.sorted</code></pre>
+<pre><code>samtools sort eg2.bam -o eg2.sorted.bam</code></pre>
 <p>We now have a sorted BAM file called <code>eg2.sorted.bam</code>. Sorted BAM is a useful format because the alignments are (a) compressed, which is convenient for long-term storage, and (b) sorted, which is conveneint for variant discovery. To generate variant calls in VCF format, run:</p>
-<pre><code>samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -bvcg - > eg2.raw.bcf</code></pre>
+<pre><code>samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -Ov - > eg2.raw.bcf</code></pre>
 <p>Then to view the variants, run:</p>
 <pre><code>bcftools view eg2.raw.bcf</code></pre>
 <p>See the official SAMtools guide to <a href="http://samtools.sourceforge.net/mpileup.shtml">Calling SNPs/INDELs with SAMtools/BCFtools</a> for more details and variations on this process.</p>
diff --git a/doc/website/manual.ssi b/doc/website/manual.ssi
index 7c50b2a..5891c95 100644
--- a/doc/website/manual.ssi
+++ b/doc/website/manual.ssi
@@ -1,5 +1,5 @@
 <h1>Table of Contents</h1>
-<p> Version <b>2.3.1</b></p>
+<p> Version <b>2.3.2</b></p>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
@@ -93,7 +93,6 @@
  ! distracting formatting clutter.  See 'MANUAL' for an easier-to-read version
  ! of this text document, or see the HTML manual online.
  ! -->
-
 <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 [...]
@@ -103,21 +102,21 @@
 <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">
-<li><p>For reads longer than about 50 bp Bowtie 2 is generally faster, more sensitive, and uses less memory than Bowtie 1. For relatively short reads (e.g. less than 50 bp) Bowtie 1 is sometimes faster and/or more sensitive.</p></li>
+<li><p>For reads longer than about 50 bp Bowtie 2 is generally faster, more sensitive, and uses less memory than Bowtie 1. For relatively short reads (e.g. less than 50 bp) Bowtie 1 is sometimes faster and/or more sensitive. B</p></li>
 <li><p>Bowtie 2 supports gapped alignment with affine gap penalties. Number of gaps and gap lengths are not restricted, except by way of the configurable scoring scheme. Bowtie 1 finds just ungapped alignments.</p></li>
 <li><p>Bowtie 2 supports <a href="#end-to-end-alignment-versus-local-alignment">local alignment</a>, which doesn't require reads to align end-to-end. Local alignments might be "trimmed" ("soft clipped") at one or both extremes in a way that optimizes alignment score. Bowtie 2 also supports <a href="#end-to-end-alignment-versus-local-alignment">end-to-end alignment</a> which, like Bowtie 1, requires that the read align entirely.</p></li>
 <li><p>There is no upper limit on read length in Bowtie 2. Bowtie 1 had an upper limit of around 1000 bp.</p></li>
 <li><p>Bowtie 2 allows alignments to <a href="#ambiguous-characters">overlap ambiguous characters</a> (e.g. <code>N</code>s) in the reference. Bowtie 1 does not.</p></li>
 <li><p>Bowtie 2 does away with Bowtie 1's notion of alignment "stratum", and its distinction between "Maq-like" and "end-to-end" modes. In Bowtie 2 all alignments lie along a continuous spectrum of alignment scores where the <a href="#scores-higher-more-similar">scoring scheme</a>, similar to <a href="http://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm">Needleman-Wunsch</a> and <a href="http://en.wikipedia.org/wiki/Smith_waterman">Smith-Waterman</a>.</p></li>
 <li><p>Bowtie 2's <a href="#aligning-pairs">paired-end alignment</a> is more flexible. E.g. for pairs that do not align in a paired fashion, Bowtie 2 attempts to find unpaired alignments for each mate.</p></li>
-<li><p>Bowtie 2 reports a spectrum of mapping qualities, in contrast fo Bowtie 1 which reports either 0 or high.</p></li>
+<li><p>Bowtie 2 reports a spectrum of mapping qualities, in contrast for Bowtie 1 which reports either 0 or high.</p></li>
 <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">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>
+<p>Bowtie 2 does not support alignment of colorspace reads.</p>
 <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">Obtaining Bowtie 2</h1>
@@ -125,7 +124,7 @@
 <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. +The Threading Building Blocks library, TBB, is now the default +threading library in bowtie2. On POSIX platforms (like linux, Mac +OS, etc) if TBB is not available the pthread library will be used. +Although it is possible to use pthread library on Windows, a non-POSIX +platform, due to performance reasons bowtie 2 will try to use Windows +native mult [...]
+<p>+Bowtie 2 is using the multithreading software model in order to +speed up execution times on SMP architectures where this is possible. +The Threading Building Blocks library, TBB, is now the default +threading library in Bowtie 2. On POSIX platforms (like Linux, Mac +OS, etc.) if TBB is not available the pthread library will be used. +Although it is possible to use pthread library on Windows, a non-POSIX +platform, due to performance reasons Bowtie 2 will try to use Windows +native m [...]
 <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- [...]
@@ -136,7 +135,7 @@
              |||||  |||||||||| |||
   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>
+<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">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>
@@ -159,7 +158,7 @@ Alignment:
                  ||||||||| ||||||
   Reference: TAACTTGCGTTAAATCCGCCTGG</code></pre>
 <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>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">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>
@@ -236,8 +235,8 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <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 interrupted 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>
+<p>The trade-off 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.  [...]
+<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 trade-off between speed and sensitivity/accuracy.</p>
 <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">Ambiguous characters</h2>
@@ -245,9 +244,9 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <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">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 [...]
+<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 trade-off space, with the presets ending in <code>fast</code> generally being faster but less sensitive a [...]
 <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>
+<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 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 because 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>
 <li><code>YF:Z:NS</code>: the read was filtered because it contains a number of ambiguous characters (usually <code>N</code> or <code>.</code>) greater than the ceiling specified with <a href="#bowtie2-options-n-ceil"><code>--n-ceil</code></a>.</li>
@@ -305,239 +304,273 @@ Reference: GCAGATTATATGAGTCAGCTACGATATTGTTTGGGGTGACACATTACGCGTCTTTGAC</code></pr
 <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">Main arguments</h3>
-<table><tr><td>
-
+<table>
+<tr>
+<td>
 <pre><code>-x <bt2-idx></code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-1 <m1></code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-2 <m2></code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-U <r></code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-S <hit></code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+</table>
 <h3 id="options">Options</h3>
 <h4 id="input-options">Input options</h4>
 <table>
-<tr><td id="bowtie2-options-q">
-
+<tr>
+<td id="bowtie2-options-q">
 <pre><code>-q</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Reads (specified with <code><m1></code>, <code><m2></code>, <code><s></code>) are FASTQ files. FASTQ files usually have extension <code>.fq</code> or <code>.fastq</code>. FASTQ is the default format. See also: <a href="#bowtie2-options-solexa-quals"><code>--solexa-quals</code></a> and <a href="#bowtie2-options-int-quals"><code>--int-quals</code></a>.</p>
-</td></tr>
-<tr><td id="bowtie2-options-interleaved">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-interleaved">
 <pre><code>--interleaved</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Reads interleaved FASTQ files where the first two records (8 lines) represent a mate pair.</p>
-</td></tr>
-<tr><td id="bowtie2-options-tab5">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-tab5">
 <pre><code>--tab5</code></pre>
-</td><td>
-
-<p>Each read or pair is on a single line. An unpaired read line is [name]. A paired-end read line is [name]. An input file can be a mix of unpaired and paired-end reads and Bowtie 2 recognizes each according to the number of fields, handling each as it should.</p>
-</td></tr>
-<tr><td id="bowtie2-options-tab6">
-
+</td>
+<td>
+<p>Each read or pair is on a single line. An unpaired read line is [name]\t[seq]\t[qual]\n. A paired-end read line is [name]\t[seq1]\t[qual1]\t[seq2]\t[qual2]\n. An input file can be a mix of unpaired and paired-end reads and Bowtie 2 recognizes each according to the number of fields, handling each as it should.</p>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-tab6">
 <pre><code>--tab6</code></pre>
-</td><td>
-
-<p>Similar to <a href="#bowtie2-options-tab5"><code>--tab5</code></a> except, for paired-end reads, the second end can have a different name from the first: [name1]</p>
-</td></tr>
-<tr><td id="bowtie2-options-qseq">
-
+</td>
+<td>
+<p>Similar to <a href="#bowtie2-options-tab5"><code>--tab5</code></a>  except, for paired-end reads, the second end can have a different name from the first: [name1]\t[seq1]\t[qual1]\t[name2]\t[seq2]\t[qual2]\n</p>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-qseq">
 <pre><code>--qseq</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Reads (specified with <code><m1></code>, <code><m2></code>, <code><s></code>) are QSEQ files. QSEQ files usually end in <code>_qseq.txt</code>. See also: <a href="#bowtie2-options-solexa-quals"><code>--solexa-quals</code></a> and <a href="#bowtie2-options-int-quals"><code>--int-quals</code></a>.</p>
-</td></tr>
-<tr><td id="bowtie2-options-f">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-f">
 <pre><code>-f</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Reads (specified with <code><m1></code>, <code><m2></code>, <code><s></code>) are FASTA files. FASTA files usually have extension <code>.fa</code>, <code>.fasta</code>, <code>.mfa</code>, <code>.fna</code> or similar. FASTA files do not have a way of specifying quality values, so when <code>-f</code> is set, the result is as if <code>--ignore-quals</code> is also set.</p>
-</td></tr>
-<tr><td id="bowtie2-options-r">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-r">
 <pre><code>-r</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Reads (specified with <code><m1></code>, <code><m2></code>, <code><s></code>) are files with one input sequence per line, without any other information (no read names, no qualities). When <code>-r</code> is set, the result is as if <code>--ignore-quals</code> is also set.</p>
-</td></tr>
-<tr><td id="bowtie2-options-c">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-c">
 <pre><code>-c</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The read sequences are given on command line. I.e. <code><m1></code>, <code><m2></code> and <code><singles></code> are comma-separated lists of reads rather than lists of read files. There is no way to specify read names or qualities, so <code>-c</code> also implies <code>--ignore-quals</code>.</p>
-</td></tr>
-<tr><td id="bowtie2-options-s">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-s">
 <pre><code>-s/--skip <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Skip (i.e. do not align) the first <code><int></code> reads or pairs in the input.</p>
-</td></tr>
-<tr><td id="bowtie2-options-u">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-u">
 <pre><code>-u/--qupto <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Align the first <code><int></code> reads or read pairs from the input (after the <a href="#bowtie2-options-s"><code>-s</code>/<code>--skip</code></a> reads or pairs have been skipped), then stop. Default: no limit.</p>
-</td></tr>
-<tr><td id="bowtie2-options-5">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-5">
 <pre><code>-5/--trim5 <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Trim <code><int></code> bases from 5' (left) end of each read before alignment (default: 0).</p>
-</td></tr>
-<tr><td id="bowtie2-options-3">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-3">
 <pre><code>-3/--trim3 <int></code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-phred33-quals">
 <pre><code>--phred33</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Input qualities are ASCII chars equal to the <a href="http://en.wikipedia.org/wiki/Phred_quality_score">Phred quality</a> plus 33. This is also called the "Phred+33" encoding, which is used by the very latest Illumina pipelines.</p>
-</td></tr>
-<tr><td id="bowtie2-options-phred64-quals">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-phred64-quals">
 <pre><code>--phred64</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Input qualities are ASCII chars equal to the <a href="http://en.wikipedia.org/wiki/Phred_quality_score">Phred quality</a> plus 64. This is also called the "Phred+64" encoding.</p>
-</td></tr>
-<tr><td id="bowtie2-options-solexa-quals">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-solexa-quals">
 <pre><code>--solexa-quals</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Convert input qualities from <a href="http://en.wikipedia.org/wiki/Phred_quality_score">Solexa</a> (which can be negative) to <a href="http://en.wikipedia.org/wiki/Phred_quality_score">Phred</a> (which can't). This scheme was used in older Illumina GA Pipeline versions (prior to 1.3). Default: off.</p>
-</td></tr>
-<tr><td id="bowtie2-options-int-quals">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-int-quals">
 <pre><code>--int-quals</code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+</table>
 <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">
-
+<tr>
+<td id="bowtie2-options-very-fast">
 <pre><code>--very-fast</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 5 -R 1 -N 0 -L 22 -i S,0,2.50</code></p>
-</td></tr>
-<tr><td id="bowtie2-options-fast">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-fast">
 <pre><code>--fast</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 10 -R 2 -N 0 -L 22 -i S,0,2.50</code></p>
-</td></tr>
-<tr><td id="bowtie2-options-sensitive">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-sensitive">
 <pre><code>--sensitive</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 15 -R 2 -L 22 -i S,1,1.15</code> (default in <a href="#bowtie2-options-end-to-end"><code>--end-to-end</code></a> mode)</p>
-</td></tr>
-<tr><td id="bowtie2-options-very-sensitive">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-very-sensitive">
 <pre><code>--very-sensitive</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 20 -R 3 -N 0 -L 20 -i S,1,0.50</code></p>
-</td></tr>
+</td>
+</tr>
 </table>
-
 <h4 id="preset-options-in---local-mode">Preset options in <code>--local</code> mode</h4>
 <table>
-<tr><td id="bowtie2-options-very-fast-local">
-
+<tr>
+<td id="bowtie2-options-very-fast-local">
 <pre><code>--very-fast-local</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 5 -R 1 -N 0 -L 25 -i S,1,2.00</code></p>
-</td></tr>
-<tr><td id="bowtie2-options-fast-local">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-fast-local">
 <pre><code>--fast-local</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 10 -R 2 -N 0 -L 22 -i S,1,1.75</code></p>
-</td></tr>
-<tr><td id="bowtie2-options-sensitive-local">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-sensitive-local">
 <pre><code>--sensitive-local</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 15 -R 2 -N 0 -L 20 -i S,1,0.75</code> (default in <a href="#bowtie2-options-local"><code>--local</code></a> mode)</p>
-</td></tr>
-<tr><td id="bowtie2-options-very-sensitive-local">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-very-sensitive-local">
 <pre><code>--very-sensitive-local</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Same as: <code>-D 20 -R 3 -N 0 -L 20 -i S,1,0.50</code></p>
-</td></tr>
+</td>
+</tr>
 </table>
-
 <h4 id="alignment-options">Alignment options</h4>
 <table>
-
-<tr><td id="bowtie2-options-N">
-
+<tr>
+<td id="bowtie2-options-N">
 <pre><code>-N <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets the number of mismatches to allowed in a seed alignment during <a href="#multiseed-heuristic">multiseed alignment</a>. Can be set to 0 or 1. Setting this higher makes alignment slower (often much slower) but increases sensitivity. Default: 0.</p>
-</td></tr>
-<tr><td id="bowtie2-options-L">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-L">
 <pre><code>-L <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets the length of the seed substrings to align during <a href="#multiseed-heuristic">multiseed alignment</a>. Smaller values make alignment slower but more sensitive. Default: the <a href="#bowtie2-options-sensitive"><code>--sensitive</code></a> preset is used by default, which sets <code>-L</code> to 20 both in <a href="#bowtie2-options-end-to-end"><code>--end-to-end</code></a> mode and in <a href="#bowtie2-options-local"><code>--local</code></a> mode.</p>
-</td></tr>
-<tr><td id="bowtie2-options-i">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-i">
 <pre><code>-i <func></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets a function governing the interval between seed substrings to use during <a href="#multiseed-heuristic">multiseed alignment</a>. For instance, if the read has 30 characters, and seed length is 10, and the seed interval is 6, the seeds extracted will be:</p>
 <pre><code>Read:      TAGCTACGCTCTACGCTATCATGCATAAAC
 Seed 1 fw: TAGCTACGCT
@@ -549,473 +582,526 @@ Seed 3 rc:             ATGATAGCGT
 Seed 4 fw:                   TCATGCATAA
 Seed 4 rc:                   TTATGCATGA</code></pre>
 <p>Since it's best to use longer intervals for longer reads, this parameter sets the interval as a function of the read length, rather than a single one-size-fits-all number. For instance, specifying <code>-i S,1,2.5</code> sets the interval function <code>f</code> to <code>f(x) = 1 + 2.5 * sqrt(x)</code>, where x is the read length. See also: <a href="#setting-function-options">setting function options</a>. If the function returns a result less than 1, it is rounded up to 1. Default: th [...]
-</td></tr>
-<tr><td id="bowtie2-options-n-ceil">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-n-ceil">
 <pre><code>--n-ceil <func></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets a function governing the maximum number of ambiguous characters (usually <code>N</code>s and/or <code>.</code>s) allowed in a read as a function of read length. For instance, specifying <code>-L,0,0.15</code> sets the N-ceiling function <code>f</code> to <code>f(x) = 0 + 0.15 * x</code>, where x is the read length. See also: <a href="#setting-function-options">setting function options</a>. Reads exceeding this ceiling are <a href="#filtering">filtered out</a>. Default: <code>L,0, [...]
-</td></tr>
-<tr><td id="bowtie2-options-dpad">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-dpad">
 <pre><code>--dpad <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>"Pads" dynamic programming problems by <code><int></code> columns on either side to allow gaps. Default: 15.</p>
-</td></tr>
-<tr><td id="bowtie2-options-gbar">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-gbar">
 <pre><code>--gbar <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Disallow gaps within <code><int></code> positions of the beginning or end of the read. Default: 4.</p>
-</td></tr>
-<tr><td id="bowtie2-options-ignore-quals">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-ignore-quals">
 <pre><code>--ignore-quals</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>When calculating a mismatch penalty, always consider the quality value at the mismatched position to be the highest possible, regardless of the actual value. I.e. input is treated as though all quality values are high. This is also the default behavior when the input doesn't specify quality values (e.g. in <a href="#bowtie2-options-f"><code>-f</code></a>, <a href="#bowtie2-options-R"><code>-r</code></a>, or <a href="#bowtie2-options-c"><code>-c</code></a> modes).</p>
-</td></tr>
-<tr><td id="bowtie2-options-nofw">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-nofw">
 <pre><code>--nofw/--norc</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>If <code>--nofw</code> is specified, <code>bowtie2</code> will not attempt to align unpaired reads to the forward (Watson) reference strand. If <code>--norc</code> is specified, <code>bowtie2</code> will not attempt to align unpaired reads against the reverse-complement (Crick) reference strand. In paired-end mode, <code>--nofw</code> and <code>--norc</code> pertain to the fragments; i.e. specifying <code>--nofw</code> causes <code>bowtie2</code> to explore only those paired-end confi [...]
-</td></tr>
-<tr><td id="bowtie2-options-no-1mm-upfront">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-no-1mm-upfront">
 <pre><code>--no-1mm-upfront</code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-end-to-end">
 <pre><code>--end-to-end</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>In this mode, Bowtie 2 requires that the entire read align from one end to the other, without any trimming (or "soft clipping") of characters from either end. The match bonus <a href="#bowtie2-options-ma"><code>--ma</code></a> always equals 0 in this mode, so all alignment scores are less than or equal to 0, and the greatest possible alignment score is 0. This is mutually exclusive with <a href="#bowtie2-options-local"><code>--local</code></a>. <code>--end-to-end</code> is t [...]
-</td></tr>
-<tr><td id="bowtie2-options-local">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-local">
 <pre><code>--local</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>In this mode, Bowtie 2 does not require that the entire read align from one end to the other. Rather, some characters may be omitted ("soft clipped") from the ends in order to achieve the greatest possible alignment score. The match bonus <a href="#bowtie2-options-ma"><code>--ma</code></a> is used in this mode, and the best possible alignment score is equal to the match bonus (<a href="#bowtie2-options-ma"><code>--ma</code></a>) times the length of the read. Specifying <code [...]
-</td></tr>
+</td>
+</tr>
 </table>
-
 <h4 id="scoring-options">Scoring options</h4>
 <table>
-
-<tr><td id="bowtie2-options-ma">
-
+<tr>
+<td id="bowtie2-options-ma">
 <pre><code>--ma <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets the match bonus. In <a href="#bowtie2-options-local"><code>--local</code></a> mode <code><int></code> is added to the alignment score for each position where a read character aligns to a reference character and the characters match. Not used in <a href="#bowtie2-options-end-to-end"><code>--end-to-end</code></a> mode. Default: 2.</p>
-</td></tr>
-<tr><td id="bowtie2-options-mp">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-mp">
 <pre><code>--mp MX,MN</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets the maximum (<code>MX</code>) and minimum (<code>MN</code>) mismatch penalties, both integers. A number less than or equal to <code>MX</code> and greater than or equal to <code>MN</code> is subtracted from the alignment score for each position where a read character aligns to a reference character, the characters do not match, and neither is an <code>N</code>. If <a href="#bowtie2-options-ignore-quals"><code>--ignore-quals</code></a> is specified, the number subtracted quals <cod [...]
-</td></tr>
-<tr><td id="bowtie2-options-np">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-np">
 <pre><code>--np <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets penalty for positions where the read, reference, or both, contain an ambiguous character such as <code>N</code>. Default: 1.</p>
-</td></tr>
-<tr><td id="bowtie2-options-rdg">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-rdg">
 <pre><code>--rdg <int1>,<int2></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets the read gap open (<code><int1></code>) and extend (<code><int2></code>) penalties. A read gap of length N gets a penalty of <code><int1></code> + N * <code><int2></code>. Default: 5, 3.</p>
-</td></tr>
-<tr><td id="bowtie2-options-rfg">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-rfg">
 <pre><code>--rfg <int1>,<int2></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets the reference gap open (<code><int1></code>) and extend (<code><int2></code>) penalties. A reference gap of length N gets a penalty of <code><int1></code> + N * <code><int2></code>. Default: 5, 3.</p>
-</td></tr>
-<tr><td id="bowtie2-options-score-min">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-score-min">
 <pre><code>--score-min <func></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Sets a function governing the minimum alignment score needed for an alignment to be considered "valid" (i.e. good enough to report). This is a function of read length. For instance, specifying <code>L,0,-0.6</code> sets the minimum-score function <code>f</code> to <code>f(x) = 0 + -0.6 * x</code>, where <code>x</code> is the read length. See also: <a href="#setting-function-options">setting function options</a>. The default in <a href="#bowtie2-options-end-to-end"><code>--en [...]
-</td></tr>
+</td>
+</tr>
 </table>
-
 <h4 id="reporting-options">Reporting options</h4>
 <table>
-
-<tr><td id="bowtie2-options-k">
-
+<tr>
+<td id="bowtie2-options-k">
 <pre><code>-k <int></code></pre>
-</td><td>
-
+</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>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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-a">
 <pre><code>-a</code></pre>
-</td><td>
-
-<p>Like <a href="#bowtie2-options-k"><code>-k</code></a> but with no upper limit on number of alignments to search for. <code>-a</code> is mutually exclusive with <a href="#bowtie2-options-k"><code>-k</code></a>.</p>
+</td>
+<td>
+<p>Like <a href="#bowtie2-options-k"><code>-k</code></a> but with no upper limit on number of alignments to search for. <code>-a</code> is mutually exclusive with <a href="#bowtie2-options-k"><code>-k</code></a>.</p>
 <p>Note: Bowtie 2 is not designed with <code>-a</code> mode in mind, and when aligning reads to long, repetitive genomes this mode can be very, very slow.</p>
-</td></tr>
+</td>
+</tr>
 </table>
-
 <h4 id="effort-options">Effort options</h4>
 <table>
-
-<tr><td id="bowtie2-options-D">
-
+<tr>
+<td id="bowtie2-options-D">
 <pre><code>-D <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Up to <code><int></code> consecutive seed extension attempts can "fail" before Bowtie 2 moves on, using the alignments found so far. A seed extension "fails" if it does not yield a new best or a new second-best alignment. This limit is automatically adjusted up when -k or -a are specified. Default: 15.</p>
-</td></tr>
-<tr><td id="bowtie2-options-R">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-R">
 <pre><code>-R <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p><code><int></code> is the maximum number of times Bowtie 2 will "re-seed" reads with repetitive seeds. When "re-seeding," Bowtie 2 simply chooses a new set of reads (same length, same number of mismatches allowed) at different offsets and searches for more alignments. A read is considered to have repetitive seeds if the total number of seed hits divided by the number of seeds that aligned at least once is greater than 300. Default: 2.</p>
-</td></tr>
+</td>
+</tr>
 </table>
-
 <h4 id="paired-end-options">Paired-end options</h4>
 <table>
-
-<tr><td id="bowtie2-options-I">
-
+<tr>
+<td id="bowtie2-options-I">
 <pre><code>-I/--minins <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The minimum fragment length for valid paired-end alignments. E.g. if <code>-I 60</code> is specified and a paired-end alignment consists of two 20-bp alignments in the appropriate orientation with a 20-bp gap between them, that alignment is considered valid (as long as <a href="#bowtie2-options-X"><code>-X</code></a> is also satisfied). A 19-bp gap would not be valid in that case. If trimming options <a href="#bowtie2-options-3"><code>-3</code></a> or <a href="#bowtie2-options-5"><cod [...]
 <p>The larger the difference between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a>, the slower Bowtie 2 will run. This is because larger differences between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a> require that Bowtie 2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very efficient.</p>
 <p>Default: 0 (essentially imposing no minimum)</p>
-</td></tr>
-<tr><td id="bowtie2-options-X">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-X">
 <pre><code>-X/--maxins <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The maximum fragment length for valid paired-end alignments. E.g. if <code>-X 100</code> is specified and a paired-end alignment consists of two 20-bp alignments in the proper orientation with a 60-bp gap between them, that alignment is considered valid (as long as <a href="#bowtie2-options-I"><code>-I</code></a> is also satisfied). A 61-bp gap would not be valid in that case. If trimming options <a href="#bowtie2-options-3"><code>-3</code></a> or <a href="#bowtie2-options-5"><code>-5 [...]
 <p>The larger the difference between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a>, the slower Bowtie 2 will run. This is because larger differences between <a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a> require that Bowtie 2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very efficient.</p>
 <p>Default: 500.</p>
-</td></tr>
-<tr><td id="bowtie2-options-fr">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-fr">
 <pre><code>--fr/--rf/--ff</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The upstream/downstream mate orientations for a valid paired-end alignment against the forward reference strand. E.g., if <code>--fr</code> is specified and there is a candidate paired-end alignment where mate 1 appears upstream of the reverse complement of mate 2 and the fragment length constraints (<a href="#bowtie2-options-I"><code>-I</code></a> and <a href="#bowtie2-options-X"><code>-X</code></a>) are met, that alignment is valid. Also, if mate 2 appears upstream of the reverse co [...]
-</td></tr>
-<tr><td id="bowtie2-options-no-mixed">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-no-mixed">
 <pre><code>--no-mixed</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>By default, when <code>bowtie2</code> cannot find a concordant or discordant alignment for a pair, it then tries to find alignments for the individual mates. This option disables that behavior.</p>
-</td></tr>
-<tr><td id="bowtie2-options-no-discordant">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-no-discordant">
 <pre><code>--no-discordant</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>By default, <code>bowtie2</code> looks for discordant alignments if it cannot find any concordant alignments. A discordant alignment is an alignment where both mates align uniquely, but that does not satisfy the paired-end constraints (<a href="#bowtie2-options-fr"><code>--fr</code>/<code>--rf</code>/<code>--ff</code></a>, <a href="#bowtie2-options-I"><code>-I</code></a>, <a href="#bowtie2-options-X"><code>-X</code></a>). This option disables that behavior.</p>
-</td></tr>
-<tr><td id="bowtie2-options-dovetail">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-dovetail">
 <pre><code>--dovetail</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>If the mates "dovetail", that is if one mate alignment extends past the beginning of the other such that the wrong mate begins upstream, consider that to be concordant. See also: <a href="#mates-can-overlap-contain-or-dovetail-each-other">Mates can overlap, contain or dovetail each other</a>. Default: mates cannot dovetail in a concordant alignment.</p>
-</td></tr>
-<tr><td id="bowtie2-options-no-contain">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-no-contain">
 <pre><code>--no-contain</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>If one mate alignment contains the other, 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: a mate can contain the other in a concordant alignment.</p>
-</td></tr>
-<tr><td id="bowtie2-options-no-overlap">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-no-overlap">
 <pre><code>--no-overlap</code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+</table>
 <h4 id="output-options">Output options</h4>
 <table>
-
-<tr><td id="bowtie2-options-t">
-
+<tr>
+<td id="bowtie2-options-t">
 <pre><code>-t/--time</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print the wall-clock time required to load the index files and align the reads. This is printed to the "standard error" ("stderr") filehandle. Default: off.</p>
-</td></tr>
-<tr><td id="bowtie2-options-un">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-un">
 <pre><code>--un <path>
 --un-gz <path>
 --un-bz2 <path>
 --un-lz4 <path></code></pre>
-</td><td>
-
+</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> 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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-al">
 <pre><code>--al <path>
 --al-gz <path>
 --al-bz2 <path>
 --al-lz4 <path></code></pre>
-</td><td>
-
+</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. 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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-un-conc">
 <pre><code>--un-conc <path>
 --un-conc-gz <path>
 --un-conc-bz2 <path>
 --un-conc-lz4 <path></code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-al-conc">
 <pre><code>--al-conc <path>
 --al-conc-gz <path>
 --al-conc-bz2 <path>
 --al-conc-lz4 <path></code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-quiet">
 <pre><code>--quiet</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print nothing besides alignments and serious errors.</p>
-</td></tr>
-<tr><td id="bowtie2-options-met-file">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-met-file">
 <pre><code>--met-file <path></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Write <code>bowtie2</code> metrics to file <code><path></code>. Having alignment metric can be useful for debugging certain problems, especially performance issues. See also: <a href="#bowtie2-options-met"><code>--met</code></a>. Default: metrics disabled.</p>
-</td></tr>
-<tr><td id="bowtie2-options-met-stderr">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-met-stderr">
 <pre><code>--met-stderr <path></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Write <code>bowtie2</code> metrics to the "standard error" ("stderr") filehandle. This is not mutually exclusive with <a href="#bowtie2-options-met-file"><code>--met-file</code></a>. Having alignment metric can be useful for debugging certain problems, especially performance issues. See also: <a href="#bowtie2-options-met"><code>--met</code></a>. Default: metrics disabled.</p>
-</td></tr>
-<tr><td id="bowtie2-options-met">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-met">
 <pre><code>--met <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Write a new <code>bowtie2</code> metrics record every <code><int></code> seconds. Only matters if either <a href="#bowtie2-options-met-stderr"><code>--met-stderr</code></a> or <a href="#bowtie2-options-met-file"><code>--met-file</code></a> are specified. Default: 1.</p>
-</td></tr>
+</td>
+</tr>
 </table>
-
 <h4 id="sam-options">SAM options</h4>
 <table>
-
-<tr><td id="bowtie2-options-no-unal">
-
+<tr>
+<td id="bowtie2-options-no-unal">
 <pre><code>--no-unal</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Suppress SAM records for reads that failed to align.</p>
-</td></tr>
-<tr><td id="bowtie2-options-no-hd">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-no-hd">
 <pre><code>--no-hd</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Suppress SAM header lines (starting with <code>@</code>).</p>
-</td></tr>
-<tr><td id="bowtie2-options-no-sq">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-no-sq">
 <pre><code>--no-sq</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Suppress <code>@SQ</code> SAM header lines.</p>
-</td></tr>
-<tr><td id="bowtie2-options-rg-id">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-rg-id">
 <pre><code>--rg-id <text></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Set the read group ID to <code><text></code>. This causes the SAM <code>@RG</code> header line to be printed, with <code><text></code> as the value associated with the <code>ID:</code> tag. It also causes the <code>RG:Z:</code> extra field to be attached to each SAM output record, with value set to <code><text></code>.</p>
-</td></tr>
-<tr><td id="bowtie2-options-rg">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-rg">
 <pre><code>--rg <text></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Add <code><text></code> (usually of the form <code>TAG:VAL</code>, e.g. <code>SM:Pool1</code>) as a field on the <code>@RG</code> header line. Note: in order for the <code>@RG</code> line to appear, <a href="#bowtie2-options-rg-id"><code>--rg-id</code></a> must also be specified. This is because the <code>ID</code> tag is required by the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM Spec</a>. Specify <code>--rg</code> multiple times to set multiple fields. See the <a hr [...]
-</td></tr>
-<tr><td id="bowtie2-options-omit-sec-seq">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-omit-sec-seq">
 <pre><code>--omit-sec-seq</code></pre>
-</td><td>
-
-<p>When printing secondary alignments, Bowtie 2 by default will write out the <code>SEQ</code> and <code>QUAL</code> strings. Specifying this option causes Bowtie 2 to print an asterix in those fields instead.</p>
-</td></tr>
-
-
+</td>
+<td>
+<p>When printing secondary alignments, Bowtie 2 by default will write out the <code>SEQ</code> and <code>QUAL</code> strings. Specifying this option causes Bowtie 2 to print an asterisk in those fields instead.</p>
+</td>
+</tr>
 </table>
-
 <h4 id="performance-options">Performance options</h4>
-<table><tr>
-
+<table>
+<tr>
 <td id="bowtie2-options-o">
-
 <pre><code>-o/--offrate <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Override the offrate of the index with <code><int></code>. If <code><int></code> is greater than the offrate used to build the index, then some row markings are discarded when the index is read into memory. This reduces the memory footprint of the aligner but requires more time to calculate text offsets. <code><int></code> must be greater than the value used to build the index.</p>
-</td></tr>
-<tr><td id="bowtie2-options-p">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-p">
 <pre><code>-p/--threads NTHREADS</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Launch <code>NTHREADS</code> parallel search threads (default: 1). Threads will run on separate processors/cores and synchronize when parsing reads and outputting alignments. Searching for alignments is highly parallel, and speedup is close to linear. Increasing <code>-p</code> increases Bowtie 2's memory footprint. E.g. when aligning to a human genome index, increasing <code>-p</code> from 1 to 8 increases the memory footprint by a few hundred megabytes. This option is only available [...]
-</td></tr>
-<tr><td id="bowtie2-options-reorder">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-reorder">
 <pre><code>--reorder</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Guarantees that output SAM records are printed in an order corresponding to the order of the reads in the original input file, even when <a href="#bowtie2-options-p"><code>-p</code></a> is set greater than 1. Specifying <code>--reorder</code> and setting <a href="#bowtie2-options-p"><code>-p</code></a> greater than 1 causes Bowtie 2 to run somewhat slower and use somewhat more memory then if <code>--reorder</code> were not specified. Has no effect if <a href="#bowtie2-options-p"><code [...]
-</td></tr>
-<tr><td id="bowtie2-options-mm">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-mm">
 <pre><code>--mm</code></pre>
-</td><td>
-
+</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>
-
+</td>
+</tr>
+</table>
 <h4 id="other-options">Other options</h4>
 <table>
-<tr><td id="bowtie2-options-qc-filter">
-
+<tr>
+<td id="bowtie2-options-qc-filter">
 <pre><code>--qc-filter</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Filter out reads for which the QSEQ filter field is non-zero. Only has an effect when read format is <a href="#bowtie2-options-qseq"><code>--qseq</code></a>. Default: off.</p>
-</td></tr>
-<tr><td id="bowtie2-options-seed">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-seed">
 <pre><code>--seed <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Use <code><int></code> as the seed for pseudo-random number generator. Default: 0.</p>
-</td></tr>
-<tr><td id="bowtie2-options-non-deterministic">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-non-deterministic">
 <pre><code>--non-deterministic</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Normally, Bowtie 2 re-initializes its pseudo-random generator for each read. It seeds the generator with a number derived from (a) the read name, (b) the nucleotide sequence, (c) the quality sequence, (d) the value of the <a href="#bowtie2-options-seed"><code>--seed</code></a> option. This means that if two reads are identical (same name, same nucleotides, same qualities) Bowtie 2 will find and report the same alignment(s) for both, even if there was ambiguity. When <code>--non-determ [...]
-</td></tr>
-<tr><td id="bowtie2-options-version">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-version">
 <pre><code>--version</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print version information and quit.</p>
-</td></tr>
-<tr><td id="bowtie2-options-h">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-options-h">
 <pre><code>-h/--help</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print usage information and quit.</p>
-</td></tr></table>
-
+</td>
+</tr>
+</table>
 <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 subsequent 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>
 <ol style="list-style-type: decimal">
 <li><p>Name of read that aligned.</p>
-<p>Note that the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM specification</a> disallows whitespace in the read name. If the read name contains any whitespace characters, Bowtie 2 will truncate the name at the first whitespace character. This is similar to the behavior of other tools.</p></li>
+<p>Note that the <a href="http://samtools.sourceforge.net/SAM1.pdf">SAM specification</a> disallows whitespace in the read name. If the read name contains any whitespace characters, Bowtie 2 will truncate the name at the first whitespace character. This is similar to the behavior of other tools. The standard behavior of truncating at the first whitespace can be suppressed with <code>--sam-noqname-trunc</code> at the expense of generating non-standard SAM.</p></li>
 <li><p>Sum of all applicable flags. Flags relevant to Bowtie are:</p>
-<table><tr><td>
-
+<table>
+<tr>
+<td>
 <pre><code>1</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The read is one of a pair</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>2</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The alignment is one end of a proper paired-end alignment</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>4</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The read has no reported alignments</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>8</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The read is one of a pair and has no reported alignments</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>16</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The alignment is to the reverse reference strand</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>32</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The other mate in the paired-end alignment is aligned to the reverse reference strand</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>64</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The read is mate 1 in a pair</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>128</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The read is mate 2 in a pair</p>
-</td></tr></table>
-
+</td>
+</tr>
+</table>
 <p>Thus, an unpaired read that aligns to the reverse reference strand will have flag 16. A paired-end read that aligns and is the first mate in the pair will have flag 83 (= 64 + 16 + 2 + 1).</p></li>
 <li><p>Name of reference sequence where alignment occurs</p></li>
 <li><p>1-based offset into the forward reference strand where leftmost character of the alignment occurs</p></li>
@@ -1029,82 +1115,118 @@ 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></li>
 </ol>
 <table>
-<tr><td id="bowtie2-build-opt-fields-as">
+<tr>
+<td id="bowtie2-build-opt-fields-as">
 <pre><code>    AS:i:<N></code></pre>
 </td>
 <td>
-    
-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.
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xs">
+<pre><code>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.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-xs">
 <pre><code>    XS:i:<N></code></pre>
 </td>
 <td>
-    
-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 href= [...]
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-ys">
+<pre><code>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`].</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-ys">
 <pre><code>    YS:i:<N></code></pre>
 </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">
+<pre><code>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.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-xn">
 <pre><code>    XN:i:<N></code></pre>
 </td>
 <td>
-    
-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">
+<pre><code>The number of ambiguous bases in the reference covering this alignment. 
+Only present if SAM record is for an aligned read.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-xm">
 <pre><code>    XM:i:<N></code></pre>
 </td>
 <td>
-    
-The number of mismatches in the alignment. Only present if SAM record is for an aligned read.
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xo">
+<pre><code>The number of mismatches in the alignment.  Only present if SAM record is
+for an aligned read.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-xo">
 <pre><code>    XO:i:<N></code></pre>
 </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.
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-xg">
+<pre><code>The number of gap opens, for both read and reference gaps, in the alignment.
+Only present if SAM record is for an aligned read.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-xg">
 <pre><code>    XG:i:<N></code></pre>
 </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">
+<pre><code>The number of gap extensions, for both read and reference gaps, in the
+alignment. Only present if SAM record is for an aligned read.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-nm">
 <pre><code>    NM:i:<N></code></pre>
 </td>
 <td>
-    
-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">
+<pre><code>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.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-yf">
 <pre><code>    YF:Z:<S></code></pre>
-</td><td>
-    
-String indicating reason why the read was filtered out. See also: <a href="#filtering">Filtering</a>. Only appears for reads that were filtered out.
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-yt">
+</td>
+<td>
+<pre><code>String indicating reason why the read was filtered out.  See also:
+[Filtering].  Only appears for reads that were filtered out.</code></pre>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-yt">
 <pre><code>    YT:Z:<S></code></pre>
-</td><td>
-    
-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. <a href="#filtering">Filtering</a>: #filtering
-</td></tr>
-<tr><td id="bowtie2-build-opt-fields-md">
+</td>
+<td>
+<pre><code>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>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-opt-fields-md">
 <pre><code>    MD:Z:<S></code></pre>
-</td><td>
-    
-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.
-</td></tr>
+</td>
+<td>
+<pre><code>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.</code></pre>
+</td>
+</tr>
 </table>
-
 <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>
@@ -1116,171 +1238,220 @@ A string representation of the mismatched reference bases in the alignment. See
 <p>Usage:</p>
 <pre><code>bowtie2-build [options]* <reference_in> <bt2_base></code></pre>
 <h3 id="main-arguments-1">Main arguments</h3>
-<table><tr><td>
-
+<table>
+<tr>
+<td>
 <pre><code><reference_in></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>A comma-separated list of FASTA files containing the reference sequences to be aligned to, or, if <a href="#bowtie2-build-options-c"><code>-c</code></a> is specified, the sequences themselves. E.g., <code><reference_in></code> might be <code>chr1.fa,chr2.fa,chrX.fa,chrY.fa</code>, or, if <a href="#bowtie2-build-options-c"><code>-c</code></a> is specified, this might be <code>GGTCATCCT,ACGGGTCGT,CCGTTCTATGCGGCTTA</code>.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code><bt2_base></code></pre>
-</td><td>
-
+</td>
+<td>
 <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>
-
+</td>
+</tr>
+</table>
 <h3 id="options-1">Options</h3>
-<table><tr><td>
-
+<table>
+<tr>
+<td>
 <pre><code>-f</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The reference input files (specified as <code><reference_in></code>) are FASTA files (usually having extension <code>.fa</code>, <code>.mfa</code>, <code>.fna</code> or similar).</p>
-</td></tr><tr><td id="bowtie2-build-options-c">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-c">
 <pre><code>-c</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The reference sequences are given on the command line. I.e. <code><reference_in></code> is a comma-separated list of sequences rather than a list of FASTA files.</p>
-</td></tr>
-</td></tr><tr><td id="bowtie2-build-options-large-index">
-
+</td>
+</tr>
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-large-index">
 <pre><code>--large-index</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Force <code>bowtie2-build</code> to build a <a href="#small-and-large-indexes">large index</a>, even if the reference is less than ~ 4 billion nucleotides inlong.</p>
-</td></tr>
-<tr><td id="bowtie2-build-options-a">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-a">
 <pre><code>-a/--noauto</code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-p">
 <pre><code>-p/--packed</code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-bmax">
 <pre><code>--bmax <int></code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-bmaxdivn">
 <pre><code>--bmaxdivn <int></code></pre>
-</td><td>
-
+</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 * number of threads. This is configured automatically by default; use <a href="#bowtie2-build-options-a"><cod [...]
-</td></tr><tr><td id="bowtie2-build-options-dcv">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-dcv">
 <pre><code>--dcv <int></code></pre>
-</td><td>
-
+</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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-nodc">
 <pre><code>--nodc</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Disable use of the difference-cover sample. Suffix sorting becomes quadratic-time in the worst case (where the worst case is an extremely repetitive reference). Default: off.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-r/--noref</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Do not build the <code>NAME.3.bt2</code> and <code>NAME.4.bt2</code> portions of the index, which contain a bitpacked version of the reference sequences and are used for paired-end alignment.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-3/--justref</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Build only the <code>NAME.3.bt2</code> and <code>NAME.4.bt2</code> portions of the index, which contain a bitpacked version of the reference sequences and are used for paired-end alignment.</p>
-</td></tr><tr><td id="bowtie2-build-options-o">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-build-options-o">
 <pre><code>-o/--offrate <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>To map alignments back to positions on the reference sequences, it's necessary to annotate ("mark") some or all of the <a href="http://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler</a> rows with their corresponding location on the genome. <a href="#bowtie2-build-options-o"><code>-o</code>/<code>--offrate</code></a> governs how many rows get marked: the indexer will mark every 2^<code><int></code> rows. Marking more rows makes reference-position looku [...]
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-t/--ftabchars <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>The ftab is the lookup table used to calculate an initial <a href="http://en.wikipedia.org/wiki/Burrows-Wheeler_transform">Burrows-Wheeler</a> range with respect to the first <code><int></code> characters of the query. A larger <code><int></code> yields a larger lookup table but faster query times. The ftab has size 4^(<code><int></code>+1) bytes. The default setting is 10 (ftab is 4MB).</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>--seed <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Use <code><int></code> as the seed for pseudo-random number generator.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>--cutoff <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Index only the first <code><int></code> bases of the reference sequences (cumulative across sequences) and ignore the rest.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-q/--quiet</code></pre>
-</td><td>
-
+</td>
+<td>
 <p><code>bowtie2-build</code> is verbose by default. With this option <code>bowtie2-build</code> will print only error messages.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>--threads <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <p>By default <code>bowtie2-build</code> is using only one thread. Increasing the number of threads will speed up the index building considerably in most cases.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-h/--help</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print usage information and quit.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>--version</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print version information and quit.</p>
-</td></tr></table>
-
+</td>
+</tr>
+</table>
 <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">Command Line</h2>
 <p>Usage:</p>
 <pre><code>bowtie2-inspect [options]* <bt2_base></code></pre>
 <h3 id="main-arguments-2">Main arguments</h3>
-<table><tr><td>
-
+<table>
+<tr>
+<td>
 <pre><code><bt2_base></code></pre>
-</td><td>
-
+</td>
+<td>
 <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>
-
+</td>
+</tr>
+</table>
 <h3 id="options-2">Options</h3>
-<table><tr><td>
-
+<table>
+<tr>
+<td>
 <pre><code>-a/--across <int></code></pre>
-</td><td>
-
+</td>
+<td>
 <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">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-inspect-options-n">
 <pre><code>-n/--names</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print reference sequence names, one per line, and quit.</p>
-</td></tr><tr><td id="bowtie2-inspect-options-s">
-
+</td>
+</tr>
+<tr>
+<td id="bowtie2-inspect-options-s">
 <pre><code>-s/--summary</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print a summary that includes information about index settings, as well as the names and lengths of the input sequences. The summary has this format:</p>
 <pre><code>Colorspace  <0 or 1>
 SA-Sample   1 in <sample>
@@ -1290,26 +1461,33 @@ Sequence-2  <name>  <len>
 ...
 Sequence-N  <name>  <len></code></pre>
 <p>Fields are separated by tabs. Colorspace is always set to 0 for Bowtie 2.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-v/--verbose</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print verbose output (for debugging).</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>--version</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print version information and quit.</p>
-</td></tr><tr><td>
-
+</td>
+</tr>
+<tr>
+<td>
 <pre><code>-h/--help</code></pre>
-</td><td>
-
+</td>
+<td>
 <p>Print usage information and quit.</p>
-</td></tr></table>
-
+</td>
+</tr>
+</table>
 <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>
@@ -1348,12 +1526,12 @@ r7  16  gi|9626243|ref|NC_001416.1| 4692    42  143M    *   0   0   TCAGCCGGACGC
 <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>
-<p>Use <code>samtools view</code> to convert the SAM file into a BAM file. BAM is a the binary format corresponding to the SAM text format. Run:</p>
+<p>Use <code>samtools view</code> to convert the SAM file into a BAM file. BAM is the binary format corresponding to the SAM text format. Run:</p>
 <pre><code>samtools view -bS eg2.sam > eg2.bam</code></pre>
 <p>Use <code>samtools sort</code> to convert the BAM file to a sorted BAM file.</p>
-<pre><code>samtools sort eg2.bam eg2.sorted</code></pre>
+<pre><code>samtools sort eg2.bam -o eg2.sorted.bam</code></pre>
 <p>We now have a sorted BAM file called <code>eg2.sorted.bam</code>. Sorted BAM is a useful format because the alignments are (a) compressed, which is convenient for long-term storage, and (b) sorted, which is conveneint for variant discovery. To generate variant calls in VCF format, run:</p>
-<pre><code>samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -bvcg - > eg2.raw.bcf</code></pre>
+<pre><code>samtools mpileup -uf $BT2_HOME/example/reference/lambda_virus.fa eg2.sorted.bam | bcftools view -Ov - > eg2.raw.bcf</code></pre>
 <p>Then to view the variants, run:</p>
 <pre><code>bcftools view eg2.raw.bcf</code></pre>
 <p>See the official SAMtools guide to <a href="http://samtools.sourceforge.net/mpileup.shtml">Calling SNPs/INDELs with SAMtools/BCFtools</a> for more details and variations on this process.</p>
diff --git a/doc/website/recent_news.ssi b/doc/website/recent_news.ssi
index 07103af..8283835 100644
--- a/doc/website/recent_news.ssi
+++ b/doc/website/recent_news.ssi
@@ -1,3 +1,14 @@
+<h2>Version 2.3.2 - May 05, 2017</h2>
+</ul>
+    <li>Added support for interleaved paired-end FASTQ inputs (--interleaved)</li>
+    <li>Now reports MREVERSE SAM flag for unaligned end when only one end of a pair aligns</li>
+    <li>Fixed issue where first character of some read names was omitted from SAM output when using tabbed input formats</li>
+    <li>Added --sam-no-qname-trunc option, which causes entire read name, including spaces, to be written to SAM output.  This violates SAM specification, but can be useful in applications that immediately postprocess the SAM.</li>
+    <li>Fixed compilation error caused by pointer comparison issue in aligner_result.cpp</li>
+    <li>Removed termcap and readline dependencies introduced in v2.3.1</li>
+    <li>Fixed compilation issues caused by gzbuffer function when compiling with zlib v1.2.3.5 and earlier. Users compiling against these libraries will use the zlib default buffer size of 8Kb when decompressing read files.</li>
+    <li>Fixed issue that would cause Bowtie 2 hang when aligning FASTA inputs with more than one thread</li>
+</ul>
 <h2>Version 2.3.1 - Mar 03, 2017</h2>
 <p>Please note that as of this release Bowtie 2 now has dependencies on zlib and readline libraries. Make sure that all dependencies are met before attempting to build from source.</p>
 <ul>
diff --git a/doc/website/rhsidebar.ssi b/doc/website/rhsidebar.ssi
index 8f976dc..67b76b4 100644
--- a/doc/website/rhsidebar.ssi
+++ b/doc/website/rhsidebar.ssi
@@ -18,10 +18,10 @@
         </tr>
       <tr>
       <td>
-        <a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie2/2.3.1">Bowtie2 2.3.1</a>
+        <a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie2/2.3.2">Bowtie2 2.3.2</a>
       </td>
       <td align="right">
-        03/04/17 
+        05/05/17 
       </td>
       </tr>
       <tr>
diff --git a/pat.cpp b/pat.cpp
index e5f387b..6240eb7 100644
--- a/pat.cpp
+++ b/pat.cpp
@@ -463,7 +463,17 @@ void CFilePatternSource::open() {
 			}
 		}
 		is_open_ = true;
-		compressed_ ? gzbuffer(zfp_, 64*1024) : setvbuf(fp_, buf_, _IOFBF, 64*1024);
+        if (compressed_) {
+#if ZLIB_VERNUM < 0x1235
+            cerr << "Warning: gzbuffer added in zlib v1.2.3.5. Unable to change "
+                    "buffer size from default of 8192." << endl;
+#else
+            gzbuffer(zfp_, 64*1024);
+#endif
+        }
+        else {
+            setvbuf(fp_, buf_, _IOFBF, 64*1024);
+        }
 		return;
 	}
 	cerr << "Error: No input read files were valid" << endl;
@@ -672,6 +682,10 @@ pair<bool, int> FastaPatternSource::nextBatchFromFile(
 			buf.append(c);
 		}
 	}
+	// Immediate EOF case
+	if(done && readbuf[readi-1].readOrigBuf.length() == 1) {
+		readi--;
+	}
 	return make_pair(done, readi);
 }
 
@@ -1099,7 +1113,7 @@ pair<bool, int> TabbedPatternSource::nextBatchFromFile(
 			readbuf[readi].readOrigBuf.append(c);
 			c = getc_wrapper();
 		}
-		while(c >= 0 && (c == '\n' || c == '\r')) {
+		while(c >= 0 && (c == '\n' || c == '\r') && readi < pt.max_buf_ - 1) {
 			c = getc_wrapper();
 		}
 	}
diff --git a/read.h b/read.h
index 15c721f..f9bbf95 100644
--- a/read.h
+++ b/read.h
@@ -432,10 +432,14 @@ 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
+	float seedPctUnique;      // % of read covered by unique seed hits
+	float seedPctUniqueMS[4]; // % of read covered by unique seed hits by mate and strand
+	float seedPctRep;         // % of read covered by repetitive seed hits
+	float seedPctRepMS[4];    // % of read covered by repetitive seed hits by mate and strand
+	float seedHitAvg;         // avg # seed hits per hitting seed
+	float seedHitAvgMS[4];    // avg # seed hits per hitting seed by mate and strand
+	float seedsPerNuc;        // # seeds tried / # alignable nucleotides
+	float seedsPerNucMS[4];   // # seeds tried / # alignable nucleotides by mate and strand
 	
 	// For collecting information to go into an FM string
 	bool doFmString;
diff --git a/sam.cpp b/sam.cpp
index ca9ca3e..29a5af5 100644
--- a/sam.cpp
+++ b/sam.cpp
@@ -134,7 +134,7 @@ void SamConfig::printAlignedOptFlags(
 	const
 {
 	char buf[1024];
-	assert(summ.best(rd.mate < 2).valid());
+	assert(summ.bestScore(rd.mate < 2).valid());
 	if(print_as_) {
 		// AS:i: Alignment score generated by aligner
 		itoa10<TAlScore>(res.score().score(), buf);
@@ -145,10 +145,10 @@ void SamConfig::printAlignedOptFlags(
 	if(print_xs_) {
 		// XS:i: Suboptimal alignment score
 		AlnScore sco;
-		if(flags.alignedConcordant()) {
-			sco = summ.bestUnchosen(rd.mate < 2);
+		if(flags.partOfPair()) {
+			sco = summ.bestUnchosenPScore(rd.mate < 2);
 		} else {
-			sco = summ.secbest(rd.mate < 2);
+			sco = summ.bestUnchosenUScore();
 		}
 		if(sco.valid()) {
 			itoa10<TAlScore>(sco.score(), buf);
@@ -333,24 +333,24 @@ void SamConfig::printAlignedOptFlags(
 	}
 	if(flags.partOfPair() && print_zp_) {
 		// ZP:i: Score of best concordant paired-end alignment
-		if(summ.bestPaired().valid()) {
+		if(summ.bestCScore().valid()) {
 			WRITE_SEP();
 			o.append("ZP:i:");
-			itoa10<TAlScore>(summ.bestPaired().score(), buf);
+			itoa10<TAlScore>(summ.bestCScore().score(), buf);
 			o.append(buf);
 		}
 		// Zp:i: Score of second-best concordant paired-end alignment
-		if(summ.secbestPaired().valid()) {
+		if(summ.bestUnchosenCScore().valid()) {
 			WRITE_SEP();
 			o.append("Zp:i:");
-			itoa10<TAlScore>(summ.secbestPaired().score(), buf);
+			itoa10<TAlScore>(summ.bestUnchosenCScore().score(), buf);
 			o.append(buf);
 		}
 	}
 	if(print_zu_) {
 		// ZU:i: Score of best unpaired alignment
-		AlnScore best    = (rd.mate <= 1 ? summ.best1()    : summ.best2());
-		AlnScore secbest = (rd.mate <= 1 ? summ.secbest1() : summ.secbest2());
+		AlnScore best    = summ.bestScore(rd.mate <= 1);
+		AlnScore secbest = summ.bestUnchosenPScore(rd.mate <= 1);
 		WRITE_SEP();
 		o.append("ZU:i:");
 		if(best.valid()) {
@@ -521,54 +521,62 @@ void SamConfig::printAlignedOptFlags(
 	}
 	if(print_zt_) {
 		// ZT:Z: Extra features for MAPQ estimation
-		
-		// 1. AS:i for current mate
-		// 2. diff or NA for current mate
-		// 3. Like 1 for opposite mate
-		// 4. Like 2 for opposite mate
-		
 		WRITE_SEP();
 		const bool paired = flags.partOfPair();
 		const TAlScore MN = std::numeric_limits<TAlScore>::min();
 		TAlScore secondBest[2] = {MN, MN};
 		TAlScore thirdBest[2] = {MN, MN};
-		{
-			for (int self = 0; self < (paired ? 2 : 1); self++) {
-				// Second-best
-				AlnScore sco;
-				bool mate1 = rd.mate < 2;
-				if(self > 0) mate1 = !mate1;
-				if(flags.alignedConcordant()) {
-					sco = summ.bestUnchosen(mate1);
-				} else {
-					sco = summ.secbest(mate1);
+		const int ED_MAX = std::numeric_limits<int>::max();
+		AlnScore best[2] = {res.score(), res.oscore()};
+		TAlScore diffEd[2] = {ED_MAX, ED_MAX};
+		for (int self = 0; self < (paired ? 2 : 1); self++) {
+			// Second-best
+			AlnScore sco;
+			bool mate1 = rd.mate < 2; // first iteration: self
+			if(self > 0) mate1 = !mate1; // second iteration: opposite
+			if(flags.partOfPair()) {
+				sco = summ.bestUnchosenPScore(mate1);
+			} else {
+				sco = summ.bestUnchosenUScore();
+			}
+			if(sco.valid()) {
+				secondBest[self] = sco.score();
+			}
+
+			// Third-best
+			thirdBest[self] = mate1 ? prm.bestLtMinscMate1 : prm.bestLtMinscMate2;
+			
+			if(flags.partOfPair()) {
+				if(summ.bestUnchosenPDist(mate1).valid()) {
+					diffEd[self] = best[self].basesAligned() - summ.bestUnchosenPDist(mate1).basesAligned();
 				}
-				if(sco.valid()) {
-					secondBest[self] = sco.score();
+			} else {
+				if(summ.bestUnchosenUDist().valid()) {
+					diffEd[self] = best[self].basesAligned() - summ.bestUnchosenUDist().basesAligned();
 				}
-
-				// Third-best
-				thirdBest[self] = mate1 ? prm.bestLtMinscMate1 : prm.bestLtMinscMate2;
 			}
 		}
-		TAlScore best[2] = {res.score().score(), res.oscore().score()};
 		TAlScore diff[2] = {MN, MN};
 		for(int self = 0; self < 2; self++) {
 			const TAlScore mx = max(secondBest[self], thirdBest[self]);
-			if(best[self] > MN && mx > MN) {
-				diff[self] = best[self] - mx;
+			if(best[self].score() > MN && mx > MN) {
+				diff[self] = best[self].score() - mx;
 			}
 		}
 		TAlScore best_conc = MN, diff_conc = MN;
-		if(paired && summ.bestPaired().valid()) {
-			best_conc = summ.bestPaired().score();
-			if(summ.secbestPaired().valid()) {
-				diff_conc = best_conc - summ.secbestPaired().score();
+		int diffEd_conc = ED_MAX;
+		if(paired && summ.bestCScore().valid()) {
+			best_conc = summ.bestCScore().score();
+			if(summ.bestUnchosenCScore().valid()) {
+				diff_conc = best_conc - summ.bestUnchosenCScore().score();
+			}
+			if(summ.bestUnchosenCDist().valid()) {
+				diffEd_conc = summ.bestCDist().basesAligned() - summ.bestUnchosenCDist().basesAligned();
 			}
 		}
 		o.append("ZT:Z:");
 		// AS:i for current mate
-		itoa10<TAlScore>((int)best[0], buf);
+		itoa10<TAlScore>((int)best[0].score(), buf);
 		o.append(buf);
 		o.append(",");
 		// diff for current mate
@@ -579,9 +587,17 @@ void SamConfig::printAlignedOptFlags(
 			o.append("NA");
 		}
 		o.append(",");
+		// edit distance diff for current mate
+		if(diffEd[0] != ED_MAX) {
+			itoa10<TAlScore>((int)diffEd[0], buf);
+			o.append(buf);
+		} else {
+			o.append("NA");
+		}
+		o.append(",");
 		// AS:i for other mate
-		if(best[1] > MN) {
-			itoa10<TAlScore>((int)best[1], buf);
+		if(best[1].score() > MN) {
+			itoa10<TAlScore>((int)best[1].score(), buf);
 			o.append(buf);
 		} else {
 			o.append("NA");
@@ -611,16 +627,42 @@ void SamConfig::printAlignedOptFlags(
 			o.append("NA");
 		}
 		o.append(",");
-		itoa10<TAlScore>((int)(prm.seedsPerNuc * 1000), buf);
+		// Edit distance diff for aligned pairs
+		if(diffEd_conc != ED_MAX) {
+			itoa10<TAlScore>((int)diffEd_conc, buf);
+			o.append(buf);
+		} else {
+			o.append("NA");
+		}
+		// Flags related to seed hits, specific to this mate but not to the
+		// strand aligned to
+		int mate = (rd.mate < 2 ? 0 : 1);
+		o.append(",");
+		itoa10<TAlScore>((int)((prm.seedsPerNucMS[2 * mate] + prm.seedsPerNucMS[2 * mate + 1]) * 1000), buf);
+		o.append(buf);
+		o.append(",");
+		itoa10<TAlScore>((int)((prm.seedPctUniqueMS[2 * mate] + prm.seedPctUniqueMS[2 * mate + 1]) * 1000), buf);
+		o.append(buf);
+		o.append(",");
+		itoa10<TAlScore>((int)((prm.seedPctRepMS[2 * mate] + prm.seedPctRepMS[2 * mate + 1]) * 1000), buf);
+		o.append(buf);
+		o.append(",");
+		itoa10<TAlScore>((int)((prm.seedHitAvgMS[2 * mate] + prm.seedHitAvgMS[2 * mate + 1]) + 0.5f), buf);
+		o.append(buf);
+		// Flags related to seed hits again, but specific both to this mate and
+		// to the strand aligned to
+		int fw = res.fw() ? 0 : 1;
+		o.append(",");
+		itoa10<TAlScore>((int)(prm.seedsPerNucMS[2 * mate + fw] * 1000), buf);
 		o.append(buf);
 		o.append(",");
-		itoa10<TAlScore>((int)(prm.seedPctUnique * 1000), buf);
+		itoa10<TAlScore>((int)(prm.seedPctUniqueMS[2 * mate + fw] * 1000), buf);
 		o.append(buf);
 		o.append(",");
-		itoa10<TAlScore>((int)(prm.seedPctRep * 1000), buf);
+		itoa10<TAlScore>((int)(prm.seedPctRepMS[2 * mate + fw] * 1000), buf);
 		o.append(buf);
 		o.append(",");
-		itoa10<TAlScore>((int)(prm.seedHitAvg + 0.5), buf);
+		itoa10<TAlScore>((int)(prm.seedHitAvgMS[2 * mate + fw] + 0.5f), buf);
 		o.append(buf);
 	}
 }
diff --git a/scripts/test/simple_tests.pl b/scripts/test/simple_tests.pl
index 6cc1fb4..b98edab 100644
--- a/scripts/test/simple_tests.pl
+++ b/scripts/test/simple_tests.pl
@@ -1109,6 +1109,16 @@ my @cases = (
 	  args   => ""
 	},
 
+	{ name   => "MREVERSE flag is set if mate does not align",
+	  ref    => [ "TTCACCATTTTTCTTTTCGTTAACTTGCCGTCAGCCTTTTCTTTGACCTCTTCTTTCTGTTCATGTGTATTTGCTGTCTCTTAGCCCAGACTTCCCGTGTCCTTTCCACCGGGCCTTTGAGAGGTCACAGGGTCTTGATGCTGTGGTCTTCATCTGCAGGTGTCTGACTTCCAGCAACTGCTGGCCTGTGCCAGGGTGCAAGCTGAGCACTGGAGTGGAGTTTTCCTGTGGAGAGGAGCCATGCCTAGAG" ],
+	  norc   => 1,
+	  mate1s => [   "AAGACCACAGCATCAAGACCCTGTGACCTCTCAAAGGCCCGGTGGAAAGGACACGGGAAGTCTGGGCTAAGAGACAGCAAATACACATGAACAGAAAGAA" ],
+	  mate2s => [   "CAGCGGCCCTGCCTCCTACCCTTGCGCCTCATGACCAGCTTGTTGAAGAGATCCGACATCAAGTGCCCACCTTGGCTCGTGGCTCTCACTGCAACGGGAA" ],
+	  samflags_map => [{ 50 => (1 | 8 | 16 | 64), "*" => (1 | 4 | 32 | 128) }],
+	  report => "",
+	  args   => ""
+	},
+
 	{ name   => "Flags for when mates align non-concordantly, with many alignments for one",
 	#              012345678
 	  ref    => [ "CAGCGGCTAGCTATCGATCGTCCGGCAGCTATCATTATGATAGGATAGATCGCTCGCCTGACCTATATCGCTCGCGATTACGAGCTACGTACTGGCTATCCGAGCTGACGCATCACGACGATCGAGGATAGATCGCTCGCCTGACCTATATCGCTCGCGATTACGAGCTACGTACTGGCTATCCGAGCTGACGCATCACGACGATCGAGGATAGATCGCTCGCCTGACCTATATCGCTCGCGATTACGAGCTACGTACTGGCTATCCGAGCTGACGCATCACGACGATCG" ],
@@ -4466,10 +4476,10 @@ my  $idx_type = "";
 	my $cmd;
 	if($pe) {
 		# Paired-end case
-		$cmd = "$bowtie2 $debug_arg $idx_type $args -x .simple_tests.tmp $formatarg -1 $mate1arg -2 $mate2arg";
+		$cmd = "$bowtie2 $debug_arg @ARGV $idx_type $args -x .simple_tests.tmp $formatarg -1 $mate1arg -2 $mate2arg";
 	} else {
 		# Unpaired case
-		$cmd = "$bowtie2 $debug_arg $idx_type $args -x .simple_tests.tmp $formatarg $readarg";
+		$cmd = "$bowtie2 $debug_arg @ARGV $idx_type $args -x .simple_tests.tmp $formatarg $readarg";
 	}
 	print "$cmd\n";
 	open(BT, "$cmd |") || die "Could not open pipe '$cmd |'";
diff --git a/unique.h b/unique.h
index b5613d3..79a1d2d 100644
--- a/unique.h
+++ b/unique.h
@@ -61,7 +61,7 @@ public:
 		char *inps)
 	{
 		assert(!s.empty());
-		return !VALID_AL_SCORE(s.secbest(mate1));
+		return !VALID_AL_SCORE(s.bestUnchosenScore(mate1));
 	}
 };
 
@@ -120,20 +120,20 @@ public:
 		if(s.paired()) {
 			return pair_nosec_perf;
 		} else {
-			bool hasSecbest = VALID_AL_SCORE(s.secbest(mate1));
+			bool hasSecbest = VALID_AL_SCORE(s.bestUnchosenScore(mate1));
 			if(!flags.canMax() && !s.exhausted(mate1) && !hasSecbest) {
 				return 255;
 			}
 			TAlScore scMax = (TAlScore)sc_.perfectScore(rdlen);
 			TAlScore scMin = scoreMin_.f<TAlScore>((float)rdlen);
 			assert_geq(scMax, scMin);
-			TAlScore best  = scMax - s.best(mate1).score(); // best score (lower=better)
+			TAlScore best  = scMax - s.bestScore(mate1).score(); // best score (lower=better)
 			size_t best_bin = (size_t)((double)best * (10.0 / (double)(scMax - scMin)) + 0.5);
 			assert_geq(best_bin, 0);
 			assert_lt(best_bin, 11);
 			if(hasSecbest) {
-				assert_geq(s.best(mate1).score(), s.secbest(mate1).score());
-				size_t diff = s.best(mate1).score() - s.secbest(mate1).score();
+				assert_geq(s.bestScore(mate1).score(), s.bestUnchosenScore(mate1).score());
+				size_t diff = s.bestScore(mate1).score() - s.bestUnchosenScore(mate1).score();
 				size_t diff_bin = (size_t)((double)diff * (10.0 / (double)(scMax - scMin)) + 0.5);
 				assert_geq(diff_bin, 0);
 				assert_lt(diff_bin, 11);
@@ -194,8 +194,8 @@ public:
 	{
 		// Did the read have a second-best alignment?
 		bool hasSecbest = s.paired() ?
-			VALID_AL_SCORE(s.secbestPaired()) :
-			VALID_AL_SCORE(s.secbest(mate1));
+			VALID_AL_SCORE(s.bestUnchosenCScore()) :
+			VALID_AL_SCORE(s.bestUnchosenScore(mate1));
 		// This corresponds to a scenario where we found one and only one
 		// alignment but didn't really look for a second one
 		if(!flags.canMax() && !s.exhausted(mate1) && !hasSecbest) {
@@ -215,7 +215,7 @@ public:
 		TAlScore diff = (scPer - scMin);  // scores can vary by up to this much
 		TMapq ret = 0;
 		TAlScore best = s.paired() ?
-			s.bestPaired().score() : s.best(mate1).score();
+			s.bestCScore().score() : s.bestScore(mate1).score();
 		// best score but normalized so that 0 = worst valid score
 		TAlScore bestOver = best - scMin;
 		if(sc_.monotone) {
@@ -230,7 +230,7 @@ public:
 				else                                     ret = 0;
 			} else {
 				secbest = s.paired() ?
-					s.secbestPaired().score() : s.secbest(mate1).score();
+					s.bestUnchosenCScore().score() : s.bestUnchosenScore(mate1).score();
 				TAlScore bestdiff = abs(abs(static_cast<long>(best))-abs(static_cast<long>(secbest)));
 				if(bestdiff >= diff * (double)0.9f) {
 					if(bestOver == diff) {
@@ -340,7 +340,7 @@ public:
 				else                                     ret = 22;
 			} else {
 				secbest = s.paired() ?
-					s.secbestPaired().score() : s.secbest(mate1).score();
+					s.bestUnchosenCScore().score() : s.bestUnchosenScore(mate1).score();
 				TAlScore bestdiff = abs(abs(static_cast<long>(best))-abs(static_cast<long>(secbest)));
 				if     (bestdiff >= diff * (double)0.9f) ret = 40;
 				else if(bestdiff >= diff * (double)0.8f) ret = 39;
@@ -437,7 +437,7 @@ public:
 		char *inps)     // put string representation of inputs here
 		const
 	{
-		bool hasSecbest = VALID_AL_SCORE(s.secbest(mate1));
+		bool hasSecbest = VALID_AL_SCORE(s.bestUnchosenScore(mate1));
 		if(!flags.canMax() && !s.exhausted(mate1) && !hasSecbest) {
 			return 255;
 		}
@@ -448,7 +448,7 @@ public:
 		float sixth_2 = (float)(scPer - diff * (double)0.1666f * 2); 
 		float sixth_3 = (float)(scPer - diff * (double)0.1666f * 3);
 		TMapq ret = 0;
-		TAlScore best = s.best(mate1).score();
+		TAlScore best = s.bestScore(mate1).score();
 		if(!hasSecbest) {
 			// Top third?
 			if(best >= sixth_2) {
@@ -463,7 +463,7 @@ public:
 				ret = 10;
 			}
 		} else {
-			secbest = s.secbest(mate1).score();
+			secbest = s.bestUnchosenScore(mate1).score();
 			TAlScore bestdiff = abs(abs(static_cast<long>(best))-abs(static_cast<long>(secbest)));
 			if(bestdiff >= diff * 0.1666 * 5) {
 				ret = 6;

-- 
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