fall over if a bed file given as an option cannot be read
Fixed script for parsing BLAST output
Fixed a few bugs in blast2sam.pl script, added POD documentation
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>
plot-bamstats: Fixes #183
Adds support for outputting stats over the full input size distribution.

Current behaviour is to specify a parameter (-i) which governs the maximum
input size which will be considered. Any input size above this will be output
as the maximum input size. This can lead to peaks in the tail of the IS
distribution appearing incorrectly, as well as potentially breaking the calculation
of average input size.

This commit changes the current behaviour in the following ways:

- Previously, setting "-i 0" would either result in a crash or non-useful behaviour.
Instead, setting "-i 0" now removes the maximum input size. Rather than using the existing
array-backed storage, we switch to a hashmap which only stores non-0 entries (e.g. sizes x
for which there is at least one insert of size x).
- Introduce a new option "--sparse|-x" which sets the IS output into 'sparse' mode - IS
lines in this mode are only output where the total number of inserts is greater than 0.

This has been tested (on a random humgen test file) to produce identical to samtools/develop
when run with default settings (replicating default behaviour) and to agree on a bunch of randomly
selected insert sizes when using the new behaviour.

Remove infinite loop.

Remove the cool closure stuff :-()

Fix error.

Change to use the internally stored max index rather than the bound.

Add sparse array format (untested).

Remove unused variable.

Refactor to remove duplication of code responsibility.

Also checks that malloc returns successfully.

Initialise stupid.

Bug fix.

Change the return thing to kh_put.

Add an error message.

Don't add a new record if the value is 0.

This is meant to be sparse, but I suspect that 0 records are being added.

Store total for dense array.

Quick bugfix.

Make the sparse array say it has MAX items rather than TOTAL.

Most of these items will be 0.

Add 'sparse' mode for insert-size.

Fix option placement.

Change from void * to untagged union.

Not quite so horrible!

Remove nested functions (alas).

This is considerably more nasty, but sadly nested-functions is a gcc
extension. Instead, we declare some stupidly-named static functions in
another file.

Modified makefile to build new stats_isize files.

Reference uint64_t

Add a few explanatory comments.

Fixup rebase
Merge pull request #184 from wtsi-hgi/features/unbounded-is

Adds support for outputting stats over the full input size distribution.
Further stats tests

Add test to check how insert CIGAR op behaves.
Add test to check how -i 0 behaves.

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Remove unusued 'total' functions.
Merge pull request #186 from wtsi-hgi/issues/warn-unusued-fn

Remove unusued 'total' functions.
Don't require an index for full-file merges

Use the new sam_itr_queryi(idx=NULL, ...) facilities when we don't need
an index and there might not be any (in particular, when merging temporary
files at the end of samtools sort).

Don't attempt to free the list of filenames when it is argv.
Merge branch 'origin/develop' into develop

Keeps the BAM output and -b versus Usage changes from
b44c5e479db8136ed10ebe6a9123a6d1457b7f33, but discards the
filelist freeing and index building changes in favour of
those in 3ad6995d09f4dd8646e4e68ef2982dde759382fb.

Fixes #180.
The @HD header is optional
Add "make testclean" target