Adds *~ (emacs backup files) and core to .gitignore.
Adds tests for samtools view.

Adds .sam, .fa, .fa.fai and .bed files as test data for the view command.
Adds tests in the test.pl script.  Exercises most options, apart from -B,
-@, -L, -t, -T and -s.  Most tests work by taking the test/dat/view.001.sam
and modifying it in the same way as samtools is expected to, and then
comparing the result.  BAM and CRAM conversions are tested by converting
back to SAM and checking that the output is equivalent to the original copy.
Merge branch 'develop' into develop_testing
Turns on CRAM region tests, now that CRAM indexing is supported.
Adds -L (BED file reading) tests.

Also fixes missing increment of $test.
Adds tests for the -t, -T and -B options.

-B tests are fairly limited due to the poor definition of the B operator.

-t and -T test SAM and BAM conversion.  CRAM is not fully supported for
these options yet, so ignored for now.  -t is unlikely to work for CRAM
anyway, as it needs the full reference sequence.
Adds more region tests.

These tests use an input file with 1bp reads, so out-by-one errors should be
easy to spot.
Rolls converting back to SAM into run_view_test

This allows the removal of the separate tests which just convert back to
SAM and compares with another file.
Adds CRAM conversion using the MD5 REF_CACHE.
Merge branch 'develop' into develop_testing
Strips out -x / -X tests as -X is deprecated and -x has been repurposed.
Adds more optional fields in test file, and more -R / -r checks.

Updates sam_compare function to deal with optional fields in different
orders.  Adds more optional fields to the view.001.sam file including ones
that do intresting things with htslib issue #63.

Adds tests to see what happens when -R and -r are used together on the
samtools view command line.  This is samtools issue #152.

Also removes the flag conversion subroutine, which is no longer needed.
Adds tests for the new -x tag stripping option.

Includes tests for single and multiple -x arguments, and mixing -x with
-r (samtools issue #153: -r disables -x).  Also tries to filter by read
group and strip RG tags.  This currently doesn't work due to issue #153,
but should do once that has been fixed as long as tag stripping is still
done after the filtering stages.

Includes a few bugfixes to the tag stripping code in filter_sam.
Adds tests for currently undocumented -m and -Q options.
Adds some unaligned reads to the samtools view test file.
Minor changes to samtools view test output file names.
Adds tests for the -s (subsampling) and -@ (threads) options

Generate a big sam file (1Mbp consensus).  This is compressed with bgzf
so it doesn't use up too much space.  It is then used to test the -s and -@
options, which require a lot of input data to do anything interesting.

-@ is tested by making bam and cram files with different threads settings
and checking to see if they are the same.  -@ doesn't actually do anything
at the moment, so this is in place waiting for when it does.

For -s, the file is filtered, and the results are checked to ensure that
all reads came back paired and that approximately the right number were
returned.  This has to be an approximate check due to the random nature
or the sampling operation.

The sam_compare function is adjusted slightly to allow for CRAM adding
M5 tags to @SQ lines without one.  The content of the M5 tag is not
currently checked.

The compare_sam option of run_view_test is updated so that it can read from
a samtools view pipe instead of writing a file and then comparing it.  This
is done to avoid writing lots of uncompressed copies of the big SAM file
when running the threads tests.
Makes filter_sam filter @RG lines when filtering by read group.

Adds code to strip unwanted @RG lines from the SAM header when read group
filtering is enabled.  Also modifies the library filter so that it does not
try to strip @RG lines.  It is also made to work in the same way as samtools
view when combined with read group filtering - i.e. reads that do
not pass both filters are removed.
Adds comments to explain how the samtools view testing functions work.
Changes *_compare functions to not call passed() or failed().

Instead just use the return code and get the caller to call
passed()/failed() instead.  Makes the *_compare functions a bit simpler.