1. Added an extra depadding option to Export Contigs; reference sequence
positions (in addition to the old padded and unpadded consensus mode).
The purpose of this is to allow tg_index to import a sam/bam/cram, run
tools like Shuffle Pads on it, and then export back in the same
coordinate system as the original BAM.

It is not expected to work after joining and breaking has been
applied, although it needs better error handling to cope with this
more gracefully.

Updated the padded_to_reference_array() function to aid this work.


2. Fixed a bug in create_ref_seq(). It was producing incorrect .fai
files for contigs that do not start at base 1.


3. Fixed memory corruption in sam_add_seq() caused when using
excessive padding in CIGAR ops during tg_index.


4. Bug fix to contig_insert_base_common() when manipulating the
REF_POS markers.  It wasn't coping correctly with this in some
complemented scenarios and with nbases > 1.



git-svn-id: svn://svn.code.sf.net/p/staden/code/staden@3641 ba6f2710-ca9f-427c-89d3-5bf716dbc8e1
Attempt to improve mate pos when using fix-mates output of SAM in
conjunction with refpos depadding.


git-svn-id: svn://svn.code.sf.net/p/staden/code/staden@3642 ba6f2710-ca9f-427c-89d3-5bf716dbc8e1
When realigning including cutoffs, the trim and re-extend process at
the end extends the sequence for as far as it matches the consensus.

We now have a small caveat on this such that it will backtrack to the
first non-pad character after the extension, to avoid leaving trailing
pads on the ends of reads.


git-svn-id: svn://svn.code.sf.net/p/staden/code/staden@3643 ba6f2710-ca9f-427c-89d3-5bf716dbc8e1
Further improvements to samtools output with fixmates.


git-svn-id: svn://svn.code.sf.net/p/staden/code/staden@3644 ba6f2710-ca9f-427c-89d3-5bf716dbc8e1