Add 'a' (append) mode letter; propagate mode letters

For bgzf_[dh]open() and hts_open(), treat 'a' the same as 'w';
the underlying hopen() will treat it differently and open the file
in append mode.  So that hopen() can do that (and so that it gets
to see other eventual mode letters that it will be interested in),
propagate _mode_ itself to underlying *_open() calls rather than
slicing it to just 'r' or 'w'.

It has been verified that there is (currently) no conflict amongst
the mode letters acted upon by different *_open() functions at their
different levels.
Add "data:blahblah" in-memory hFILE backend (read-only)

Currently read-only; implementing writing would be useful but a little
more complex.

This is akin to the data URI scheme (RFC 2397) but without the leading
MIME-type etc.  We may want to change this to require (or perhaps ignore
if present) a leading comma, which would make for the same syntax as the
URI scheme.
fix remote fetching of regions for bam and vcf

hts.c: if `_USE_KNETFILE` is set, then remote fetching of a bam or vcf
region with `samtools view` or `bcftools view` will now work (after a
few attempts to get a usually non-existant .csi file).
Use hFILE rather than knet in test_and_fetch()

By using hFILE, fetching indices will work with other remote protocols
added to hFILE, e.g. iRODS.  Before this works, the existing ftp|http
check will need to be made more flexible (see FIXME).
Merge #70, fetching of remote BAM/VCF indices

Fixes #69, using the index for remote files.
Fixed a bug when loading in fasta files consisting of all sequence on
a single line and in lowercase.

The uppercasing code was only being called during the loop to strip
out newlines.
Fix sam_format1 failure on lines ending in integer/float tags and issue #63

This fixes a bug in sam_format1 where it gets a check to see if it has gone
off the end of the bam1_t data structure wrong when writing out optional
tags.  This affects any line ending in an integer or floating-point tag.

Also fixes __skip_tag so that it works properly with floating point tags
(issue #63).
vcf: Allow omitted trailing FORMAT fields
Rewrite __skip_tag() as skip_aux()

Redo this code similarly to swap_data() and its infrastructure, so that
it obviously handles all tag types, and making it a function rather than
an invalidly-named macro.  Fixes #63.

Fix a raft of bugs in swap_data()'s B handling -- though do we ever expect
to see another big-endian HPC machine?  Complete the partial support for
XX:d:1.5 aux tags (type 'd' for double is an existing samtools extension).
Add sam aux field tests
Merge sam_format1() and __skip_tag() fixes (PR #73)
synced_reader: Init position correctly
Add ks_release() to kstring.h

Using this function is a more explicit way of transferring ownership
than just "foo = str.s"; the latter leaves room for readers to wonder
whether a subsequent "free(str.s)" has been forgotten.
Reinstate bam_header_dup as bam_hdr_dup

In the original samtools API there was an undocumented call
bam_header_dup which was used to copy an existing header.  As I
found this is rather useful in certain situations and I have
reinstated this.

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

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>
Migrate documentation from samtools bam.h to sam.h and add a few more items.
Add Copyright notice.
Add 'a' (append) mode letter; propagate mode letters

For bgzf_[dh]open() and hts_open(), treat 'a' the same as 'w';
the underlying hopen() will treat it differently and open the file
in append mode.  So that hopen() can do that (and so that it gets
to see other eventual mode letters that it will be interested in),
propagate _mode_ itself to underlying *_open() calls rather than
slicing it to just 'r' or 'w'.

It has been verified that there is (currently) no conflict amongst
the mode letters acted upon by different *_open() functions at their
different levels.
Add "data:blahblah" in-memory hFILE backend (read-only)

Currently read-only; implementing writing would be useful but a little
more complex.

This is akin to the data URI scheme (RFC 2397) but without the leading
MIME-type etc.  We may want to change this to require (or perhaps ignore
if present) a leading comma, which would make for the same syntax as the
URI scheme.
fix remote fetching of regions for bam and vcf

hts.c: if `_USE_KNETFILE` is set, then remote fetching of a bam or vcf
region with `samtools view` or `bcftools view` will now work (after a
few attempts to get a usually non-existant .csi file).
Use hFILE rather than knet in test_and_fetch()

By using hFILE, fetching indices will work with other remote protocols
added to hFILE, e.g. iRODS.  Before this works, the existing ftp|http
check will need to be made more flexible (see FIXME).