Various fixes to keep contig start/end correct.

tg_check.c
  In check_contig, print out start and end positions in the contig and those
from the bin walk when they disagree.

tg_bin.c
  Fixed bug in bin_remove_item_from_bin where used start/end were not swapped
for complemented bins when mapping to the position in the parent.  This could
lead to the contig unclipped start/end not being recalculated when they should
have been.

tg_sequence.c
  Add code to update contig used start/end and clipped_timestamp when
necessary in sequence_move.

tg_contig.c
  Altered the way that contig_insert_base and contig_delete_base keep track of
which ends of the contig may have changed.  This fixes several cases where the
contig start/end were not updated as they should have been.
  Modified read shifting code in contig_insert_base2 and contig_delete_base2. 
The new version moves the same reads for both complemented and uncomplemented
bins.
  Renamed some variables to make the operation of the code less obscure,
e.g. r_start, r_end to v_start,v_end in contig_insert_base2 and
contig_delete_base2; ins,no_ins to del,no_del in contig_delete_base2.
  Added some comments.

gap5_del_test.tcl
  Added test to ensure cutoff data at the start/end of the contig is handled
correctly.
  Made the test script stop but not exit on failure.  This allows the
situation to be checked manually.
  Made some tests run on complemented contigs as well.
  Temporarily disabled the pattern tests to allow a faster iteration through
the random ones.



git-svn-id: svn://svn.code.sf.net/p/staden/code/staden/trunk@3640 ba6f2710-ca9f-427c-89d3-5bf716dbc8e1
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/trunk@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/trunk@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/trunk@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/trunk@3644 ba6f2710-ca9f-427c-89d3-5bf716dbc8e1