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>