workaround for bad MD fields

Added a workaround for apparently broken MD fields produced by GSNAP to
bam-rmdup.  Valid records should not be affected at all.
fixed pretzel logic in bam-rmdup

Proximal symptom was that second mates tended to be demoted to unpaired
reads.  The real reason was logic that didn't make sense at all.  This
should be fixed now, though the interaction of the various filtering and
pass-through options is rather counter-intuitive.  Also, Bio.Bam.Rmdup
looks much cleaner now.
reorg of Bio.TwoBit

Code looks cleaner now and masking is supported.  Needs through testing.
convenience functions and cleanup

Add functions that don't spew BAM onto terminals, and better handling of
the binning mechanism where we modify records.
version numbers and checking for terminal

All utility programs now uniformly check if stdout is a terminal and no
longer dump BAM to the terminal by default.  All those that parse a
command line and most of the remainder have a mechanism to print their
version number now.
inverted header parser

This fixes a 'stack overflow' when parsing BAM headers with lots of
reference sequences.  Also enhanced usability of bam-fixpair.
Merge branch 'master' into genotyper

Conflicts:
	Bio/Bam/Header.hs
	Bio/Bam/Rmdup.hs
	biohazard.cabal
	tools/bam-resample.hs
	tools/bam-rmdup.hs
	tools/bam-trim.hs
	tools/biohazard-tools.cabal
	tools/count-coverage.hs
WIP on samtools' error model