Rewrite bed_read

Makes bed_read work line-by-line, and adds new BED parsing code that
hopefully better understands the format.  BED comments are explicitly
stripped.  Browser and track lines are ignored.  Columns can be separated
by multiple whitespace characters.  There is more, but not complete,
error checking.  The VCF-style two column format is still supported.
Includes big comment.
Adds check to ensure bed_read worked, and exits non-zero if not.
Stops samtools view from writing unmapped reads with -L (BED file) option

This affects reads with no RNAME, i.e. completely unmapped.
add -U FILE to output unselected reads for pipelin
Don't malloc the kstring_t; minor changes to the big comment
Merge BED file parsing improvements (PR #165)
Merge view -U option (PR #177), also adding it to the man page
Create header of common test functions

Create a header to be included in tests for common functions.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add split command to samtools

The split command takes BAMs which consist of multiple readgroups
and separates them out into separate files, one for each readgroup.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add unit test for bam_split.c's count_rg

Add unit test to test count_rg function.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Polish bam_split

Unit test expand_format_string
Change from output_prefix to output format string
Make usage write to stdout when not an error.
Make stdout usage appear if no arguments given.
Make unaccounted reads an option and whine if found and not specified.
Filter alternate @RG lines from the files they’re not in.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add unit test for bam_split.c's filter_header_rg

Add unit test to test filter_header_rg function.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Restructure testing structure to dedupe

Move certain functions from test.h into a test.c file to reduce code
duplication.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Add unit test for bam_split.c's parse_args

Add unit test to test parse_args function.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>