========================================================================
RELEASED 2.0.0b11-2016

------------------------------------------------------------------------
r4067 | jkbonfield | 2016-04-20 12:04:17 +0100 (Wed, 20 Apr 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/eba/conf.c

Due to io_lib changes, change from min() to MIN().

------------------------------------------------------------------------
r4065 | jkbonfield | 2016-04-19 14:56:02 +0100 (Tue, 19 Apr 2016) | 7 lines
Changed paths:
   M /staden/trunk/src/README.build

Fixed io_lib version number needed.

This may not be absolutely correct (no doubt a few versions before is
also fine), but for certain it doesn't work with the stated version
number and I don't have time to exhaustively check which version is
new enough.

------------------------------------------------------------------------
r4058 | jkbonfield | 2016-03-24 10:26:12 +0000 (Thu, 24 Mar 2016) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/interval_tree.c

Interval_tree and interval_node no longer have typedef twice.
This tripped up early gcc versions (4.4 is fine, 4.1 is not).

Bug reported by Martin Mokrejs.

------------------------------------------------------------------------
r4045 | jkbonfield | 2016-03-21 12:49:04 +0000 (Mon, 21 Mar 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Fixed broken commit r3930 in gap5_cmd.tcl.  This caused a syntax error.

------------------------------------------------------------------------
r4021 | jkbonfield | 2016-02-23 14:40:25 +0000 (Tue, 23 Feb 2016) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed tcl_read_depth call to actually compute the depth rather than
use the unfinished tracks.

Added copy_refpos function to C and Tcl.  At present these are unused,
but being present in Tcl means we can use these during debugging or
experimentation within the Tcl console.

------------------------------------------------------------------------
r4020 | jkbonfield | 2016-02-23 12:37:49 +0000 (Tue, 23 Feb 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index_common.c
   D /staden/trunk/src/gap5/zfio.c
   D /staden/trunk/src/gap5/zfio.h

Removed zfio.c in favour of io_lib's copy.

------------------------------------------------------------------------
r4016 | jkbonfield | 2016-02-22 11:43:26 +0000 (Mon, 22 Feb 2016) | 4 lines
Changed paths:
   M /staden/trunk/src/copy_reads/copy_reads.c
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/primer3/src/ntdpal_main.c
   M /staden/trunk/src/primer3/src/primer3_lib.c

Applied Debian spelling patch:

https://anonscm.debian.org/viewvc/debian-med/trunk/packages/staden/trunk/debian/patches/spelling.patch?revision=21433&view=markup

------------------------------------------------------------------------
r4015 | jkbonfield | 2016-02-22 11:33:20 +0000 (Mon, 22 Feb 2016) | 6 lines
Changed paths:
   M /staden/trunk/src/gap4/gap-error.c
   M /staden/trunk/src/gap4/show_relationships.c
   M /staden/trunk/src/system.mk.in

Applied debian hardening patch:

https://anonscm.debian.org/viewvc/debian-med/trunk/packages/staden/trunk/debian/patches/hardening.patch?revision=16751&view=markup
https://anonscm.debian.org/viewvc/debian-med/trunk/packages/staden/trunk/debian/patches/hardening_format-security.patch?revision=15859&view=markup


------------------------------------------------------------------------
r4014 | jkbonfield | 2016-02-22 11:29:21 +0000 (Mon, 22 Feb 2016) | 4 lines
Changed paths:
   M /staden/trunk/src/gap4/contig_editor.tcl

Fix to cope with newer window managers.

The contig editor should no longer appear at zero height.

------------------------------------------------------------------------
r4002 | jkbonfield | 2016-02-03 18:08:33 +0000 (Wed, 03 Feb 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/contig_id.tcl

Fixed a bug where using the contig selector or contig list to fill out a contig name in a dialogue box, without then doing anything else at all except hitting OK in that dialogue, could cause the contig name validity check to fail.

------------------------------------------------------------------------
r3999 | daviesrob | 2016-01-25 10:20:34 +0000 (Mon, 25 Jan 2016) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_snps.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_haplotypes.c
   M /staden/trunk/src/gap5/gap_canvas_box.c
   M /staden/trunk/src/gap5/interval_tree.c
   M /staden/trunk/src/gap5/interval_tree.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/str_finder.c
   M /staden/trunk/src/gap5/tag_plot.c
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tman_interface.c

Fix some compiler warnings.

Mainly unused variables, plus a couple of missing prototypes.  Includes
two bug fixes:

  join_move_bins now returns non-zero on error.

  sam_export_seq could calculate the wrong index bin number when exporting
  bam if the contig started at position <= 0 dut to the offset being added
  to the sequence end position twice.


------------------------------------------------------------------------
r3998 | daviesrob | 2016-01-20 12:08:13 +0000 (Wed, 20 Jan 2016) | 5 lines
Changed paths:
   A /staden/trunk/src/gap5/replay_log.tcl

Add basic script to allow replaying of events in gap5 log files.

Incomplete, but good enough for tracking down bugs with pair_rec updates
and shuffle_pads.

------------------------------------------------------------------------
r3997 | daviesrob | 2016-01-19 16:41:51 +0000 (Tue, 19 Jan 2016) | 15 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_sequence.c

Prevent use of uninitialised values in shuffle_pads.

validate_clip_regions goes through a list of annotation record numbers
that is passed in to it.  It's possible that the annotations have been
removed beforehand, so it needs to check the result of anno_get_position
to ensure that it has set start, end and crec.

Possibly related:  Ensure that sequence_set_left, sequence_set_right
sequence_set_left_no_invalidate and sequence_set_right_no_invalidate
do not set a clip point that is outside the extents of the sequence.
It's unclear if this can be made to happen in normal use of the
contig editor, but it did happen when tracking down the problem in
validate_clip_regions.


------------------------------------------------------------------------
r3996 | daviesrob | 2016-01-19 14:14:48 +0000 (Tue, 19 Jan 2016) | 42 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Fix bin corruption caused by updates to read pairs spanning two contigs.

Updating information on read pairs could lead to bin records being updated
differently in two or more child IOs.  This could cause database corruption
when the child IOs were flushed and the bin data overwritten.

The data being updated were the cached location of read pairs, and pair_rec
which is a pointer to the other read in a pair.  The location information
is fixed by simply not updating it on the paired read (it was only being
invalidated, anyway).  This is safe as sequence_get_range_pair_position
includes sufficient checks to ensure that the information is still valid.

Updates to pair_rec on the paired read are no longer made while editing
but instead deferred until cache_flush is called.  At this point the
changes are applied by new function apply_pair_rec_updates in tg_cache.c.
This function updates any bins affected both in the base IO and also in
child IOs, so all copies of the data should be consistent.  gio_child
and gio_close are updated to maintain a linked list of child IOs to allow
apply_pair_rec_updates to iterate through all of the children.

Between an edit being made and 'save' being pressed, there is a problem
with pair_rec possibly pointing to an unmapped read.  Some other changes
have been made to deal with this possibility:

  * sequence_cmd gains a 'get_mapped' function to allow TCL to check
    for unmapped reads.

  * The contig_editor tcl function was using the base IO to get sequences
    when the -reading or -reading2 options were used.  This was incorrect,
    it now uses the child IO instead.  It also checks that the sequences
    are mapped.

  * sequence_get_pair checks that the paired read is mapped.

  * edSetCursorPos to a sequence position checks that the sequence is mapped.

  * ListEditMultiUpdate ignores unmapped sequences.

It's likely that more edge cases remain, but the changes above fix the ones
seen so far.


------------------------------------------------------------------------
r3959 | jkbonfield | 2015-09-24 17:34:52 +0100 (Thu, 24 Sep 2015) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h

Added a default quality to use for bases without quality. This defaults to 3
and is used by fasta and SAM without qual. (Maybe there are other formats to
do.)
In the GUI this is now controllable via an additional entry box.

In the C code, this is -ve to indicate a *default* value and positive to
indicate an override value, used for fastq only at present.  This permits
us to import a fasta/fastq set of consensus sequences and forcibly set
confidence high (even to 100, forcing consensus) or low as desired
irrespective of what the actual fastq qualities claim.  Useful for
manipulating consenusii.

(jkb)

------------------------------------------------------------------------
r3934 | jkbonfield | 2015-07-02 17:06:58 +0100 (Thu, 02 Jul 2015) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_utils.c

Fixed u72intw with the same fix that appears to already be in
s72intw.  When decoding a value > 31bits it wrapped around to become
negative as the shift operator is applying on int and not int64_t.

------------------------------------------------------------------------
r3931 | jkbonfield | 2015-07-02 12:13:10 +0100 (Thu, 02 Jul 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/Makefile.in

Fixed a missing dependency, causing parallel makes to sometimes fail.

------------------------------------------------------------------------
r3930 | jkbonfield | 2015-07-02 12:09:18 +0100 (Thu, 02 Jul 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Revert accidental commit of shuffle pads changes in the last commit.
These introduced compilation errors due to a partial update.

------------------------------------------------------------------------
r3925 | jkbonfield | 2015-06-04 11:27:40 +0100 (Thu, 04 Jun 2015) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c
   M /staden/trunk/src/gap5/find_haplotypes.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/tg_contig.c

Fixed Find Haplotypes left/right settings when faced with inconsistent
data.

Also made it so that the various parameters are adjustable.

------------------------------------------------------------------------
r3921 | jkbonfield | 2015-05-29 12:07:41 +0100 (Fri, 29 May 2015) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5rc

Fixed the template display auto-scrolling. It wasn't taking into
account the contig start location when computing the scrollbar
position.

Also made the margins for when to scroll and how much by adjustable in
the gap5rc.

------------------------------------------------------------------------
r3831 | jkbonfield | 2015-02-23 16:52:09 +0000 (Mon, 23 Feb 2015) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/fij.c

Auto-join now honours the -min_overlap and -max_overlap parameters.

This is important for cases where we have two very long contigs (L1,
L2) both overlapping a short contig S.
We find the two short matches (L1/S and L2/S) and probably didn't even
attempt to detect L1/L2 overlap due to -max_overlap.  After
automatically joining L1+S however we then have L1+S / L2 due to
inheriting the overlaps during merging.  We now recheck max_overlap
before each and every alignment.

------------------------------------------------------------------------
r3830 | jkbonfield | 2015-02-23 11:44:09 +0000 (Mon, 23 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Removal of debugging output

------------------------------------------------------------------------
r3829 | jkbonfield | 2015-02-23 11:28:48 +0000 (Mon, 23 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/Makefile
   M /staden/trunk/src/abi/Makefile
   M /staden/trunk/src/alf/Makefile
   M /staden/trunk/src/convert/Makefile
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/eba/Makefile
   M /staden/trunk/src/find_renz/Makefile
   M /staden/trunk/src/g/Makefile
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/get_scf_field/Makefile
   M /staden/trunk/src/global.mk
   M /staden/trunk/src/haplo/Makefile
   M /staden/trunk/src/init_exp/Makefile
   M /staden/trunk/src/make_weights/Makefile
   M /staden/trunk/src/mutlib/Makefile
   M /staden/trunk/src/polyA_clip/Makefile
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/qclip/Makefile
   M /staden/trunk/src/screen_seq/Makefile
   M /staden/trunk/src/seq_utils/Makefile
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/stops/Makefile
   M /staden/trunk/src/text_utils/Makefile
   M /staden/trunk/src/tk_utils/Makefile
   M /staden/trunk/src/tracediff/Makefile
   M /staden/trunk/src/vector_clip/Makefile

Fixed an issue in "make depend" not working in all cases.
Reran to update our local Makefiles.

------------------------------------------------------------------------
r3828 | jkbonfield | 2015-02-23 11:25:53 +0000 (Mon, 23 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c

Fixed minor compiler warning.

------------------------------------------------------------------------
r3827 | jkbonfield | 2015-02-23 11:25:32 +0000 (Mon, 23 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added interval_tree to Makefile.
(Also minor updates caused by make depend)

------------------------------------------------------------------------
r3826 | jkbonfield | 2015-02-20 17:52:19 +0000 (Fri, 20 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Allow for dotter -q NUM -s NUM

------------------------------------------------------------------------
r3825 | jkbonfield | 2015-02-20 16:28:00 +0000 (Fri, 20 Feb 2015) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c
   A /staden/trunk/src/gap5/interval_tree.c
   A /staden/trunk/src/gap5/interval_tree.h

Find Haplotypes revamp.
- Read pairs are now considered.
- Better merging of haplotype strings. Instead of aggressive merging
at time of collation, we only early-merge exact dups and then merge by
frequency after the full data has been gathered.

Also added an interval tree implementation (used in the new haplotype code).

------------------------------------------------------------------------
r3824 | jkbonfield | 2015-02-20 16:25:25 +0000 (Fri, 20 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Improved the consensus discrepancy score by taking into account a
per-base difference rather than joining all together.

------------------------------------------------------------------------
r3823 | jkbonfield | 2015-02-18 17:42:58 +0000 (Wed, 18 Feb 2015) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tk_utils/init.tcl

Added a <<control-menu>> binding to the contig editor so that it is
considered as a power-click, asking for more dialogue if appropriate.
Ie it is considered the same as using the main menu bar.

For now this only controls read selection and realignment.

------------------------------------------------------------------------
r3822 | jkbonfield | 2015-02-18 17:32:13 +0000 (Wed, 18 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed end range in Realign Selection dialogue.

------------------------------------------------------------------------
r3821 | jkbonfield | 2015-02-18 17:29:48 +0000 (Wed, 18 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc

The Realign Selection option now brings up a user interface if invoked
from the main menu, but not when right clicked via the popup menu.

------------------------------------------------------------------------
r3820 | jkbonfield | 2015-02-17 15:16:36 +0000 (Tue, 17 Feb 2015) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h

Fixed rewrite_soft_clips so it doesn't treat clips that fall partially
outside the current start..end sub-range as scoring 0. This was
causing it to falsely accept some clips.

Fixed a bug in the main loop which chunks the contig into sections.
It now tracks the number of pads added during update_io so it can
validate the soft-clips over the now extended region.  Previously some
reads at the end of the region were not validated if we introduced a
lot of pads.

------------------------------------------------------------------------
r3819 | jkbonfield | 2015-02-17 12:38:31 +0000 (Tue, 17 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c

Improved the Show Information output to include the read name, making
it easier to compare two databases.

------------------------------------------------------------------------
r3818 | jkbonfield | 2015-02-17 12:37:43 +0000 (Tue, 17 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/Misc/array.c
   M /staden/trunk/src/Misc/array.h

Added ArrayConcat() function.

------------------------------------------------------------------------
r3812 | jkbonfield | 2015-02-05 12:42:36 +0000 (Thu, 05 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Minor tweak to get_malign_counts() to persuade any non-N base to be
counted. This avoids issues with sequences full of N.

------------------------------------------------------------------------
r3811 | jkbonfield | 2015-02-05 12:39:26 +0000 (Thu, 05 Feb 2015) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Fixed a bug where we could realign data that we had previously
realigned in an earlier chunk, but against less depth. This caused
misalignments.

We now skip data previously aligned, but it has to be included in the
malign->contigl struct still for the fresh data to align against.

Also added a maximum number of passes field to the GUI.

------------------------------------------------------------------------
r3788 | jkbonfield | 2015-01-14 16:31:34 +0000 (Wed, 14 Jan 2015) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Fixed a bug in the tg_index -g mode where it erroneously added extra
columns of pads to the contig if an incoming sequence has an insertion
1 base after a pre-existing gap in the consensus.

------------------------------------------------------------------------
r3787 | jkbonfield | 2015-01-14 16:30:21 +0000 (Wed, 14 Jan 2015) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/seq_utils/dna_utils.c
   M /staden/trunk/src/seq_utils/dna_utils.h

Removed the complementary_base[] and initialisation functions from
tg_sequence.c and exported the version from seq_utils lib.  The
seq_utils copy is now also statically initialised without needed to
call the set_dna_lookup() function so we cannot accidentally forget to
initialise it.

------------------------------------------------------------------------
r3786 | jkbonfield | 2015-01-13 14:39:15 +0000 (Tue, 13 Jan 2015) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

Added a complementary_base_init function to build the
complementary_base[] array and then use this in more places than the
one function it came from.

This fixes a bug with tg_index -a -g not working due to an
complementary_base[] being unset during sequence_insert_bases() call.

------------------------------------------------------------------------
r3778 | daviesrob | 2015-01-06 11:29:22 +0000 (Tue, 06 Jan 2015) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/quality_plot.c

Fix rounding error in qplot_redraw which triggered an assertion failure.

Inverted the xzoom factor (xz) so that the x coordinate in the plot can
be worked out by multiplying by xz instead of dividing.  This seems to
fix a rounding error that could make the x position go out of bounds
when zoomed out a long way.  Multiplying should also be slightly faster.

In a belt-and-braces approach, also allocated the xs array one bigger
than strictly necessary so any remaining rounding errors shouldn't cause
a problem.  The assertions on x are adjusted to reflect this.

Only one of the xp and xs arrays is used, depending on the value of xz.  So
now only the one that is needed gets allocated.

------------------------------------------------------------------------
r3772 | jkbonfield | 2014-12-15 10:18:27 +0000 (Mon, 15 Dec 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/g-alloc.c

Updated the list of known record types in the debug HeapChecker tool.

------------------------------------------------------------------------
r3767 | jkbonfield | 2014-11-14 11:20:17 +0000 (Fri, 14 Nov 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

The list size is now shown in the contig editor, giving an indication
of how many fragments are in each haplotype.

------------------------------------------------------------------------
r3766 | jkbonfield | 2014-11-14 10:27:27 +0000 (Fri, 14 Nov 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c

Reduced complexity in haplotype_str_add(). With long sections this can
become over 100x less cpu, and growing more.  It is still a linear
scan though so needs futher optimisation yet, using a tree instead to
find snp overlaps.

Also amended it to consider sites with too many discrepancies rather
than pure consensus SNP call.

Finally, added a minimum count of 2 seqs to filter most of the
singleton haplotypes. The minimum count figure isn't yet user
adjustable, but should be made so before this becomes production
ready.

------------------------------------------------------------------------
r3765 | jkbonfield | 2014-11-14 10:25:31 +0000 (Fri, 14 Nov 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tk-io-reg.c

Improve error messages.

------------------------------------------------------------------------
r3764 | jkbonfield | 2014-11-11 12:32:11 +0000 (Tue, 11 Nov 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Changed highlight disagreements for cutoff data to always show in
foreground instead of background (if selected), so it is more easily
distinguishable.

------------------------------------------------------------------------
r3762 | jkbonfield | 2014-11-03 09:47:27 +0000 (Mon, 03 Nov 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Fix typo in the trim command, causing it to fail.

------------------------------------------------------------------------
r3761 | jkbonfield | 2014-10-31 14:45:20 +0000 (Fri, 31 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Delete old haplotype_* lists when creating new ones, so as not to
confuse people as to how many haplotypes are present.

------------------------------------------------------------------------
r3760 | jkbonfield | 2014-10-31 14:21:21 +0000 (Fri, 31 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added the option to view the readings/haplotype lists on the ednames
right click menu.

------------------------------------------------------------------------
r3759 | jkbonfield | 2014-10-31 12:36:37 +0000 (Fri, 31 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/xcombobox.tcl

The popup listbox from the combobox now shares the width from the
entry box.

------------------------------------------------------------------------
r3758 | jkbonfield | 2014-10-31 11:20:21 +0000 (Fri, 31 Oct 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed contig_export_sam (used for SAM, BAM and CRAM formats) to be
much faster in excessively deep regions where soft-clipping is being
used.

Gap5 has to convert from coordinates sorted by object start including
soft-clipped bases, to coordinates sorted by first unclipped site
(SAM).  This sorting could become O(N^2) in the worst case, but is now
O(NlogN) - possibly better if soft-clip lengths co-locate.

------------------------------------------------------------------------
r3757 | daviesrob | 2014-10-29 15:32:53 +0000 (Wed, 29 Oct 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

haplo_hash bug fixes.

In cache_dup, ensure that haplo_hash and haplo_timestamp are initialized
when duplicating a contig.  This prevents a dangling pointer from being left
in the parent if haplo_hash is freed in the child.

In cache_flush, ensure that haplo_hash is freed from the parent where
necessary when flushing a contig block.

------------------------------------------------------------------------
r3756 | jkbonfield | 2014-10-29 15:13:29 +0000 (Wed, 29 Oct 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Fixed a crash when being unable to load an annotation.

------------------------------------------------------------------------
r3755 | jkbonfield | 2014-10-29 15:12:42 +0000 (Wed, 29 Oct 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Removed zfio.[ch] as these have been in io_lib for some time and
causes compilation problems if attempting to link against a static
build of io_lib.

------------------------------------------------------------------------
r3754 | jkbonfield | 2014-10-21 17:24:22 +0100 (Tue, 21 Oct 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Rewrote the fix for r->end - r->start + 1 == ABS(s->len).  Previously
I modified s->len, but this breaks all sorts of other things, most
notably it makes s->conf - s->seq not equal to s->len, then leading to
broken confidence values and also to sequence insertion possibly
calling memmove off the end of the buffer. (Oddly not detected by
valgrind.)

We now fix the far more likely error; r->end instead.

------------------------------------------------------------------------
r3753 | jkbonfield | 2014-10-17 17:01:49 +0100 (Fri, 17 Oct 2014) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Work around for a bug where some bins are not covered by child
bins. Ie:

:-----------------------------------: Parent

                      :-------------: Left
           :------------------------: Right

I don't know what causes this yet, but it makes
calculate_consensus_simple sometiems find very large bins (the parent)
on which to compute the cached consensus, taking a lot of time.  For
now we simply reject an attempt to compute a very long cached
consensus as it is probably not the write thing to do.

(This really needs a total rewrite.)

------------------------------------------------------------------------
r3752 | jkbonfield | 2014-10-17 16:43:05 +0100 (Fri, 17 Oct 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Removal of debugging info.

------------------------------------------------------------------------
r3751 | jkbonfield | 2014-10-16 17:40:58 +0100 (Thu, 16 Oct 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Made contig_insert_base2() more robust with respect to corrupted data
or other sources of errors.

Previously it just bailed out of the recursion, leaving a half
inserted column. This is complicated to deal with and often turns a
small problem into a bigger problem.

Now it boldly carries on regardless, completing as much as it can,
before then returning -1 to the calling function to indicate the
failure.  Ideally the calling function would execute this in a child
io so it can be backed out of to revert the change, but in the absence
of this we have at least maintained consistency where able.

------------------------------------------------------------------------
r3750 | jkbonfield | 2014-10-16 16:48:56 +0100 (Thu, 16 Oct 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/editor_view.c
   A /staden/trunk/src/gap5/find_haplotypes.c
   A /staden/trunk/src/gap5/find_haplotypes.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tkEditor.h

First draft of a new haplotype finder.  It replaces the Sort By
Sequence mode in the contig editor as well as generating lists of read
IDs per haplotype and creating a master "haplotypes" list of lists.

Disassemble readings now knows how to handle list of lists, so that it
disassembles each sub-list into its own set of contigs.

There is more to do on this to tidy it up: handling read-pairs,
optimising it for larger contigs, improving the consensus algorithm to
label more things as SNPs by avoiding the dominance of depth.  However
it's a good starting point and users are already wanting to use it so
we'll see how it goes in the current state.

------------------------------------------------------------------------
r3749 | jkbonfield | 2014-10-13 12:38:17 +0100 (Mon, 13 Oct 2014) | 9 lines
Changed paths:
   A /staden/trunk/src/tk_utils/func_edit.tcl
   M /staden/trunk/src/tk_utils/tclIndex

A new debugging tool: func_edit

From the console (type "con" into the Gap5 Error window) you will be
able to type "func_edit UpdateReadingDisplays", for example, to
locally change the function definition without needing to quit and
restart the program.

All changes are temporary.

------------------------------------------------------------------------
r3748 | jkbonfield | 2014-10-07 17:45:30 +0100 (Tue, 07 Oct 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/tclIndex

Same fix as previous: Import Reads no longer clears "readings" list.

------------------------------------------------------------------------
r3747 | jkbonfield | 2014-10-07 13:58:37 +0100 (Tue, 07 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl

Replace the call to PostLoadSetup with a lighter-weight setup, so we
don't clear "readings" list on loading new contigs.

------------------------------------------------------------------------
r3741 | jkbonfield | 2014-09-22 15:13:56 +0100 (Mon, 22 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/hash_lib.c

More compiler warning removal; this time clang.

------------------------------------------------------------------------
r3740 | jkbonfield | 2014-09-22 14:55:49 +0100 (Mon, 22 Sep 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_snps.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/g-alloc.c
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/str_finder.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/zfio.c
   M /staden/trunk/src/seq_utils/align_lib.h

Various compiler warnings removed. Most are of the form "variable x
may be used uninitialised" and most of the time it is untrue, however
there are a few legitimate coding errors fixed too.

------------------------------------------------------------------------
r3739 | jkbonfield | 2014-09-22 14:02:43 +0100 (Mon, 22 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Removed append_int as this is now exported from libstaden-read (bam.c).

------------------------------------------------------------------------
r3730 | jkbonfield | 2014-09-11 18:26:02 +0100 (Thu, 11 Sep 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed memory leak and slow down caused by last patch to STR finder
calling.

Added seed_malign_region() to perform a rudimentary screen on the
heterozygous consensus to only request realignment in regions that are
heterozygous in nature.

TODO: Make this an optional 3 way - all regions, all hets, het indel only.

------------------------------------------------------------------------
r3729 | jkbonfield | 2014-09-11 18:07:41 +0100 (Thu, 11 Sep 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/str_finder.c

TEST_MAIN2 version of main() for testing on larger inputs, read from
stdin rather than argv[1] as a string.

------------------------------------------------------------------------
r3727 | jkbonfield | 2014-09-10 17:35:40 +0100 (Wed, 10 Sep 2014) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/str_finder.c

Fixed the STR finder to not step forward by 'extra' bytes as an
optimisation.  It was causing overlapping repeats to sometimes be
missed by 1 bp. Eg:

$ ./a.out CTAAATAAATAAAC
 2 .. 12 AAATAAATAAA

(Should be 1 .. 12)


------------------------------------------------------------------------
r3726 | jkbonfield | 2014-09-10 16:56:35 +0100 (Wed, 10 Sep 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed a crash introduced in r3497, triggered when using control-left
or right arrows in the editor to move a sequence location.

------------------------------------------------------------------------
r3725 | jkbonfield | 2014-09-10 11:25:50 +0100 (Wed, 10 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/str_finder.c

Fixed buffer underrun.

------------------------------------------------------------------------
r3724 | jkbonfield | 2014-09-09 15:29:18 +0100 (Tue, 09 Sep 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed rewrite_soft_clips() to correctly trim when handling overlapping
STRs.  Previously it could reset s->left/right multiple times,
overwriting the result each time, instead of taking the inner-most
union of the values.

Also tidied up the code to not needlessly compute consensus and STRs
on the first pass.

------------------------------------------------------------------------
r3723 | jkbonfield | 2014-09-08 16:24:07 +0100 (Mon, 08 Sep 2014) | 39 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/shuffle_pads.c
   A /staden/trunk/src/gap5/str_finder.c
   A /staden/trunk/src/gap5/str_finder.h
   A /staden/trunk/src/gap5/utlist.h

Added a short tandem read detector. This looks for repeated strings
between 1 and 8 bases long and returns a utlist of start..end ranges.
These may be overlapping in some situations. Eg:

$ ./a.out TGCAGAGCAGAGAGAGGGT
 1 .. 11 GCAGAGCAGAG
 8 .. 15 AGAGAGAG
15 .. 17 GGG

Compile str_finder.c with TEST_MAIN to get a command line tool.

Within Shuffle Pads this is used to identify STRs that overlap a
heterozygous indel region and then in turn to adjust the soft-clipping
of any reads that do not span that region as they cannot be relied
upon to indicate the copy number. Eg:

S1 GATCGGACGAGAG
S2 GATCGGACGAGAGAGAGAGAGT
S3 GATCGGACGAGAGAGAGAG**TCGGAC
S4     GGACGAGAGAGAGAGAGTCGGAC
S5        CGAGAGAGAGAG**TCGGAC
S6              AGAGAGAGTCGGAC

We have subseq of GAGAGAGAGAG** vs GAGAGAGAGAGAG. The first and last
(S1 and S6) sequences do not span and so we do not know which allele they
match. Specifically as the pad is at the right hand end, the alignment of
S6 gives incorrect weight to the consensus as it is stating AG when it
may actually be ** at that point.

By identifying the repeats we can soft clip as follows:

S1 GATCGGACgagag
S2 GATCGGACGAGAGAGAGAGAGT
S3 GATCGGACGAGAGAGAGAG**TCGGAC
S4     GGACGAGAGAGAGAGAGTCGGAC
S5        CGAGAGAGAGAG**TCGGAC
S6              agagagagTCGGAC


------------------------------------------------------------------------
r3722 | jkbonfield | 2014-09-05 15:31:51 +0100 (Fri, 05 Sep 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Switched to using older method of handling ONT consensus (based on a
one-liner perl/awk combo).  It just has a single parameter for how
much more likely it is to have overcall vs undercall. This is simple
to understand and more robust.

It corrects issues with the old system, which was causing * in
columns of illumina data to be downweighted too much.

------------------------------------------------------------------------
r3721 | jkbonfield | 2014-09-05 15:29:36 +0100 (Fri, 05 Sep 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/qualIO.c

Bug fixes the insertion/deletion counting in List Base Confidence
(they were reversed). Also updated it to report percentages.

------------------------------------------------------------------------
r3719 | jkbonfield | 2014-09-05 12:01:38 +0100 (Fri, 05 Sep 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Changed the simple consensus qualities to be Phred scores instead of
log-odds scores.  This fixes a bug where negative consensus qualities
were appearing in CAF and ACE outputs.

The change also impacts some other code, such as searching for
consensus quality in the editor and fastq outputs, but only at the
very low end as log-odds and phred scales rapidly converge. It is only
very poor quality data that changes.

------------------------------------------------------------------------
r3718 | jkbonfield | 2014-09-01 09:37:22 +0100 (Mon, 01 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Added Contig Extend/Trim options to gap5_cmd

------------------------------------------------------------------------
r3717 | jkbonfield | 2014-08-29 15:51:26 +0100 (Fri, 29 Aug 2014) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/configure.tcl
   M /staden/trunk/src/gap5/gap_globals.tcl

Fixed configuring consenus mode when in read only mode.

Fixed using File->Open to swap databases, ensuring it now correctly
sets the default_seq_tech back to Illumina.

------------------------------------------------------------------------
r3716 | jkbonfield | 2014-08-29 15:42:53 +0100 (Fri, 29 Aug 2014) | 30 lines
Changed paths:
   M /staden/trunk/src/gap5/configure.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   A /staden/trunk/src/gap5/gap_globals.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Allowed the default_seq_tech parameter to be modified from Gap5 GUI.

To do this required several things.

1) The cached consensus may be incorrect after changing this, so it
has to be purged. 

2) The parameter needs to be remembered in the database itself so it
can be set the next time we open a database.  I tidied up the setting
of default parameters in multiple locations and put them into
gap_globals.tcl.

3) To store an arbitrary variable without modifying the database
format required some lateral thinking. WARNING: ugliness ahead. Those
of a nervous disposition should look away now.

We create an anno_ele object with parent_type of GT_Database; ie an
annotation on the database rather than a contig or sequence. 
A scaffold of name __g5::CONFIG is created whose record number points
to this annotation instead of a scaffold.  The annotation contains
a series of 'set key val' tuples, which are carefully checked for
validty so we don't blindly trust everything.

We can extend this with other __g5::* fields for different types of
data, replacing the old Gap4 "Notes" mechanism as tags attached to a
database are essentially the same thing as notes.

4) Added various C/Tcl interfaces to set and get the config_anno
field.

------------------------------------------------------------------------
r3715 | jkbonfield | 2014-08-29 15:35:02 +0100 (Fri, 29 Aug 2014) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap_globals.c
   M /staden/trunk/src/gap5/gap_globals.h

Updated the consensus algorithm to cope with different overcall and
undercall probabilities per machine platform, permitting mixing of
different technologies to form a single consensus.

At present these are complete guesses with only a minimal nod to
reality and have no measurements backing them up (yet).  Expect them
to be tuned in the future. However they act as a good proof of
concept.

The Tcl variable default_seq_tech may be modified to change what the
Unknown sequencing tech is treated as.

------------------------------------------------------------------------
r3714 | jkbonfield | 2014-08-28 17:20:08 +0100 (Thu, 28 Aug 2014) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c

Fasta data now has a default quality of 3 instead of 0, as this was
causing problems with my experimental consensus algorithm.  It makes
more sense at 3 anyway. Confidence 0 implies it is 100% chance of
being incorrect.

------------------------------------------------------------------------
r3713 | jkbonfield | 2014-08-28 17:19:17 +0100 (Thu, 28 Aug 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Further tweakage of the align_blocks function. This was necessary in
order to get alignments scoring positive when using very weakly
aligning data.

It doesn't seem to overly harm my other tests for Illumina.

------------------------------------------------------------------------
r3712 | jkbonfield | 2014-08-28 17:18:11 +0100 (Thu, 28 Aug 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Prevent treatment of confidence 255 ("*" in qual field for BAM) as
confidence -1 (or 255). Instead set it to a minimal confidence of 3.

------------------------------------------------------------------------
r3711 | jkbonfield | 2014-08-26 17:35:51 +0100 (Tue, 26 Aug 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Fixed the mapping quality filter range from 0-80 to 0-255 as we are
seeing data with >80 as mquals.

Fixed the use of TEMPLATE_DISPLAY.SETTINGS_$i library records. These
could be for another database, so it already attempted to blank out
the libraries-list when they don't match up, but it failed to clear
the undo versions causing the filter window to possibly blank the data
when it's invoked.

------------------------------------------------------------------------
r3710 | jkbonfield | 2014-08-26 15:20:32 +0100 (Tue, 26 Aug 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Fixed spacing

------------------------------------------------------------------------
r3709 | jkbonfield | 2014-08-26 11:58:00 +0100 (Tue, 26 Aug 2014) | 32 lines
Changed paths:
   M /staden/trunk/src/gap5/libraries.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_library.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Further work on read-group machine types.

1) Bug fix to the tg_index process so that it looks up "PL"atform RG
tag correctly.  Previously it was doing something bizarre with
attempting to find the library name as a 2 character key.

2) Changed seq_tech to be an int instead of int:3 in the seq_t struct
as it has 9 possible values now.

3) Changed the on-disk format, which also packs 3 bits, to steal 2
bits from the parent_type field and use these for seq_tech.  This is
backwards compatible as these top bits have always been zero and we've
also never needed more than 7 for seq_tech either.

This limits the available number of GT_* types to 64, but we're only
using 18 at the moment and I don't see us adding that many more table
types to gap5. It gives us up to 32 instrument types.

4) Added set_name and set_machine_type methods to the library tcl
object.

5) The List Libraries window now allows editing of the library name
too, also also saves both this and edits to library machine type.


Note that editing the machine type here does not actually modify all
the sequence structures as the library type has been cached in both
seq and range structures during tg_index. I do not know how to prevent
that in an efficient manner, so for now editing the type is purely for
informational purposes.


------------------------------------------------------------------------
r3708 | jkbonfield | 2014-08-22 17:17:51 +0100 (Fri, 22 Aug 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/libraries.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/tk_utils/xcombobox.tcl

Updated Gap5 to support a richer list of machine platforms in the SAM
@RG tag.

(Ongoing: the platform type can also now be edited, but not yet saved,
in the ListLibraries window.)

------------------------------------------------------------------------
r3707 | jkbonfield | 2014-08-21 09:29:53 +0100 (Thu, 21 Aug 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Removed memory leak in sam_refbased_cigar().

Also removed debugging output from the output GFF function.

------------------------------------------------------------------------
r3706 | jkbonfield | 2014-08-21 09:28:56 +0100 (Thu, 21 Aug 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Removed memory leak in padded_to_reference_array().

------------------------------------------------------------------------
r3705 | jkbonfield | 2014-08-01 14:45:41 +0100 (Fri, 01 Aug 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added code to provide an export_snps command. This is *PURELY TEST
ONLY*.  It has hard coded names (like "chr20") and has a few bugs too,
but it serves as a useful starting point for if/when we want to do
proper VCF output at some stage.

For now it is not supported by the GUI.

------------------------------------------------------------------------
r3704 | jkbonfield | 2014-08-01 14:45:22 +0100 (Fri, 01 Aug 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   A /staden/trunk/src/gap5/export_snps.c
   A /staden/trunk/src/gap5/export_snps.h
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added code to provide an export_snps command. This is *PURELY TEST
ONLY*.  It has hard coded names (like "chr20") and has a few bugs too,
but it serves as a useful starting point for if/when we want to do
proper VCF output at some stage.

For now it is not supported by the GUI.

------------------------------------------------------------------------
r3703 | jkbonfield | 2014-07-31 11:28:25 +0100 (Thu, 31 Jul 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c

Fixed the buffer size for the OBJ_GET_BRIEF callback to be 160 instead
of 80. This fixes buffer overruns when dealing with large databases
and long record numbers.

Worked it out on paper the maximum length is around 120 for FIJ, and
a few bytes more for the others (but under 130). Set the new buffer
size to 160.

------------------------------------------------------------------------
r3702 | jkbonfield | 2014-07-16 10:31:55 +0100 (Wed, 16 Jul 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Put back the line of code to output BAM_FPROPER_PAIR flag for reads in
---> <--- paired orientation.

While this isn't strictly correct for all library types, making this
assumption is still usually correct and far better than simply never
setting this flag at all.

------------------------------------------------------------------------
r3701 | jkbonfield | 2014-07-08 17:49:20 +0100 (Tue, 08 Jul 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_struct.h

Added explanatory note to GRANGE_FLAG_REFPOS_HAVE_* fields so we don't
accidentally recreate the same bug as before. (Fake warnings from
Check Database.)

------------------------------------------------------------------------
r3700 | jkbonfield | 2014-07-08 17:44:14 +0100 (Tue, 08 Jul 2014) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Remove the code attempting to set GRANGE_FLAG_REFPOS_HAVE_* fields.

These are used internally in tg_iface_g.c to determine whether we need
to store the Position, Size or ID fields via a simplistic delta
mechanism.  Outside of that file they should never be set or queried.

This fix removes a warning about the in-memory and on-disc
representations differing, which is bogus as these bit fields are
zeroed after reading anyway.

------------------------------------------------------------------------
r3699 | jkbonfield | 2014-07-08 16:31:10 +0100 (Tue, 08 Jul 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/consensus.h
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added an interface to save heterozygous bases in the consensus.

Internally there are some new functions for this too (eg
calculate_consensus_simple_het) as well as some experimental only
functions for evaluation of SNP calling. (It is not expected that Gap5
will perform well here.)

------------------------------------------------------------------------
r3698 | jkbonfield | 2014-07-08 15:29:41 +0100 (Tue, 08 Jul 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed a bug in r3655 caused by failure to save bin ranges after
modifying.  This causes thousands of errors after inserting columns of
bases (eg via shuffle_pads).

------------------------------------------------------------------------
r3697 | jkbonfield | 2014-07-02 15:31:59 +0100 (Wed, 02 Jul 2014) | 7 lines
Changed paths:
   M /staden/trunk/course/data/shotgun_data/DEMO.0.log
   M /staden/trunk/course/data/shotgun_data/xb54f3.s1ta.exp
   M /staden/trunk/course/data/shotgun_data/xb56a5.s1.exp
   M /staden/trunk/demo/gap4/DEMO.0
   M /staden/trunk/demo/gap4/DEMO.0.aux
   M /staden/trunk/doc/Makefile
   A /staden/trunk/doc/manual/test.texi
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/seq_utils/align_lib.c

Tweaks to the shuffle pads scoring system, in particular what tables
it uses for the non-linear transforms (sinh vs log) as both have their
particular strengths and weaknesses.

The default is now to use soft-clips in the editor too for
realignment.

------------------------------------------------------------------------
r3696 | jkbonfield | 2014-07-02 15:17:33 +0100 (Wed, 02 Jul 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Added back Mask/Mark consensus filtering modes to Find Internal Joins.

------------------------------------------------------------------------
r3683 | jkbonfield | 2014-06-27 14:02:07 +0100 (Fri, 27 Jun 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap_globals.c

Fixed Mask/Mark consensus and also updated the gap5_cmd consensus
function to allow specifying of arbitrary maps for masking purposes.

------------------------------------------------------------------------
r3674 | jkbonfield | 2014-06-11 16:28:22 +0100 (Wed, 11 Jun 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Sanitise TGILIBS to use GAP5_LIBS and also removed the duplicate
SEQUTILS_LIBS from GAP5_LIBS.

This fix will also prevent the explicit -L/usr/lib64 -ltcl8.5 link
line on Fedora from capturing a system libstaden-read.so in preference
to the one we attempted to link against.

------------------------------------------------------------------------
r3661 | daviesrob | 2014-05-28 15:15:35 +0100 (Wed, 28 May 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Stop undo list from being converted to a string, just to see if it's empty.

------------------------------------------------------------------------
r3658 | daviesrob | 2014-05-22 09:40:29 +0100 (Thu, 22 May 2014) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Rewrite of contig_insert_base2.

The new version is much shorter and less byzantine than the previous one.


------------------------------------------------------------------------
r3657 | jkbonfield | 2014-05-21 12:35:46 +0100 (Wed, 21 May 2014) | 34 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/seq_utils/align_lib.c
   M /staden/trunk/src/seq_utils/align_lib.h

Many changes to shuffle pads implementation.

The malign code in align_lib now copes with start/end range being
something other than 1..length. This makes it far more efficient at
dealing with sub-sections of a contig.

Added a EDGE_GAPS_MAXY cost to block shifting the consensus to match
the sequence (vice versa is OK). In essence this is moving the
sequence beyond the end of the consensus, which can cause problems in
BAM world if we get coordinates < 1.

Adjusted the malign scores. It's now hard coded for DNA only, but it
was never used on proteins anyway. The scaling of scores is still 0 to
128, but now it is nonlinear and not in direct proportion to the
fraction of base type in the consensus vector. This was arrived at by
experimentation.

There is also an optional second scoring method for pads, which works
in some cases and not in others. This is selected by specifying
gap_extend to be 0 (gap_extend has been ignored for years, since we
switched from affine alignments). The shuffle pads code now executes
both modes in an attempt to find the best alignments.

When evaluating our realigned soft-clips we first undo the clipped
before recomputing the new consensus vector. This avoids a circular
argument and means we can only extend into heterozygous cutoffs when
there was already the same heterozygosity in the originally clipped
data.

Finally, adjusted the soft clipped scoring method to promote more
extension before realignment, but harsher when validating whether to
keep the alignments.


------------------------------------------------------------------------
r3656 | jkbonfield | 2014-05-21 12:17:34 +0100 (Wed, 21 May 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c

Rename g_index to tg_index in usage output.

------------------------------------------------------------------------
r3655 | daviesrob | 2014-05-20 16:30:34 +0100 (Tue, 20 May 2014) | 85 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5_del_test.tcl
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

More reworking of contig insertion / deletion code.

The tcl code to undo consensus base deletion has been simplified by creating a
contig insert_column interface, which takes the list of reads and base calls in
the undo stack and applies it to the column being inserted.  This allows the C
code to do a much more complete job than the old insert_base code, so the tcl
part does not need to do as much cleaning up.  This also means there is less
need to iterate around the bin tree.

Consensus base deletion now also stores undo information for reference position
markers.  As deleting a base may cause markers to be merged, the only way to
get them back when undoing is to know what markers were present in the first
place.

Various edge cases and problems with complemented bins have been fixed.

tg_tcl.c
  Added contig insert_column, find_refpos_marker, set_refpos_marker and
delete_refpos_marker interfaces.

tg_contig.c
tg_contig.h
  Made it easier to turn debugging code on and off.

  Added new contig_insert_column() function.  This is like contig_insert_base,
but can be passed an array listing the base and confidence value to be inserted
into each read in the column.  This is used to make a hash table which is
passed to contig_insert_base_common and then contig_insert_base2 so the updates
can be made reasonably efficiently without having to do too many traverses of
the bin tree.

  Update contig_insert_base2 to take the pileup hash, and to fix more edge
case and complemented bin issues.

  Ensure bin_incr_nseq() is only called for sequences in contig_delete_base2.

  Improved calculation of moved_left, moved_right and fixed_right in
contig_delete_base2.

  Allow deletion of the first base of the contig in contig_delete_base_common.

  Reworked refpos marker code to simplify it and to fix a bug where some
deletion markers were not removed in contig_delete_base_common causing them
to pile up.

  Added set_refpos_marker() and delete_refpos_marker() functions.  These are
called from the tcl interfaces in tg_tcl.c

tg_sequence.c
tg_sequence.h

  Pass in comp to sequence_insert_bases, which should be 1 if the current bin
is complemented.  This means it's possible to work out if the base call should
be complemented or not when inserting in bin orientation.  The value passed in
is ignored if in contig_orientation.

tg_check.c

  In bin_walk, when an incorrect nseqs or nanno count is found, print out what
the stored and actual values were.

contig_editor.tcl

  C_INS undo code now uses $contig insert_column instead of insert_base.  This
allowed a lot of code that was fixing eveything $contig insert_base had not
done correctly to be removed.

  Added RP_SET and RP_DEL undo commands.

  Made editor_delete_cons_base store undo for any reference position markers
that could be affected.  This is the only way to guarantee that the undo
operation can get them back as they were before.

gap5_del_test.tcl

  Made the basic test run on a complemented bin as well as an uncomplemented
one.

  Make do_test compare sam files for the before and after complemented case.

Makefile

  Recalculated dependencies.


------------------------------------------------------------------------
r3651 | jkbonfield | 2014-05-08 15:25:15 +0100 (Thu, 08 May 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Bug fix to bounds checking of cons[p]. Remember it's not start..end
but 0..end-start.

Inconsequential update to the scoring functions; the match and
mismatch costs are now #defines (but the same as before).

------------------------------------------------------------------------
r3650 | jkbonfield | 2014-05-06 17:10:18 +0100 (Tue, 06 May 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Now more rigorous bounds checking in rewrite_soft_clips(), curing some
crashes.

concordant_soft_clips() is now more liberal with the scoring when
extending into cutoff, to allow for misalignments of the cutoff data.
The final assessment post re-alignment within rewrite_soft_clips() is
still using the original scores so this shouldn't cause problems.

------------------------------------------------------------------------
r3649 | jkbonfield | 2014-05-06 17:07:14 +0100 (Tue, 06 May 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Cull some of the old malign scoring methods in scale_malign_scores().

Switched to a new version that scores based on log(count) instead of
count. This allows for better multiple sequence alignments within
heterozygous regions, so that we don't overly penalise the rare allele
but still prefer to align correctly.

------------------------------------------------------------------------
r3648 | jkbonfield | 2014-05-02 14:20:48 +0100 (Fri, 02 May 2014) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Bug fix to the recent update to look at consensus heterozygous bases
(typo leading to crash).

Make the concordant clip detection more liberal to start with (it'll
filter out those with turn out to be incorrect).

Remove pad columns both both and after rewriting the clips, as
series of pads left in the consensus was causing the seq-matches-cons
check to fail early.

------------------------------------------------------------------------
r3647 | jkbonfield | 2014-05-02 12:26:52 +0100 (Fri, 02 May 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h

Renamed coherent to concordant for the soft-clipping strategy. This is
the more appropriate English word.

------------------------------------------------------------------------
r3646 | jkbonfield | 2014-05-02 12:20:38 +0100 (Fri, 02 May 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed missing output of print_malign (unused unless uncommented out).

Changed the cutoff evaluation and extension to align against
heterozygous calls rather than single base consensus call. This allows
it to extend reads into cutoffs in more situations.

------------------------------------------------------------------------
r3645 | jkbonfield | 2014-05-02 09:46:53 +0100 (Fri, 02 May 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed @SQ line LN: field to use the clipped contig length instead of
unclipped.

------------------------------------------------------------------------
r3644 | jkbonfield | 2014-05-01 16:52:07 +0100 (Thu, 01 May 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Further improvements to samtools output with fixmates.

------------------------------------------------------------------------
r3643 | jkbonfield | 2014-05-01 14:59:20 +0100 (Thu, 01 May 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

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.

------------------------------------------------------------------------
r3642 | jkbonfield | 2014-05-01 14:57:59 +0100 (Thu, 01 May 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Attempt to improve mate pos when using fix-mates output of SAM in
conjunction with refpos depadding.

------------------------------------------------------------------------
r3641 | jkbonfield | 2014-05-01 11:50:26 +0100 (Thu, 01 May 2014) | 26 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.h
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

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.


------------------------------------------------------------------------
r3640 | daviesrob | 2014-04-29 10:16:55 +0100 (Tue, 29 Apr 2014) | 38 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_del_test.tcl
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c

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.


------------------------------------------------------------------------
r3639 | jkbonfield | 2014-04-28 12:23:03 +0100 (Mon, 28 Apr 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/tracediff/main.cpp

Replaced the potentially ambiguous copyright notice with the full root
copyright notice (although we don't actually bother to have any in
most of the files).

When MRC open-sourced the software they sent me the original
(LICENCE.txt) copyright notice for it to be applied to all the
software.  Any internal MRC specific copyrights left in place are an
accidental and  superceded.

------------------------------------------------------------------------
r3636 | jkbonfield | 2014-04-14 11:29:30 +0100 (Mon, 14 Apr 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Minor comment tidyup

------------------------------------------------------------------------
r3622 | daviesrob | 2014-04-07 12:45:07 +0100 (Mon, 07 Apr 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Made bin_add_to_range explicitly check for sequences beyond clipped_start/end

bin_add_to_range would fail to set (*c)->clipped_timestamp = 0 if a sequence
being added was within the existing contig used start/end but caused the
clipped_start/end to change.  Added a check to see if the new range may
go beyond clipped_start or clipped_end, and reset clipped_timestamp if
this is the case.

------------------------------------------------------------------------
r3616 | daviesrob | 2014-04-04 13:43:20 +0100 (Fri, 04 Apr 2014) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5_del_test.tcl

Debugging aids for contig deletion/insertion
------------------------------------------------------------------------
r3615 | daviesrob | 2014-04-04 13:40:08 +0100 (Fri, 04 Apr 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed occasional incorrect update of contig used end position.

Put in check that seq_end has actually been set in contig_insert_base2
before using the value.

Removed some dead code.

------------------------------------------------------------------------
r3612 | daviesrob | 2014-04-02 12:44:48 +0100 (Wed, 02 Apr 2014) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Remove duplicate move_seq code and ensure annotations are in same bin as seq.

The code for MOVE_SEQ in contig_cmd could move sequences to new bins without
ensuring that the annotations were moved as well.  The version in
sequence_move did fix the annotations, so made contig_cmd call this instead
of using its own code.

sequence_move now takes a contig_t ** so it can update the location of
the contig record in the caller should it get checked out.  It also gets a
prototype in tg_sequence.h


------------------------------------------------------------------------
r3611 | daviesrob | 2014-04-02 12:43:45 +0100 (Wed, 02 Apr 2014) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Stop tags from extending at the contig end when inserting consensus bases
------------------------------------------------------------------------
r3600 | daviesrob | 2014-03-19 16:33:20 +0000 (Wed, 19 Mar 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Disabled fix for annotations that do not overlap the annotated object.

Trying to move the annotation to a new bin causes problems in bin_walk which
expects the items in the bins to remain stable.  This leads it to try to
fix problems that aren't really there resulting in a database that is in
a much worse state that it was to start with.  Disabling the annotation
fix prevents this.

------------------------------------------------------------------------
r3598 | daviesrob | 2014-03-14 17:02:32 +0000 (Fri, 14 Mar 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/template_draw.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c

Fix compiler warnings.

Mainly missing prototypes, a few char subscripts and some missing braces.

------------------------------------------------------------------------
r3597 | daviesrob | 2014-03-14 15:10:31 +0000 (Fri, 14 Mar 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h

Changed flags in contig_t struct from tg_rec to uint32_t

Done to match what is stored in the database.

------------------------------------------------------------------------
r3596 | daviesrob | 2014-03-14 12:28:38 +0000 (Fri, 14 Mar 2014) | 8 lines
Changed paths:
   A /staden/trunk/src/gap5/test
   A /staden/trunk/src/gap5/test/test_tg_utils.c
   M /staden/trunk/src/gap5/tg_utils.c

Fixed handling of INT32_MIN in s72int and INT64_MIN in s72intw

int2s7 and intw2s7 both encode the lowest possible integer value with the
output code 1, which was converted to 0 by s72int and s72intw.  Fixed the
latter so they output the correct value instead.  Also added some test code
to exercise these functions, including testing all the extreme values.


------------------------------------------------------------------------
r3595 | jkbonfield | 2014-03-11 14:46:58 +0000 (Tue, 11 Mar 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed exporting CRAM in padded mode. It was outputting a depadded
consensus, causing CRAM to work excessively hard in encoding reference
differences.

------------------------------------------------------------------------
r3594 | jkbonfield | 2014-03-11 09:35:36 +0000 (Tue, 11 Mar 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/g-request.c

Added back fsync of main .g5d file when flushing.

This will slow things down slightly, depending on how often flushes
occur, but resolves some database corruptions we've been seeing.

Specifically if a user has gap5 open on one machine, makes changes and
saves the DB, then creates a backup of the database on the command
line on a different machine[1] then there is a chance that NFS hasn't
correctrly synced the changes yet. This call forces that to happen.

[1] This happens a lot here due to using load-sharing to launch gap5
on one of several nodes in a cluster.

------------------------------------------------------------------------
r3591 | jkbonfield | 2014-03-04 17:17:20 +0000 (Tue, 04 Mar 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h

Added an automatic adapter detector. This works by hashing the
soft-clip and hashing the used data (FIXME: need to strip pads) and
then comparing the distributions.

Also reduced memory and potentially sped up on very long contigs by
doing shuffle pads in 32Kb windows. This avoids purging of memory
cache.

------------------------------------------------------------------------
r3590 | jkbonfield | 2014-03-04 14:35:38 +0000 (Tue, 04 Mar 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed bug in ed_set_sequence_sort(). It wasn't correctly handling the
variation of selection end < start.

------------------------------------------------------------------------
r3588 | jkbonfield | 2014-02-28 15:30:34 +0000 (Fri, 28 Feb 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Improvements to Shuffle Pads's validate_clip() function. Using a
similar method to rewrite_soft_clips (possibly the validation should
be merged into that code), it now counts differences to the
consensus.  This is often more reliable than counting SNP consensus
bases when faced with highly varying read depth.

------------------------------------------------------------------------
r3587 | jkbonfield | 2014-02-28 12:44:58 +0000 (Fri, 28 Feb 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap4/edMutations.c

Fixed a bug in showing the reading-frame translations. It's a 1 byte
buffer overrun that has existed since ~2002.

------------------------------------------------------------------------
r3583 | jkbonfield | 2014-02-27 11:19:20 +0000 (Thu, 27 Feb 2014) | 19 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Added an option to Shuffle Pads to use the cutoff/soft-clip data.

This is quite complex as it performs multiple passes. Firstly it looks
for "coherent soft-clips"; regions with multiple sequences
soft-clipped with the cutoffs in agreement with one another. Then it
extends sequences into the cutoffs before running shuffle pads.

Once realigned, it then inspects the data to check that the unclipped
reads align. If so then they are kept, if not then they are tagged
with CLIP and the clips are trimmed back to where they agree with the
consensus.

Finally special care is taken around consensus Ns. These are included
in local conventions by faking scaffolds, placing contigs next to each
other in the same "contig". Sometimes the realignment will resolve and
join them together, but often it produces unaligned data. In that case
we attempt to unclip and recreate the N as a internal scaffold marker,
but it's not bullet proof.

------------------------------------------------------------------------
r3582 | jkbonfield | 2014-02-26 12:10:55 +0000 (Wed, 26 Feb 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Optimised contig_insert_base2 and contig_delete_base2.  The main
change is avoiding recomputing contig ends all the while. Often we can
work out what the change will be (eg we're in a bin in the middle of
the contig) and it's only at the boundary bins where it gets more
complex. So we avoid brute force calculations where possible.

Also updated contig_shift_base to accept +N and -N to shift by more
than 1 bp.

------------------------------------------------------------------------
r3581 | jkbonfield | 2014-02-26 12:08:33 +0000 (Wed, 26 Feb 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/array.h

Added an ArrayPush macro. Basically it's just a short-hand for
appending to the end of an array.

------------------------------------------------------------------------
r3580 | jkbonfield | 2014-02-24 17:33:57 +0000 (Mon, 24 Feb 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_struct.h

Fix to ANNO_DIR_REV, but apparently it is unused.

------------------------------------------------------------------------
r3565 | awhitwham | 2014-01-24 10:16:04 +0000 (Fri, 24 Jan 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c

Changed the name index sorting mechanism of tg_index.  Should be faster.

------------------------------------------------------------------------
r3564 | jkbonfield | 2014-01-17 09:45:44 +0000 (Fri, 17 Jan 2014) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_index_common.c

Reduced the volume of read-pair entries dumped to the /tmp file.

Previously when we saw Read.1st we recorded it in a hash table and then
when we found Read.2nd we linked it back to Read.1st and recorded in
the temporary file a request to link Read.1st to Read.2nd in a second
pass. (As doing this immediately causes a lot of disk thrashing due to
chimeras, mismatches, genome shuffling etc.)

Now we also make the forward link of Read.1st to Read.2nd if it is
within a bin that is still held in the in-memory cache and is still
locked for read-write (meaning it is yet to be saved/flushed).

On a 3Gb bam file test this reduced the number of entries stored in
the tmp file for 2nd pass from 15.9 million down to 0.6 million. The
effect on speed was slight - only 3% quicker overall.

------------------------------------------------------------------------
r3563 | jkbonfield | 2014-01-16 16:19:54 +0000 (Thu, 16 Jan 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added Template Status and Library Name to the multi-column list
viewer.

Also fixed a bug discovered in edview_items_between() which could
return record numbers for cached consensus.

------------------------------------------------------------------------
r3562 | jkbonfield | 2014-01-16 14:10:04 +0000 (Thu, 16 Jan 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Changed the click and drag bindings to check whether the initial press
came from a double-1 binding to move the editor cursor. If so drag the
cursor, otherwise do the old plot-drag code.

------------------------------------------------------------------------
r3561 | jkbonfield | 2014-01-16 11:53:37 +0000 (Thu, 16 Jan 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Added Shift-Function-key and Function-key bindings to the template
display to store and restore the current configuration. Additionally
this can be saved to ~/.gap5rc via the File->Save Settings option.



========================================================================
RELEASED 2.0.0b10

------------------------------------------------------------------------
r3554 | jkbonfield | 2013-12-18 16:36:35 +0000 (Wed, 18 Dec 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/seq_utils/Makefile

Use text_utils instead of tk_utils as vector_clip was inheriting a
dependency on tk86.dll which bizarrely then crashes on program exit.

The reason we switched to tk_utils instead of text_utils was, I think,
originally due to inanities of the macosx linker disallowing linking
against seq_utils and tk_utils within, say, gap4. But both that and
windows now work.

------------------------------------------------------------------------
r3553 | jkbonfield | 2013-12-18 16:33:41 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/pregap4/modules/interactive_clip.p4m

Fixed launching of Trev to avoid knowing the wish executable name.

------------------------------------------------------------------------
r3552 | jkbonfield | 2013-12-18 12:37:05 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/auto_build/remote.windows-i386
   M /staden/trunk/auto_build/remote.windows-x86_64

Bug fix to Gap4 - it's gap.exe and not gap4.exe that we need.

------------------------------------------------------------------------
r3551 | jkbonfield | 2013-12-18 12:28:28 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/windows/inno_setup/staden_config.iss

Minor updates to windows setup: icon file locations; Start menu contents.

------------------------------------------------------------------------
r3550 | jkbonfield | 2013-12-18 12:27:28 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c

Bug fix for Windows - force opening in O_BINARY mode.

------------------------------------------------------------------------
r3545 | jkbonfield | 2013-12-16 14:31:51 +0000 (Mon, 16 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/auto_build/Makefile
   M /staden/trunk/auto_build/local.lucid-i386
   M /staden/trunk/auto_build/local.macosx
   M /staden/trunk/auto_build/local.precise-x86_64
   M /staden/trunk/auto_build/local.windows-i386
   M /staden/trunk/auto_build/local.windows-x86_64
   M /staden/trunk/auto_build/remote.lucid-i386
   M /staden/trunk/auto_build/remote.macosx
   M /staden/trunk/auto_build/remote.precise-x86_64
   M /staden/trunk/auto_build/remote.windows-i386
   M /staden/trunk/auto_build/remote.windows-x86_64

Added documentation to the generated tarballs.
Also produce lzma versions for linux.

------------------------------------------------------------------------
r3544 | jkbonfield | 2013-12-16 11:35:02 +0000 (Mon, 16 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/auto_build/Makefile
   M /staden/trunk/auto_build/config
   M /staden/trunk/auto_build/local.macosx
   M /staden/trunk/auto_build/local.windows-i386
   M /staden/trunk/auto_build/local.windows-x86_64

Fixes to cope with moving the auto_build directory.

------------------------------------------------------------------------
r3543 | jkbonfield | 2013-12-16 11:28:11 +0000 (Mon, 16 Dec 2013) | 2 lines
Changed paths:
   A /staden/trunk/auto_build/README
   A /staden/trunk/auto_build/README.linux
   A /staden/trunk/auto_build/README.macosx
   A /staden/trunk/auto_build/README.windows

Docs for local machines.

------------------------------------------------------------------------
r3542 | jkbonfield | 2013-12-16 11:08:55 +0000 (Mon, 16 Dec 2013) | 6 lines
Changed paths:
   A /staden/trunk/auto_build
   A /staden/trunk/auto_build/Makefile
   A /staden/trunk/auto_build/config
   A /staden/trunk/auto_build/local.lucid-i386
   A /staden/trunk/auto_build/local.macosx
   A /staden/trunk/auto_build/local.precise-x86_64
   A /staden/trunk/auto_build/local.windows-i386
   A /staden/trunk/auto_build/local.windows-x86_64
   A /staden/trunk/auto_build/remote.lucid-i386
   A /staden/trunk/auto_build/remote.macosx
   A /staden/trunk/auto_build/remote.precise-x86_64
   A /staden/trunk/auto_build/remote.windows-i386
   A /staden/trunk/auto_build/remote.windows-x86_64

Added auto_build directory. This contains Makefiles and shell scripts
for local use in Sanger to build distributions on a variety of
platforms.  It is designed to speed up the release cycle.

(Still a work in progress.)

------------------------------------------------------------------------
r3541 | jkbonfield | 2013-12-13 17:56:44 +0000 (Fri, 13 Dec 2013) | 2 lines
Changed paths:
   A /staden/trunk/src/windows/inno_setup
   A /staden/trunk/src/windows/inno_setup/splash.bmp
   A /staden/trunk/src/windows/inno_setup/staden_config.iss

Added InnoSetup configuration for building windows installations.

------------------------------------------------------------------------
r3539 | jkbonfield | 2013-12-13 16:55:30 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/ac_stubs/tcl.m4
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/staden_config.h.in

Updated to newer version of tcl.m4 to better support cross-compiling
for windows.

------------------------------------------------------------------------
r3538 | jkbonfield | 2013-12-13 14:18:15 +0000 (Fri, 13 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tkTraceDisp.c

Renamed Winport to WinPort as case matters when cross-compiling from linux.

------------------------------------------------------------------------
r3537 | jkbonfield | 2013-12-13 14:17:42 +0000 (Fri, 13 Dec 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c

Added staden_config.h for belt and braces. I don't think it's needed
now that I fixed an issue elsewhere, but it ought to have it
explicitly included anyway.

------------------------------------------------------------------------
r3536 | jkbonfield | 2013-12-13 14:16:56 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Removed tg_view. It doesn't work on windows (unless we build our own
curses) and is pretty pointless now anyway.

------------------------------------------------------------------------
r3535 | jkbonfield | 2013-12-13 14:16:28 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/windows/run/main.cpp

Updated to work with tcl8.6 and also now adds lib directory to PATH so
dlls don't need to be in the main bin directory.

------------------------------------------------------------------------
r3534 | jkbonfield | 2013-12-13 14:15:36 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/windows/run/Makefile

Added $(COMPILER) to Makefile as a command prefix so we can override
it for cross-compilers.

------------------------------------------------------------------------
r3527 | jkbonfield | 2013-11-29 10:13:20 +0000 (Fri, 29 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/pregap4/modules/interactive_clip.p4m
   M /staden/trunk/src/tk_utils/stash

Fixes to cope with spaces in filenames.

------------------------------------------------------------------------
r3526 | jkbonfield | 2013-11-21 15:36:07 +0000 (Thu, 21 Nov 2013) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

Fixed a bizarre red/blue colour swap on Windows. It seems to have been
there several years. I'm not sure of the reason for it, but also see
http://sourceforge.net/p/tktoolkit/bugs/1049/ for further discussion
on the matter.

That bug was rejected, but I do wonder if it's still there. Tested
against Windows Server 2008 R2 and Win XP, both had the error and both
now display correctly.

------------------------------------------------------------------------
r3525 | jkbonfield | 2013-11-21 15:34:16 +0000 (Thu, 21 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.h

Fix when cross-compiling. (Missing int*_t)

------------------------------------------------------------------------
r3524 | jkbonfield | 2013-11-21 14:15:26 +0000 (Thu, 21 Nov 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

A better fix to the template X Image handling. Blinding calling
ckalloc and ckfree works for Windows, but then causes crashes on Unix
for the same reasons we had crashes on Windows when using malloc/free.

We now pick and choose which functions to use based on the OS.

------------------------------------------------------------------------
r3523 | jkbonfield | 2013-11-21 10:44:50 +0000 (Thu, 21 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/eba/conf.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/hetins/hetins.c
   M /staden/trunk/src/init_exp/init_exp.c

Minor compilation warnings removed, particularly with respect to
Windows building.

------------------------------------------------------------------------
r3522 | jkbonfield | 2013-11-20 17:29:17 +0000 (Wed, 20 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/depth.tcl

Fixed mouse wheel bindings for Windows in template display and contig
editor.

------------------------------------------------------------------------
r3521 | jkbonfield | 2013-11-20 16:32:07 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap4/IO1.h

Renamed #ifdef _IO_H_ guard. Forgot this in io to io1 rename.

------------------------------------------------------------------------
r3520 | jkbonfield | 2013-11-20 15:36:21 +0000 (Wed, 20 Nov 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

Switched to using ckalloc and ckfree for image->buf as this is copied
into the XImage and sometimes freed by Tcl. (On windows if tcl frees it
we must allocate it using ckalloc.)

------------------------------------------------------------------------
r3519 | jkbonfield | 2013-11-20 15:33:35 +0000 (Wed, 20 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tkWinX.c

Renamed tkpWinRopModes to a static sp_tkpWinRopModes to avoid clashes
with the same named variable in tk8.6 distribution.

------------------------------------------------------------------------
r3518 | jkbonfield | 2013-11-20 15:32:25 +0000 (Wed, 20 Nov 2013) | 9 lines
Changed paths:
   M /staden/trunk/src/Misc/Makefile
   M /staden/trunk/src/Misc/os.h
   M /staden/trunk/src/abi/Makefile
   M /staden/trunk/src/alf/Makefile
   M /staden/trunk/src/convert/Makefile
   M /staden/trunk/src/convert/gapDB.c
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/eba/Makefile
   M /staden/trunk/src/find_renz/Makefile
   M /staden/trunk/src/g/Makefile
   D /staden/trunk/src/gap4/IO.c
   D /staden/trunk/src/gap4/IO.h
   A /staden/trunk/src/gap4/IO1.c (from /staden/trunk/src/gap4/IO.c:3509)
   A /staden/trunk/src/gap4/IO1.h (from /staden/trunk/src/gap4/IO.h:3509)
   M /staden/trunk/src/gap4/IO2.c
   M /staden/trunk/src/gap4/IO3.c
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap4/alter_rel.c
   M /staden/trunk/src/gap4/alter_rel.h
   M /staden/trunk/src/gap4/assemble_direct.c
   M /staden/trunk/src/gap4/assemble_direct.h
   M /staden/trunk/src/gap4/auto_assemble.c
   M /staden/trunk/src/gap4/auto_break.c
   M /staden/trunk/src/gap4/break_contig.c
   M /staden/trunk/src/gap4/break_contig.h
   M /staden/trunk/src/gap4/check_assembly.c
   M /staden/trunk/src/gap4/clip.h
   M /staden/trunk/src/gap4/clones.c
   M /staden/trunk/src/gap4/clones.h
   M /staden/trunk/src/gap4/complement.c
   M /staden/trunk/src/gap4/confidence_graph.c
   M /staden/trunk/src/gap4/consen.c
   M /staden/trunk/src/gap4/consen.h
   M /staden/trunk/src/gap4/contigEditor.c
   M /staden/trunk/src/gap4/contig_order.c
   M /staden/trunk/src/gap4/contig_order.h
   M /staden/trunk/src/gap4/contig_selector.c
   M /staden/trunk/src/gap4/copy_db.c
   M /staden/trunk/src/gap4/copy_db.h
   M /staden/trunk/src/gap4/cs-object.h
   M /staden/trunk/src/gap4/dbcheck.c
   M /staden/trunk/src/gap4/dis_readings.c
   M /staden/trunk/src/gap4/edStructs.h
   M /staden/trunk/src/gap4/edUtils.h
   M /staden/trunk/src/gap4/edUtils2.c
   M /staden/trunk/src/gap4/extract.c
   M /staden/trunk/src/gap4/fij.c
   M /staden/trunk/src/gap4/fij.h
   M /staden/trunk/src/gap4/find_fragments.c
   M /staden/trunk/src/gap4/find_oligo.c
   M /staden/trunk/src/gap4/find_repeats.c
   M /staden/trunk/src/gap4/find_repeats.h
   M /staden/trunk/src/gap4/gap-tcl.c
   M /staden/trunk/src/gap4/gap-thrash2.c
   M /staden/trunk/src/gap4/gap-thrash2bug.c
   M /staden/trunk/src/gap4/gap-thrash3.c
   M /staden/trunk/src/gap4/gap-thrash_main.c
   M /staden/trunk/src/gap4/gap_canvas_box.h
   M /staden/trunk/src/gap4/io-reg.c
   M /staden/trunk/src/gap4/io-reg.h
   M /staden/trunk/src/gap4/io_handle.c
   M /staden/trunk/src/gap4/io_utils.h
   M /staden/trunk/src/gap4/join.c
   M /staden/trunk/src/gap4/list_proc.h
   M /staden/trunk/src/gap4/newgap_cmds.c
   M /staden/trunk/src/gap4/newgap_cmds.h
   M /staden/trunk/src/gap4/newgap_structs.h
   M /staden/trunk/src/gap4/notes.c
   M /staden/trunk/src/gap4/oligo.c
   M /staden/trunk/src/gap4/oligo_sel.c
   M /staden/trunk/src/gap4/plot_quality.c
   M /staden/trunk/src/gap4/preass.c
   M /staden/trunk/src/gap4/probe.h
   M /staden/trunk/src/gap4/qualIO.c
   M /staden/trunk/src/gap4/quality_plot.c
   M /staden/trunk/src/gap4/reactions.c
   M /staden/trunk/src/gap4/reading_coverage.c
   M /staden/trunk/src/gap4/readpair.c
   M /staden/trunk/src/gap4/readpair_coverage.c
   M /staden/trunk/src/gap4/restriction_enzymes.h
   M /staden/trunk/src/gap4/ruler_display.c
   M /staden/trunk/src/gap4/ruler_display.h
   M /staden/trunk/src/gap4/seqInfo.c
   M /staden/trunk/src/gap4/shuffle_pads.c
   M /staden/trunk/src/gap4/shuffle_pads.h
   M /staden/trunk/src/gap4/strand_coverage.c
   M /staden/trunk/src/gap4/tagU2.c
   M /staden/trunk/src/gap4/tagUtils.h
   M /staden/trunk/src/gap4/template.c
   M /staden/trunk/src/gap4/template.h
   M /staden/trunk/src/gap4/template_display.h
   M /staden/trunk/src/gap4/text-io-reg.c
   M /staden/trunk/src/gap4/tk-io-reg.c
   M /staden/trunk/src/gap4/tman_display.h
   M /staden/trunk/src/gap4/vseqs.c
   M /staden/trunk/src/gap4/vseqs.h
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/get_scf_field/Makefile
   M /staden/trunk/src/haplo/Makefile
   M /staden/trunk/src/haplo/haplo.h
   M /staden/trunk/src/haplo/haplo_cons.c
   M /staden/trunk/src/haplo/haplo_snps.c
   M /staden/trunk/src/haplo/haplo_split.c
   M /staden/trunk/src/haplo/haplo_tcl.c
   M /staden/trunk/src/init_exp/Makefile
   M /staden/trunk/src/make_weights/Makefile
   M /staden/trunk/src/mutlib/Makefile
   M /staden/trunk/src/polyA_clip/Makefile
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/prefinish/finish.c
   M /staden/trunk/src/prefinish/finish.h
   M /staden/trunk/src/prefinish/finish_long.c
   M /staden/trunk/src/prefinish/finish_main.c
   M /staden/trunk/src/prefinish/finish_pcr.c
   M /staden/trunk/src/prefinish/finish_pcr.h
   M /staden/trunk/src/prefinish/finish_reverse.c
   M /staden/trunk/src/prefinish/finish_utils.c
   M /staden/trunk/src/prefinish/finish_utils.h
   M /staden/trunk/src/prefinish/finish_walk.c
   M /staden/trunk/src/prefinish/insert_size_dist.c
   M /staden/trunk/src/prefinish/read_conf_dist.c
   M /staden/trunk/src/prefinish/read_size_dist.c
   M /staden/trunk/src/qclip/Makefile
   M /staden/trunk/src/screen_seq/Makefile
   M /staden/trunk/src/seq_utils/Makefile
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/stops/Makefile
   M /staden/trunk/src/text_utils/Makefile
   M /staden/trunk/src/tk_utils/Makefile
   M /staden/trunk/src/tracediff/Makefile
   M /staden/trunk/src/vector_clip/Makefile

Added #include <io.h> to the MINGW part of os.h so the chdir() macro
is applied after the system definition. This avoids errors if we
include os.h before io.h and then get an illegal system head file.

Unfortunately adding this breaks Gap4's IO.h (and .c) as on windows
IO.h and io.h are the same file. So renamed these to IO1.c and IO1.h,
given we have IO2.c and IO3.c already, updated the myriad of places
they were included from and reran make depend too.

------------------------------------------------------------------------
r3517 | daviesrob | 2013-11-20 15:19:00 +0000 (Wed, 20 Nov 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Stopped parse_acd_tag from returning pointers beyond the end of the string.

If parse_acd_tag tag was handed a string that did not end in \n, it would
return a pointer to 1 past the NUL byte on the end.  This would cause it
to attempt to read uninitialized memory when called next time.

------------------------------------------------------------------------
r3516 | jkbonfield | 2013-11-20 15:15:10 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

Cosmetic code tidyup. Lines longer than 80 characters offend me!

------------------------------------------------------------------------
r3515 | jkbonfield | 2013-11-20 15:14:21 +0000 (Wed, 20 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/ChangeLog
   M /staden/trunk/src/configure.in

Nearing the next release so updated version and changelog. More to go
still, specifically Windows and a few bugs uncovered.

------------------------------------------------------------------------
r3514 | jkbonfield | 2013-11-20 15:13:41 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Minor optimisation

------------------------------------------------------------------------
r3513 | jkbonfield | 2013-11-20 15:12:00 +0000 (Wed, 20 Nov 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/staden.profile

Added $STADENROOT/lib to LD_LIBRARY_PATH too so we can add any
third-party libraries (ie not part of the staden package) in there to
override any system versions or to ensure libraries exist. This is
particularly relevant to the MacOS X build.

------------------------------------------------------------------------
r3512 | jkbonfield | 2013-11-20 15:10:29 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/Makefile.in

Make distsrc now also generates a tarball

------------------------------------------------------------------------
r3511 | jkbonfield | 2013-11-20 15:10:05 +0000 (Wed, 20 Nov 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Make FIJ and Find Read Pairs sub-commands open in read-only mode as
they have no strong need to be read-write.

However possibly we should add a -rw command line option to force
read-write still as some actions of these tools could generate data
which is best cached (eg consensus, read-pair locations).

------------------------------------------------------------------------
r3510 | daviesrob | 2013-11-20 09:34:09 +0000 (Wed, 20 Nov 2013) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

Fix bugs in spanning_pairs when run in end_all mode.

When spanning_pairs had to use sequence_get_position to look up pair positions,
it was not filling in all the needed parts of r2, leading to the use of
uninitialized values later on.  It now fills in everything that is needed,
which makes the results much more deterministic.  This only affected end_all
mode, as none of the others needed to look up pairs by this method.

Using sequence_get_position could also bring back links to contigs that were
not in the original list passed to spanning_pairs.  These are now filtered
out.  This also fixes a failed assertion in Find Internal Joins that was
triggered by spanning_pairs returning such unexpected links.

------------------------------------------------------------------------
r3508 | jkbonfield | 2013-11-07 16:53:38 +0000 (Thu, 07 Nov 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/MacOSX/Gap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/gap4 (from /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/run.sh:3506)
   D /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/Gap5.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/gap5 (from /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/run.sh:3506)
   D /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/Makefile
   M /staden/trunk/src/MacOSX/Pregap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/pregap4 (from /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/run.sh:3506)
   D /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/Spin.app/Contents/Info.plist
   D /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/spin (from /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/run.sh:3506)
   M /staden/trunk/src/MacOSX/Trev.app/Contents/Info.plist
   D /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/trev (from /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/run.sh:3506)
   M /staden/trunk/src/MacOSX/wrapper.c

Replaced the wrapper script with a shell script now I figured out what
was causing the failures in the past (Launch Service changes
Contents/MacOS/gap5 to Contents/MacOS/Gap5 and then caused the sed
part to fail).

This avoids the whole 32-bit vs 64-bit Carbon woes.

------------------------------------------------------------------------
r3507 | jkbonfield | 2013-11-06 17:38:19 +0000 (Wed, 06 Nov 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Fixed the merge sorting of the sequence name index when only one file
is needed. In this case it was closing the file descriptor early and
then attempting to read it.

------------------------------------------------------------------------
r3506 | jkbonfield | 2013-11-06 17:03:39 +0000 (Wed, 06 Nov 2013) | 2 lines
Changed paths:
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Makefile
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/wrapper.c

Added code to help build and update the application bundles.

------------------------------------------------------------------------
r3505 | jkbonfield | 2013-11-06 09:19:24 +0000 (Wed, 06 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/README.build
   M /staden/trunk/src/staden.profile

MacOS X updates for building and running.

------------------------------------------------------------------------
r3504 | jkbonfield | 2013-10-31 09:32:16 +0000 (Thu, 31 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/eba/qual.c

Removed CTF support as it's been purged from io_lib.

------------------------------------------------------------------------
r3497 | daviesrob | 2013-10-24 15:33:32 +0100 (Thu, 24 Oct 2013) | 54 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_editor.tcl
   A /staden/trunk/src/gap5/gap5_del_test.tcl
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Much work on base deletion and associated undo.  Added flag for unmapped seqs.

Re-factor edit_delete_base to pull consensus and sequence cases into
separate functions.

Remove reads when the last base is deleted, unless it's the last base of the
last read in the contig, in which case do nothing.
Add undo command to add removed reads back to the assembly.

Break link with pair for sequences that have been removed.
When adding reads (for undo), restore pair link for paired reads.

Reset orientation for removed sequences to the original one so that
undo can get them the right way round.

Set a flag on sequences that get unmapped, and set the bin number to -1.
Upgrade various routines to sensibly handle sequences that are unmapped.

Correctly handle shrinking and removing annotations, and replacing or
growing them for undo.
Make anno_ele move tcl function use anno_get_range to get the object record
number.

Contig delete base/insert base only delete/insert to visible parts of
reads, so remove cut-off bases from the pileup stored in the undo array.

Allow contig_insert_base and contig_delete_base to insert/delete the
first visible base.

When inserting bases (for undo), ensure sequences get promoted to a
new bin if they exceed the boundaries on the one that they are in.  Added
new sequence_move function to tg_sequence.c to do this.

Get the correct object record number when moving contig annotations.

Made delete consensus base move the entire contig left when removing the
leftmost base.

Rewrote sequence_range_length (used to fix sequence position in a contig
after it has changed length).  The new version is simpler and does a better
job of fixing the contig start/end positions (both clipped and unclipped).

Make consensus_valid_range better at handling completely clipped reads.

Set clipped_timestamp to zero in bin_add_to_range and bin_remove_item_from_bin
to force recalculation of clipped start/end.

Recalculate contig start/end earlier in contig_insert_base_common so
contig iterators used later start from the correct point.

Included somewhat dodgy gap5_del_test.tcl script to exercise the delete and
undo code.  Currently only really tests the consensus case.


------------------------------------------------------------------------
r3496 | awhitwham | 2013-10-23 14:35:08 +0100 (Wed, 23 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h

Made the name sorting code more efficient.  Should now work with larger numbers of names.  Still needs work.

------------------------------------------------------------------------
r3491 | jkbonfield | 2013-10-17 09:49:12 +0100 (Thu, 17 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_extend.c

Fixed Extend Contigs to cope with columns containing pads.

------------------------------------------------------------------------
r3490 | jkbonfield | 2013-10-16 12:34:21 +0100 (Wed, 16 Oct 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/contig_extend.h
   M /staden/trunk/src/gap5/contig_extend.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed a bug in the Contig Extend code, where extensions containing
zero base matches would sometimes trim the sequence rather than extend
it.

Also added Contig Trim, to clip back straggly low-depth contig ends.

------------------------------------------------------------------------
r3488 | jkbonfield | 2013-10-14 16:56:14 +0100 (Mon, 14 Oct 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap_range.c

Changed the min/max mapping quality sliders to be the actual mapping
quality instead of 3*mqual. (That was an error, multiplied up purely
for obtaining a colour.)

Also changed the default colour mode to be minimum mapping quality
instead of average, as minimum is typically what we want when
evaluating the reliability of an assembly.

------------------------------------------------------------------------
r3487 | jkbonfield | 2013-10-11 14:45:07 +0100 (Fri, 11 Oct 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/Misc/misc.h
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/consensus.h
   M /staden/trunk/src/gap5/tg_sequence.c

Added a consensus_pileup() function to iterate through a contig in
column by column order instead of sequence by sequence.

This reuses the MIN4 macro from tg_sequence, so I moved this to misc.h

------------------------------------------------------------------------
r3486 | jkbonfield | 2013-10-11 11:33:47 +0100 (Fri, 11 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/ac_stubs/ax_lib_samtools.m4

Even though we no longer use samtools, here are the corrected M4 macros
that work with Ubuntu Precise and with multi-threaded samtools.

------------------------------------------------------------------------
r3485 | jkbonfield | 2013-10-10 12:48:31 +0100 (Thu, 10 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Split the singleton and spanning read pair categories/scores into
uniquely and non-uniquely mapping sets.

------------------------------------------------------------------------
r3484 | jkbonfield | 2013-10-09 11:19:36 +0100 (Wed, 09 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Removal of debugging output.

------------------------------------------------------------------------
r3483 | jkbonfield | 2013-10-09 11:19:08 +0100 (Wed, 09 Oct 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Corrected check_overlap_pairs() to only count failed pairs in the
overlap region specified.

This isn't ideal, but at least it's the same count used for good
pairs, so it doesn't artificially think the worst about all joins.

Ideally we should switch to the pair analysis used in auto-break, on a
simulated joined up contig. (Or maybe just make the join in a child io,
evaluate it, and then destroy the io). 

------------------------------------------------------------------------
r3482 | jkbonfield | 2013-10-08 15:11:40 +0100 (Tue, 08 Oct 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_cache.c

Switch to allocating sequence record numbers at the time of finding
the last base in a sequence rather than the first base. This means we
can correct estimate the sequence of the SeqBlock. Also updated the
maximum SeqBlock size to 1Mb (was 250Kb).

Flush more often if the total number of bases added is high. This is
useful when dealing with technologies using very long sequence lengths
as it writes data more often (although it doesn't yet purge from the
cache, as that also needs knowledge of object size - TO DO).

------------------------------------------------------------------------
r3481 | jkbonfield | 2013-10-08 12:27:37 +0100 (Tue, 08 Oct 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

When exporting in SAM, don't just take any foo/bar to mean foo, but
explicitly check for foo/1 and foo/2 as they are the only forms where
we have historically meant "foo" and not foo/bar as a name.

This was tripping up on PacBio generated read names.

------------------------------------------------------------------------
r3480 | jkbonfield | 2013-10-07 15:21:34 +0100 (Mon, 07 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Changed default parameters to be less severe. These have been tuned
for a few specific datasets on known problems.

------------------------------------------------------------------------
r3479 | jkbonfield | 2013-10-07 15:20:58 +0100 (Mon, 07 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Bug fix to correct buffer underrun on clip_depth[]

------------------------------------------------------------------------
r3478 | jkbonfield | 2013-10-07 15:20:25 +0100 (Mon, 07 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Protect against potentially corrupted databases leading to crashes.

------------------------------------------------------------------------
r3477 | jkbonfield | 2013-10-04 17:11:07 +0100 (Fri, 04 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_library.c

Various fixes to prevent crashes when dealing with inconsistent data.

------------------------------------------------------------------------
r3476 | jkbonfield | 2013-10-04 17:10:48 +0100 (Fri, 04 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Exposed -end_skip param to command line interface too.

------------------------------------------------------------------------
r3475 | jkbonfield | 2013-10-04 17:09:40 +0100 (Fri, 04 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Added the option to skip problems near the ends of contigs, as these
are often poor quality.

------------------------------------------------------------------------
r3474 | jkbonfield | 2013-10-04 15:02:43 +0100 (Fri, 04 Oct 2013) | 24 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Many auto_break tidyups.

* Don't break on every negative issue. Instead look for lowest -ve
  issue within a short span and break that, under the assumption that
  the other neighbouring ones will get fixed in the process (we don't
  yet check this so it'd require a second pass).

* Searches for soft clipping errors where more than a certain
  percentage of reads are clipped at the same base position.

* Be more rigid in the dinucleotide repeat screening to try and speed
  up the program. It didn't add to much I think.

* Improved detection of library insertion size so that we don't count
  reads too distant from the problem as verifying or conflicting
  against a candidate break. This is particularly necessary when
  dealing with mixed libraries of differing sizes.

* (Debugging tool: gc() function to compute GC content over a given
  region. It was used in investigations of whether GC biases insertion
  size.)

* Gap merging now applies to contig end gaps too.

------------------------------------------------------------------------
r3473 | jkbonfield | 2013-09-27 15:59:25 +0100 (Fri, 27 Sep 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/g-alloc.c

Added some debugging code, now #ifdefed out, to time how long the
heap_allocate function takes and how many iterations looking for
blocks.

The intention is to bail out after a fixed number of iterations incase
of pathologically bad conditions.

Also bumped up the assertion size in the (debug) heap checker as we
were hitting it on real data.

------------------------------------------------------------------------
r3472 | jkbonfield | 2013-09-27 15:57:12 +0100 (Fri, 27 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Delete Contigs now flushes per contig. This seems excessive, but it
reduces the memory usage of the B+Tree name index (at the expense of
slowing things down as we may rewrite the same nodes).

[This was causing Delete Contigs on HAEM to use 32Gb of memory up.]

------------------------------------------------------------------------
r3471 | jkbonfield | 2013-09-27 15:56:08 +0100 (Fri, 27 Sep 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c

Fixed a reference count leak in the B+Tree code.

Also modified the TEST_MAIN debugging code to check for reference
counting errors.

------------------------------------------------------------------------
r3469 | jkbonfield | 2013-09-23 10:03:42 +0100 (Mon, 23 Sep 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/depth_track.c

Removed the -5 adjustment from Y position depth tracks.

I'm not sure why it was there and it made the plot incorrect, implying
we don't hit zero when we do.

------------------------------------------------------------------------
r3465 | jkbonfield | 2013-09-19 13:39:49 +0100 (Thu, 19 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Updated auto_break.

It now has more categories of read pair, breaking them down into ones
with uniquely mapping reads and non-unique. There is now also the
option to detect conesnsus repeat words and filter by them.

------------------------------------------------------------------------
r3464 | jkbonfield | 2013-09-16 12:14:38 +0100 (Mon, 16 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/depth_track.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/template_display.c

The average template insert size is now drawn superimposed on top of
the template display.

------------------------------------------------------------------------
r3463 | jkbonfield | 2013-09-16 10:29:13 +0100 (Mon, 16 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap4/GTAGDB
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Minor tweaks to auto-break; adding the correct tag type and an option
to prevent breakage (just tagging).

------------------------------------------------------------------------
r3462 | jkbonfield | 2013-09-16 10:24:24 +0100 (Mon, 16 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed Import Reads to work with the newer bttmp_sort_t structures. (It
was crashing before.)

------------------------------------------------------------------------
r3459 | jkbonfield | 2013-09-11 12:21:37 +0100 (Wed, 11 Sep 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Tags are now addwed to the contigs prior to breaking.

------------------------------------------------------------------------
r3458 | jkbonfield | 2013-09-11 11:55:53 +0100 (Wed, 11 Sep 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Break contig now duplicates consensus tags when they overlap both the
left and right contig. This was the gap4 behaviour and also what we
need for auto_break.

------------------------------------------------------------------------
r3457 | jkbonfield | 2013-09-11 10:10:00 +0100 (Wed, 11 Sep 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added run_cons_command function. It's unused in the existing code, but
allows for local invocation from gap5rc.local menus. Eg to run Dotter
on an underlined section of the sequence.

------------------------------------------------------------------------
r3456 | jkbonfield | 2013-09-11 10:08:53 +0100 (Wed, 11 Sep 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c

Improved error checking in anno_ele_add()

------------------------------------------------------------------------
r3455 | jkbonfield | 2013-09-11 10:08:16 +0100 (Wed, 11 Sep 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index_common.c

Call contig_visible_start/end after importing each contig so it can
correct for any mistakes in the SAM file where annotations overlap the
visible end of the contig. This helps to make gap5->sam->gap5 round
trips a better auto-fix mechanism.

------------------------------------------------------------------------
r3454 | jkbonfield | 2013-09-09 11:38:01 +0100 (Mon, 09 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/map_reads.tcl

Type of bam vs bwa.
See https://sourceforge.net/p/staden/patches/10/

------------------------------------------------------------------------
r3451 | jkbonfield | 2013-09-06 17:04:27 +0100 (Fri, 06 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/depth_track.c
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/template_display.c

The template display can now filter by libraries.

Also a lot of the template display options now come from the gap5rc
file.  There is still more to be done here though, such as allowing
the startup list of tracks.

------------------------------------------------------------------------
r3450 | jkbonfield | 2013-09-06 17:02:56 +0100 (Fri, 06 Sep 2013) | 2 lines
Changed paths:
   D /staden/trunk/src/gap5/template_display.tcl

Removed defunct gap4 code.

------------------------------------------------------------------------
r3449 | daviesrob | 2013-09-06 11:28:47 +0100 (Fri, 06 Sep 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c

Fix double free if the database doesn't exist.

find_db_files passed values back in *fndb and *fnaux even if it failed, and
had therefore called free on them.  This cause a segfault when an invalid
database name was given on the command line.  Now it only sets them if it
succeeds.

------------------------------------------------------------------------
r3448 | daviesrob | 2013-09-05 12:26:32 +0100 (Thu, 05 Sep 2013) | 19 lines
Changed paths:
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/g-files.c
   M /staden/trunk/src/gap5/g-files.h
   M /staden/trunk/src/gap5/g-struct.c
   M /staden/trunk/src/gap5/g-struct.h
   M /staden/trunk/src/gap5/tg_gio.c

Fix bug where g_check_header used the wrong .aux filename.

g_check_header constructed the wrong name for the .g5x file when the
database name was given with a suffix on the command-line.  This caused it
to incorrectly complain about the database being renamed, and (due to it not
stopping then and checking for the wrong value from gfile->low_level_vector)
also that the timestamp had changed.

g_open_file now stores the actual aux file name in the GFile struct, so
g_check_header can use it later.  g_check_header now calls panic_shutdown()
immediately on failure, and also checks for the right return value from
gfile->low_level_vector.

Took the opportunity to remove various fixed-size buffers when dealing with
filenames, especially in find_db_files and actf_lock.

Fixed an invalid read in open_log_file when log files are enabled and the
database name is very short.

------------------------------------------------------------------------
r3447 | jkbonfield | 2013-09-05 12:20:37 +0100 (Thu, 05 Sep 2013) | 17 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Split the unknown score into (sligtly too) large and (contig) spanning
scores.

Tweaks to the auto-break parameters:
    - Increased MIN_OVERLAP
    - Valid read pairs need to span the region by at least MIN_OVERLAP
      rather than just 1 bp. We may wish to improve this further by more
      than that amount; eg based on library insert size.
    - Read mapping quality is taken into account for the good score.
      Low mapping still counts, but at about 1/3rd benefit.

Added some currently unusued code for dump_template_dist(). This is an
experiment to see whether sampling the insert size distribution at a
specific consensus base is accurate enough to predict small indels. [It
seems yes, if small is >20bp or so.]


------------------------------------------------------------------------
r3446 | jkbonfield | 2013-09-05 12:15:12 +0100 (Thu, 05 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Added a CITER_PAIR option to the contig iterators to call the
read-pairing code to update COMP1/2 flags. This isn't perfect as it's
done in blocks, but for the reads that get their pairs recomputed the
timestamp is updated meaning code that explicitly calls
sequence_get_range_pair_position will now be far faster.

------------------------------------------------------------------------
r3445 | jkbonfield | 2013-09-05 12:13:51 +0100 (Thu, 05 Sep 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

sequence_get_range_pair_position() now also updates
GRANGE_FLAG_COMP[12] flags for this range (but not the pair) if the
contig is known.

------------------------------------------------------------------------
r3444 | jkbonfield | 2013-09-05 12:12:29 +0100 (Thu, 05 Sep 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/seq_utils/filter_words.c

Fix to the various filter functions. Previously they struck out up to
the maximum score whenever the running total crossed zero, but that
means a match like ...==========.....=====.. would only strike out the
first match as the bit between the two isn't enough to reduce the
score to zero while the aggregate score still isn't higher than the
peak score after the first match.

It now resets the score to -1 (and strikes out the previous match if
appropriate) whenever the drop is higher than the minimum score for a match.

------------------------------------------------------------------------
r3443 | daviesrob | 2013-08-16 12:18:18 +0100 (Fri, 16 Aug 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full

Make selecting highlight disagreements mode also turn it on.

Saves having to open the menu twice - once to turn H.D. on, and again to
select the mode.

------------------------------------------------------------------------
r3442 | daviesrob | 2013-08-15 11:05:00 +0100 (Thu, 15 Aug 2013) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Fixed reference count on libraries in auto break.

compute_lib_type was not calling cache_incr on the library_t pointers
that it stored in a hash table.  This meant the pointers could go stale
if the library information later got pushed out of the cache, leading to
a segmentation fault.

compute_lib_type now calls cache_incr on the library_t pointer to prevent this.
confirm_gaps calls cache_decr on all of the items in the hash table when it
has finished with them.


------------------------------------------------------------------------
r3441 | jkbonfield | 2013-08-09 16:41:31 +0100 (Fri, 09 Aug 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

More auto-break updates.
- Weightings for scores are now adjustable external and are gap5_cmd
  parameters.
- Tweaks to default scores
- Allow for a minimum score (so not just 0).

Also updated sequence_get_range_pair_position() to take extra argument
indicating the contigs to check timestamps on. This is useful if we
know both ends for the pair already.

------------------------------------------------------------------------
r3440 | jkbonfield | 2013-08-09 12:22:21 +0100 (Fri, 09 Aug 2013) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

More rigorous calculation of invalid read-pairs.

We ensure contig-spanning pairs have an sequence pointing towards the
problem rather than away from it, and also that it's not close to the
contig end and pointing off it as it may then be a real join.

Singletons for reads from paired end libraries now also get their own
scoring category (currently set to 0 while I test they're worth).

------------------------------------------------------------------------
r3436 | jkbonfield | 2013-08-07 12:16:56 +0100 (Wed, 07 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Removal of debugging output.

------------------------------------------------------------------------
r3435 | jkbonfield | 2013-08-07 11:59:20 +0100 (Wed, 07 Aug 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Fixed the calculation of insert size for swapped fwd/rev pairs:
rev-->   <--fwd.

Also adjusted the min/max to be 3*sd instead of 2*sd.

------------------------------------------------------------------------
r3434 | jkbonfield | 2013-08-07 11:24:50 +0100 (Wed, 07 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/ChangeLog
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/ReleaseNotes

Collated changes since the last official release.

------------------------------------------------------------------------
r3433 | jkbonfield | 2013-08-06 11:19:32 +0100 (Tue, 06 Aug 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_struct.h

Deleted contigs now get flagged specifically as DELETED. Calling
cache_search on a deleted contig now returns NULL.

This fixes crashes where people could delete a contig and then attempt
to edit the contig via the old #record_number.

------------------------------------------------------------------------
r3432 | jkbonfield | 2013-08-06 10:17:36 +0100 (Tue, 06 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Fix minor printf formatting error.

------------------------------------------------------------------------
r3431 | jkbonfield | 2013-08-06 10:15:48 +0100 (Tue, 06 Aug 2013) | 2 lines
Changed paths:
   A /staden/trunk/src/gap5/auto_break.c
   A /staden/trunk/src/gap5/auto_break.h

Adding auto_break code itself (forgot to svn add it).

------------------------------------------------------------------------
r3430 | jkbonfield | 2013-08-06 10:08:57 +0100 (Tue, 06 Aug 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Implemented auto_break command for gap5_cmd. This is similar to Gap4's
auto-splitter, but primarily uses mapping qualities over word
uniqueness analysis (although it still contains low complexity
checking).

It identifies suspicious joins and then verifies them via read pairs.

------------------------------------------------------------------------
r3429 | jkbonfield | 2013-08-06 10:01:55 +0100 (Tue, 06 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/seq_utils/dna_utils.c
   M /staden/trunk/src/seq_utils/dna_utils.h
   M /staden/trunk/src/seq_utils/filter_words.c
   M /staden/trunk/src/seq_utils/filter_words.h

Optimised ambiguity2basebit and filter_words_local functions.

------------------------------------------------------------------------
r3428 | jkbonfield | 2013-08-01 17:49:08 +0100 (Thu, 01 Aug 2013) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c
   M /staden/trunk/src/gap5/g-request.c

Improved on the g_check_header() and related functions.

This attempts to spot when the global .g5x aux timestamp changes under
the feet of the current process, indicating that someone was naughty
and either removed the BUSY file to open up a second r/w gap5 or
copied another database version over the top of our own one.

Unfortunately due to filesystem caching it was too slow to spot a lot
of errors. We now use a new filedescriptor each time to do the disk vs
memory comparison and we also explicitly call fsync after updating
this to ensure the time is flushed out.

------------------------------------------------------------------------
r3427 | daviesrob | 2013-07-30 14:31:45 +0100 (Tue, 30 Jul 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Ensure min_match is always at least word_length in init_hash8n.  Prevents a segfault in reps_nocount.
------------------------------------------------------------------------
r3426 | awhitwham | 2013-07-29 10:26:53 +0100 (Mon, 29 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h

Now able to control where tmp files go using either TMP_DIR or TEMP
environment variables.  Also changed the sorting routine for the name
index so it does not use the standard unix sort.  This is an interim
release as there is too much code duplication in the sorting
functions.

------------------------------------------------------------------------
r3424 | jkbonfield | 2013-07-18 17:53:37 +0100 (Thu, 18 Jul 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Updated FIJ calculation of percentage good read-pairs.

It was only counting the number of read-pairs between contig A and B
(for efficiency), but we needed to know the number of read-pairs
between contigs A+B and any other contig. We now also compute this
when necessary.

------------------------------------------------------------------------
r3423 | jkbonfield | 2013-07-18 17:51:35 +0100 (Thu, 18 Jul 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Be more aggressive in the clearing of r->pair_contig if the timestamp
is invalid.

We were seeing strange effects when data has been joined into the same
contig.

------------------------------------------------------------------------
r3422 | daviesrob | 2013-07-12 12:24:20 +0100 (Fri, 12 Jul 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/import_contigs.tcl

Set repad to 0 if not merging contigs, and ensure the names are indexed
------------------------------------------------------------------------
r3417 | jkbonfield | 2013-07-05 12:22:17 +0100 (Fri, 05 Jul 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/utils.tcl

Added a mechanism to swallow auto-repeat generated keypresses (under
Unix X11 only) where the program is lagging and failing to keep up.  
This is utilised in the contig editor.


------------------------------------------------------------------------
r3416 | jkbonfield | 2013-07-05 12:20:45 +0100 (Fri, 05 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c

Add "#number name" to seq_hits instead of "name", as name may not be unique.

------------------------------------------------------------------------
r3415 | jkbonfield | 2013-07-05 12:16:09 +0100 (Fri, 05 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Code layout tidyness.

------------------------------------------------------------------------
r3414 | jkbonfield | 2013-07-04 17:19:43 +0100 (Thu, 04 Jul 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Try to fix cases of lost focus, where the user clicking in the
toplevel window grants focus to the toplevel window (eg .e1) but we
require it to be given to the internal sheet component.

------------------------------------------------------------------------
r3413 | jkbonfield | 2013-07-04 17:14:21 +0100 (Thu, 04 Jul 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Fixed a bug where trying to bring up a second FIJ window when one
already existed was clearing the $w.ops() states.

------------------------------------------------------------------------
r3412 | jkbonfield | 2013-07-04 12:26:01 +0100 (Thu, 04 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/seq_utils/dna_utils.c

Added the length to the alignment pretty-printer.

------------------------------------------------------------------------
r3411 | jkbonfield | 2013-07-04 12:17:06 +0100 (Thu, 04 Jul 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Changed keybindings for tab traversal as straight arrow keys prevents
editing within entry fields.

------------------------------------------------------------------------
r3410 | jkbonfield | 2013-07-04 12:07:23 +0100 (Thu, 04 Jul 2013) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Fixed issues with the FIJ GUI:

- The cancel button now correctly destroys the window.

- Selecting libraries works again.

- Updating the contig identifier by clicking in the contig list or
  contig selector no longer errors. (In some cases it still only
  updates 1 of the 2 Ids, which I am still investigating.)



------------------------------------------------------------------------
r3409 | jkbonfield | 2013-07-02 16:55:22 +0100 (Tue, 02 Jul 2013) | 15 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5rc

Minor tweaks to new FIJ:

- %age mismatch is back to 30 by default as users suggested that they
  like the high default as it allows spotting joins that were missed
  due to misassembly errors (requiring manual editing before making of
  course).

- The FIJ parameters are now listed at the start of FIJ rather than
  the end, meaning the end line still contains the summary of number
  of joins found.

- Fixed a bug where the last edited parameters were being used as the
  defaults for the next FIJ window.


------------------------------------------------------------------------
r3408 | jkbonfield | 2013-07-02 14:57:29 +0100 (Tue, 02 Jul 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/readpair.c

Added min/max (joined) depth, max overlap length, containment vs end,
minimum valid read-pair percentage and unique-ends filters to Find
Internal Joins.

Also updated the gap5_cmd tool and reorganised the FIJ GUI to be
smaller, using a tabbed notebook.

------------------------------------------------------------------------
r3407 | jkbonfield | 2013-07-02 14:55:17 +0100 (Tue, 02 Jul 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/restriction_enzymes.c

Removed the use of io_clnbr() in various plots. These just caused the
"Information" query to take excessively long while gaining nothing
important.

------------------------------------------------------------------------
r3404 | jkbonfield | 2013-06-26 12:24:22 +0100 (Wed, 26 Jun 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a bug with uninitialised memory in unlink_read. It sometimes
failed when it should have succeeded, but didn't corrupt data.

The error seen by the user was "failure to unlink sequence #"...

------------------------------------------------------------------------
r3393 | jkbonfield | 2013-06-24 09:39:44 +0100 (Mon, 24 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c

Flush auto-join joins every contig rather than only at the end.

------------------------------------------------------------------------
r3385 | jkbonfield | 2013-06-20 11:17:31 +0100 (Thu, 20 Jun 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed a cache ref count bug in consensus code, when faced with
inconsistent consensus records.

Added further checks for inconsistent cached consensus sequences, now
checking that range length matches seq length. I do not know why this
differs at times, but this works around such data corruptions.

------------------------------------------------------------------------
r3384 | daviesrob | 2013-06-19 15:30:38 +0100 (Wed, 19 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Clear the selection in edview_renumber if it is the contig id that is changing.

------------------------------------------------------------------------
r3382 | awhitwham | 2013-06-19 15:25:18 +0100 (Wed, 19 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Set panedwindow opaqueresize to resolve the different defaults between Tk 8.4 and 8.5.  Removed the proxy sync_panes code as it is no longer needed.

------------------------------------------------------------------------
r3373 | daviesrob | 2013-06-13 17:17:17 +0100 (Thu, 13 Jun 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_join.h
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/find_repeats.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.h
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_sequence.h

Fixed compiler warnings and bug in cache_item_remove.

Sorted several compiler warnings, mainly due to missing prototypes.
Fixed bug in cache_item_remove where it attempted to cache_rw the wrong
pointer for GT_Scaffold objects.


------------------------------------------------------------------------
r3371 | daviesrob | 2013-06-13 15:07:04 +0100 (Thu, 13 Jun 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed reference count leak in sequence_get_clipped_position
------------------------------------------------------------------------
r3370 | jkbonfield | 2013-06-13 15:00:48 +0100 (Thu, 13 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.tcl

Removed object reference count leak in PopUpCSContigMenu().

------------------------------------------------------------------------
r3365 | jkbonfield | 2013-06-10 16:24:14 +0100 (Mon, 10 Jun 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl

Also fixed the contig names output from get_consensus to use
[$c get_name] instead of the original identifier (which is possibly
a reading name of #number).

------------------------------------------------------------------------
r3364 | jkbonfield | 2013-06-10 11:13:18 +0100 (Mon, 10 Jun 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl

get_consensus no longer outputs the same contig multiple times if it
is specified by a reading list with multiple seqs per contig.

------------------------------------------------------------------------
r3363 | jkbonfield | 2013-06-03 16:50:05 +0100 (Mon, 03 Jun 2013) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/g-request.c

Observed a database corruption where the same record had been freed
twice in a row, forming a tight loop in the free list.
This then subsequently causes the same record to be allocated twice in
a row, causing mayhem.

This workaround is in two parts.

1) g_free_rec_ (which returns a free record, not frees it) now checks
for the tight loop and corrects the free list if it finds this case,
returning G_NO_REC too (ie create a new record as none are free).

2) g_unlock_views with a view of flag G_VIEW_DELETED now does an
assertion for attempting to delete it twice in a row. I've no idea
where this happens, but if it happens again then the assert should
help to pinpoint where.

------------------------------------------------------------------------
r3361 | jkbonfield | 2013-05-31 11:35:53 +0100 (Fri, 31 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/pregap4/Makefile
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/trev/Makefile

Bug fixes to "make distsrc".

------------------------------------------------------------------------
r3360 | jkbonfield | 2013-05-31 11:24:28 +0100 (Fri, 31 May 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/Makefile.in
   M /staden/trunk/src/gap4/tkAppInit.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/tkAppInit.c
   M /staden/trunk/src/prefinish/tkMain.c
   M /staden/trunk/src/spin2/tkAppInit.c
   A /staden/trunk/src/tcl-license.terms
   M /staden/trunk/src/tk_utils/html_library.tcl
   M /staden/trunk/src/tk_utils/tclAppInit.c

Added copy of the Tcl license.terms file, to comply with their
licencing policy.

------------------------------------------------------------------------
r3359 | jkbonfield | 2013-05-31 11:16:29 +0100 (Fri, 31 May 2013) | 2 lines
Changed paths:
   D /staden/trunk/LICENCE.txt
   A /staden/trunk/src/LICENCE.txt (from /staden/trunk/LICENCE.txt:3358)

Moved to source tree so it can be including in "make dist"

------------------------------------------------------------------------
r3358 | jkbonfield | 2013-05-31 11:16:11 +0100 (Fri, 31 May 2013) | 2 lines
Changed paths:
   D /staden/trunk/LICENCE.rtf
   A /staden/trunk/src/LICENCE.rtf (from /staden/trunk/LICENCE.rtf:3357)

Moved to source tree so it can be including in "make dist"

------------------------------------------------------------------------
r3348 | jkbonfield | 2013-05-28 17:46:03 +0100 (Tue, 28 May 2013) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/check_assembly.h
   M /staden/trunk/src/gap5/check_assembly.tcl
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_oligo.h
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/find_repeats.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.tcl
   M /staden/trunk/src/gap5/result_manager.tcl
   M /staden/trunk/src/gap5/tk-io-reg.c

Added the ability to split apart Contig Comparator plot generation
from the actual plotting. This works for Find Internal Joins, Find
Repeats, Find Oligos (Sequence Search), Find Read Pairs and Check
Assembly.

Plots can now also be saved and loaded from the comparator window.

Combined this means we can also generate plots off-line, although they
become out of date very quickly - on the first contig edit. The
gap5_cmd script has an interface to these 5 plotting methods.

------------------------------------------------------------------------
r3347 | jkbonfield | 2013-05-24 15:11:03 +0100 (Fri, 24 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5rc

Added CRAM to the list of export formats.

When writing to cram it also writes a consensus fasta and fasta.fai
file to use as the reference, although it embeds this in the CRAM file
so it does not need to be preserved.

------------------------------------------------------------------------
r3342 | jkbonfield | 2013-05-22 14:50:26 +0100 (Wed, 22 May 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c

Bug fix to updating join overlap regions for previously joined
contigs.

Also added some belt and braces code after this to double check for
possible local alignments, forcing them to be global alignments
instead, just incase we still have lurking bugs in the overlap
computation.

------------------------------------------------------------------------
r3341 | jkbonfield | 2013-05-22 14:18:59 +0100 (Wed, 22 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap4/GTAGDB
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/fij.c

Fixed setting the OBJ_FLAG_JOINED to mark contigs involved in
joins.  It was only detecting one of the two contigs.

Auto-join now creates a JOIN tag to mark the region spanning automatic
joins.

------------------------------------------------------------------------
r3340 | jkbonfield | 2013-05-22 12:27:36 +0100 (Wed, 22 May 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_index.h
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/sam_pileup.h
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index_common.c

Switched from bam_open function to scram_open and ancillary
methods. This means we can now read CRAM too.

Also fixed a bug in PT/CT handling of multiple tags. It was missing
the first character on 2nd tag onwards due to the str++ but - this is
now outside the function rather than inside and per-tag.

------------------------------------------------------------------------
r3335 | jkbonfield | 2013-05-21 14:43:48 +0100 (Tue, 21 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/gap5/Makefile
   D /staden/trunk/src/gap5/gap5_check.in
   D /staden/trunk/src/gap5/gap5_check.tcl
   A /staden/trunk/src/gap5/gap5_cmd.in
   A /staden/trunk/src/gap5/gap5_cmd.tcl
   D /staden/trunk/src/gap5/gap5_command.tcl
   D /staden/trunk/src/gap5/gap5_consensus.in
   D /staden/trunk/src/gap5/gap5_consensus.tcl
   D /staden/trunk/src/gap5/gap5_export.in
   D /staden/trunk/src/gap5/gap5_export.tcl
   D /staden/trunk/src/gap5/gap5_shuffle_pads.in
   D /staden/trunk/src/gap5/gap5_shuffle_pads.tcl
   M /staden/trunk/src/staden_config.h.in

Replaced the gap5_{export,shuffle_pads,check,consensus} with a
generic gap5_cmd tool (this replaces the previous and unfinished
gap5_command program).

Also included in gap5_cmd is the interface to auto_join.

------------------------------------------------------------------------
r3334 | jkbonfield | 2013-05-20 17:26:43 +0100 (Mon, 20 May 2013) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.h
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_join.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_oligo.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/gap5/tg_register.h
   M /staden/trunk/src/gap5/tk-io-reg.c

Updated the FIJ and Find Oligos (more to come) to be split into
searching and plotting methods at the scripting level. The search
function now returns a registration ID and we then send a method to
this to plot (task TASK_CS_PLOT).

Experimented with task TASK_CS_SAVE (but no load implemented yet).

Added TASK_CS_AUTO_JOIN. This is the bulk of this commit.  It runs the
join editor Align button code (now also split up into separate
algorithms to avoid needing the editor up) and if it finds a high
enough quality alignment it'll run the joining code.

The command line script to perform auto-join will follow.

------------------------------------------------------------------------
r3332 | jkbonfield | 2013-05-17 17:38:44 +0100 (Fri, 17 May 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Bug fix to tag shifting.

It wasn't correctly taking into account the s->left value in the
position.

It also wasn't allowing for entire reads to be shifting, also
requiring tags to shift.

------------------------------------------------------------------------
r3328 | jkbonfield | 2013-05-15 11:23:11 +0100 (Wed, 15 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/result_manager.tcl

Fixed display to show #ID instead of #0 (contig number).

------------------------------------------------------------------------
r3326 | daviesrob | 2013-05-13 15:23:44 +0100 (Mon, 13 May 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/import_contigs.tcl

Fixed New->From Imported File
------------------------------------------------------------------------
r3325 | daviesrob | 2013-05-13 13:51:39 +0100 (Mon, 13 May 2013) | 18 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/tk_utils/text_output.c

Reworked fasta/fastq import; map reads fixes.

Unified fasta and fastq reading code.  The new code works out which sort of
file is being read, so it's no longer necessary to specify the file type.
Improved error detection and handing of out of memory conditions.  Messages
are now output using vmessage/verror so they go to the gap5 GUI and not the
user's terminal.

Wrapped tcl calls to import_reads in catch blocks to stop the GUI from being
left in busy mode if the import fails.

Made MapReads_tidyup actually tidy up the temporary files.

Fixed bwa sampe map_reads so that it actually completes.

Made UpdateTextOutput flush stdout in text mode.


------------------------------------------------------------------------
r3324 | jkbonfield | 2013-05-13 13:46:50 +0100 (Mon, 13 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5.tcl

Added citation to startup text.

------------------------------------------------------------------------
r3323 | jkbonfield | 2013-05-13 12:11:48 +0100 (Mon, 13 May 2013) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/tg_contig.c

Without accurate mode on, the template display takes the pair
start/end values as gospel even with the timestamps indicate they are
out of date.

This is fine, but a couple fixes rationalise it further:

- Make sure we set timestamp in tg_contig so fewer are considerdd out
  of date. (This was just an omission.)

- When the read pair is in this same contig but beyond the contig
  extents due to Break Contig, it's obviously not correct. Mark these
  as spanning instead.

------------------------------------------------------------------------
r3322 | jkbonfield | 2013-05-13 11:47:47 +0100 (Mon, 13 May 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Removed rogue dependency, put there by accidentally running "make depend"
on a configuration using a local lzma dependency.

------------------------------------------------------------------------
r3320 | jkbonfield | 2013-05-10 14:35:05 +0100 (Fri, 10 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/g-alloc.c
   M /staden/trunk/src/gap5/gap-error.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_pileup.h
   M /staden/trunk/src/gap5/tg_gio.c

Various minor compilation warning fixes (ok and sam_pileup.h which I
forgot to add to the previous commit).

In the case of the error functions this removes potential crashes
if the error message contained percent-codes.

------------------------------------------------------------------------
r3319 | jkbonfield | 2013-05-10 14:28:54 +0100 (Fri, 10 May 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/os.h
   M /staden/trunk/src/gap5/Makefile
   D /staden/trunk/src/gap5/bam.c
   D /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c

Removed Gap5's own SAM/BAM reading code and made it use the latest
io_lib version.

------------------------------------------------------------------------
r3318 | jkbonfield | 2013-05-09 15:02:54 +0100 (Thu, 09 May 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Fixed an error causing FIJ to miss some joins consisting of only one
hash hit.

Also substantially modified the block-stitching heuristics. Typically
it's finding ~2% more joins now and generally at a better percentage
mismatch (averaging 4% better).


------------------------------------------------------------------------
r3317 | daviesrob | 2013-05-07 17:57:45 +0100 (Tue, 07 May 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Reverted accidental commit of tg_gio.c
------------------------------------------------------------------------
r3316 | daviesrob | 2013-05-07 17:55:41 +0100 (Tue, 07 May 2013) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/tg_gio.c

Find Repeats fixes - malloc error handling and incorrectly recorded matches.

Improved handling of out-of-memory conditions in repeat_search,
repeat_search_depadded and gap_realloc_matches.

Stopped match_fwd_back from running beyond the end of a sequence.  This could
lead to matches being allocated to the wrong contigs.

Removed call to remdup in reps_nocount.  The duplicates shouldn't be there
anyway, and it seemed to remove some reverse matches that were not duplicates.

Fixed off-by-one errors in find_repeats, caused by confusion between counting
positions from 1 and zero.  The new version appears to give the right answer.

------------------------------------------------------------------------
r3315 | jkbonfield | 2013-05-07 15:05:59 +0100 (Tue, 07 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c

This time testing it builds! Ooops

------------------------------------------------------------------------
r3314 | jkbonfield | 2013-05-07 14:27:12 +0100 (Tue, 07 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c

Speed up - no need to compute the total contig length twice.

------------------------------------------------------------------------
r3313 | jkbonfield | 2013-05-07 12:50:17 +0100 (Tue, 07 May 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/template_display.c

Bug fix to template display drawing, fixing a crash. Occasionally it
could attempt to draw in an unallocated colour, caused by zooming up
in Y and then selecting the uninitialised fwd/rev_col3.

------------------------------------------------------------------------
r3272 | daviesrob | 2013-04-12 14:27:59 +0100 (Fri, 12 Apr 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_register.c

Fixed iteration on wrong contig number in contig_register_join.

Iterator hit searches on cto, but the next search incorrectly used cfrom.
This could lead to hit returning entries for cfrom if cto and cfrom happened
to hash into the same bin.  If it did, they were incorrectly deleted which
could lead to a crash later on in contig_reg_remove when it tries to
access the deleted item.  Changing HacheTableNext to use cto fixes this.

------------------------------------------------------------------------
r3271 | jkbonfield | 2013-04-11 14:46:25 +0100 (Thu, 11 Apr 2013) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Bug fix to r3240 which added contig_insert_bases() function to perform
multi-base insertions. This was used by shuffle pads and join editor
align button.

MAJOR ERROR: It produced alignment errors downstream where the next
bin started as that was still ch->pos++ instead of ch->pos += nbases.

Also tidied up the logic surrounding reference base coordinates,
although less of a major issue. I'm still not 100% certain refpos
updates are correct though.

------------------------------------------------------------------------
r3267 | daviesrob | 2013-04-10 11:24:19 +0100 (Wed, 10 Apr 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c

Speed up OBJ_GET_BRIEF by showing contig numbers instead of leftmost read
------------------------------------------------------------------------
r3266 | daviesrob | 2013-04-09 09:39:07 +0100 (Tue, 09 Apr 2013) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEditor.c

Fixed cache look-up of edview structs.

edview_hash now allows duplicate keys so that it can handle the same contig
being open in multiple views.  edview_destroy has been updated so that it
searches for the correct edview struct when removing items.

Added edview_renumber, which changes the contig record number associated
with an editor (e.g. when joining).  It also updates edview_hash so
that the edview struct is refiled under the new record number.  This fixes
a crash caused by an old edview	being used after a join as it wasn't cleaned
up correctly.

Simplified edview_find.  It can only return one edview pointer, so it returns
the first one it finds for the contig record number.  This is likely to be
the last one that was opened.

------------------------------------------------------------------------
r3240 | jkbonfield | 2013-03-25 16:25:28 +0000 (Mon, 25 Mar 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h

Added contig_insert_bases() and sequence_insert_bases() functions to
insert multiple bases of the same base/conf. Practically speaking that
just means runs of pads, however it sometimes has a major speed
improvement to the join editor and possibly shuffle pads.

------------------------------------------------------------------------
r3231 | daviesrob | 2013-03-21 12:03:02 +0000 (Thu, 21 Mar 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed handling of JOIN_TO registration events.

Calls io_detach for the old contig number.
Properly sets opt(io), opt(io2), opt(contig), opt(contig2) depending on
which contig(s) have been joined.

------------------------------------------------------------------------
r3210 | daviesrob | 2013-03-19 09:28:36 +0000 (Tue, 19 Mar 2013) | 33 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl

Clean up windows when closing the database; various list editor improvements.

Stop Gap_Open from trying to exit if the user presses cancel when asked to
save contig changes.

Clean up old windows when closing the database.  This prevents crashes
caused by stale $io references in the old windows.

Raise the contig editor window before asking if changes should be saved.
Reduces the chance of the save changes dialogue from being obscured by
other windows.  Also makes it easier to see which contig editor is being
referred to.

List editor windows are now tracked using an array variable instead of
by creating unmapped child windows of the main window.  List editor toplevel
windows are now direct children of the main window, which allows the window
clean-up code to find them more easily.

Only bring up the extended reads list view for lists that have the appropriate
magic enabled.  Normal lists, along with the contigs and allcontigs lists,
get the standard list editor instead.

Prevent the pop-up menu from appearing in the extended read list view if the
user right clicks on an entry that is not a valid read identifier.

When outputting to another list from the extended reads list, properly filter
out entries that are not valid reads.

Fixed a couple of contig reference leaks in list_proc.tcl

Try to speed up saving long read lists when closing the list editor.


------------------------------------------------------------------------
r3197 | daviesrob | 2013-03-12 15:12:14 +0000 (Tue, 12 Mar 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/import_gff.tcl

Added more logging.

Log calls to import_gff, and edJoinAlign.  edJoinAlign logging includes the
positions of the two contig editor windows.

------------------------------------------------------------------------
r3196 | daviesrob | 2013-03-12 15:09:19 +0000 (Tue, 12 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Set r.y in save_range_sequence
------------------------------------------------------------------------
r3194 | jkbonfield | 2013-03-11 11:18:41 +0000 (Mon, 11 Mar 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Fixed a memory error where I accessed a pointer immediately after
freeing it in cache_flush().

------------------------------------------------------------------------
r3193 | daviesrob | 2013-03-11 10:08:33 +0000 (Mon, 11 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl

Enable menus after loading single reads from a fasta file.
------------------------------------------------------------------------
r3190 | daviesrob | 2013-03-08 11:30:44 +0000 (Fri, 08 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Remove .g5d/.g5x suffix when making log file name
------------------------------------------------------------------------
r3189 | daviesrob | 2013-03-07 17:15:10 +0000 (Thu, 07 Mar 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/select_contig.tcl

Stop UpdateContigLimits from complaining about an empty entrybox.

Makes deleting whatever is there and then going to find something to paste
in much less annoying.

------------------------------------------------------------------------
r3188 | daviesrob | 2013-03-07 14:19:42 +0000 (Thu, 07 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_extend.tcl

Added SetBusy/ClearBusy around contig_extend
------------------------------------------------------------------------
r3187 | daviesrob | 2013-03-07 14:13:07 +0000 (Thu, 07 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/select_contig.tcl

Improved handling of invalid contig/read record numbers entered by the user
------------------------------------------------------------------------
r3186 | daviesrob | 2013-03-07 11:39:18 +0000 (Thu, 07 Mar 2013) | 31 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl
   M /staden/trunk/src/gap5/break_contig.tcl
   M /staden/trunk/src/gap5/check_assembly.tcl
   M /staden/trunk/src/gap5/check_database.tcl
   M /staden/trunk/src/gap5/complement.tcl
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/contig_extend.tcl
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/find_oligo.tcl
   M /staden/trunk/src/gap5/find_repeats.tcl
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap_cli_arg.c
   M /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/shuffle_pads.tcl
   M /staden/trunk/src/gap5/tag_checklist.tcl
   M /staden/trunk/src/gap5/tag_editor.tcl
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/text_utils/text_output.h
   M /staden/trunk/src/text_utils/text_output_stubs.c
   M /staden/trunk/src/tk_utils/text_output.c
   M /staden/trunk/src/tk_utils/text_output.h

Added logging and improved list handling.

Added code to create .log files, in a similar manner to gap4.  Currently
disabled, but can be turned on by uncommenting #define DO_LOGGING in
tg_gio.c.

Improved logging code in tk_utils/text_output.c, including adding new
tcl interfaces log_str, log_call and log_vmessage.  log_str writes its
parameters to the log file.  log_call does the same, but then calls
Tcl_EvalObjv on the parameter list.  This allows tcl function calls to be
logged by simply putting 'log_call' in front of them. log_vmessage is
a tcl interface to the C log_vmessage function.  It controls whether
messages written to the gap5 message window are also written to the log file.
log_vmessage now returns the previous setting.

Put logging statements everywhere so pretty much anything the user does
that changes the database gets recorded when logging is enabled.

Made some improvements to handling of unusual contig names.  Gave up on
ones with spaces in, and just prevented the contig rename dialogues from
allowing you to put a space in a contig name.  They are not allowed in most
other formats anyway.

Simplified lget_contig_num_base.  It now uses tcl list handling functions
and removes duplicates while building the list instead of filtering them
out later.

The extended reads list now checks that the items in the list really are
reads.  Stops get_sequence from throwing an error if the user tries to
get an extended view of the contig list.

------------------------------------------------------------------------
r3183 | daviesrob | 2013-03-05 17:36:26 +0000 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed crash in shuffle pads caused by out-of-bounds read clip points
------------------------------------------------------------------------
r3157 | daviesrob | 2013-02-21 09:42:47 +0000 (Thu, 21 Feb 2013) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   A /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/tclIndex

Added user interface to import_reads and to make an empty database.

Added menu items and interfaces to allow users to import reads without
having to use tg_index.  Also allow them to create an empty database.

Fixed bitmap values for the main menus so that items are enabled and disabled
correctly as the state changes from started to database open but empty to
open with data in it.

Prevented divide by zero in DatabaseInfo when run on an empty database.

------------------------------------------------------------------------
r3152 | daviesrob | 2013-02-19 15:04:54 +0000 (Tue, 19 Feb 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed attempt to remove GT_AnnoEle range records twice.

GT_AnnoEle were being removed by bin_remove_item, and then again by
anno_ele_destroy.  The latter couldn't find them, so returned an error code
which caused delete_tag_single_contig to stop after only removing one tag.
Fixed by declaring anno_ele_destroy obsolete and not calling it any more.

------------------------------------------------------------------------
r3149 | daviesrob | 2013-02-14 15:36:21 +0000 (Thu, 14 Feb 2013) | 37 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_scaffold.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_view.c
   M /staden/trunk/src/gap5/tk-io-reg.c
   M /staden/trunk/src/gap5/tkAppInit.c
   M /staden/trunk/src/gap5/tkEdNames.c
   M /staden/trunk/src/gap5/zfio.c

Fix compiler warnings and few bugs.

Fixes for lots of compiler warnings, make compilation with -Wall much less
chatty.  Also fix some bugs that were flagged up by the warnings.

The changes to remove warnings are:
  * Added missing include files and prototypes.
  * Fixed lots of signed / unsigned issues, especially for char types.
  * Ensure indexes into look-up tables are unsigned
  * Removed redundant variables.
  * Assignments used as truth values.

A notable change is that confidence values are now type int8_t instead
of char.  They need to be signed as log-odds scores can be negative.

The other fixes are:

caf.c            - removed use of isblank (requires C99)

consensus.c      - misplaced bracket in get_uniqueness.

export_contigs.c - in sam_depadded_cigar, fix use of & instead of &&

newgap5_cmds.c   - In tcl_reformat_sequence, set default max cut-off to 127.
                   This is consistent with using signed confidence values.

tg_anno.c        - delete_tag_single_contig no longer tries to carry on in
                   the fact of errors.

tg_tcl.c         - Wrong parameter index used for l.score in ADD_LINK case of
                   contig_cmd
                 - sequence_cmd cases GET_CONF and GET_CONF4 now return
                   a ByteArrayObj instead of a StringObj.  This stops Tcl
                   from trying to interpret negative confidence values as
                   UTF-8 characters.


------------------------------------------------------------------------
r3146 | daviesrob | 2013-02-13 17:21:08 +0000 (Wed, 13 Feb 2013) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c

Fixes for bugs in map_reads, import_reads and calculate_consensus_bit_het.

Fix various bugs:

 Attempt to read a closed filehandle in MapReads_run (map_reads.tcl).

 Not setting link_pairs parameter in tcl_import_reads (newgap5_cmds.c).

 Failure to resize s->pad in sam_add_seq, leading to a buffer overflow if
 enough pads get added (sam_index.c).

 Reading past the end of a sequence in calculate_consensus_bit_het if the
 right clip point is past the end.  This shouldn't happen, but databases do
 exist with clipping broken in this way.


------------------------------------------------------------------------
r3135 | daviesrob | 2013-02-08 12:35:20 +0000 (Fri, 08 Feb 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Put in work-around for crash due to edGetSelection being called with a
massive value for offset.  Not sure what the root cause is at the
moment, it needs more investigation.
------------------------------------------------------------------------
r3118 | daviesrob | 2013-02-01 14:42:34 +0000 (Fri, 01 Feb 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Disable rounding up of bin sizes in extend_root_bin

Rounding up the new bin size to a power of 2 gives a more balanced tree
structure.  Unfortunately it also leads to the bins growing in size very
rapidly under certain conditions during long sequences of joins.  In view
of this, the rounding up code has been disabled for now until we come up
with a better solution.

------------------------------------------------------------------------
r3117 | daviesrob | 2013-01-30 11:59:20 +0000 (Wed, 30 Jan 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Made off[] array the right size in unpack_rng_array
------------------------------------------------------------------------
r3116 | daviesrob | 2013-01-28 09:29:32 +0000 (Mon, 28 Jan 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tman_interface.c

Always set edc->dc = NULL in tman_unhighlight

Fixes bug where shutting down the join editor without first closing the
trace display causes a crash the next time an attempt is made to view a
trace.

------------------------------------------------------------------------
r3105 | jkbonfield | 2013-01-07 15:02:05 +0000 (Mon, 07 Jan 2013) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap_utils.tcl
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed an issue with renaming contigs within or outside of the contig
selector while edits are being made.

The contig name is held in two places - the contig name B+Tree
providing name->rec mapping, and the contig_t struct itself.

To avoid clashes when renaming multiple contigs within the contig
editors the B+Tree is not updated until we hit Save. Similarly edits
are now made on the child IO rather than the base I/O. The act of
flushing the child I/O is what performs the B+Tree update.

Also made the Contig List window perform a contig_lock_write call,
forcing any existing editors to prompt for saving.

------------------------------------------------------------------------
r3104 | jkbonfield | 2013-01-07 11:51:45 +0000 (Mon, 07 Jan 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Initialise c->clipped_timestamp when loading single contigs in the
older database format.

Without this we could generate random timestamps and so sometimes use
a cached (zero length) contig size when the cache wasn't valid,
leading to truncated contigs from Save Consensus (and elsewhere).

This only happened when using the newer gap5 on a database built with
the older tg_index.

------------------------------------------------------------------------
r3103 | awhitwham | 2012-12-21 10:12:25 +0000 (Fri, 21 Dec 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_struct.h

Moved sort settings into the editor view.  Not entirely happy with the behaviour in the Join Editor but at least it should not crash.

------------------------------------------------------------------------
r3102 | jkbonfield | 2012-11-27 10:26:43 +0000 (Tue, 27 Nov 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Fixed a bug with cached consensus lengths and sequence clipping.
Adjusting clip points at left/right end could leave trailing Ns at the
end of the contig.

We now increment the contig timestamp to force the cached size to be
recomputed.

------------------------------------------------------------------------
r3101 | jkbonfield | 2012-11-20 17:16:31 +0000 (Tue, 20 Nov 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Implemented a newer resort_contigl() function that uses qsort()
instead of a weak bubble (or even worse!) sort variant.

This was becoming the dominant part of performance in very deep
assemblies, but acted fine elsewhere. The newer code has better worst
case implementation, given that qsort() isn't pure quick-sort.

------------------------------------------------------------------------
r3100 | daviesrob | 2012-11-08 14:35:44 +0000 (Thu, 08 Nov 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Update timestamps to prevent contig_visible_start/end from using stale
cached data.


------------------------------------------------------------------------
r3099 | jkbonfield | 2012-11-06 16:15:25 +0000 (Tue, 06 Nov 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed calculate_consensus_bit_het() to assign confidence for an N call
to all of A,C,G,T but not *.

This fixes issues of N vs * being * while A vs * is A, given equal
quality for all bases (eg after import of a fasta file).


------------------------------------------------------------------------
r3098 | jkbonfield | 2012-11-05 16:28:07 +0000 (Mon, 05 Nov 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

The "$io contig_order" method now permits setting of the order as well
as querying. This can be used interactively to fix broken DBs.

Save Order in the List Contigs window now generates a list based on
=num instead of contig names. This means when a contig name is missing
from the name B+Tree index it doesn't silently throw away contigs.

This doesn't fix the bug that renaming sometimes fails, but it stops
it from causing subsequent data loss.

------------------------------------------------------------------------
r3097 | jkbonfield | 2012-10-30 16:57:54 +0000 (Tue, 30 Oct 2012) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/template_draw.h

Added 10 alternative colour choices for the template display spanning
contigs.  I'm open to other colours as the 10 chosen are a bit
arbitrary, but I tried to pick things that didn't get confused with
blues, reds and greys already in use.

This doesn't guarantee neighbouring spanning read pairs in two
different contigs come up in two different colours (as to do so would
mean changing colours as we scroll), but it's a good start I think.

------------------------------------------------------------------------
r3096 | jkbonfield | 2012-10-30 12:21:29 +0000 (Tue, 30 Oct 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed uninitialised access of pair_contig in sequence_get_rangec().

Also removal of some debugging output.

------------------------------------------------------------------------
r3095 | jkbonfield | 2012-10-29 14:48:57 +0000 (Mon, 29 Oct 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Added a multi-column List viewer. It's much like the old Readings list
editor/viewer, but showing the location of boths ends if a
read-pair. The reads are shown in a tablelist widget with sortable
columns, permitting selection of sub-lists for further refinement.

------------------------------------------------------------------------
r3094 | jkbonfield | 2012-10-29 14:46:32 +0000 (Mon, 29 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Fix to CalcTotalContigLen to use clipped contig lengths.

------------------------------------------------------------------------
r3093 | jkbonfield | 2012-10-29 14:33:23 +0000 (Mon, 29 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Fix and issue with Scaffold name sorting when a scaffold doesn't exist.

------------------------------------------------------------------------
r3092 | daviesrob | 2012-10-17 11:27:22 +0100 (Wed, 17 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/gap5/tg_gio.h

Added a check for inline to configure.in, and use it in tg_gio.h to remove an
annoying warning about DB_VERS.

------------------------------------------------------------------------
r3091 | jkbonfield | 2012-10-17 11:13:45 +0100 (Wed, 17 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Dependency updates via "make depend"

------------------------------------------------------------------------
r3090 | jkbonfield | 2012-10-16 17:08:33 +0100 (Tue, 16 Oct 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.h
   M /staden/trunk/src/gap5/contig_selector.tcl

The contig selector now shows clipped lengths. Note this may be slow
on older format databases, but with the new clipped length caching it
is fast on modern ones and also once it's computed and cached on old
DBs.

Also fixed a bug where the X/Y coords displayed and invoked (editor)
didn't compensate for contigs that start somewhere other than base 1.

------------------------------------------------------------------------
r3089 | jkbonfield | 2012-10-15 17:08:44 +0100 (Mon, 15 Oct 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap4_compat.h
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Use the contig timestamp to verify if the cached clipped start/end
positions are valid. In-memory contig structs do this via the
clipped_timestamp value, but to preserve compatibility with the
existing disc format this is convert to a CONTIG_FLAG_CLIPPED_VALID
flag on disc.

------------------------------------------------------------------------
r3088 | jkbonfield | 2012-10-12 17:20:43 +0100 (Fri, 12 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Added rangec_t sort modes by template status (single, paired, bad,
etc) and by library record number.

------------------------------------------------------------------------
r3087 | jkbonfield | 2012-10-12 15:27:34 +0100 (Fri, 12 Oct 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed the default width of the contig list when faced with
exceptionally long contig names.

Also (commented out for now, as debugging only) added the ability to
show a column of contig timestamps.

------------------------------------------------------------------------
r3086 | jkbonfield | 2012-10-12 15:12:02 +0100 (Fri, 12 Oct 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h

When using tg_index on multiple files (eg tg_index a.bam b.bam c.bam)
or appending to an existing database (tg_index -a) we will now
automatically check for read-pairing between files. Use -L option to
disable this.

------------------------------------------------------------------------
r3085 | jkbonfield | 2012-10-12 12:34:51 +0100 (Fri, 12 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Initialise bio->libs so that "tg_index -a" or "tg_index *.bam" don't
cause duplicate libraries to appear.

------------------------------------------------------------------------
r3084 | jkbonfield | 2012-10-11 16:03:23 +0100 (Thu, 11 Oct 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Disabled Accurate mode by default again as it's too slow when run on
older format databases. (Ideally we should make it user controllable
by putting this in the gap5rc file.)

------------------------------------------------------------------------
r3083 | jkbonfield | 2012-10-11 15:33:10 +0100 (Thu, 11 Oct 2012) | 35 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/hache_table.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_struct.h

Major addition (and corresponding database format version change)
involving caching of read pair data.

The Bin GRange arrays now hold pair_{start, end, mqual, contig} in
addition to the previously held pair_rec value. This means the
absolute position of a read-pair can be obtained fast (faster even
than the absolute position of "yourself") without needing to resort to
extra seeks and I/O.

However this data can become outdated if edits occur, such as
breaking/joining, complementing or even just insertion and deletion to
contigs and/or sequences. So every range element also now has a
pair_timestamp indicating when the pair_* records were last validated.

The timestamp is compared against the pair_contig, if it still exists,
and against the main database timestamp. (The timestamps are simply
incremental numbers rather than actual times.)

There is a high chance of an error in this caching code given the
complexity and number of places that we could invalidate the cache,
but it has been well tested.

Benchmarks
==========

After initial tg_index (which sets valid timestamps) I see approx 100x
reduction in seeks and I/O for the template display in "Acc"urate mode
(this is now the default mode). ~1.1k vs 107k seeks.

After editing a contig, scrolling in the template display then
drastically slows down while the data is recomputed, but not by as
much as the old template display was at all times. It's maybe 5-6x
slower than a fully up to date version, and soon speeds up again.


------------------------------------------------------------------------
r3082 | jkbonfield | 2012-10-11 14:38:09 +0100 (Thu, 11 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Switch of xx->edname to xx->seq_win given edname is blank (not filled
out).  I'm not sure why the code didn't fail before.

------------------------------------------------------------------------
r3081 | jkbonfield | 2012-10-11 14:34:41 +0100 (Thu, 11 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Added #ifdef CACHE_STATS around various debugging options (previously
#if 0). Improved the debugging output a bit too.

------------------------------------------------------------------------
r3080 | daviesrob | 2012-10-10 17:22:05 +0100 (Wed, 10 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/do_fij.c

Try to make the join editor come up in the right place for joins in cutoff
sequences.  It will also now automatically turn cutoffs on in these cases.

------------------------------------------------------------------------
r3079 | jkbonfield | 2012-10-09 15:35:16 +0100 (Tue, 09 Oct 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap4_compat.h

Removed an absent "Make join" option from the FIJ results in the
contig selector.

Also updated the broken entries in gap4_compat.h for io_rdonly and
io_name and removed the unused io_dbsize define.

------------------------------------------------------------------------
r3078 | daviesrob | 2012-10-09 14:21:51 +0100 (Tue, 09 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/readpair.c

Go back to complementing the shortest contig when bringing up the join
editor, by popular request.

------------------------------------------------------------------------
r3077 | jkbonfield | 2012-10-08 16:31:13 +0100 (Mon, 08 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c

Remove minor compilation warning.

------------------------------------------------------------------------
r3076 | jkbonfield | 2012-10-08 16:28:38 +0100 (Mon, 08 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/qualIO.c

Fixed vmessage format: %d vs %ld

------------------------------------------------------------------------
r3075 | jkbonfield | 2012-10-05 11:55:59 +0100 (Fri, 05 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Shifting sequences now forces that sequence to be visible on screen still.

------------------------------------------------------------------------
r3074 | daviesrob | 2012-10-05 10:26:53 +0100 (Fri, 05 Oct 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/read_depth.c
   M /staden/trunk/src/gap5/tag_plot.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_tracks.c

Made contig_objects_in_range return a valid pointer and zero count when
nothing is found in the desired range.  It still returns NULL if it fails.
Ensured that everything that calls it does something sensible with the
results.

Put in some more checks for NULL return values, mainly from memory
allocations and cache_search.

Fixed bug in get_hidden_end, which was not calculating the correct position
in the cons[] array for the start of the alignment.

------------------------------------------------------------------------
r3073 | jkbonfield | 2012-10-05 10:22:02 +0100 (Fri, 05 Oct 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Protect against the range of shuffle pads ending at a position with no
sequences (eg an internal run of Ns in a contig). In this case the
iterator returned no next seq, causing a crash in the range extension logic.

------------------------------------------------------------------------
r3072 | jkbonfield | 2012-10-04 15:17:53 +0100 (Thu, 04 Oct 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Removed triggers for the various "error, start/end do not match
template pos" error messages. These came about for two reasons:

1) Containments, where start>pair_start and end<pair_end or vice
versa.

2) Failure to check for spanning read-pairs.

------------------------------------------------------------------------
r3071 | jkbonfield | 2012-10-04 09:34:11 +0100 (Thu, 04 Oct 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Use gio_base(io) in various object creation functions. Without this
creating tags (for example) in the editor was crashing as child io->db
is NULL.

Also boosted the default cache from 1024 to 2048 items, based on
experimental evidence of our existing DBs and the number of items in
the typical template display.

------------------------------------------------------------------------
r3070 | jkbonfield | 2012-10-01 11:45:12 +0100 (Mon, 01 Oct 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed bug in SAM/BAM contig export when requesting "fixmates"
mate-pair data. This is a long-standing bug that existing before the
latest updates.

If exporting just one contig, we still needed to output all @SQ lines
incase that one contig has spanning read-pairs.

------------------------------------------------------------------------
r3069 | daviesrob | 2012-09-28 15:53:10 +0100 (Fri, 28 Sep 2012) | 24 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/gap_hash.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/seq_utils/dna_utils.c
   M /staden/trunk/src/seq_utils/dna_utils.h

Made the join editor open at more sensible positions for each contig,
especially in the case of reverse alignments.  The obj_match, obj_checkass,
obj_read_pair and obj_fij structs have all had end1 and end2 fields added
which store the padded position of the end of the alignment in each contig.
This means the positions can be accurately recalculated when one or other
contig is complemented.

Adjusted the code in FIJ, Find Repeats, Check Assembly, Find Read Pairs and
Sequence Search (find_oligo) to work with the revised data structure.  At
the same time made some efficency improvements to FIJ and Find Repeats.
Those two also now show the contig record number instead of the left read
number in the contig selector when hovering over a match.

The contig selector now draws matches from (pos1,pos2) to (end1,end2) which
means some of the match lines are no longer at exactly 45 degrees.

csmatch_join_to and csmatch_complement in cs-object.c update the pos1/2 and
end1/2 locations as necessary.

Added a new function to dna_utils.c to copy and complement sequences at the
same time.  Also added functions to allocate a complemented sequence, and
allocate a depadded sequence.


------------------------------------------------------------------------
r3068 | jkbonfield | 2012-09-27 17:35:49 +0100 (Thu, 27 Sep 2012) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/complement.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/search.tcl
   M /staden/trunk/src/gap5/tclIndex

Added an option to perform bulk contig renaming.

This operates either on a list or on a pattern to check against all
contig names.  The replacement text has a single printf rule to
replace %d by an automatically iterated contig number. Eg replacing
everything with "Contig_%06d" to get Contig_000001 upwards.

If operating in pattern mode it can use filename glob style wildcards
("Node*Contig*"). In this case the replacement pattern can also use
\1, \2 etc regexp matches to utilise whatever the * matched. This
allows for renaming of "Contig*" to "C\1". (Should this be "C*" too
for ease?)

------------------------------------------------------------------------
r3067 | jkbonfield | 2012-09-27 17:31:40 +0100 (Thu, 27 Sep 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap_utils.tcl

Fixed Select Readings to operate over the underlined region of the
consensus rather than the current single position.

Also, for use in next commit, changed contig_rename to return the new
name rather than 0 or 1 and for it to optionally try alternative names
(name#%d) when the existing name clashes.

------------------------------------------------------------------------
r3066 | jkbonfield | 2012-09-27 12:31:02 +0100 (Thu, 27 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/export_contigs.c

Added a SAM header and sort order definition to SAM/BAM export.

Fixed a memory leak when parsing SAM headers containing read-groups
with duplicate IDs. (Shouldn't happen, but can do if we have
duplicated libraries for some reason.)

------------------------------------------------------------------------
r3065 | jkbonfield | 2012-09-27 10:06:23 +0100 (Thu, 27 Sep 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl

Rewrote the SAM exporter and added a BAM exporter. These are all in
bam.c now instead instead of input in bam.c and output in
export_contigs.c.

Now BAM format is an option from gap5_export script and Gap5 Export
Sequences dialogue.

------------------------------------------------------------------------
r3064 | daviesrob | 2012-09-25 09:57:10 +0100 (Tue, 25 Sep 2012) | 39 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/hash_lib.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.h

Added read pair filtering option to Find Internal Joins.  Turning this on
make FIJ check each match to see how many read pairs span between the two
contigs in the neighborhood of the aligned region.  The alignments are only
kept if the number of read pairs exceeds a given threshold.

The read pair screen actually runs in two stages.  In the first stage, fij
calls fij_prefilter_repeats on the combined contig list.  This calls
spanning_pairs (the guts of Find Read Pairs) to get a list of contigs
that are linked by the desired number of pairs.  It uses this list to make
a HashTable of contig_pair structs and also to prune any contigs with no
read pair links from the list being searched.  The idea is that
spanning_pairs is fairly quick, so using it to reduce the search space should
save time later.

do_it_fij, compare_b_bulk and align_blocks_bulk all now take the HashTable
of contig pairs.  Any word matches that do not match an item in the HashTable
are filtered out so they do not have to be aligned later.

The second stage of filtering takes place in check_overlap_pairs which
is called by add_fij_overlap and add_fij_overlap_r.  This scans for read
pairs over the aligned region, plus a little extra to account for templates
that extend beyond the alignment. It ensures that any spanning pairs
found are a reasonable distance apart and in the correct orientation for the
library.

Other minor changes are:

 * In buffij, pos1 and pos2 are no longer swapped

 * The code to convert a list of libraries to a HashTable has moved from
   spanning_pairs to create_lib_hash.  This allows the library HashTable
   to be used later on in check_overlap_pairs.

 * fij and do_it_fij now take a fij_arg * parameter to vastly reduce the
   number of separate parameters passed in.

 * Read pair screening options have been added to the FIJ dialog box.


------------------------------------------------------------------------
r3063 | jkbonfield | 2012-09-18 17:30:37 +0100 (Tue, 18 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed a memory corruption bug.

------------------------------------------------------------------------
r3062 | jkbonfield | 2012-09-18 17:29:43 +0100 (Tue, 18 Sep 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.h

Improvements to the CACHE_REF_DEBUG code (not enabled normally).
It's still not foolproof when using cache_rw on child I/Os, but
cache_incr and cache_decr for child I/Os now works better.

------------------------------------------------------------------------
r3061 | jkbonfield | 2012-09-17 12:29:10 +0100 (Mon, 17 Sep 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/search.tcl

Fixed search sequence names to generate a list of "#num name" form
instead of just "name". The text output window is still names though,
but the SEQID tag handler has been updated to also look for
SEQID:<num> to allow numerical IDs to be used instead of name lookup.
These fixes make it possible to click on the read names and bring up
the correct read of a pair.

Likewise also added SEQID tag to the (already #numeric) output of
ContigsToReadings.

------------------------------------------------------------------------
r3060 | jkbonfield | 2012-09-14 16:23:48 +0100 (Fri, 14 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c

Fixed a bug in Sequence Search (inexact_pad_match) causing it to find
the same match multiple times if the match starts with a pad.

------------------------------------------------------------------------
r3059 | jkbonfield | 2012-09-14 15:09:25 +0100 (Fri, 14 Sep 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fix to sequence_get_template_info() for when a library has
insufficient data. Now we just call it paired if it is paired, but
don't pontificate on the whether it is consistent.

Previously it could access uninitialised memory and return
inconsistent results.

------------------------------------------------------------------------
r3058 | jkbonfield | 2012-09-14 15:07:48 +0100 (Fri, 14 Sep 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tkEditor.c

Updates to the copy-on-write caching layer to allow for the
possibility of child IOs of child IOs (ie grandchild IOs).

In practice it's not finished, but it doesn't harm normal operation
either and the commenting has been improved, with a few extra asserts
too. So we'll keep this variant.

There is also a new gio_base(io) function to return the base io rather
than just using io->base ? io->base : io.

------------------------------------------------------------------------
r3057 | jkbonfield | 2012-09-14 15:03:47 +0100 (Fri, 14 Sep 2012) | 21 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/qualIO.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h
   M /staden/trunk/src/gap5/shuffle_pads.tcl
   M /staden/trunk/src/seq_utils/align_lib.c
   M /staden/trunk/src/seq_utils/align_lib.h

Shuffle pads can now operate over regions of contigs in addition to an
entire contig. This means it is callable from the contig editor too by
selecting (underlining) a region in the consensus and picking the
Realign Seqs command from the consensus.

Given this shuffle pads was also updated to remember which regions
are modified on pass 1 and supply these regions to the next pass
recursively. This considerably speeds up the algorithm, typically by
4-5x faster. Also increased the default band width, given it's now faster.

The scoring function in align_lib has been updated too. Previously it
purely counted differences, but this meant a better alignment
(matching other common alignment trends) that doesn't alter the number
of differences to the consensus could yield no overall change. Now we
take into account the fractional base matches.

Finally, improved diagnostics from List Base Confidence so we can more
accurately see the impact of shuffle pads. It breaks down the match
and mismatch scores by base types and provides a summary of counts of
substitutions and indels.

------------------------------------------------------------------------
r3056 | jkbonfield | 2012-09-14 14:55:01 +0100 (Fri, 14 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Protect against attempting to store cached consensus in child
IOs.  This does not work due to accessing io->db.

------------------------------------------------------------------------
r3055 | daviesrob | 2012-09-11 09:23:01 +0100 (Tue, 11 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

spanning_pairs now uses the library record in the range structs (if present)
when filtering by library.  This makes it much faster as it no longer
has to read the sequences.  It will fall back to the old method if it finds
any ranges without a library record (e.g. when looking at an old format
database).  Also added more error checking and cleanup code.

------------------------------------------------------------------------
r3054 | daviesrob | 2012-09-07 16:28:23 +0100 (Fri, 07 Sep 2012) | 46 lines
Changed paths:
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_struct.h

Got rid of various static variables that should really only have the same
lifetime as the GapIO struct instead of that of the program.  The variables
have been moved to either the GapIO, database_t or g_io structs.  The result
is that repeatedly opening and closing databases without restarting gap5
now works as you would expect.  It should also be possible to have two
databases open simultaneously in a single process without them interfering
with each other.

Specific changes follow.

tg_iface_g.c:
* File-level wrstats, wrcounts, rdstats, rdcounts are now in the g_io struct.
* File-level other_record and other_record_start have been removed (not needed).
* In allocate(), record is now in the g_io struct. allocate is also
  much simpler.
* In btree_node_create(), hd did not need to be static.
* io_database_read() and io_database_create() call init_block_record_numbers(),
  see tg_cache.c

tg_cache.c:
tg_struct.h:
* In cache_item_create_{seq,contig,scaffold,anno_ele}, moved brec and sub_rec
  in each function to the database_t struct.  Added a new function
  init_block_record_numbers() to initialize them all.
* cache_flush now checks io->last_bin to see if any outstanding updates
  are needed in bin_add_range().  See tg_bin.c

tg_bin.c:
tg_gio.h:
* File-level last_bin and incr_{s,r,a}value variables moved to the GapIO
  struct.  These are used by bin_add_range().

tg_library.c:
tg_gio.h:
* In template_max_size(), moved max_size to max_template_size in the GapIO
  struct.

tg_gio.c:
* gio_open() initializes io->last_bin, io->incr_{s,r,a}value and
  io->max_template_size.
* gio_child asserts that io_p->last_bin == 0 (i.e. no outstanding updates are
  needed in bin_add_range) and copies io->max_template_size from the base.

template_display.c:
* In redraw_template_image(), removed redundant last_zoom.

------------------------------------------------------------------------
r3053 | daviesrob | 2012-09-06 17:27:45 +0100 (Thu, 06 Sep 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed tcl_import_reads so that it sets more of the parameters in the tg_args
struct args.a - previously these were being used uninitialized.  Added
code to call parse_caf and parse_afg which were supported by tg_index but
not tcl_import_reads.  Also improved the error handling a bit.

------------------------------------------------------------------------
r3052 | jkbonfield | 2012-09-06 12:11:12 +0100 (Thu, 06 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/gap5_shuffle_pads.in
   A /staden/trunk/src/gap5/gap5_shuffle_pads.tcl
   M /staden/trunk/src/staden_config.h.in

Added a gap5_shuffle_pads command to allow batch execution of the
Shuffle Pads menu item.

------------------------------------------------------------------------
r3051 | jkbonfield | 2012-09-06 12:09:26 +0100 (Thu, 06 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Robustness improvements (error handling).

------------------------------------------------------------------------
r3050 | jkbonfield | 2012-09-04 17:24:28 +0100 (Tue, 04 Sep 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/tk_utils/init.tcl

Added a mode for allowing (de)selection of reads with their
mate-pairs.

In the editor names panel this is by using the Control key, so
click-drag is the reads under cursor only while control-click-drag is
also their mate-pairs.

In the right-click menu this has been split into two menu entries:
with and without mate-pairs.

------------------------------------------------------------------------
r3049 | jkbonfield | 2012-09-04 16:19:31 +0100 (Tue, 04 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.h
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added a Pair Reading List menu item. This takes a list of reads and
produces a list containing those reads and their mate-pairs.

------------------------------------------------------------------------
r3048 | jkbonfield | 2012-09-04 14:01:25 +0100 (Tue, 04 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_utils.tcl

Bug fix to error dialogue in contig_rename. (Nil effect until it gets
an error.)

------------------------------------------------------------------------
r3047 | jkbonfield | 2012-09-04 12:35:07 +0100 (Tue, 04 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Bug fix to contig_shift_base(). In some cases it was causing bins to
grow beyond their parent boundaries.

The fix was to use the same logic we already have for when inserting
or deleting consensus columns.

------------------------------------------------------------------------
r3046 | jkbonfield | 2012-09-04 12:32:04 +0100 (Tue, 04 Sep 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_scaffold.h

Add missing prototype for complement_scaffold()
------------------------------------------------------------------------
r3045 | jkbonfield | 2012-09-04 12:31:36 +0100 (Tue, 04 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

Fix potential buffer overrun in the mouse-over text in the read pair plot.

------------------------------------------------------------------------
r3044 | jkbonfield | 2012-09-04 12:30:59 +0100 (Tue, 04 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added contig shift (control+left/right arrows in editor) checking.

------------------------------------------------------------------------
r3043 | jkbonfield | 2012-09-04 09:47:26 +0100 (Tue, 04 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Additional assert, just to be sure: spotting that the free range list
in bins always contains items that are genuingly tagged as UNUSUED.

------------------------------------------------------------------------
r3042 | jkbonfield | 2012-09-04 09:36:58 +0100 (Tue, 04 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.h

Increased the maximum contig name length (largely unused now)
DB_NAMELEN to be 1024. This was causing truncation of display within
the contig editor and I suspect in fasta/fastq output.

I think the scrollbar in the editor name display needs fixing still though.

------------------------------------------------------------------------
r3041 | jkbonfield | 2012-09-04 09:35:24 +0100 (Tue, 04 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_utils.tcl

Fixed a bug causing contig renaming in the editor to produce a tcl error.

------------------------------------------------------------------------
r3040 | jkbonfield | 2012-08-31 15:22:37 +0100 (Fri, 31 Aug 2012) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Removed an assumption in recursive_grow_bins() that the bin siblings being
recursed down never overlap each other. (I'm not sure what causes this
- likely contig indels.)

Previously this created errors like:

bin 879: used start/end range beyond the bin boundaries (size 2042 vs start=1,end=2042).


------------------------------------------------------------------------
r3039 | daviesrob | 2012-08-31 12:17:15 +0100 (Fri, 31 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Added assertions to ensure that bins never shrink in recursive_grow_bins and
that extend_root_bin always makes a parent bin bigger than the existing one.

------------------------------------------------------------------------
r3038 | jkbonfield | 2012-08-30 11:33:47 +0100 (Thu, 30 Aug 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c

Added an additional cache_flush after the final updating of nseqs, but
before the slow process of updating the name index.

It's not needed, but is a preventative issue incase of errors or
interrupted tg_index later on.

------------------------------------------------------------------------
r3037 | daviesrob | 2012-08-24 16:35:04 +0100 (Fri, 24 Aug 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

More tweaks to find internal joins.  Notably the band in align_wrap has been
made wider and shifted slightly when aligning non-square regions.  Also
added code to avoid calling align_bit in trivial cases (1 base against 1 base
or zero bases against anything) which gives a small speed-up.  align_blocks
has also been rearranged a little so that it can avoid doing some pointless
work in fast mode if it is going to bail out anyway.

------------------------------------------------------------------------
r3036 | jkbonfield | 2012-08-23 12:54:18 +0100 (Thu, 23 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Improved handling of failure conditions (failure to cache_search()).

------------------------------------------------------------------------
r3035 | jkbonfield | 2012-08-23 12:42:56 +0100 (Thu, 23 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed an uninitialised memory access when working out if the sequences
are visible on screen, triggered when there are zero sequences display
in the editor range.

------------------------------------------------------------------------
r3034 | jkbonfield | 2012-08-23 12:42:21 +0100 (Thu, 23 Aug 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/import_gff.c

Bug fix when importing GFF files that could lead to crashes. It wasn't
correctly incrementing and decrementing the reference count on the
contig, and due to calculate_consensus_simple() this could be pushed out
of scope.

------------------------------------------------------------------------
r3033 | jkbonfield | 2012-08-23 12:41:06 +0100 (Thu, 23 Aug 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_tcl.c

Major bug fix to contig linking code. The "$c invalidate_consensus"
method had no break statement forcing it to flow into the add_link
code, creating uninitialised links.

Also added some extra initialising of links, just incase of
corruptions anywhere. (Shouldn't ever matter.)


------------------------------------------------------------------------
r3032 | daviesrob | 2012-08-20 17:17:44 +0100 (Mon, 20 Aug 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Removed debugging output
------------------------------------------------------------------------
r3031 | daviesrob | 2012-08-20 15:35:03 +0100 (Mon, 20 Aug 2012) | 15 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/hash_lib.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Updated find internal joins.  Previously it could only compare a single contig
to a list, or all the contigs in a list with each other.  Now it accepts
two contig lists, and compares all the contigs in list 1 with each of the
contigs in list 2.

Also made some improvements to the quick alignment code so that it misses
fewer hits.  Notably align_blocks now works out the best scoring chain after
stitching all of the blocks together instead of trying to keep track on the
way through, and it also adds a penalty for stopping short of the end of the
diagonal.  align_blocks also now sorts the blocks by the manhatten distance
to the end of each match instead of (manhatten distance to the start + length).
Some redundant code has been removed, and the near-duplicate hash_wordXXn
and hash_seqXXn functions have been amalgamated into hash_word_n and
hash_seq_n, although stubs still exist for the old functions for now.

------------------------------------------------------------------------
r3030 | daviesrob | 2012-08-20 13:48:18 +0100 (Mon, 20 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Fixed bug in affine_align.  If the alignment was predicted to use more
than MAX_MEMORY2 bytes, params->band was halved twice, leading to
a segfault in affine_align_bits. 

------------------------------------------------------------------------
r3029 | jkbonfield | 2012-08-17 16:34:59 +0100 (Fri, 17 Aug 2012) | 17 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Two fixes.

1) In g_read_alloc check that vi.used is not G_NO_IMAGE before
attempting to read. Our previous assumption that vi.used length is
non-zero is not solely enough as the record may have been re-allocated
from an earlier free record in which case only the image has been
reset. (This is perhaps a bug.)

2) When writing contig links we now forcibly check that data is within
the desired range, in particular that end1, end2 and orientation are
booleans. Failure to be so means we could have underallocated memory
and leads to a corruption.

This is to work around an unknown bug elsehwere which corrupted this
link data. We need to find and fix that too! (On going work.)


------------------------------------------------------------------------
r3028 | jkbonfield | 2012-08-17 12:05:25 +0100 (Fri, 17 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tag_editor.tcl

Protect against attempts to use tag-macros on read only databases.

------------------------------------------------------------------------
r3027 | jkbonfield | 2012-08-17 10:15:39 +0100 (Fri, 17 Aug 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Bug fix in ListContigsRepopulate().

This is called via an "after idle" handler, but could sometimes be
called after the window has been shut down, producing (harmless) Tk
error messages.

------------------------------------------------------------------------
r3026 | jkbonfield | 2012-08-17 10:14:39 +0100 (Fri, 17 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Bug fix to marking a selection. If we start the selection off the
right hand end of a sequence it was forcing the start point to right+1
instead of right-1.

------------------------------------------------------------------------
r3025 | jkbonfield | 2012-08-17 10:13:52 +0100 (Fri, 17 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tkEditor.c

Removed harmless access of uninitialised variable. We check bounds of
f1 when scrolling, even when it hasn't been set. But in the same
situation it hasn't been set we also then never use it again.

------------------------------------------------------------------------
r3024 | jkbonfield | 2012-08-17 10:11:56 +0100 (Fri, 17 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Fixed a bug with check-db when run from a child I/O (ie the hidden
keybinding for checking internal editor state).

------------------------------------------------------------------------
r3023 | jkbonfield | 2012-08-16 09:46:07 +0100 (Thu, 16 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap4/consen.c

Bug fix to fastq output. Values above 94 were becoming negative and
then rounded up to 0 quality ('!') when printed out.

------------------------------------------------------------------------
r3022 | jkbonfield | 2012-08-15 16:33:50 +0100 (Wed, 15 Aug 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Fixed an error causing errors like:

    registration_callback: expected integer but got "-26848.744"

Generated when joining contigs together with the template display up.

------------------------------------------------------------------------
r3021 | jkbonfield | 2012-08-15 15:30:29 +0100 (Wed, 15 Aug 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Fixed a bug in writing scaffolds with zero items. It was writing the
scaffold still (with 0 items and name) instead of just 0 only.

This caused failure to read due to corrupted format.

------------------------------------------------------------------------
r3020 | awhitwham | 2012-08-15 14:15:42 +0100 (Wed, 15 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/tag_plot.c

Stop tag code being called when the tag plot is not being displayed.

------------------------------------------------------------------------
r3019 | jkbonfield | 2012-08-15 12:47:08 +0100 (Wed, 15 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/quality_plot.c

Fixed the XFillRectangle in qual plot to be after the check for
whether the display is drawn. (Minor speed improvement.)

------------------------------------------------------------------------
r3018 | jkbonfield | 2012-08-15 12:32:00 +0100 (Wed, 15 Aug 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Fixed the library type query (--> <-- vs <-- --> vs <-- <--). It
previously called update_library_stats over and over again when using
mixed libraries. We now cache the results in a hash table.

This new code is now much faster, within 5% of the speed of the original 
template display before we took into account the library type field.


------------------------------------------------------------------------
r3017 | jkbonfield | 2012-08-14 10:01:32 +0100 (Tue, 14 Aug 2012) | 15 lines
Changed paths:
   M /staden/trunk/src/Misc/misc.h
   M /staden/trunk/src/Misc/strings.c
   M /staden/trunk/src/gap4/GTAGDB
   M /staden/trunk/src/gap4/acd2tag.tcl
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/tag_editor.tcl

Major overhaul of GFF import and export in Gap5.

(Some of this changes code in Gap4 as the tag database and ACD parsing
is shared between the two, but in an invisible manner.)

We now have a GUI for GFF tags using the #!acdtag syntax. The ACD tag
code was extended slightly to allow querying of ACD variables so the
unhandled key=value attribute pairs in GFF can be placed inside a
text box.

Also moved the various escaping and unescaping functions out from
export_contigs.c to Misc/strings.c as it's now used in multiple places
- all in gap5 atm, but Misc is the right spot.


------------------------------------------------------------------------
r3016 | jkbonfield | 2012-08-10 17:29:56 +0100 (Fri, 10 Aug 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Zooming with mouse wheel now operates around the cursor position
instead of the centre of the screen.

Also reduced the width of the editor cursor line from 5 to 2. It's
less intrusive, but harder to select. At some stage we should replace
this with a canvas item instead of a frame window and allow for
dragging via canvas closest item selection.

------------------------------------------------------------------------
r3015 | jkbonfield | 2012-08-09 14:38:16 +0100 (Thu, 09 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/import_gff.c

Use zfopen (etc) instead of fopen to support gzipped GFF files.

------------------------------------------------------------------------
r3014 | jkbonfield | 2012-08-09 11:20:45 +0100 (Thu, 09 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed a typo in the contig renaming code preventing it from working.

------------------------------------------------------------------------
r3013 | jkbonfield | 2012-08-08 14:35:15 +0100 (Wed, 08 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/caf.c

Fix to resolve crash parsing extremely long lines (32Kb or more).

------------------------------------------------------------------------
r3012 | jkbonfield | 2012-08-08 12:07:36 +0100 (Wed, 08 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c

Improved diagnostics while running Delete Tags.

------------------------------------------------------------------------
r3011 | jkbonfield | 2012-08-06 12:16:44 +0100 (Mon, 06 Aug 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/io_utils.h
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tag_checklist.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_anno.h
   M /staden/trunk/src/gap5/tg_gio.h

Added Delete Tags feature. This removes all tags of specific types in
specific contigs. (Warning: with no Undo functionality.)

In the process of this I revamped the rec_list_t used by
active_list_scaffold et al to just use a tg_rec array. This avoids
conflict with rec_list already used elsewhere.

------------------------------------------------------------------------
r3010 | jkbonfield | 2012-08-01 15:25:02 +0100 (Wed, 01 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Even more muppetry! Added code for testing random sequence moves.

------------------------------------------------------------------------
r3009 | jkbonfield | 2012-08-01 15:24:04 +0100 (Wed, 01 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/scaffold.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_scaffold.h

Added Scaffold exporting code.

------------------------------------------------------------------------
r3008 | awhitwham | 2012-07-26 17:17:36 +0100 (Thu, 26 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

Fixed potential memory leak.

------------------------------------------------------------------------
r3007 | jkbonfield | 2012-07-25 17:49:04 +0100 (Wed, 25 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h
   M /staden/trunk/src/gap5/tg_tcl.c

Added Check Database code for checking, and sometimes fixing (untested),
scaffolds.

------------------------------------------------------------------------
r3006 | awhitwham | 2012-07-25 17:36:17 +0100 (Wed, 25 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Tidy up adding tracks to the tk grid.  Also, x zoom by mouse wheel now sets x zoom control. 

------------------------------------------------------------------------
r3005 | jkbonfield | 2012-07-25 16:52:40 +0100 (Wed, 25 Jul 2012) | 31 lines
Changed paths:
   M /staden/trunk/src/gap5/complement.tcl
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/io_utils.h
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   A /staden/trunk/src/gap5/scaffold.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_scaffold.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

More updates involving scaffolds.

- Scaffold names now have their own index instead of abusing the
  contig index.

- Btree index nodes are now forcibly written on creation, rather
  than delaying until subsequent adds and updates. This resolves a
  problem where we create an index but do not enter a single item (as
  it typically for scaffold_index).

- Added code to import an AGP file creating new scaffolds. If contigs
  are already in a scaffold they'll be silently moved to the new
  scaffold, but it does not clear any scaffold IDs for existing
  contigs not mentioned in the AGP file. (Maybe we need a clear
  scaffolds function? or a bulk remove? Via list contigs?)

- contig_id megawidget has a -scaffold option which, when not using
  -range 1, will permit scaffold names to be used.

- Complement Contigs is now Complement Contigs or
  Scaffolds. Complementing a scaffold complements all members of that
  scaffold and also reverses the order of members. At present it can
  only complement a single scaffold.

- Added various C->Tcl interface scaffold bits: $io num_scaffolds, $io
  scaffold_order, db_info get_scaffold_num.

- List Contigs ^ and v (up and down) buttons are now
  autorepeating. They also auto-scroll to keep the data being moved
  visible on screen.

------------------------------------------------------------------------
r3004 | jkbonfield | 2012-07-25 16:44:12 +0100 (Wed, 25 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c

We now create a library for all records in an ACE file. Technically
this isn't correct as we should honour the WR{lib:} field, but this
doesn't seem to be present in most ACE files anyway.

------------------------------------------------------------------------
r3003 | daviesrob | 2012-07-25 11:54:14 +0100 (Wed, 25 Jul 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Major rewrite of join_contigs.  Instead of simply overlapping the bin
structures of the two contigs, it now tries to merge them together by
transplanting bins where possible or by moving sequences.  It falls back
to the old method if it looks like this will be too much work.  Most of the
activity now takes place in a child IO, so if anything goes wrong the
changes so far can be abandoned leaving the database unchanged (at least
until it gets to cache_flush).  A small amount of activity still takes
place on the base IO, mainly the contig notifications and removing the
remains of the unwanted contig.

------------------------------------------------------------------------
r3002 | daviesrob | 2012-07-25 11:44:09 +0100 (Wed, 25 Jul 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c

Only allow bin_unload and contig_unload to destroy bins/contigs on the base IO.

Made cache debugging messages more detailed.

Fixed various memory leaks in cache_flush.  Also changed contig_destroy to
use cache_deallocate instead of cache_rec_deallocate as the latter also
leaks memory if the caller does not tidy up correctly.

------------------------------------------------------------------------
r3001 | daviesrob | 2012-07-25 11:35:35 +0100 (Wed, 25 Jul 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Stop bin_get_item_position from crashing if a bin is missing
------------------------------------------------------------------------
r3000 | daviesrob | 2012-07-24 16:43:17 +0100 (Tue, 24 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

s/ANNO_ELE_BLOCK/CONTIG_BLOCK/ in io_contig_block_read.  Luckily the different
block types were both the same size, so the change is just cosmetic.

------------------------------------------------------------------------
r2999 | awhitwham | 2012-07-24 14:44:33 +0100 (Tue, 24 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   A /staden/trunk/src/gap5/tag_plot.c
   A /staden/trunk/src/gap5/tag_plot.h

Interim check-in.  Add a tag plot to the template display.  Needs some further work.

------------------------------------------------------------------------
r2998 | daviesrob | 2012-07-23 12:41:31 +0100 (Mon, 23 Jul 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Re-wrote the part of bin_for_range that creates child bins.  The new version
is a bit shorter, and removes an assumption about the order of the child
bins that caused the parent to be incorrectly used instead under certain
conditions.


------------------------------------------------------------------------
r2997 | daviesrob | 2012-07-23 11:59:21 +0100 (Mon, 23 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/hache_table.c

Put #ifdef DEBUG around "Resizing HacheTable..." message.


------------------------------------------------------------------------
r2996 | daviesrob | 2012-07-23 11:52:43 +0100 (Mon, 23 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Copy debug_level and debug_fp to child io.

------------------------------------------------------------------------
r2995 | daviesrob | 2012-07-23 11:44:50 +0100 (Mon, 23 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

When dumping to postscript, fill rows from right to left.  This helps to keep
each row filled as much as possible.

------------------------------------------------------------------------
r2994 | daviesrob | 2012-07-13 16:54:55 +0100 (Fri, 13 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Use byte arrays instead of strings in tcl_calc_quality and
tcl_reformat_sequence.  Fixes problems with negative quality values being
misinterpreted as UTF8 character codes.

------------------------------------------------------------------------
r2993 | daviesrob | 2012-07-10 13:45:58 +0100 (Tue, 10 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed bug in calculate_consensus_simple that caused the last base to be
missed out if it was immediately after the end of a cached region.

------------------------------------------------------------------------
r2992 | jkbonfield | 2012-07-06 17:04:51 +0100 (Fri, 06 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/template_display.c

Added support for LENGTH, COMPLEMENT and JOIN_TO registration events.

This fixes crashes where editing and joining data displayed in the
template display is changed by external (to it) edits; eg Join Editor.

------------------------------------------------------------------------
r2991 | jkbonfield | 2012-07-06 13:48:44 +0100 (Fri, 06 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Added support for LENGTH, COMPLEMENT and JOIN_TO registration events.

This fixes crashes where editing and joining data displayed in the
template display is changed by external (to it) edits; eg Join Editor.

------------------------------------------------------------------------
r2990 | jkbonfield | 2012-07-05 15:04:01 +0100 (Thu, 05 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h

Remove the cached contig_t pointer from the gap_range. This can become
out of date after contig editing, causing subsequent crashes in the
template display. It's only accessed once per redraw, so instead we
re-search it every time using the cached record number instead.

------------------------------------------------------------------------
r2989 | jkbonfield | 2012-07-05 15:02:30 +0100 (Thu, 05 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tclIndex

Added a "Reading #Numbers to Names" list option to convert reading
lists generated as #[0-9]+ into sequence names.

------------------------------------------------------------------------
r2988 | jkbonfield | 2012-07-05 12:14:21 +0100 (Thu, 05 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Initialise range_t.library_rec=0 for consensus sequences. This removes
an uninitialised memory access in tg_iface_g.c, although it's largely
irrelevant as the data is never used (it just marginally increased
storage by a few bytes).

------------------------------------------------------------------------
r2987 | jkbonfield | 2012-07-05 11:26:07 +0100 (Thu, 05 Jul 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/depth_track.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_library.h

Added a function to work out the maximum expected insert size (mean + 3
standard deviations) of all the libraries.

This is used to set the extra query range added to the templay display
searches to improve read-pairing. It has the effect of removing 99% of
the orange mismatched pairs when viewing plots with large insert
libraries.

------------------------------------------------------------------------
r2986 | jkbonfield | 2012-07-04 17:03:45 +0100 (Wed, 04 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Fixed a buffer overflow in pack_rng_array (nparts[] array).

Also removed some debugging output.

------------------------------------------------------------------------
r2985 | jkbonfield | 2012-07-04 16:47:48 +0100 (Wed, 04 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_scaffold.c

Correction for List Contigs dialogue when using an older database
version.  We no longer display the scaffold name, permit changing
scaffold or attempt to adjust the scaffold order when saving.

------------------------------------------------------------------------
r2984 | jkbonfield | 2012-07-04 16:40:47 +0100 (Wed, 04 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl

Code for a basic search by edit. It's incomplete as it only finds
confidence 0 or 100. The users deemed this insufficient, so for now it
is commented out of the search dialogue, but the code exists and may
be extended to provide full edit searching at a later stage.

------------------------------------------------------------------------
r2983 | jkbonfield | 2012-07-04 16:27:37 +0100 (Wed, 04 Jul 2012) | 30 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   A /staden/trunk/src/gap5/contig_graph.tcl
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_utils.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index_common.c
   A /staden/trunk/src/gap5/tg_scaffold.c
   A /staden/trunk/src/gap5/tg_scaffold.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

First draft: major addition of scaffolding structures. The GUI support
is minimal at present, being limited purely to the List Contigs
dialogue, but the underlying data structures seem to be OK.

We can now rename contigs from the List Contigs window too (using a
new rename_contig proc rather than the old code in the contig editor),
in addition to moving contigs between scaffolds. The order can now
also be changed using the up and down arrow buttons. (These are
unicode - if we get display issues we can change them to bitmaps.) The
order of contigs within scaffolds is desired from the main contig
order.

Part of the implementation adds a scaffold object to Tcl, created by
e.g. "set f [$io get_scaffold [$c get_scaffold]]"

Also added contig links, although these are currently unused. These
provide the ability to form a full graph (eg like FASTG) rather than
just a linear scaffold. It is expected that we can use these to store
hits from find read pairs, find repeats and find internal joins, with
suitable functions to cull or recompute as desired. A noddy and
currently unused contig_graph.tcl implementation experiments with ways
to draw these graphs. This needs much more work still.

The library record is now also stored in the range_t structure. This
means that it is fast to detect the correct orientation of sequences
in the template display (now implemented) and also in future to
provide fast filtering by library methods. Todo: update find read
pairs filtering to use this too.


------------------------------------------------------------------------
r2982 | jkbonfield | 2012-07-04 15:21:50 +0100 (Wed, 04 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/utils.tcl

Added lreverse for when using tcl8.4 or below. Tcl 8.5 or higher uses
the builtin version.

------------------------------------------------------------------------
r2981 | jkbonfield | 2012-07-04 15:21:08 +0100 (Wed, 04 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Unprintable characters in sequences can now be fixed too.

------------------------------------------------------------------------
r2980 | jkbonfield | 2012-07-04 15:19:07 +0100 (Wed, 04 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

A tidier implementation of Rob's fix to Break Contig. There already
existed a function to update the contig cached nseq/nanno values.

------------------------------------------------------------------------
r2979 | jkbonfield | 2012-07-04 15:18:27 +0100 (Wed, 04 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Fixed missing prototype.

------------------------------------------------------------------------
r2978 | jkbonfield | 2012-07-04 15:18:04 +0100 (Wed, 04 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Fixed potential issue with using add_pads(). This can modify the
contig and so change the contig pointer (via cache_rw), but the
calling function (align) was using cache_decr on the original pointer.

------------------------------------------------------------------------
r2977 | jkbonfield | 2012-07-04 15:16:30 +0100 (Wed, 04 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed minor compiler warnings.

------------------------------------------------------------------------
r2976 | daviesrob | 2012-06-22 09:18:07 +0100 (Fri, 22 Jun 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Ensure contig seq/refpos/anno counts are up to date in break_contig.
------------------------------------------------------------------------
r2975 | jkbonfield | 2012-06-21 12:47:21 +0100 (Thu, 21 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Typo in error report for nrefpos.

------------------------------------------------------------------------
r2974 | daviesrob | 2012-06-21 12:24:25 +0100 (Thu, 21 Jun 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Fixed bug in cache_dup.  It was returning the wrong pointer for sub-records
that has already been duplicated if the pointer to the original was passed in.
It now returns the pointer to the copy instead.

------------------------------------------------------------------------
r2973 | jkbonfield | 2012-06-20 12:35:21 +0100 (Wed, 20 Jun 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added memory cache vs disk checks for GT_ContigBlock type.
This avoids the "rec %d of type 26 mismatches" error messages.

------------------------------------------------------------------------
r2972 | awhitwham | 2012-06-18 14:59:44 +0100 (Mon, 18 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc

Save "Group By" settings added. 

------------------------------------------------------------------------
r2971 | awhitwham | 2012-06-15 12:21:24 +0100 (Fri, 15 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_struct.h

Added a hash value to the group by sequence function in order to group
the non matching similar sequences together.

------------------------------------------------------------------------
r2970 | awhitwham | 2012-06-14 12:42:53 +0100 (Thu, 14 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

More group by selection.  On a right to left selection the start is
now before the end.  Stops the program trying to allocate negative
memory.

------------------------------------------------------------------------
r2969 | awhitwham | 2012-06-14 12:20:32 +0100 (Thu, 14 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Changed the group by selection to act like the other options and no
longer needs to be chosen from the selection right click menu. Should
have been added to the last commit.

------------------------------------------------------------------------
r2968 | awhitwham | 2012-06-14 12:16:39 +0100 (Thu, 14 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Changed the group by selection to act like the other options and no
longer needs to be chosen from the selection right click menu.

------------------------------------------------------------------------
r2967 | daviesrob | 2012-06-11 17:19:29 +0100 (Mon, 11 Jun 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Remember to check incr_avalue when testing if bin seq/repos/anno
counts need to be updated
------------------------------------------------------------------------
r2966 | jkbonfield | 2012-05-30 12:32:44 +0100 (Wed, 30 May 2012) | 22 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Merged multiple GT_Contig records into a single GT_ContigBlock.
Internally contigs are still fetched by individual cache_search(io,
GT_Contig, crec) calls but like SeqBlock and AnnoEleBlock this
populates 1024 entries at a time.

For backwards compatibility reasons this is only done on databases
with version 5 or higher (previous was v4). To create databases
compatible with the old gap5 use "tg_index -v 4".

This dramatically reduces the I/O load on bringing up the contig
selector. To further reduce I/O for the List Contigs window I also
copied the nseqs, nanno and nrefpos fields from the root bin into the
contig_t struct too.

At the same time I also added placeholders for future work so the
format doesn't (hopefully) change too much. [Be warned: even if it
does I won't boost the database version number unless I've pushed a
new public release out since the initial v5 mods.]  These include
adding flags and clipped_start/end to contigs (currently flag is never
set to indicate validity) and parent scaffold records to contigs and a
scaffold order to database_t.

------------------------------------------------------------------------
r2965 | jkbonfield | 2012-05-30 12:16:15 +0100 (Wed, 30 May 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/g-request.c

Removed bogus seek calls to pos -4 caused by image being zero instead
of G_NO_IMAGE. I'm not sure when this occurs, but we know 0 is invalid
too as that will be the file header.

------------------------------------------------------------------------
r2964 | jkbonfield | 2012-05-24 17:51:13 +0100 (Thu, 24 May 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Added code to range_populate() when sorting by clipped sequence
end. If a sequence overlaps the start..end range but after clipping it
does not, throw it away so we deal with it later.

The reason for this is it was providing out of order sorting between
one bucket of data in from range_populate and the next bucket of data
in range_populate, causing iterators to give incorrect ordering. This
in turn shows up as contig holes leading to erroneous contig
breaking around sequences with long cutoff regions.

------------------------------------------------------------------------
r2963 | jkbonfield | 2012-05-15 16:48:39 +0100 (Tue, 15 May 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed analysis of template status.

For the contig editor, via sequence_get_template_info(), we now
consider TEMPLATE_ORIENT as a valid return status.

For the template display, fixed a bug where assumptions were that
r1->comp and r2->comp would be identical. This meant templates
spanning bins could sometimes be considered in the wrong
orientation. We now correct the COMP1 and COMP2 flags taking this into
account.

------------------------------------------------------------------------
r2962 | jkbonfield | 2012-05-15 16:43:44 +0100 (Tue, 15 May 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tkEditor.c

Cosmetic improvements to template status colours, to make the contrast
easier for those with poor colour vision.

------------------------------------------------------------------------
r2961 | jkbonfield | 2012-05-14 15:29:09 +0100 (Mon, 14 May 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/tclIndex

Renamed bwa dbwtsw as bwa bwasw, in accordance with the renaming in
bwa itself (thank goodness!).

Also added an option to specify an output filename. When set this
outputs unmapped sequences to a new fasta or fastq file to allow
subsequent analysis or import as single-read contigs,.

------------------------------------------------------------------------
r2960 | jkbonfield | 2012-05-10 17:46:47 +0100 (Thu, 10 May 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Fixed tg_index -g mode. This loads a SAM file that has been aligned
against a depadded consensus sequence. It didn't take into
consideration that the contig may not start at base 1. (It now does.)

------------------------------------------------------------------------
r2958 | jkbonfield | 2012-04-20 17:21:15 +0100 (Fri, 20 Apr 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h

Sped up Disassemble Readings by delaying a lot of the consistency
updates until after all the reads have been removed.

This involved creating a replacement for bin_remove_item_from_bin()
called fast_remove_item_from_bin() as well as bulk identifying
annotations for sets of reads instead of individual reads and delaying
of fixing contig start/end values.

Also sped up the bin_get_item_position() function when sequences are
used; it can utilise the seq->bin_index field to prevent a full bin
search.

------------------------------------------------------------------------
r2957 | jkbonfield | 2012-04-20 17:14:52 +0100 (Fri, 20 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/vlen.c

Support for long long via %lld. This is automatically generated on
32-bit machines when using %"PRId64".

------------------------------------------------------------------------
r2956 | awhitwham | 2012-04-20 12:04:04 +0100 (Fri, 20 Apr 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tkEditor.c

Added group by sequence.  This uses niave match scoring but should be good enough for proof of concept.

------------------------------------------------------------------------
r2955 | jkbonfield | 2012-04-19 16:34:41 +0100 (Thu, 19 Apr 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tg_tcl.c

Added the ability to show tags in the contig selector.

Performance is adequate, but not great. On a database with ~1000
contigs and ~1000 tags it adds 6-7s. With ~400,000 tags it adds 12s or
so. (The initial bulk time is due to scanning bins.)

By default tags are not shown.

------------------------------------------------------------------------
r2954 | daviesrob | 2012-04-19 12:22:35 +0100 (Thu, 19 Apr 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_tcl.c

Rewrote code to dump the bin structure as a postscript file.  Also added a dump_graph version that outputs graphviz format.
------------------------------------------------------------------------
r2953 | jkbonfield | 2012-04-17 15:21:00 +0100 (Tue, 17 Apr 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tkEditor.h
   M /staden/trunk/src/tk_utils/xcombobox.tcl

Added the ability to switch between multiple lists for selecting reads
in the contig editor. For fast use, the list name and number of
elements in the list are visible in the editor tool bar. New lists can
be created simply by typing in a new name.

A little oddly, the displayed list size is also a menubutton allowing
actions to load, save, delete and clear. I'm open to ideas on more
conventional UI wisdom for how to manage this in a compact manner.

Also added a -postcommand to the emulated combobox, needed for this UI.

------------------------------------------------------------------------
r2952 | jkbonfield | 2012-04-16 12:34:38 +0100 (Mon, 16 Apr 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEdNames.c

Added Shift+B1 binding for the contig editor names panel for bulk
selection of sequences.

This only acts in the vertical orientation. An attempt to select,
scroll in X and then shift+click will be ignored as this is an
altogether trickier operation (if not impossible) to complete.

------------------------------------------------------------------------
r2951 | jkbonfield | 2012-04-13 15:11:53 +0100 (Fri, 13 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Bug fix to editor_return function. It wasn't changing the status line
due to non-global variable access.

------------------------------------------------------------------------
r2950 | jkbonfield | 2012-04-13 14:56:05 +0100 (Fri, 13 Apr 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Added a "Template Display" entry to the Commands menu in the contig
editor. This brings up the standard template display centred on the
current editor x-view location.

------------------------------------------------------------------------
r2949 | jkbonfield | 2012-04-13 11:53:30 +0100 (Fri, 13 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tag_editor.tcl

Fixed an issue with copy/move tags when no region has been selected.
This now follows gap4 behaviour and copies or moves to a single bp tag.

------------------------------------------------------------------------
r2948 | jkbonfield | 2012-04-13 10:55:31 +0100 (Fri, 13 Apr 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/utils.tcl

Fixed insertion and deletion impact on tags, with correctly working
Undo too.

This also involved adding an lprepend analogue to the lappend function.

------------------------------------------------------------------------
r2947 | jkbonfield | 2012-04-11 12:45:08 +0100 (Wed, 11 Apr 2012) | 17 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Found a cause of consensus caching to sometimes use different bins,
causing unnecessary work.

Even when we have a fully cached consensus, updated by doing "Save
consensus" for all contigs, asking for smaller ranges of consensus (eg
search by consensus quality) would sometimes return a different set of
bins to hold the cached consensus, causing recomputation of the
consensus again.

The cause is that the function returns the first (ie largest) bins
within a range smaller than a fixed size (100Kb). If we have a bin
with only one child node to the right, then on a full range query that
child node may be returned, but on a smaller range query it may be
excluded and the parent node is instead returned.

The code now explictly checks for this case and filters such bins.

------------------------------------------------------------------------
r2946 | jkbonfield | 2012-04-10 17:41:36 +0100 (Tue, 10 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/xentry.tcl

Fixed missing brace in xentry (sorry for not checking the KP_Enter
binding fix).

------------------------------------------------------------------------
r2945 | jkbonfield | 2012-04-10 12:36:10 +0100 (Tue, 10 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_bin.c

Improvements to editor delete vs backspace code. Also fixed a
rare data consistency error when removing data from bins.

------------------------------------------------------------------------
r2944 | jkbonfield | 2012-04-05 14:08:10 +0100 (Thu, 05 Apr 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added several key bindings for inserting and deleting while keeping
the right side of the alignment stationary. These are Shift + key, eg
shift-Backspace, shift-Delete, shift-Insert.

Also added a control-z binding for Undo.

------------------------------------------------------------------------
r2943 | jkbonfield | 2012-04-05 09:58:55 +0100 (Thu, 05 Apr 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tag_editor.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added Copy and Move functionality to the Tag Editor, as in Gap4.

These even allow moving and copying of tags between editors.

------------------------------------------------------------------------
r2942 | jkbonfield | 2012-04-03 16:59:52 +0100 (Tue, 03 Apr 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added KP_Enter binding for position panel (in addition to existing
Return key binding).

Changed Delete key to delete under the cursor and not move, vs remove
from left of cursor and move for Backspace.

Added functionality to move pads left and right with Control-L and
Control-R.  For those that like to live dangerously, bases can also be
moved if you use Alt-L and Alt-R bindings.

------------------------------------------------------------------------
r2941 | jkbonfield | 2012-04-03 16:57:55 +0100 (Tue, 03 Apr 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/tk_utils/entrybox.tcl
   M /staden/trunk/src/tk_utils/xentry.tcl

Added keypad Enter key bindings where we bound to Return key.

------------------------------------------------------------------------
r2940 | jkbonfield | 2012-04-03 09:56:21 +0100 (Tue, 03 Apr 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap4/editor_search.tcl

https://sourceforge.net/tracker/?func=detail&aid=3276158&group_id=100316&atid=627060

Added patch from Bastien to bind Control-S "next search" in search window.

------------------------------------------------------------------------
r2939 | jkbonfield | 2012-04-02 14:44:41 +0100 (Mon, 02 Apr 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.tcl

Use =rec syntax for All Contigs list to work around broken contig indices
------------------------------------------------------------------------
r2938 | jkbonfield | 2012-04-02 14:44:12 +0100 (Mon, 02 Apr 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Changes to handle nasties with SAM cigar strings starting in I or P
operators (or I/P after S/H).

Also fixed output to cope with these cases too.

------------------------------------------------------------------------
r2937 | jkbonfield | 2012-03-29 17:52:01 +0100 (Thu, 29 Mar 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c

Fixed issues with zero length template names. These were used in FASTA
import, but they caused oddities in SAM export and some other formats
where we ended up with a blank read name and the entire name being
fitted into the FS:Z: field. (Fixed in both import and export code.)

Also changed the default SAM/BAM quality values to be 2, from 0.

------------------------------------------------------------------------
r2936 | jkbonfield | 2012-03-28 09:44:49 +0100 (Wed, 28 Mar 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed an issue with consensus caching. We identify that a specific bin
misses a cached consensus sequence and compute it, but then use
bin_add_range to add it instead of bin_add_to_range. This meant that
after joining where we can have multiple bins spanning the same
physical coordinates that we could be piling up duplicate consensus
sequences in one bin due to failing to find them in another.

------------------------------------------------------------------------
r2935 | jkbonfield | 2012-03-27 16:40:05 +0100 (Tue, 27 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

More bin_set_used_range() calls - missed out in the earlier commit?

------------------------------------------------------------------------
r2934 | jkbonfield | 2012-03-27 16:39:23 +0100 (Tue, 27 Mar 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c

Fixed sequence orientation bugs.

One is in the editor view where "<<" and ">>" were reported in the
information line incorrectly on complemented contigs.

The other is more serious and in the export to SAM code. It was
incorrectly setting the orientation flags. This mean exporting a
"--> <--" pair in a complemented contig and re-importing turned them
into a "<-- -->" pair, showing up as red in the template display.

------------------------------------------------------------------------
r2933 | jkbonfield | 2012-03-27 16:37:31 +0100 (Tue, 27 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed some editor cursor starting positions. When bringing up the
editor on a specific sequence, it should now be visible.

------------------------------------------------------------------------
r2932 | jkbonfield | 2012-03-27 10:28:29 +0100 (Tue, 27 Mar 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h

Further bug fixes to reference position handling, discovered by the
million monkeys script. We now have a new function
bin_set_used_range() that brute force iterates through bin contents
and sets start_used and end_used fields. We call this any time we
remove something from the bin that also happens to be at the current
start_used or end_used boundaries (meaning it *may* require a
change).

Also fixed a bug in contig_delete_base_fix(). It needed to recurse
down with +1 on the bin extents, as this corresponds to the refpos
edits applied elsewhere.

------------------------------------------------------------------------
r2931 | jkbonfield | 2012-03-23 16:12:59 +0000 (Fri, 23 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/tg_bin.c

More refpos & bin range bug fixes, including a fix to the last
fix. (Checking nrefpos==0 is not sufficient as it is hierarchical - an
empty bin may has full child bins.)

------------------------------------------------------------------------
r2930 | jkbonfield | 2012-03-23 11:52:26 +0000 (Fri, 23 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Further fix to contig_remove_refpos_markers() called when making
joins.  As per previous fix, but note that removing a refpos marker
that is the first or last thing in a bin also means we have to adjust
the start_used and end_used too.

------------------------------------------------------------------------
r2929 | jkbonfield | 2012-03-23 11:24:57 +0000 (Fri, 23 Mar 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Fix for a bug causing "bin 1741: used start/end range are incorrect"
style errors from Check Database.

When we remove the last reference position marker from a bin and there
is nothing else in the bin either, we now zero the start/end range to
mark the bin as empty.

------------------------------------------------------------------------
r2928 | jkbonfield | 2012-03-23 11:24:00 +0000 (Fri, 23 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Improvements to cope with data corruptions better.

------------------------------------------------------------------------
r2927 | jkbonfield | 2012-03-23 11:23:20 +0000 (Fri, 23 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Minor output tidyup
------------------------------------------------------------------------
r2926 | jkbonfield | 2012-03-22 17:51:32 +0000 (Thu, 22 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed tag corruption in disassemble readings. Consensus annotations
that are shared between original and new contigs had their tag type
and direction fields swapped, causing errors.

------------------------------------------------------------------------
r2925 | jkbonfield | 2012-03-22 09:28:54 +0000 (Thu, 22 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/fij.c

A couple more minor tweaks to stop compiler whinges - shouldn't affect
any actual code paths.

------------------------------------------------------------------------
r2924 | jkbonfield | 2012-03-21 16:33:40 +0000 (Wed, 21 Mar 2012) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap-error.c
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/hache_table.c
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/qual.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tk-io-reg.c

Code tidy up, looking at various gcc -W warning output and complaints
from the \
clang static analyser.

Most are warnings about things that cannot happen, incorrect
handling of error cases that "should not" happen, or just warnings
about pointless code and unused variables. A few are genuine:

- The (currently unused) uniqueness plot access uninitialised memory
  in var W.

- Various verror calls using strings which could contain %s and fail
  (but I don't think they were exploitable and under user control).



------------------------------------------------------------------------
r2923 | daviesrob | 2012-03-20 17:34:02 +0000 (Tue, 20 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Sort cached_items forwards by record_number instead of backwards by view
in cache_flush.  This puts the file contents in a more sensible order when
building the database.

------------------------------------------------------------------------
r2922 | jkbonfield | 2012-03-20 17:31:44 +0000 (Tue, 20 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/zfio.h

Fixed an error with using gzFile* instead of gzFile. This didn't
matter in zlib 1.2.5 and before as all function prototypes took a void
pointer for this argument. With zlib-1.2.6 this is now a structure and
so now producing errors.

------------------------------------------------------------------------
r2921 | jkbonfield | 2012-03-16 17:19:08 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Protect against alignments of nul data.

------------------------------------------------------------------------
r2920 | jkbonfield | 2012-03-16 17:18:46 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Protect against zero length reads.

------------------------------------------------------------------------
r2919 | jkbonfield | 2012-03-16 17:18:29 +0000 (Fri, 16 Mar 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c

Bug fixes to the ACE format reading code.

It now handles (ie ignores instead of choking) WR{} records.

It also now spots left/right clip points as both -1 and discards such
entries and unaligned data.

Finally it handles the lack of DS lines. Previously it added reads
when seeing a DS line. Now it adds reads when it sees either a new CO
or RD line so the lack of DS lines does not mean a total lack of
imported data.

------------------------------------------------------------------------
r2918 | jkbonfield | 2012-03-16 17:14:30 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Removal of debugging.

------------------------------------------------------------------------
r2917 | jkbonfield | 2012-03-16 12:31:49 +0000 (Fri, 16 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/maq.c

Removed a rogue free statement. I'm not sure why this didn't die
before, but we haven't tested maq support for a couple of years.

------------------------------------------------------------------------
r2916 | jkbonfield | 2012-03-16 12:31:25 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/restriction_enzymes.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_cache.c

Fixed various %d vs %"PRIrec" issues.

------------------------------------------------------------------------
r2915 | jkbonfield | 2012-03-16 12:30:41 +0000 (Fri, 16 Mar 2012) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_struct.h

Fixed various losses in the name and contig indices. The bug was that
when creating a new root node, we did not always spot this and left
the old db->contig_index and db->seq_name_index pointing to the
original root node. This has the effect of removing data from the
tree. Both insert and delete could cause this. 

Note we did sometimes update correctly, it was just omitted in a few
places.

Related to this was the fact that deletion never returned the root
correctly (but it's a rare issue) and both insert/delete were
returning int instead of tg_rec.

------------------------------------------------------------------------
r2914 | jkbonfield | 2012-03-12 16:42:10 +0000 (Mon, 12 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap4_compat.tcl

Fixed a minor memory leak in the consensus algorithm.

Fixed another memory leak (potentially very large) in the Tcl code
for cname2crec when faced with a database with a corrupted B-Tree.

------------------------------------------------------------------------
r2913 | jkbonfield | 2012-03-12 10:23:20 +0000 (Mon, 12 Mar 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c

Fixed some B+Tree update errors when dealing with large numbers of
duplicate strings (more than an entire nodes worth).

Fixed a tree error when updating the parent after a deletion of the
right-most entry in a node. I'm not sure if this was capable of
recreating the issues users sometimes see (entries going missing from
the tree), but it's an inconsistency which may lead to more errors
downstream.

Also improved debugging with -DTEST_MAIN.

------------------------------------------------------------------------
r2912 | jkbonfield | 2012-03-12 10:20:11 +0000 (Mon, 12 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed potential uninitialise memory access in update_io(). The effect
was harmless though - it would sometimes write data back to disc that
didn't need to be written as it had not changed.

------------------------------------------------------------------------
r2911 | jkbonfield | 2012-03-08 11:23:47 +0000 (Thu, 08 Mar 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed an illegal cache_decr call if edGetBriefSeq() is called with a
nul format string (not really a valid case).

Also fixed the %*.*c printf argument case. Precision (the .* bit) is
not permitted in %c expansion.

------------------------------------------------------------------------
r2910 | jkbonfield | 2012-03-08 10:32:44 +0000 (Thu, 08 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed simple_sort_by_base() error when given broken input (if the
records are not sequences it accessed uninitialised memory).

------------------------------------------------------------------------
r2909 | jkbonfield | 2012-03-08 10:15:59 +0000 (Thu, 08 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed a bug spotted by Rob, via clang.

In build_malign, the recent code to handle zero length sequences was
using an uninitialised variable in the fix-up.

------------------------------------------------------------------------
r2908 | jkbonfield | 2012-03-07 15:21:50 +0000 (Wed, 07 Mar 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

Fixed a bug in the editor Sequence Search. It was failing to correctly
record the best match position for sequences that overlapped the
starting position of the search range.

Similarly fixed reverse searches.

------------------------------------------------------------------------
r2907 | jkbonfield | 2012-03-02 16:26:59 +0000 (Fri, 02 Mar 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Warning: I'm not *100%* certain this is correct!

Swapped the unlock and commit calls during the flush procedure.
Previously this was causing B+Tree writes to be auto-flushed giving
lots of index updates. Now they'll also be appended on the "to flush"
list due to the lock and updated in one step along with the other
records recently written. The theory was to improve performance, but
I'm not sure it makes much difference.


------------------------------------------------------------------------
r2906 | jkbonfield | 2012-03-02 16:25:14 +0000 (Fri, 02 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c

More frequent flushing of B+Tree to reduce max memory usage
------------------------------------------------------------------------
r2905 | jkbonfield | 2012-03-02 16:24:13 +0000 (Fri, 02 Mar 2012) | 3 lines
Changed paths:
   A /staden/trunk/src/tk_utils/console.tcl
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/text_output.tcl

Replaced the Console mode with newer code (triggered by typing "con"
into the error window).

------------------------------------------------------------------------
r2904 | jkbonfield | 2012-03-02 16:23:23 +0000 (Fri, 02 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/select_contig.tcl
   M /staden/trunk/src/tk_utils/scalebox.tcl

Fixed the setting of the contig start/end range in the contig ID
selector. This sometimes worked, but not in all cases. Now it should
always use the visible start/end coordinates.

------------------------------------------------------------------------
r2903 | jkbonfield | 2012-03-02 16:21:41 +0000 (Fri, 02 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Improved warning messages to the user
------------------------------------------------------------------------
r2902 | jkbonfield | 2012-03-02 16:21:25 +0000 (Fri, 02 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c

Fixed illegal cache_decr in error handling code (so not normally
triggered). 

------------------------------------------------------------------------
r2901 | jkbonfield | 2012-03-02 16:20:46 +0000 (Fri, 02 Mar 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Faster implementation of Delete Contig. The code to unlink other
sequences from ones we have deleted has an additional sort step to
iterate through sequences in order, to reduce disc thrashing. It also
periodically flushes and reports progress.


------------------------------------------------------------------------
r2900 | jkbonfield | 2012-03-02 16:17:59 +0000 (Fri, 02 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_export.tcl

Protect against broken name B+Tree by operating on =number contig
list by default.

------------------------------------------------------------------------
r2899 | daviesrob | 2012-03-02 13:59:46 +0000 (Fri, 02 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   A /staden/trunk/src/gap5/editor_join.h
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/gap4_compat.h
   M /staden/trunk/src/gap5/gap_canvas_box.c
   M /staden/trunk/src/gap5/init.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/restriction_enzymes.c
   M /staden/trunk/src/gap5/restriction_enzymes.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/stack_dump.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_tcl.h
   M /staden/trunk/src/gap5/tk-io-reg.c
   M /staden/trunk/src/gap5/tkAppInit.c

Fixed lots of implicit function declarations
------------------------------------------------------------------------
r2898 | daviesrob | 2012-03-01 17:13:51 +0000 (Thu, 01 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Fixed accidental assignment in if statement
------------------------------------------------------------------------
r2897 | jkbonfield | 2012-02-24 17:28:57 +0000 (Fri, 24 Feb 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Protect against negative or zero length sequences. The assertion has
simply been replaced by code that fixes the errors.

------------------------------------------------------------------------
r2896 | jkbonfield | 2012-02-16 12:12:59 +0000 (Thu, 16 Feb 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/search.tcl

Now with improved error reporting.

------------------------------------------------------------------------
r2895 | jkbonfield | 2012-02-16 12:08:19 +0000 (Thu, 16 Feb 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/search.tcl

Protect against crashes when trying to bring double click on a
hyperlinked contig that no longer exists.

------------------------------------------------------------------------
r2894 | jkbonfield | 2012-02-16 12:07:18 +0000 (Thu, 16 Feb 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Protect against attempts to read contigs via location in contig order
when using a child I/O.

------------------------------------------------------------------------
r2893 | jkbonfield | 2012-02-16 12:06:43 +0000 (Thu, 16 Feb 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/fij.tcl

Implemented the hidden data search mode of FIJ.

Removed from the GUI the unimplemented mask/mark parameters.

------------------------------------------------------------------------
r2892 | jkbonfield | 2012-02-13 16:23:23 +0000 (Mon, 13 Feb 2012) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/gap5rc

Fixed a bug in remove_contig_holes() called by Break Contig and
Disassemble Readings. When remove_contig_holes() found a hole and
called break_contig it was incorrectly checking the return code,
causing falsely reported failures.

On a related topic I also changed Break Contig in the contig editor to
default to not removing holes. This can be overridden by modifying the
CONTIG_EDITOR.REMOVE_HOLES setting in ~/.gap5rc.

------------------------------------------------------------------------
r2891 | jkbonfield | 2012-02-09 15:29:43 +0000 (Thu, 09 Feb 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/import_gff.c

Made the GFF import more liberal when facing percent escaping that is
invalid. Ie %xx where x are not hex digits will just treat it as
unescaped text instead (which is typically output from a badly coded
GFF generator).

------------------------------------------------------------------------
r2890 | jkbonfield | 2012-02-08 17:29:26 +0000 (Wed, 08 Feb 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/contig_extend.c
   A /staden/trunk/src/gap5/contig_extend.h
   A /staden/trunk/src/gap5/contig_extend.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex

Added the implementation of the Extend Contigs function.

This looks into the cutoff data at the ends of contigs and where the
bulk of cutoff data aligns with each other it is unclipped and the
contig extended.

------------------------------------------------------------------------
r2889 | jkbonfield | 2012-02-03 12:39:33 +0000 (Fri, 03 Feb 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Export to fastq now automatically strips pads. If users request then
this could be made optional, but it seems logical that the use of
fastq export is to realign data again so pad stripped makes most
sense.

------------------------------------------------------------------------
r2888 | jkbonfield | 2012-02-03 12:38:39 +0000 (Fri, 03 Feb 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Bug fix to the fix mode of Check Contig. It was failing to correct
contig annotations that overlapped the end of the consensus, due to
changing the bin to uninitialised values.

------------------------------------------------------------------------
r2887 | jkbonfield | 2012-02-03 12:37:46 +0000 (Fri, 03 Feb 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed typo in error message
------------------------------------------------------------------------
r2886 | jkbonfield | 2012-02-03 12:37:27 +0000 (Fri, 03 Feb 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h

Fixed the %d operator in the editor sequence information line.

This is for the direction of a read, but it was giving the same data
as sense (ie complemented or not). Now we can get +>> -<< as well as
->> +<< combinations to indicate whether a sequence is the 1st or 2nd
in a pair.

------------------------------------------------------------------------
r2885 | jkbonfield | 2012-01-31 17:26:59 +0000 (Tue, 31 Jan 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c

First draft of editor Realign Selection function.

This takes a region of a sequence and realigns it against the
consensus, editing sequence and/or consensus accordingly. It also
adjusts the cutoff regions to make any selection visible if
appropriate.


------------------------------------------------------------------------
r2884 | jkbonfield | 2012-01-27 14:44:17 +0000 (Fri, 27 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Robustness improvement - handle more cases of xx->r == NULL. (Why is
this happening?)

------------------------------------------------------------------------
r2883 | jkbonfield | 2012-01-27 14:43:57 +0000 (Fri, 27 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c

Improved debugging and thrash/test code.

------------------------------------------------------------------------
r2882 | jkbonfield | 2012-01-24 12:32:11 +0000 (Tue, 24 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/README.build

Information to help those on broken RedHat based systems.

------------------------------------------------------------------------
r2881 | jkbonfield | 2012-01-23 17:27:35 +0000 (Mon, 23 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/mutscan/Makefile
   M /staden/trunk/src/tracediff/Makefile

Fixed the order of library linking so that these programs link on
Ubuntu 11.10.

------------------------------------------------------------------------
r2880 | jkbonfield | 2012-01-20 11:28:09 +0000 (Fri, 20 Jan 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

edview_search_position() on a contig position failed if the cursor was
not on the consensus as it thought the contigs mismatched.

We now correctly check against xx->cnum instead xx->cursor_rec.

------------------------------------------------------------------------
r2879 | jkbonfield | 2012-01-19 09:10:36 +0000 (Thu, 19 Jan 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/staden.profile

Allow for GTAGDB to be specified before sourcing staden.profile
instead of simply overriding it.

[The change of the wrapper scripts to call this file directly instead
of each replicating parts of each removed the ability to override
several variables.]

------------------------------------------------------------------------
r2878 | jkbonfield | 2012-01-18 14:52:38 +0000 (Wed, 18 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Protect against tmpnam + open failing. (Race condition?).

I've seen this happen, but cannot explain why.

------------------------------------------------------------------------
r2877 | jkbonfield | 2012-01-18 14:51:56 +0000 (Wed, 18 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Improved reliability in the face of contigs that fail to be read. This
is important as gap5_export + tg_index together form a database fixer.

------------------------------------------------------------------------
r2876 | jkbonfield | 2012-01-18 14:45:27 +0000 (Wed, 18 Jan 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/tg_iface_g.c

Added code to initialise template name length in maq and fasta
import. This was giving random values which caused exports to die.

We now check for sane values when loading a seq_block and reinitialise
if appropriate to recover from past mistakes.

------------------------------------------------------------------------
r2875 | jkbonfield | 2012-01-16 11:56:34 +0000 (Mon, 16 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/tg_contig.c

Improved error handling for when sequence records fail to load.

------------------------------------------------------------------------
r2874 | jkbonfield | 2012-01-16 11:40:32 +0000 (Mon, 16 Jan 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tclIndex

Fixed export contigs to cope with a broken contig name B+Tree. I'm not
sure what is corrupting this tree, but when faced with a large number
of contigs not in the tree two main issues occured:

1) We couldn't export all contigs. We now generate a contig list of
"=rec ..." instead of "name ...", completely avoiding the lookup to
the index.

2) The contig uniqness part in lget_contig_num ironically introduced a
duplicate if any contigs returned 0 for their name lookup.


------------------------------------------------------------------------
r2873 | jkbonfield | 2012-01-12 12:28:53 +0000 (Thu, 12 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added code to fix tags that are extended beyond the bounds of the item
they annotate.

------------------------------------------------------------------------
r2872 | jkbonfield | 2012-01-12 12:05:16 +0000 (Thu, 12 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/init.c

Further fix needed to make tg_index work after the "new_contigs" list
addition.

------------------------------------------------------------------------
r2871 | jkbonfield | 2012-01-12 12:04:52 +0000 (Thu, 12 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c

Added bounds checking for tags on both import and exported. This
prevents crashes when faced with invalid data and also means that
export+import can act as a way to tidy up inconsistencies.

------------------------------------------------------------------------
r2870 | jkbonfield | 2012-01-12 12:03:44 +0000 (Thu, 12 Jan 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Added a comment to explain some rather obfuscated looking code
------------------------------------------------------------------------
r2869 | jkbonfield | 2012-01-12 12:03:16 +0000 (Thu, 12 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/list_proc.c

Bug fix to recent addition of "new_contigs" list in gap5. It was
breaking tg_index, which runs without a Tcl interpreter and therefore
generated errors when attempting to append to a list.

------------------------------------------------------------------------
r2868 | jkbonfield | 2012-01-10 17:00:45 +0000 (Tue, 10 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/seq_utils/search_utils.c
   M /staden/trunk/src/seq_utils/search_utils.h

Added a new sequence search to the contig editor in gap5. This is like
the consensus search, but on sequences instead (and correspondingly
slower of course).

------------------------------------------------------------------------
r2867 | jkbonfield | 2012-01-10 16:45:19 +0000 (Tue, 10 Jan 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Added a list named "new_contigs". This is automatically appended to
every time the contig_new() function is called, so Break Contig,
Disassemble Readings, Assembly etc all append the new contig names to
this list. It can be cleared at any time to reset it.

------------------------------------------------------------------------
r2866 | jkbonfield | 2012-01-10 16:44:17 +0000 (Tue, 10 Jan 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Changed by user request: disassembling a set of reads where some reads
in the set do not exist in the database will no longer terminate the
disassembly process. Instead it continues and disassembles the ones
that do exist.

------------------------------------------------------------------------
r2865 | jkbonfield | 2012-01-10 15:25:30 +0000 (Tue, 10 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Improve debugging output for Break Contig so we can distinguish which
error case is which.

------------------------------------------------------------------------
r2864 | jkbonfield | 2012-01-09 15:29:47 +0000 (Mon, 09 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tman_interface.c

Fixed crashes in join editor when making a join with the trace display
open.

------------------------------------------------------------------------
r2863 | jkbonfield | 2012-01-09 09:34:14 +0000 (Mon, 09 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_tcl.c

Improved error handling (report err instead of crash).

------------------------------------------------------------------------
r2862 | jkbonfield | 2012-01-06 17:41:17 +0000 (Fri, 06 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Fixed a bug with the initial placement of data in the template
display.

------------------------------------------------------------------------
r2861 | jkbonfield | 2012-01-04 12:28:12 +0000 (Wed, 04 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/system.mk.in

Removed ^ from expr BRE. It was generating warnings on some systems,
and it's not needed either as all BREs are anchored from the start of
the string anyway in expr.

------------------------------------------------------------------------
r2860 | jkbonfield | 2012-01-04 11:58:03 +0000 (Wed, 04 Jan 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/copy_reads/copy_reads.in
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap4/gap4.in
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/gap5.in
   M /staden/trunk/src/gap5/gap5_check.in
   M /staden/trunk/src/gap5/gap5_consensus.in
   M /staden/trunk/src/gap5/gap5_export.in
   M /staden/trunk/src/gap5/tg_index.in
   M /staden/trunk/src/gap5/tg_view.in
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/prefinish/prefinish.in
   M /staden/trunk/src/pregap4/Makefile
   M /staden/trunk/src/pregap4/pregap4.in
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/spin/spin.in
   M /staden/trunk/src/system.mk.in
   M /staden/trunk/src/trev/Makefile
   M /staden/trunk/src/trev/trev.in

Fixed the wrapper scripts to handle STADENROOT having spaces in the
path name.

Added use of the BSD install program instead of cp for the wrapper
scripts. When they're generated from .in they don't automatically get
the execute bit set, so we need to explictly do this while
installing. See system.mk.in for an alternative solution.

------------------------------------------------------------------------
r2859 | jkbonfield | 2012-01-04 11:53:09 +0000 (Wed, 04 Jan 2012) | 1 line
Changed paths:
   M /staden/trunk/src/README.macosx


------------------------------------------------------------------------
r2858 | jkbonfield | 2011-12-15 16:52:16 +0000 (Thu, 15 Dec 2011) | 6 lines
Changed paths:
   A /staden/trunk/src/MacOSX
   A /staden/trunk/src/MacOSX/Gap4.app
   A /staden/trunk/src/MacOSX/Gap4.app/Contents
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Gap5.app
   A /staden/trunk/src/MacOSX/Gap5.app/Contents
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Pregap4.app
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Spin.app
   A /staden/trunk/src/MacOSX/Spin.app/Contents
   A /staden/trunk/src/MacOSX/Spin.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Spin.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Spin.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Trev.app
   A /staden/trunk/src/MacOSX/Trev.app/Contents
   A /staden/trunk/src/MacOSX/Trev.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Trev.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Trev.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/wrapper.c

Added additional components for MacOS X.

Each .app needs a program name in the Contents/MacOS directory (eg
Contents/MacOS/gap5). This will then be redirected to bin/gap5
instead. The source for the program is wrapper.c

------------------------------------------------------------------------
r2857 | jkbonfield | 2011-12-14 16:58:21 +0000 (Wed, 14 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tkTrace.c

Fixed use of setjmp for libpng (required for newer libpng versions).

------------------------------------------------------------------------
r2856 | awhitwham | 2011-12-14 09:38:24 +0000 (Wed, 14 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/windows/wix/splash.bmp

Changed for version b9.

------------------------------------------------------------------------
r2855 | jkbonfield | 2011-12-13 13:54:59 +0000 (Tue, 13 Dec 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/copy_reads/Makefile
   D /staden/trunk/src/copy_reads/copy_reads
   A /staden/trunk/src/copy_reads/copy_reads.in (from /staden/trunk/src/copy_reads/copy_reads:2849)
   M /staden/trunk/src/gap4/Makefile
   D /staden/trunk/src/gap4/gap4
   A /staden/trunk/src/gap4/gap4.in (from /staden/trunk/src/gap4/gap4:2849)
   M /staden/trunk/src/gap5/Makefile
   D /staden/trunk/src/gap5/gap5
   A /staden/trunk/src/gap5/gap5.in (from /staden/trunk/src/gap5/gap5:2849)
   D /staden/trunk/src/gap5/gap5_check
   A /staden/trunk/src/gap5/gap5_check.in (from /staden/trunk/src/gap5/gap5_check:2849)
   D /staden/trunk/src/gap5/gap5_consensus
   A /staden/trunk/src/gap5/gap5_consensus.in (from /staden/trunk/src/gap5/gap5_consensus:2849)
   D /staden/trunk/src/gap5/gap5_export
   A /staden/trunk/src/gap5/gap5_export.in (from /staden/trunk/src/gap5/gap5_export:2849)
   D /staden/trunk/src/gap5/tg_index
   A /staden/trunk/src/gap5/tg_index.in (from /staden/trunk/src/gap5/tg_index:2849)
   D /staden/trunk/src/gap5/tg_view
   A /staden/trunk/src/gap5/tg_view.in (from /staden/trunk/src/gap5/tg_view:2849)
   M /staden/trunk/src/prefinish/Makefile
   D /staden/trunk/src/prefinish/prefinish
   A /staden/trunk/src/prefinish/prefinish.in (from /staden/trunk/src/prefinish/prefinish:2849)
   M /staden/trunk/src/pregap4/Makefile
   D /staden/trunk/src/pregap4/pregap4
   A /staden/trunk/src/pregap4/pregap4.in (from /staden/trunk/src/pregap4/pregap4:2849)
   M /staden/trunk/src/spin/Makefile
   D /staden/trunk/src/spin/spin
   A /staden/trunk/src/spin/spin.in (from /staden/trunk/src/spin/spin:2849)
   M /staden/trunk/src/staden.profile
   M /staden/trunk/src/trev/Makefile
   D /staden/trunk/src/trev/trev
   A /staden/trunk/src/trev/trev.in (from /staden/trunk/src/trev/trev:2849)

Replaced tclsh in the wrapper scripts with @TCLSH_PROG@ coming from
tcl.m4 via autoconf.

Also changed the tg_view and tg_index binaries to be .bin, so as not
to conflict with the wrapper scripts when configuring and building in
the main source directory rather than a subdirectory (recommended).

------------------------------------------------------------------------
r2854 | jkbonfield | 2011-12-13 10:22:06 +0000 (Tue, 13 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap4/template_display.c

Removal of debugging data.

------------------------------------------------------------------------
r2853 | jkbonfield | 2011-12-13 10:09:28 +0000 (Tue, 13 Dec 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/system.mk.in

Improvements to use of svnversion: quoting the result and also a check
for it looking legitimate (starting with a numeric value).

========================================================================
RELEASED 2.0.0b9	

r2852 | jkbonfield | 2011-12-05 12:26:04 +0000 (Mon, 05 Dec 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Changed the Open Database error message to be classified as an error
instead of text output. This means it goes to stderr and/or the error
window.

------------------------------------------------------------------------
r2850 | jkbonfield | 2011-12-05 10:31:10 +0000 (Mon, 05 Dec 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/ReleaseNotes

------------------------------------------------------------------------
r2849 | awhitwham | 2011-12-01 16:32:45 +0000 (Thu, 01 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap4/list_contigs.tcl

Changed to work with tk8.5.

------------------------------------------------------------------------
r2848 | jkbonfield | 2011-12-01 14:14:21 +0000 (Thu, 01 Dec 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Changed bin_invalidate_consensus() to invalidate more bins rather than
just leaf nodes at a fixed size.

This is partly because sometimes contig_bins_in_range returns other
sets of leaf nodes (I'm not sure why), but also because it's safer
this way given bins can and do change size due to edits.

------------------------------------------------------------------------
r2847 | awhitwham | 2011-12-01 12:34:42 +0000 (Thu, 01 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Removed subscript from global that is now illegal in tk8.5

------------------------------------------------------------------------
r2846 | awhitwham | 2011-11-30 16:21:31 +0000 (Wed, 30 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Put in code to deal with DOS text format and file opening changes for Windows.

------------------------------------------------------------------------
r2845 | jkbonfield | 2011-11-29 09:47:58 +0000 (Tue, 29 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed illegal memory access in contig_set_name().

------------------------------------------------------------------------
r2844 | jkbonfield | 2011-11-28 13:55:24 +0000 (Mon, 28 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added gap5_check to distsrc target.

------------------------------------------------------------------------
r2843 | jkbonfield | 2011-11-28 13:55:01 +0000 (Mon, 28 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c

Set maping qual to zero. Previously it was undefined and resulted in
"mapping_qual disagrees with range" from check database.

------------------------------------------------------------------------
r2842 | jkbonfield | 2011-11-28 13:54:33 +0000 (Mon, 28 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_index_common.c

Removed contig_index_update calls as contig_set_name, called by
contig_new, now does this. It was causing double entries in the contig
index.

------------------------------------------------------------------------
r2841 | jkbonfield | 2011-11-25 15:23:41 +0000 (Fri, 25 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Removed "default" as the default tag comment.

------------------------------------------------------------------------
r2840 | jkbonfield | 2011-11-25 15:00:32 +0000 (Fri, 25 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/configure.in

Update to 2.0.0b9

------------------------------------------------------------------------
r2839 | jkbonfield | 2011-11-25 14:58:27 +0000 (Fri, 25 Nov 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c

Improved SAM tag format handling. Previously we ignored all key=value
syntax and just read the data as-is. This is fine for Gap5 given we
don't actually use key=value pairing yet, however it meant gap5 could
output data which other programs may not understand.

Now we always prepend Note= to the annotations so that other tools
aren't confused.

------------------------------------------------------------------------
r2838 | jkbonfield | 2011-11-25 10:44:20 +0000 (Fri, 25 Nov 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Added code to remove quotes from (for example) template lines in CAF
files, which was causing failure messages.

Also added some experimental code to trim template suffixes, where
MIRA's templates almost but not quite match a prefix of the sequence
name.

------------------------------------------------------------------------
r2837 | jkbonfield | 2011-11-24 17:47:08 +0000 (Thu, 24 Nov 2011) | 5 lines
Changed paths:
   D /staden/trunk/src/gap5/IO.h
   D /staden/trunk/src/gap5/IO2.h
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.h
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_oligo.h
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/find_repeats.h
   D /staden/trunk/src/gap5/gap-dbstruct.h
   M /staden/trunk/src/gap5/gap_canvas_box.h
   M /staden/trunk/src/gap5/io_utils.h
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_cmds.h
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/restriction_enzymes.h

Removed defunct Gap4 copies of header files and replaced where
included with appropriate tg_gio or io_utils.h includes.

Removed: IO.h, IO2.h, gap-dbstruct.h

------------------------------------------------------------------------
r2836 | jkbonfield | 2011-11-23 16:51:57 +0000 (Wed, 23 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/ChangeLog
   M /staden/trunk/doc/Makefile
   M /staden/trunk/doc/manual/dependencies
   M /staden/trunk/doc/manual/gap5-t.texi
   M /staden/trunk/doc/manual/gap5_break_contig.png
   A /staden/trunk/doc/manual/gap5_check_ass.png
   A /staden/trunk/doc/manual/gap5_check_database.png
   A /staden/trunk/doc/manual/gap5_check_db-t.texi
   M /staden/trunk/doc/manual/gap5_contig_editor-t.texi
   M /staden/trunk/doc/manual/gap5_contig_editor.names1.png
   M /staden/trunk/doc/manual/gap5_contig_editor.names2.png
   M /staden/trunk/doc/manual/gap5_contig_editor.search.png
   A /staden/trunk/doc/manual/gap5_delete_contigs.png
   M /staden/trunk/doc/manual/gap5_disassembly-t.texi
   M /staden/trunk/doc/manual/gap5_export-t.texi
   M /staden/trunk/doc/manual/gap5_export_sequences.png
   M /staden/trunk/doc/manual/gap5_fij-t.texi
   A /staden/trunk/doc/manual/gap5_fij.dialogue.png
   M /staden/trunk/doc/manual/gap5_list_libraries.png
   A /staden/trunk/doc/manual/gap5_org-t.texi
   A /staden/trunk/doc/manual/gap5_remove_contig_holes.png
   A /staden/trunk/doc/manual/gap5_remove_pad_columns.png
   A /staden/trunk/doc/manual/gap5_shuffle-t.texi
   A /staden/trunk/doc/manual/gap5_shuffle_pads.png
   M /staden/trunk/doc/manual/list_libraries-t.texi
   M /staden/trunk/doc/manual/lists-t.texi
   M /staden/trunk/doc/manual/restrict_enzymes-t.texi
   M /staden/trunk/src/gap5/check_database.tcl
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Updated documentation for gap5.

------------------------------------------------------------------------
r2835 | jkbonfield | 2011-11-22 14:44:49 +0000 (Tue, 22 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/ReleaseNotes


------------------------------------------------------------------------
r2834 | jkbonfield | 2011-11-22 14:42:18 +0000 (Tue, 22 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2833 | jkbonfield | 2011-11-22 14:17:14 +0000 (Tue, 22 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Protect against invalid contig in get_contig_name().

This showed up as a crash when highlighting a sequence name where the
sequence is paired with one that is no longer attached to a contig -
itself a bug in the delete contig code (now fixed).

------------------------------------------------------------------------
r2832 | jkbonfield | 2011-11-22 12:40:23 +0000 (Tue, 22 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Reordered entries in the Edit menu to group contig oriented and
sequence oriented functions. Also renamed Disassemble Contigs as
Delete Contigs and put a warning message in it too as some users
accidentally used this in place of Disassemble Readings.

------------------------------------------------------------------------
r2831 | jkbonfield | 2011-11-22 12:36:30 +0000 (Tue, 22 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

Fixed a bug in backward sequence search. It was failing to handle
block overlaps when scanning backwards meaning a 65 base pattern would
fail to be spotted 1 in 1000 times due to spanning blocks.

------------------------------------------------------------------------
r2830 | jkbonfield | 2011-11-22 12:35:25 +0000 (Tue, 22 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap4/consen.tcl
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Fixed a broken error window in various dialogues that save files.

Also simplified the save consensus option for gap5: no need to select
from the pointless sub-menu.

------------------------------------------------------------------------
r2829 | jkbonfield | 2011-11-17 16:16:19 +0000 (Thu, 17 Nov 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/hash_lib.h

Fixed a bug in align_blocks(). It wasn't resetting gap_pen correctly
in one step.

Also tweaked this to downgrade scores when stitching blocks together,
based on a rough heuristic on the number of mismatches in inter-block
regions.

Reduced the MINMAT parameter from 20 to 12, allowing the sensitive
algorithm to potentially find more hits.

------------------------------------------------------------------------
r2828 | jkbonfield | 2011-11-16 17:11:11 +0000 (Wed, 16 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/gap_restriction_enzymes.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tkEditor.c

Added the ability to rename contigs and change the contig start
location.

This is available by the scripting interface in tg_tcl, and exposed to
the users by Contig editor dialogues.

------------------------------------------------------------------------
r2827 | jkbonfield | 2011-11-16 16:47:13 +0000 (Wed, 16 Nov 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/gap_canvas_box.c
   M /staden/trunk/src/gap5/gap_canvas_box.h
   D /staden/trunk/src/gap5/io-reg.h
   M /staden/trunk/src/gap5/restriction_enzymes.c
   M /staden/trunk/src/gap5/restriction_enzymes.h
   R /staden/trunk/src/gap5/tg_register.h
   M /staden/trunk/src/gap5/tk-io-reg.c

Removed the defunct io-reg.h, which in most places was being included
but ignored due to the correct tg_register.h having replaced it
already.

The exception to this is in restriction_enzymes.c which was only
including the old io-reg.h, and it turns out in doing so was making
some registration handling bugs due to int vs tg_rec on for record
IDs.

Also added RENAME as a registration type. This is sent when a contig
changes name.

------------------------------------------------------------------------
r2826 | jkbonfield | 2011-11-16 10:32:27 +0000 (Wed, 16 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

Fixed edview_search_position to check contig number matches.

(This has the effect of fixing the From File search to skip matches in
other contigs.)

------------------------------------------------------------------------
r2825 | jkbonfield | 2011-11-16 10:03:03 +0000 (Wed, 16 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c

More error checking, this time in anno_ele_add() for when
bin_add_to_range() fails.

I can't yet figure out why this function would fail though, so for now
it just emits a suitable error to aid in bug reporting.

------------------------------------------------------------------------
r2824 | jkbonfield | 2011-11-16 09:57:46 +0000 (Wed, 16 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Attempt to avoid crashes when running out of memory in edview_visible_items().

------------------------------------------------------------------------
r2823 | jkbonfield | 2011-11-16 09:39:03 +0000 (Wed, 16 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Additional check in bttmp_file_open() to see if fdopen fails.  It
appears to have done based on a core dump, but maybe it was simply
malloc failure. Unknown at present.

------------------------------------------------------------------------
r2822 | awhitwham | 2011-11-09 16:35:20 +0000 (Wed, 09 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/depth_track.c

Fixed bug in template depth display due to the inconsistant colour being set to zero.

------------------------------------------------------------------------
r2821 | jkbonfield | 2011-11-07 16:31:04 +0000 (Mon, 07 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Added back the count of the number of sequences indexed in SAM.
Somehow this got lost in a recent update.

------------------------------------------------------------------------
r2820 | jkbonfield | 2011-11-07 12:02:13 +0000 (Mon, 07 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

More unpadded coordinate fixes - this time to consensus_padded_pos()
so it's now the correct analogue to consensus_unpadded_pos().

------------------------------------------------------------------------
r2819 | jkbonfield | 2011-11-04 17:34:04 +0000 (Fri, 04 Nov 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/import_gff.c

Changed unpadded GFF coordinates to agree with the new unpadded coords
in the editor: base 1 is the left base, regardless of where the contig
start coordinate is.

This works well for local users and it matches up with coordinates in
a FASTA file, but may cause issues for people using gap5 in a
reference coordinate system. (Right now this isn't common, if at all,
given there are better viewers for such things. If it becomes a
problem we can revisit this and make the unpadded coordinate start
point optional.)

------------------------------------------------------------------------
r2818 | jkbonfield | 2011-11-04 17:31:28 +0000 (Fri, 04 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Improved error recovery.

------------------------------------------------------------------------
r2817 | jkbonfield | 2011-11-04 16:31:16 +0000 (Fri, 04 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Check Database now correctly fixes bin parenting issues. It was
failing to set BIN_BIN_UPDATED flag so the previous fix was silently
being dropped when flushing to disk.

------------------------------------------------------------------------
r2816 | jkbonfield | 2011-11-04 12:07:14 +0000 (Fri, 04 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c

Replaced RT with CT for consensus tags. I thought I'd already done
this, but it seems I'd merely updated the format and not the type
code. 

------------------------------------------------------------------------
r2815 | jkbonfield | 2011-11-04 10:41:27 +0000 (Fri, 04 Nov 2011) | 1 line
Changed paths:
   A /staden/trunk/src/ReleaseNotes

Don't get too excited - but it's on the way
------------------------------------------------------------------------
r2814 | jkbonfield | 2011-11-03 17:20:20 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2813 | jkbonfield | 2011-11-03 17:00:37 +0000 (Thu, 03 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Better error handling in consensus_valid_range when faced with
corrupted data.

------------------------------------------------------------------------
r2812 | jkbonfield | 2011-11-03 16:37:29 +0000 (Thu, 03 Nov 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h
   M /staden/trunk/src/gap5/tg_tcl.c

Updated to Check Database to fix an observed problem where failure
part way through joining a contig could leave a residual contig
behind, but containing data already corrected linked in to another
contig.

When fixing this we now destroy the contig if we can determine that
the root bin has a two-way linkage with the true parent.

------------------------------------------------------------------------
r2811 | jkbonfield | 2011-11-03 15:15:47 +0000 (Thu, 03 Nov 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Fixed reference count handling in join_contigs().

A user was rarely seeing the right hand contig not being destroyed
after a contig join. The only possible code route I can see for this
happening is cr being freed during one of the plots redrawing via
contig_notify callbacks, and cr memory being reused to point to, say,
a bin object. Then contig_destroy(io, cr->rec) later on fails as the
object isn't valid.

At least I hope that's the cause of that bug... Whatever the case this
is a bug and it's fixed.

------------------------------------------------------------------------
r2810 | jkbonfield | 2011-11-03 14:44:25 +0000 (Thu, 03 Nov 2011) | 33 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Scary change, but I *think* a correct one... It seems to pass my
gap5_thrash tests anyway.

When doing cache_rw on an object from a derived (aka child) io, we use
copy-on-write methods to duplicate the object from the parent io into
the child io. The address we return to the caller is now the child io
object instead. This is implemented via cache_dup(). This is used
within the contig editor to allow for edits to be not live and also to
allow exit without saving.

When incremementing or decrementing the reference count on a child io
object we were previously just working on that object itself. However
the cache_dup function didn't copy the full reference count from the
parent - this is perhaps a bug. Consequentially it's possible to
perform several cache_incr on a read-only object, call cache_rw to get
a new one (now with ref count 1 again), and then cache_decr on the
read-write object and trigger an error due to negative reference
counts.

Rather than attempt to fix this via copying the master ref count
into the child io object, which itself causes other errors, I now do
all reference counting on the master object instead. Hence a
cache_incr or cache_decr on an object in the child io will update the
ref count in the parent io. (This is perhaps not implemented in the
most efficient manner, using a separate cache_search, but if it has
performance issues consider implementing a master pointer to
cached_item struct.)

I believe this is robust given the child io only contains cache_rw
objects and we'll never be wanting to purge from the child - making it
more hash than hache.


------------------------------------------------------------------------
r2809 | jkbonfield | 2011-11-03 14:23:29 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tk_utils/filebrowser.tcl

Bug fix to the 'file does not exist' error dialogue
------------------------------------------------------------------------
r2808 | jkbonfield | 2011-11-03 14:23:09 +0000 (Thu, 03 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.tcl

Protect against some strange case where the bounding box is empty,
perhaps due to firing a scroll event that occurs during redraw.

------------------------------------------------------------------------
r2807 | jkbonfield | 2011-11-03 14:22:32 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Minor cache ref fix
------------------------------------------------------------------------
r2806 | jkbonfield | 2011-11-03 14:22:11 +0000 (Thu, 03 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a bug in Disassemble Contigs - it now unpairs paired reads that
point to one of the disassembled readings.

Also added minor speedup to unlink_read().

------------------------------------------------------------------------
r2805 | jkbonfield | 2011-11-03 11:34:06 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Don't report bin memory/disk conflicts when dealing with known issues of older DB formats
------------------------------------------------------------------------
r2804 | jkbonfield | 2011-11-03 11:32:45 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Added io flush to Disassemble Contigs
------------------------------------------------------------------------
r2803 | jkbonfield | 2011-11-02 17:13:59 +0000 (Wed, 02 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_contig.c

Fixed some shuffle pads bugs where it could produce out of alignment
data (due to incorrectly adjusting clip points) and also trigger
oddities with removing columns of pads when there exists an out of
date cached consensus (having no *).

------------------------------------------------------------------------
r2802 | jkbonfield | 2011-11-02 16:51:05 +0000 (Wed, 02 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

Comment only. (A question about complementing seqs.)

------------------------------------------------------------------------
r2801 | jkbonfield | 2011-11-02 09:54:51 +0000 (Wed, 02 Nov 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed the Join Editor quitting/saving. It was previously only checking
for edits and offering to save in the active contig (with the solid
editor cursor).

This only impacted the join editor where changes were made and then we
decided not to make a join, but to save the changed regardless.

------------------------------------------------------------------------
r2800 | jkbonfield | 2011-11-02 09:53:35 +0000 (Wed, 02 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed edPrevDifference; it was finding a false difference every 1024 bases.

------------------------------------------------------------------------
r2799 | jkbonfield | 2011-11-01 16:48:01 +0000 (Tue, 01 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Check Database in fix mode now clears any consensus cache. This has
been added due to the recent (fortunately short-lived) bug that
sometimes cached Ns in valid consensus bases.

------------------------------------------------------------------------
r2798 | jkbonfield | 2011-11-01 16:47:22 +0000 (Tue, 01 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Fix window title for Remove Pad Columns
------------------------------------------------------------------------
r2797 | jkbonfield | 2011-11-01 14:01:47 +0000 (Tue, 01 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fix to consensus calling for N when reads contain only N.
It previously only did this in certain cases (when flags & CONS_COUNTS
is set). This showed up as cut and pasting of consensus giving A
instead of N.

------------------------------------------------------------------------
r2796 | jkbonfield | 2011-11-01 12:26:18 +0000 (Tue, 01 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Improved speed of fetching consensus when we're in read-only mode and
no consensus cache exists. (Don't bother trying.)

Bug fix to consensus_unpadded_pos(). Now starts from base 1 in all
cases.

------------------------------------------------------------------------
r2795 | jkbonfield | 2011-10-31 17:08:56 +0000 (Mon, 31 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed a bug in Export Contigs to SAM format involving the handling of
template names. It could sometimes cause a crash.

------------------------------------------------------------------------
r2794 | jkbonfield | 2011-10-31 17:08:35 +0000 (Mon, 31 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/break_contig.h
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tg_tcl.c

Added an option to Break Contig at a specific position within the
contig editor.

------------------------------------------------------------------------
r2793 | jkbonfield | 2011-10-26 16:53:16 +0100 (Wed, 26 Oct 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tag_editor.tcl
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_anno.h
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Tag directions are now stored in the database, and can be edited/set
using the Tag Editor within the contig editor.

This required a change of database format, with the master format
number now being 4, meaning that older gap5s will not be able to load
the latest databases (but vice versa is true).

I also added the ability of tg_index to create databases in older
formats. In this case run "tg_index -v 3". However doing so will mean
attempts to set tag strands will silently fail as they cannot be
written back to disc.

------------------------------------------------------------------------
r2792 | jkbonfield | 2011-10-26 12:00:13 +0100 (Wed, 26 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added n/- bindings for editing sequence. Also Insert key for inserting pads.

------------------------------------------------------------------------
r2791 | jkbonfield | 2011-10-26 10:23:18 +0100 (Wed, 26 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/sam_pileup.h

Fixed the tag export format to use ; instead of | for field separators
in CT and PT tags.

Fixed parsing of tags in padded SAM files. It now takes note of
whether a base is explicitly added via cigar-P or implicitly added via
another sequences cigar-I.

------------------------------------------------------------------------
r2790 | jkbonfield | 2011-10-25 14:21:42 +0100 (Tue, 25 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2789 | jkbonfield | 2011-10-25 14:05:08 +0100 (Tue, 25 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed consensus when consisting solely of reads of N. We now force the
consensus to be N too.

Also included some currently unused code for uniqueness testing.

------------------------------------------------------------------------
r2788 | awhitwham | 2011-10-25 11:52:59 +0100 (Tue, 25 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.h

Some code tidying on tg_contig.

------------------------------------------------------------------------
r2787 | jkbonfield | 2011-10-24 16:55:13 +0100 (Mon, 24 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Protect against users trying to create annotations off the ends of
contigs (in the cutoff data).

------------------------------------------------------------------------
r2786 | jkbonfield | 2011-10-24 12:31:49 +0100 (Mon, 24 Oct 2011) | 21 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_join.c

Major join editor bug fix.

When making a join, the first thing the editor does is to save both
contigs. This causes a redraw of both editors and in doing so was
causing the editors to adjust the X scrollbar to ensure the editing
cursor is visible on screen. If the join Lock mode wasn't enable and
the editor cursors weren't both visible this would shift one editor
with respect to the other, immediately before making the join. It
happens so fast you can't see it.

The effect was a catastrophically broken join with sequences out of
alignment.

The fix was changing the REG_LENGTH event callback in the editor to
not request the cursor to be visible when calling $ed set_cursor.

I also added an explicit recalculation of xx->link->lockOffset in
edJoin as it assumes this to be valid, but it appears something
already recomputes this (maybe the save). I left that fix there though
for belt-n-braces extra checking.

------------------------------------------------------------------------
r2785 | jkbonfield | 2011-10-21 12:11:46 +0100 (Fri, 21 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/dis_readings.h
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex

First draft of Disassemble Contigs.

(It works in the limited testing I have time to do before local site
shutdown.)

------------------------------------------------------------------------
r2784 | jkbonfield | 2011-10-20 15:03:21 +0100 (Thu, 20 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Added a bulk trimming function using < and > in the contig editor.

------------------------------------------------------------------------
r2783 | awhitwham | 2011-10-20 14:54:20 +0100 (Thu, 20 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tkEditor.c

Added group by base.  Still some tidying to be done on the grouping code. 

------------------------------------------------------------------------
r2782 | jkbonfield | 2011-10-19 16:46:23 +0100 (Wed, 19 Oct 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Protect against attempts to join a contig to itself.

This was possible if you deliberately brought up the same pair twice
and then made the join in the first one, leaving the second join
editor still in existance with a still functioning Join button.

------------------------------------------------------------------------
r2781 | jkbonfield | 2011-10-19 16:38:37 +0100 (Wed, 19 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Removed the edview->contig cached contig_t. We now always load on
demand using cache_search. This avoids the need to use incr_contig and
decr_contig methods for keeping it up to date when we modify it
somehow. It's perhaps marginally slower, but more robust.

------------------------------------------------------------------------
r2780 | jkbonfield | 2011-10-19 16:37:59 +0100 (Wed, 19 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_oligo.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEdNames.c
   M /staden/trunk/src/gap5/tkEditor.c

Removed the edview->contig cached contig_t. We now always load on
demand using cache_search. This avoids the need to use incr_contig and
decr_contig methods for keeping it up to date when we modify it
somehow. It's perhaps marginally slower, but more robust.

------------------------------------------------------------------------
r2779 | jkbonfield | 2011-10-19 12:28:58 +0100 (Wed, 19 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Protect against malformed data - no longer crashing when a read-pair
record number fails to load.

------------------------------------------------------------------------
r2778 | jkbonfield | 2011-10-19 11:21:48 +0100 (Wed, 19 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_join.c

Fixed redrawing bugs when using the Join Editor and having existing
contig editors on screen for the same contig.

This is mainly a problem of cached xx->contig structs, but I will be
removing these soon I think. This patch is simply to mark the best
version so far with using cached contigs.

------------------------------------------------------------------------
r2777 | jkbonfield | 2011-10-19 09:47:28 +0100 (Wed, 19 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

fix typo
------------------------------------------------------------------------
r2776 | jkbonfield | 2011-10-19 09:47:18 +0100 (Wed, 19 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl

Added "Contigs to readings" function

------------------------------------------------------------------------
r2775 | jkbonfield | 2011-10-18 16:46:57 +0100 (Tue, 18 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Correct the window title of joined editors.

------------------------------------------------------------------------
r2774 | jkbonfield | 2011-10-18 12:02:45 +0100 (Tue, 18 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Added a %B expansion for the sequence information line. This expands
to the bin record number containing the sequence. It is intended to be
used for debugging purposes.

------------------------------------------------------------------------
r2773 | jkbonfield | 2011-10-18 12:02:04 +0100 (Tue, 18 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added the ability to copy and paste contig names as well as reading
names from the editor window. Also rebound <2> to be copy by #number,
with <1> still being "name".

------------------------------------------------------------------------
r2772 | jkbonfield | 2011-10-17 18:09:25 +0100 (Mon, 17 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a bug where we failed to check for empty contigs properly when
removing readings coming from multiple contigs.

------------------------------------------------------------------------
r2771 | jkbonfield | 2011-10-17 18:08:43 +0100 (Mon, 17 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Added No.Annotations field to the copy buffer
------------------------------------------------------------------------
r2770 | jkbonfield | 2011-10-17 18:08:30 +0100 (Mon, 17 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/tg_iface_g.c

Fixed some caching bugs with the B+Tree code, showing up as crashes or
corruptions.

------------------------------------------------------------------------
r2769 | jkbonfield | 2011-10-13 17:05:22 +0100 (Thu, 13 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Bug fix to new SAM exporting:

- Blank tags no longer get an additional '|' character.

- Consensus tags are now sorted correctly, removing the need to use
  samtools sort.

------------------------------------------------------------------------
r2768 | jkbonfield | 2011-10-13 17:04:39 +0100 (Thu, 13 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2767 | jkbonfield | 2011-10-13 16:28:10 +0100 (Thu, 13 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Protect against a crash due to a data error.

I don't know how this can happen yet, but it's possible to have old
data in the cache for a record which no longer exists. This causes
Check Database to explode when verifying the cache against the disk
copies. (Now it just complains and keeps going.)

------------------------------------------------------------------------
r2766 | jkbonfield | 2011-10-13 16:26:45 +0100 (Thu, 13 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Improved contig_name_to_number() to handle #<sequence_rec>.

------------------------------------------------------------------------
r2765 | jkbonfield | 2011-10-13 14:33:05 +0100 (Thu, 13 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/Misc/dstring.c
   M /staden/trunk/src/gap5/sam_index.c

Fixes to the new SAM tag encodings and their URL style escaping.

------------------------------------------------------------------------
r2764 | jkbonfield | 2011-10-12 17:44:57 +0100 (Wed, 12 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/dstring.c
   M /staden/trunk/src/Misc/dstring.h
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Added experimental code for supporting the new tag format within
SAM. Ongoing work - see samtools-devel mailing list.

------------------------------------------------------------------------
r2763 | jkbonfield | 2011-10-12 10:04:58 +0100 (Wed, 12 Oct 2011) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/check_assembly.c
   A /staden/trunk/src/gap5/check_assembly.h
   A /staden/trunk/src/gap5/check_assembly.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/tclIndex

Added Check Assembly to Gap5. It doesn't have the option of Gap4 to
align cutoff data to the consensus, but that is best served in a
different route now. Instead this implementation is simply comparing
used/visible data against the consensus over a window length to find
highly discrepant regions of sequences.

Cutoff plan: I observe lots of places where a whole raft of data
has been clipped back to make it align. For individual sequences this
probably isn't an issue - maybe it's chimeric or poor quality - but if
multiple sequences have been clipped at the same position and the
clipped data matches then it is indicative of a problem such as a
collapsed repeat.

------------------------------------------------------------------------
r2762 | jkbonfield | 2011-10-10 17:16:08 +0100 (Mon, 10 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Extended the read selector/deselector to ask whether we want to select
reads entirely within the range or overlapping the range.

------------------------------------------------------------------------
r2761 | jkbonfield | 2011-10-10 14:32:05 +0100 (Mon, 10 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.h
   M /staden/trunk/src/gap5/readpair.tcl

Find Read Pairs now has an option to filter the results to only
display contig pairings spanned by more than a certain number of
read-pairs.

------------------------------------------------------------------------
r2760 | jkbonfield | 2011-10-10 14:30:29 +0100 (Mon, 10 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl

The contig editor now has functions to select and deselect all
sequences at a particular consensus column (or range).

------------------------------------------------------------------------
r2759 | jkbonfield | 2011-10-10 14:29:23 +0100 (Mon, 10 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2758 | jkbonfield | 2011-10-07 14:34:25 +0100 (Fri, 07 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/gap5rc

Added "depth <" and "depth >" searches in the contig editor.

------------------------------------------------------------------------
r2757 | jkbonfield | 2011-10-07 12:23:44 +0100 (Fri, 07 Oct 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

When displaying the editor we now call update_library_stats regularly
on reads with libraries in order to check consistency. This in turn
does cache_rw and attempts to cache_dup from base io to child io,
causing a "FIXME: implement library_dup" warning message as this
hadn't been implemented yet.

However it also causes another side effect - the editor thinks we've
modified something and asks if we want to save; annoying too. For now
I just changed the cache_rw on libraries to always work on the base io
even if we're trying to cache_rw on the child io, solving both issues
at once. It's not ideal from a code purist view, but it works.

------------------------------------------------------------------------
r2756 | jkbonfield | 2011-10-07 12:06:15 +0100 (Fri, 07 Oct 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c
   M /staden/trunk/src/gap5/g-files.h
   M /staden/trunk/src/gap5/g-request.c

Scary updates to the low level DB code.

The previous rewrite of g_write_aux_index() had the side effect of
only ever using one pair of the twinned image/time/use arrays in the
index.  Consequentially crashing or killing the program mid-write
could leave an inconsistent database.

We now store the old index values and put those into ind[1] with
ind[0] being the new ones and delay the dheap_free calls until after
the update_header() call.

This means the single transaction and rollback code now works again
and we can recover from partial commits.

------------------------------------------------------------------------
r2755 | jkbonfield | 2011-10-06 16:46:24 +0100 (Thu, 06 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed memory corruption in consensus caching. If a bin dramatically
shrinks, the old cached consensus could be larger than the
bstart..bend range which then caused an overflow.

------------------------------------------------------------------------
r2754 | jkbonfield | 2011-10-06 16:14:14 +0100 (Thu, 06 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Control-A keybinding now selects all in the List Contigs window.

------------------------------------------------------------------------
r2753 | jkbonfield | 2011-10-06 15:30:30 +0100 (Thu, 06 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl

Fixed tcl selection handlers when pasting long strings.

The most significant of this is the Contig List window.

------------------------------------------------------------------------
r2752 | jkbonfield | 2011-10-06 14:58:25 +0100 (Thu, 06 Oct 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added a method to determine the effective orientation of a template
from a sequence.

Use this within the contig editor Join To command, so we can reverse
complement the other contig if appropriate.

------------------------------------------------------------------------
r2751 | jkbonfield | 2011-10-06 10:10:24 +0100 (Thu, 06 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Bug fixes to cope with sequence of "*" in SAM/BAM files.

------------------------------------------------------------------------
r2750 | jkbonfield | 2011-10-05 14:44:59 +0100 (Wed, 05 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tag_editor.tcl

- Increased the default size of the tag editor.

- Changed the line wrapping to "none", meaning the horizontal scroll
  bar becomes useful.

------------------------------------------------------------------------
r2749 | jkbonfield | 2011-10-05 14:44:23 +0100 (Wed, 05 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Improved error handling of SAM/BAM I/O. It can now distinguish between
eof and an early termination due to an error. It also reports the line
number in SAM (or equivalent SAM if reading BAM).

------------------------------------------------------------------------
r2748 | jkbonfield | 2011-10-05 11:57:19 +0100 (Wed, 05 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

The join editor now has the top editor being the first contig listed
(in both the initial join editor dialogue and in the "contig1 /
contig2" window header) and the bottom is the second contig.  They
were reversed before.

------------------------------------------------------------------------
r2747 | jkbonfield | 2011-10-03 16:57:40 +0100 (Mon, 03 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl

Added the Gap4 "search from file" functionality to Gap5's contig editor.

------------------------------------------------------------------------
r2746 | jkbonfield | 2011-10-03 14:34:16 +0100 (Mon, 03 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_oligo.c
   M /staden/trunk/src/gap5/primlib.c

Bug fix to the editor Find Primer-walk function. It was adding tags to
the wrong place for reverse strand oligos.

Also removed some debugging output.

------------------------------------------------------------------------
r2745 | jkbonfield | 2011-10-03 14:33:21 +0100 (Mon, 03 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2744 | jkbonfield | 2011-10-03 12:29:27 +0100 (Mon, 03 Oct 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Added back compute_ypos_tags() call (accidentally removed in the Group
Readings revamp).

This showed up as an inability to edit tags by pressing F11 in the
contig editor.

------------------------------------------------------------------------
r2743 | jkbonfield | 2011-10-03 11:38:30 +0100 (Mon, 03 Oct 2011) | 15 lines
Changed paths:
   M /staden/trunk/src/tk_utils/entrybox.tcl

Removed the tkwait call in entrybox_get, to remove the wait-forever
idea. I cannot remember why we use this now, so who knows what affects
this will have.

However removing it cures one very strange bug:

1) In Gap5 bring up a contig editor via Edit Contig menu item
2) Go to the Edit Contig menu item again and deliberately type in an
   invalid name, then attempt to hit OK to invoke the editor (does
   nothing).
3) In the first editor, which should still be visible, position the
   editor cursor on a location not covered by a base.

At this point you'll get a Tk error message.

------------------------------------------------------------------------
r2742 | jkbonfield | 2011-09-30 12:34:47 +0100 (Fri, 30 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

create_new_contig() now checks for duplicate contig names and
automatically renames them to prevent this happening.

------------------------------------------------------------------------
r2741 | jkbonfield | 2011-09-30 12:16:20 +0100 (Fri, 30 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Duplicate contig names are now removed in lget_contig_num, meaning FIJ
etc won't find self matches when given duplicates.

------------------------------------------------------------------------
r2740 | awhitwham | 2011-09-30 12:12:03 +0100 (Fri, 30 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tkEditor.h

Initial Group Readings check in.  Gives the option in the editor to order readings in various ways.  Default setting matches current ordering.  Some more work needs to be done.

------------------------------------------------------------------------
r2739 | jkbonfield | 2011-09-30 11:54:54 +0100 (Fri, 30 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.tcl

Fixed Remove Contig Holes to request read/write lock access before
proceeding and to shut down and restart the contig selector window.

------------------------------------------------------------------------
r2738 | jkbonfield | 2011-09-30 11:08:42 +0100 (Fri, 30 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Removal of B+Tree debugging output.

------------------------------------------------------------------------
r2737 | jkbonfield | 2011-09-29 16:11:08 +0100 (Thu, 29 Sep 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/b+tree2.h
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/g-alloc.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed various disassembly issues.
- We now remove the correct reading name entry from the B+Tree when
  there are multiples with the same name. (We check name,rec pairing)

- Fixed an error in the b+tree code when completely removing nodes. It
  was causing errors when flushing later on.

- Better error handling for when faced with a record number that no
  longer exists (due to the bug above).

- Also tidied up some g-alloc debugging info with an extraneous "d".

------------------------------------------------------------------------
r2736 | jkbonfield | 2011-09-29 09:57:39 +0100 (Thu, 29 Sep 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c

Fix to severe bug in shuffle pads.

In rare cases it could introduce a column of pads itself, and then
remove it again in the final step. If during this stage it didn't make
any other edits then it did not save the data and so the column being
removed was incorrect - effectively deleting a real column of bases.

This has now been fixed, but also added a contig_delete_pad function
which acts as contig_delete_base but with additional checks to ensure
it doesn't accidentally delete something else.

------------------------------------------------------------------------
r2735 | jkbonfield | 2011-09-28 12:45:12 +0100 (Wed, 28 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Bug fix to recent change for positioning the cursor at 1st used base.

This broke editing with #contig_num (but =contig_num was working).

------------------------------------------------------------------------
r2734 | jkbonfield | 2011-09-28 12:41:34 +0100 (Wed, 28 Sep 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/check_database.tcl
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h
   M /staden/trunk/src/gap5/tg_tcl.c

Check Database on a single contig now honours the "fix" option - it
was ignored before.

We now also report the number of errors we attempted to fix, given that we
don't yet attempt to fix everything.

------------------------------------------------------------------------
r2733 | jkbonfield | 2011-09-28 12:03:02 +0100 (Wed, 28 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

When invoking the editor by a reading name instead of a contig name,
the cursor position is now set to be the first visible base rather
than the first possibly-clipped base.

------------------------------------------------------------------------
r2732 | jkbonfield | 2011-09-28 11:52:44 +0100 (Wed, 28 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/gap_utils.tcl

Fixed the start/end ranges for the Contig ID widget within dialogues.
This was already working when being updated by the contig selector or
contig list windows, but ContigParams called from (say) editing a
contig or the default initial values when opening a database
incorrectly set the range from 1 to $length instead of clipped_start
to clipped_end.

------------------------------------------------------------------------
r2731 | jkbonfield | 2011-09-28 11:51:00 +0100 (Wed, 28 Sep 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Improvements in Export Contigs:

- It now has entries in gap5rc for changing the default dialogue
  options.

- When outputting subsets of a contig in SAM, CAF or BAF, we now
  ensure we output tags that are outside the requested range but
  attached to readings that overlap the requested range. To implement
  this I added an iterator_expand_range() function.

- Fixed a bug introduced in the last update to this file for padded
  alignment output, involving pads next to soft-clips.


------------------------------------------------------------------------
r2730 | jkbonfield | 2011-09-28 11:46:46 +0100 (Wed, 28 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed bug when outputting fasta or fastq sequences that are a multiple
of 60 bp. We no longer have an additional newline in the output.

------------------------------------------------------------------------
r2729 | jkbonfield | 2011-09-27 11:53:59 +0100 (Tue, 27 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed unpaddec consensus coords to always start from base-pair 1.

------------------------------------------------------------------------
r2728 | jkbonfield | 2011-09-26 11:37:30 +0100 (Mon, 26 Sep 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed a recent change to break_check_counts(). It now finds the
left-most read that starts >= cpos and not the right-most overlapping
it.

This bug was introduced in r2715.

------------------------------------------------------------------------
r2727 | jkbonfield | 2011-09-23 17:57:02 +0100 (Fri, 23 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/sam_pileup.h

Added an unpadded mode to the SAM output code.

------------------------------------------------------------------------
r2726 | jkbonfield | 2011-09-23 16:24:36 +0100 (Fri, 23 Sep 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tclIndex

Added export of CreateAllContigListNumbers
------------------------------------------------------------------------
r2725 | jkbonfield | 2011-09-21 17:34:43 +0100 (Wed, 21 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/consensus.h
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h
   M /staden/trunk/src/gap5/shuffle_pads.tcl
   M /staden/trunk/src/gap5/tclIndex

Added a "Remove Pad Columns" function to gap5.

Also fixed a potential cache ref count bug in the consensus calculation.

------------------------------------------------------------------------
r2724 | jkbonfield | 2011-09-20 17:45:23 +0100 (Tue, 20 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed sizing of jog control in contig and join editor, to take into
account height of pos entry and pos_type buttons.

This was the cause of Alan's vanishing consensus, caused by the name
and sequence sheet widgets being slightly different sizes due to an
overlarge button and a too-small scalebar (jog).

------------------------------------------------------------------------
r2723 | jkbonfield | 2011-09-20 15:23:42 +0100 (Tue, 20 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.tcl

Added Page Up/Down bindings to the editor Search dialogue for next and
previous search.

------------------------------------------------------------------------
r2722 | jkbonfield | 2011-09-20 15:15:45 +0100 (Tue, 20 Sep 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tman_interface.c
   M /staden/trunk/src/gap5/trace_display.tcl

Fixed the trace display:

1) It now scrolls in the correct orientation when dragging a
   complemented trace.

2) It keeps in sync with edits & pads. It does a sequence alignment
   against the (cached) trace to work out this mapping, although the
   alignment itself isn't cached yet.

3) The Lock button no longer produces errors.

------------------------------------------------------------------------
r2721 | jkbonfield | 2011-09-20 11:58:12 +0100 (Tue, 20 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_register.c

Remove small memory leak from broadcast_event().

------------------------------------------------------------------------
r2720 | jkbonfield | 2011-09-16 17:35:48 +0100 (Fri, 16 Sep 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c

Added debugging code to tg_cache to blat any unreferenced cached
objects on each and every call to cache_search(). This is a brutal way
of finding places where we make assumptions rather than properly
calling cache_incr and cache_decr. This is enabled by adding
-DCACHE_REF_PURGE to your CFLAGS in the configured system.mk.

Also fixed a few issues discovered via this technique.

------------------------------------------------------------------------
r2719 | jkbonfield | 2011-09-16 17:33:13 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Fixed a bug in the template display where complemented contigs were
often shown as being inconsistent templates.

------------------------------------------------------------------------
r2718 | jkbonfield | 2011-09-16 17:32:38 +0100 (Fri, 16 Sep 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   A /staden/trunk/src/gap5/gap_canvas_box.c
   A /staden/trunk/src/gap5/gap_canvas_box.h
   M /staden/trunk/src/gap5/gap_canvas_box.tcl
   A /staden/trunk/src/gap5/gap_restriction_enzymes.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   A /staden/trunk/src/gap5/restriction_enzymes.c
   A /staden/trunk/src/gap5/restriction_enzymes.h
   M /staden/trunk/src/gap5/tclIndex

Added the Gap4 restriction enzymes plot to Gap5. It's pretty warty and
confusing code and would be better off done these days using pure Tcl
for the window and just having a C function purely for finding
restriction enzymes on the consensus. However this was a couple hours
work to port so it'll do for now.

------------------------------------------------------------------------
r2717 | jkbonfield | 2011-09-16 14:16:20 +0100 (Fri, 16 Sep 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fudged the iterators to add slack either side of the contig. This
works around catch-22 problems with trying to use the iterators to
work out the next contig extents. We need to replace this hack with a
dedicated function for just this purpose though. (One that doesn't use
the iterators.)

Also fixed contig_insert_base2() to call contig_visible_start/end so
it can double check and correct the contig extents.

------------------------------------------------------------------------
r2716 | jkbonfield | 2011-09-16 11:13:23 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h
   M /staden/trunk/src/gap5/tg_check.c

Added a bin_remove_refpos() function. Also fixed Check Database when
facing REFPOS markers so stop producing false warnings.

------------------------------------------------------------------------
r2715 | jkbonfield | 2011-09-16 11:10:06 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Bug fix to contig_visible_start/contig_visible_end. These now also
trim REFPOS items.

------------------------------------------------------------------------
r2714 | jkbonfield | 2011-09-16 11:09:15 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Added extra cache_incr/decr guards around tk_redisplaySeqSequences
code (due to sequence_get_template_info loading a lot of data).

------------------------------------------------------------------------
r2713 | jkbonfield | 2011-09-15 16:52:50 +0100 (Thu, 15 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/staden.profile

Replaced == with = in 'test' expression. This accidental ksh/bashism
breaks when using a real bourne shell.

------------------------------------------------------------------------
r2712 | jkbonfield | 2011-09-15 11:47:46 +0100 (Thu, 15 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c

Improved robustness when a sequence points to a pair (via r->pair_rec)
which no longer exists. We just whinge instead of crashing now.

------------------------------------------------------------------------
r2711 | jkbonfield | 2011-09-14 17:16:41 +0100 (Wed, 14 Sep 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2710 | jkbonfield | 2011-09-14 16:53:57 +0100 (Wed, 14 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added support for testing disassemble readings.

------------------------------------------------------------------------
r2709 | jkbonfield | 2011-09-14 16:53:38 +0100 (Wed, 14 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_bin.c

Reverse previous fix as it broke Break Contig (it calls
bin_remove_item_from_bin during a phase where the data hasn't yet been
tidied up so it's incorrect to try and fix contig length then).

Instead added the consensus_unclipped_range code into disassemble
readings directly. Messy, but sufficient for now.

------------------------------------------------------------------------
r2708 | jkbonfield | 2011-09-14 16:18:52 +0100 (Wed, 14 Sep 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Fixed error bin_remove_item_from_bin called from diasassemble
readings. It wasn't always recomputing the contig extents when it
should. For now I disabled some of the optimisations and recompute this
more often than is strictly necessary.

------------------------------------------------------------------------
r2707 | jkbonfield | 2011-09-14 09:58:15 +0100 (Wed, 14 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed bug in Disassemble Readings when the set of reads being removed
from a contig have the left-most unclipped read not being the
left-most clipped read.

------------------------------------------------------------------------
r2706 | jkbonfield | 2011-09-13 17:28:10 +0100 (Tue, 13 Sep 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h

Improved sequence name searching as per RT#231099

When looking for a sequence name/number we now jump to the first
visible (unclipped) base of the sequence instead of the first clipped
base.  To implement this I've created a new
sequence_get_clipped_position function to replace the
sequence_get_position version.

I also changed the editor X position so that new searches that have to
reposition the scrollbar to make the match visible does so with the
match 10 bases in from the left edge instead of the right edge as before.

------------------------------------------------------------------------
r2705 | jkbonfield | 2011-09-13 15:24:49 +0100 (Tue, 13 Sep 2011) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_contig.c

Fixed bug when deleting the last base of a sequence (so the sequence
is removed) which is the last base in the contig and there was a hole
between this sequence and the previous, meaning that the contig now
shrinks substantially more than just one base, *and* that we had
annotations between the old last sequence and the new last sequence.

Eg:

Cons: CG....Tag....Tag.....*
Seq1  CG
Seq2                       *


Also removed some debugging output from this code and disassemble
readings.

------------------------------------------------------------------------
r2704 | jkbonfield | 2011-09-13 15:05:48 +0100 (Tue, 13 Sep 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Further fixes to contig_delete_base2().

1) We now correctly deal with annotations on a sequence that we've
entirely removed due to deleting the last base in it.

2) Fixed < vs <= conditions when deciding whether to move or shrink
tags.

3) Added code to entirely remove tags when the only base they cover is
deleted.

------------------------------------------------------------------------
r2703 | jkbonfield | 2011-09-13 15:03:54 +0100 (Tue, 13 Sep 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/break_contig.h
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a couple more bugs in disassemble readings.

1) Moving a sequence that has been clipped to zero bases (clipped to 1
base, a pad, and then delete that column) no longer produces zero
length contigs and errors.

2) Fixed some more cases of failure to trim tags in consensus cutoff
regions after moving data at the end of contigs.

------------------------------------------------------------------------
r2702 | jkbonfield | 2011-09-13 10:00:10 +0100 (Tue, 13 Sep 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Further consensus tag handling bug fixes - we now track the clipped
seq coords when tracking which consensus tags to move/clip to.

Fixed an orientation bug when moving data from one contig to
another. Previously we could change the orientation of sequences
sometimes, meaning moving data from a previously joined contig (a
merge of complemented and uncomplemented contigs) could yield out of
alignment data in the newly created contig due to swapping the
sequence orientations back.

------------------------------------------------------------------------
r2701 | jkbonfield | 2011-09-13 09:57:43 +0100 (Tue, 13 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Fixed a reference counting crash in grow_bin() caused when we're
attempting to grow the root bin of the contig.

------------------------------------------------------------------------
r2700 | jkbonfield | 2011-09-12 16:11:31 +0100 (Mon, 12 Sep 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Major overhaul of consensus annotation support in Disassemble
Readings. We now copy consensus tags to new contigs when the used
portion overlaps, and improved trimming of old tags at contig ends or
internal holes.

------------------------------------------------------------------------
r2699 | jkbonfield | 2011-09-12 16:10:29 +0100 (Mon, 12 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed reference count corruption. We failed to cache_incr earlier
enough in contig_visible_start and contig_visible_end functions.

------------------------------------------------------------------------
r2698 | jkbonfield | 2011-09-09 15:25:50 +0100 (Fri, 09 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h

Altered the consensus tag clipped code to clip/remove tags based on
the cutoff data. Ie consensus tags should only be kept when they're on
visible consensus sequence and not within clipped regions.

Also added checks in Check Database for this and the "tags in sequence
bins" change.

------------------------------------------------------------------------
r2697 | jkbonfield | 2011-09-09 15:24:13 +0100 (Fri, 09 Sep 2011) | 24 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Major rewrite of contig_insert_base and contig_delete_base.

These now take into account the sequence cutoff data and don't insert
or delete within those portions. The implementation is considerably
trickier to get right however. Eg on insertion:

1) It is no longer the case that all tags to the right get shifted to
the right. If they're right-hand cutoff data they will not.

2) It is no longer the case that all tags to the left will not get
shifted right. If they're in left-hand cutoff data and the read starts
to the right, then the read will be moved right causing the left tags
to move too.

3) Inserting a column of pads may not actually grow the contig
(likewise deleting may not shrink it). If the contig extents were
defined by cutoff data of a sequence and we're inserting a column that
doesn't insert into the sequence that is furhest right (so we're
inserting at a pos covering the right-hand cutoff data of it) then the
contig will not grow.

These and other problems lead to the requirement that tags should no
longer be created within the cutoff regions of the consensus.

------------------------------------------------------------------------
r2696 | jkbonfield | 2011-09-09 15:16:45 +0100 (Fri, 09 Sep 2011) | 23 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Policy change - tags should belong in the same bin as the sequences
they are attached to (unless they're attached to the contig
consensus).  This greatly simplifies many algorithms (although by and
large they haven't been simplified yet) and also fixes some obscure
bugs. Specifically it makes inserting and deleting columns of pads
work easier.

This has been implemented by adding a bin_add_to_range() function
which adds a range to a specific bin rather than finding its own
appropriate bin. Reimplemented bin_add_range() as a special case
variant of the new bin_add_to_range() function.

Also fixed a bug in the tcl interface $contig add_sequence and $contig
move_sequence interfaces. They were incorrectly setting the
complemented status of a sequence when it gets moved from a bin of one
orientation into a bin of the opposite orientation, causing conflicts
between on disc and in memory representations.

Bug fix to bin_plus_children_empty(). It now considers bins that have
no sequence/tags beneath them but *do* contained cached consensus
sequences as empty still. This was preventing disassemble readings
from deleting contigs in some cases.

------------------------------------------------------------------------
r2695 | jkbonfield | 2011-09-09 10:11:54 +0100 (Fri, 09 Sep 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Protect against a crash while joining.

I'm not sure of the circumstances to trigger it, but while handling
the contig registration events for a join, the editor can sometimes
end up trying to run show_cursor on a position where no range data has
been returned. We now gloss over this and refuse to show the cursor
(as we're about to shut down anyway).

------------------------------------------------------------------------
r2694 | jkbonfield | 2011-09-07 10:16:30 +0100 (Wed, 07 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc

Made the editor dimensions and the position of the names/seq pane
configurable in .gap5rc. These values are now also saved when using
Save Settings menu item.

------------------------------------------------------------------------
r2693 | jkbonfield | 2011-09-05 12:46:51 +0100 (Mon, 05 Sep 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.tcl

Catch errors in break_contig Tcl-interface and report
appropriately. This avoids leaving a SetBusy on the database, which
previously wasn't being cleared and so blocked out the GUI from the
error onwards.

------------------------------------------------------------------------
r2692 | jkbonfield | 2011-09-05 12:30:38 +0100 (Mon, 05 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed the handling of the -index_names option of import_reads command.
It was negated in operation.

------------------------------------------------------------------------
r2691 | jkbonfield | 2011-08-18 17:41:06 +0100 (Thu, 18 Aug 2011) | 42 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed issues with reference counting and making records r/o again.

An earlier commit to fix the issues of contig editors operating on
live data after an initial cache_flush introduced a bug such that
objects shared by multiple editors would erroneously be set back to
read-only copies despite another editor still having a copy-on-write
portion of that data.

This sounds unlikely to happen, but occurs due to seq_blocks being
split between two contigs. The same seq_block can have reads in two
editors, both of which are being actively edited as they form the
halves of a join editor. When we made the join it flushed the changes
to the seq_block from the first editor, making it read-only, and then
died while flushing the changes to the seq_block from the second
editor.

We now keep better track of reference counting when dealing with
multiple child IOs and also changed the cache_rw code to call
cache_dup any time a cached_item is in a parent io rather than simply
relying on a check for ro/rw (which was the original bug I should have
fixed).

In tg_tcl there are also some reference count leaks still. I fixed the
main ones related to sequence editing though with this patch. Consider
the following scenario.

"set s [$io get_sequence 100]" where $io is a child io. This does a
cache_incr(child_io, seq).

"$s replace_base ..." on this object will then call cache_rw() and
replace_base(). The ts->seq pointer gets replaced with a new one as
cache_rw has done a copy-on-write from master to child-io. However the
initial cache_incr from [$io get_sequence] is no longer valid as it's
in another io entirely. I'm not sure what the best general purpose fix
is other than to track which ref count came from where
(messy). Instead I simply cache_decr / cache_rw / cache_incr to move
the $s ref count from master to child i/o.

This fix needs applying to anno and contig objects too, but it's not
so easy as it's unclear whether we'll accidentally lose an object in
the middle.

------------------------------------------------------------------------
r2690 | jkbonfield | 2011-08-18 17:29:09 +0100 (Thu, 18 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Fixed memory overrun on small contigs.

------------------------------------------------------------------------
r2689 | jkbonfield | 2011-08-17 14:30:12 +0100 (Wed, 17 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Fixed Complement Contig via the list contigs window.

------------------------------------------------------------------------
r2688 | jkbonfield | 2011-08-10 16:39:27 +0100 (Wed, 10 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Fixed the setting of io->name when opening via full pathname (eg using
the File->Open dialogue). This was also causing errors in Check Database.

------------------------------------------------------------------------
r2687 | jkbonfield | 2011-08-10 12:40:23 +0100 (Wed, 10 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Smaller cache size when compiled with WAS_CACHE_REF_DEBUG, to further
stress-test the reference counting.

------------------------------------------------------------------------
r2686 | jkbonfield | 2011-08-10 12:39:52 +0100 (Wed, 10 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5.tcl

Minor version bump to 1.2.14 - long overdue!

------------------------------------------------------------------------
r2685 | jkbonfield | 2011-08-10 12:39:40 +0100 (Wed, 10 Aug 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h

Added proper template name support, albeit requiring it to be a prefix
of the read-name.  This then parses/generates the appropriate Template
fields in caf, baf, ace  and the FS aux tag in SAM.

------------------------------------------------------------------------
r2684 | jkbonfield | 2011-08-10 11:54:26 +0100 (Wed, 10 Aug 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tman_display.c

Fixed crash when failing to bring up 1000 traces at one point.

Also no longer attempt to bring up illumina or solid traces when
double clicking on the consensus. You can still bring up individual
ones by clicking on them though.

------------------------------------------------------------------------
r2683 | jkbonfield | 2011-08-08 12:15:23 +0100 (Mon, 08 Aug 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

I now have a better undertstanding of the causes of bin consensus
sequences being invalid, so removed the warning.

The cached consensus will be correct, just not always spanninig the
entire bin. This can happen when bin_add_range adds the cached cons to
a larger bin than the one we were computing it for. We could of course
force it to only ever add to the bin we expected, and I tried this.
For some reason it caused yet more errors though, so for now I'm
glossing over this by simply gracefully handling the case.

It's not as fficient as it could be therefore as it sometimes has to
recompute the consensus again as the bin has grown, but it's
sufficient and I believe reliable.

------------------------------------------------------------------------
r2682 | jkbonfield | 2011-08-08 11:13:23 +0100 (Mon, 08 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_sequence.c

More checks for cached items being purged, primarily fixed by adding
cache_incr/decr calls.

------------------------------------------------------------------------
r2681 | jkbonfield | 2011-08-08 11:11:48 +0100 (Mon, 08 Aug 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Improved reference counting.

Fixed a bug where failure to call invalidate_consensus could yield a
crash in this code. We now still check whether the cached consequence
sequence spans the correct region when it claims to be up to date, and
recompute if not.

------------------------------------------------------------------------
r2680 | jkbonfield | 2011-08-05 12:12:23 +0100 (Fri, 05 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed a bug in caching consensus for read-only mode. It was sometimes
complementing the contig when it didn't need to.

------------------------------------------------------------------------
r2679 | jkbonfield | 2011-08-04 15:29:21 +0100 (Thu, 04 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/check_database.tcl

Added "$io flush" so changes are written immediately after fixing a database.

------------------------------------------------------------------------
r2678 | jkbonfield | 2011-08-02 17:10:37 +0100 (Tue, 02 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h

Sequence Search now creates a list named "seq_hits" for each sequence
found by the sequence search. (Only when matching vs sequences.)

------------------------------------------------------------------------
r2677 | jkbonfield | 2011-08-02 16:29:34 +0100 (Tue, 02 Aug 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/find_oligo.c

Fixed Sequence Search (main menu, not the method inside editor).

It was falsely reporting locatations when searching on complemented
reads instead of the usual mode of looking in consensus.

Also updated it to start the editor on the specific sequence we found
rather than the consensus, and fixed a bug in the edit_contig()
startup function in the process.

------------------------------------------------------------------------
r2676 | jkbonfield | 2011-08-01 17:11:18 +0100 (Mon, 01 Aug 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2675 | jkbonfield | 2011-08-01 17:08:44 +0100 (Mon, 01 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed out by one error in code to determine whether to move data to
right or left contig.

------------------------------------------------------------------------
r2674 | jkbonfield | 2011-08-01 12:26:22 +0100 (Mon, 01 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added test to compute the consensus, testing cached consensus code.

------------------------------------------------------------------------
r2673 | jkbonfield | 2011-08-01 12:25:56 +0100 (Mon, 01 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Improved diagnostics in cache ref checking code. We no longer give
false errors in some cases.

------------------------------------------------------------------------
r2672 | jkbonfield | 2011-08-01 10:04:55 +0100 (Mon, 01 Aug 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed bug in complementing of existing cached consensus. We weren't
setting/clearing the SEQ_COMPLEMENTED flag correctly, meaning on-disk
and in-memory structs became out of sync.

------------------------------------------------------------------------
r2671 | jkbonfield | 2011-07-29 15:02:14 +0100 (Fri, 29 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Enabled debugging output.

Prevent clipping of data to 0 base visible sequences (as this is
disallowed in the editor too).

------------------------------------------------------------------------
r2670 | jkbonfield | 2011-07-29 15:00:14 +0100 (Fri, 29 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c

Protect against cycles in break_contig/remove_contig_holes. This can
happen when a contig starts with a zero length sequence, which is
interpreted as a hole if it doesn't overlap anything else.

------------------------------------------------------------------------
r2669 | jkbonfield | 2011-07-29 12:18:29 +0100 (Fri, 29 Jul 2011) | 19 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Fixed an error caused in the contig editor whereby edits to data
previously edited and then saved could either not be saved correctly
or instead accidentally saved when you exit without saving.

More specifically, when using a child I/O editing uses copy-on-write
to take a local writable version of the master I/O record. Saving
flushed this data out and pushed the child I/O record back to the
master I/O, but it didn't reset the lock from r/w to read-only.
Consequentially the next edit to that record did not perform a
copy-on-write again as the child I/O believed it had a writeable
version already.

Corrected this by adding a cache_upgrade(io, ci, G_LOCK_RO) call.
There still a (new?) bug in that the data is not correctly referenced
counted and so edited data wastes cache, however this is simply a
small memory leak rather than a substantial problem with the
possibility to break data.  I'll submit a new patch with corrected
reference counting when I figure out where that problem comes from.

------------------------------------------------------------------------
r2668 | jkbonfield | 2011-07-29 11:18:04 +0100 (Fri, 29 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Moved the cache_decr lines later down, to after running
remove_contig_holes.  This was occasionally causing crashes.

------------------------------------------------------------------------
r2667 | jkbonfield | 2011-07-29 09:50:10 +0100 (Fri, 29 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Moved free(io) in io_database_disconnect. Likely a harmless change (on
our systems at least), but safer and preventing a valgrind error.

------------------------------------------------------------------------
r2666 | jkbonfield | 2011-07-28 17:28:05 +0100 (Thu, 28 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/depad_seq_tree.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/g-struct.c
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_view.c

Moved a lot of debugging output to only appear when running
"gap5 -debug 1". This uses a new gio_debug() function to print up the
messages instead of printf, which checks the debug level before
printing. Call gio_debug_level() to set it or "$io debug_level N" in
Tcl.

------------------------------------------------------------------------
r2665 | jkbonfield | 2011-07-28 17:26:36 +0100 (Thu, 28 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added sequence clipping tests too.

------------------------------------------------------------------------
r2664 | jkbonfield | 2011-07-28 15:26:32 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.h

Fixed false errors from the reference count debugging mode. These
occurred when we ran cache_item_resize() and changed an item pointer,
breaking the hache entry.

------------------------------------------------------------------------
r2663 | jkbonfield | 2011-07-28 12:27:54 +0100 (Thu, 28 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed bug in removing tags via the tcl interface. It wasn't removing
the item from the bin.

------------------------------------------------------------------------
r2662 | jkbonfield | 2011-07-28 12:02:57 +0100 (Thu, 28 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c

Revamped how I detect for empty bins in various pieces of code. Added
a bin_empty() function to do this now so it's consistent in all
locations.

This cures a bug in bin_add_range fails to set bin->start_used
correctly. This happens when adding data to a bin containing a
bin->rng array with bin->rng->max != 0, but containing only ranges
flagged as UNUSED.

------------------------------------------------------------------------
r2661 | jkbonfield | 2011-07-28 12:00:12 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Added protection against contig_iter_new returning NULL. This caused
crashes when trying to open the contig editor on a contig containing
no data. (An error in itself, but it shouldn't crash.)

------------------------------------------------------------------------
r2660 | jkbonfield | 2011-07-28 11:59:26 +0100 (Thu, 28 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed crashes when importing malformed fasta files. Also added a
missing cache_flush() call.

------------------------------------------------------------------------
r2659 | jkbonfield | 2011-07-28 09:56:00 +0100 (Thu, 28 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Made the chksum code optional via an #ifdef. Yet to decide if it's
robust enough to leave in place for all situations.

------------------------------------------------------------------------
r2658 | jkbonfield | 2011-07-28 09:54:00 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Similar checks to bin->rng being set but empty. I don't believe these
caused bugs, but being extra safe and checking "bin->rng &&
ArrayMax(bin->rng)" now.

------------------------------------------------------------------------
r2657 | jkbonfield | 2011-07-28 09:49:31 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Fixed a bug in bin_add_range when updating bin start/end used on a bin
with an existing bin->rng array containing zero items (ie it used to
have data).

------------------------------------------------------------------------
r2656 | jkbonfield | 2011-07-27 17:42:33 +0100 (Wed, 27 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Initialise seq_t->sam_aux to NULL when not filled out. Technically
it's not an issue as aux_len is zero in such cases, but it feels tidier.

------------------------------------------------------------------------
r2655 | jkbonfield | 2011-07-27 17:13:42 +0100 (Wed, 27 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added code to check that the in-memory cached structures match those
on disk. We do this check by reopening the database and comparing
against it, which may not work if we changed directory. However it's
sufficient for current evaluation purposes.

Unfortunately this also causes a lot of spam to stderr at the moment
too due to close_db, but we should resolve that elsewhere.

------------------------------------------------------------------------
r2654 | jkbonfield | 2011-07-27 17:12:12 +0100 (Wed, 27 Jul 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed wide spread false meme about anno_ele_t struct. The idx field is
an index into the anno_ele_block array, but in many places it was used
in a manner as if it was the bin_index (ie like seq_t->bin_index vs
seq_t->idx).

There is no bin_index in the anno_ele_t struct, rightly or wrongly.
Rather than simply remove the code I changed it to access a->bin_idx
(which doesn't exist yet) and commented it out so I can add the code
back to update this if and when I extend the structure to contain the
bin index.

------------------------------------------------------------------------
r2653 | jkbonfield | 2011-07-27 17:09:23 +0100 (Wed, 27 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Added check sum code for bin->rng too.

------------------------------------------------------------------------
r2652 | jkbonfield | 2011-07-27 11:25:57 +0100 (Wed, 27 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed an issue with computing the overlapping extents during break
contig. We now have pos2 and pos3 both and compute these upfront
before breaking. These are the overlap extents for the rightmost edge
of the left contig and the leftmost edge of the right contig
respectively. The latter wasn't being computed before, but is
necessary when determining whether the a bin can be moved left or
whether it needs splitting incase it contains a tag.

------------------------------------------------------------------------
r2651 | jkbonfield | 2011-07-26 16:46:44 +0100 (Tue, 26 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added code that's currently #ifdefed out.

When ANNO_LOWER_CHECK is defined we check for tags being in the same
bin or a child bin of the object they are tagging. This turns out to
be an invalid assertion currently unless we fix join contigs to refuse
to create overlapping bins.

------------------------------------------------------------------------
r2650 | jkbonfield | 2011-07-26 16:45:26 +0100 (Tue, 26 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Added code to cope with overlapping bins. This causes our assumption
that tags will only occur in the same bin or a child bin that contains
sequences to be false. After joining we have overlapping bins, and new
tags added could take a different branch down that tree.

Similarly the incremental setting of pos2 is invalid too for the same
reason, so we compute it upfront.

------------------------------------------------------------------------
r2649 | jkbonfield | 2011-07-26 11:52:35 +0100 (Tue, 26 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed a bug with tags when breaking a contig containing holes and tags
within those holes. They were previously ended up off the ends of
contigs, but now we remove them completely.

------------------------------------------------------------------------
r2648 | jkbonfield | 2011-07-26 10:18:37 +0100 (Tue, 26 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added -break_holes option to the break_contig function. Use this in
the thrash test code.

------------------------------------------------------------------------
r2647 | jkbonfield | 2011-07-26 09:41:45 +0100 (Tue, 26 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Sorry last version didn't compile! Adding contig_start/end declarations
------------------------------------------------------------------------
r2646 | jkbonfield | 2011-07-26 08:34:35 +0100 (Tue, 26 Jul 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/break_contig.h
   M /staden/trunk/src/gap5/break_contig.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/dis_readings.h
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Fixed the hole detection code in Disassemble Readings to check clipped
visible-only portion of reads rather than the entire thing. This
involved adding new sort modes to the contig iterators.

Added an option to Break Contig to break the right hand contig up
further if holes were introduced.

Also fixed a bug in the Break Contig code that checks whether one of
the contig-portions would contain zero sequences.

------------------------------------------------------------------------
r2645 | jkbonfield | 2011-07-25 14:36:04 +0100 (Mon, 25 Jul 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c

Improvements to the database checking/fixing.

- The database is automatically updated to v2 format if it's v1. This
  is simply a matter of filling out the nanno and nrefpos fields in
  bins.

- Check for and correct various bin boundary issues. It's complex to
  fix, but when a bin extends beyond the parent we adjust the parent
  pos/size and bubble up to the root.

- Also check that bin parent_type/rec are valid.

------------------------------------------------------------------------
r2644 | jkbonfield | 2011-07-25 14:33:29 +0100 (Mon, 25 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Protect against crashes when faced with negative reference
coordinates. (I'm not sure how this happens, but it's more robust now.)

------------------------------------------------------------------------
r2643 | jkbonfield | 2011-07-22 10:21:58 +0100 (Fri, 22 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Improved checking of bins with two new checks:
- That start_used/end_used fits within the bin extents.
- That bin pos/pos+size-1 fits entirely within the parent bin.

As yet no auto-fixes have been implemented though.

------------------------------------------------------------------------
r2642 | awhitwham | 2011-07-21 17:07:50 +0100 (Thu, 21 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Fixed parsing error where a space at the begining of the line within a qualities block was being interpreted as the end of the qualities.

------------------------------------------------------------------------
r2641 | jkbonfield | 2011-07-21 16:49:20 +0100 (Thu, 21 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Changed some asserts (more to do still) in the low level I/O code to
be g_assert instead. This new macro outputs an error and then returns
an appropriate error code to the calling function, enabling us to
catch low level errors more gracefully than calling abort().

------------------------------------------------------------------------
r2640 | jkbonfield | 2011-07-21 16:48:15 +0100 (Thu, 21 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tclIndex


------------------------------------------------------------------------
r2639 | jkbonfield | 2011-07-21 16:37:32 +0100 (Thu, 21 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap4/find_oligo.tcl
   M /staden/trunk/src/gap4/ng_fb_cmds.tcl
   M /staden/trunk/src/gap4/select_contig.tcl
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/find_oligo.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/select_contig.tcl
   M /staden/trunk/src/tk_utils/entrybox.tcl
   M /staden/trunk/src/tk_utils/filebrowser.tcl
   M /staden/trunk/src/tk_utils/xentry.tcl
   M /staden/trunk/src/tk_utils/xfilebrowser.tcl

Various tk raise window changes to compensate for issues with Gnome's
metacity window manager woes.

We now try harder to ensure any tk_messageBox dialogues are childs of
the appropriate window. We also make sure the contig editor is raised
when receiving a CURSOR_NOTIFY event from another window, eg the
template display.

------------------------------------------------------------------------
r2638 | jkbonfield | 2011-07-21 10:00:22 +0100 (Thu, 21 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added LZMA_LIB to tg_index library list. It's no longer automatically
brought in via libtgap dependencies on MacOS X.

------------------------------------------------------------------------
r2637 | jkbonfield | 2011-07-20 12:29:00 +0100 (Wed, 20 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2636 | jkbonfield | 2011-07-20 12:15:27 +0100 (Wed, 20 Jul 2011) | 6 lines
Changed paths:
   A /staden/trunk/src/gap5/gap5_thrash.tcl

Debugging program - thrashes a database with random edits to random
contigs and continuously runs Check Database to ensure we haven't
corrupted things.

A very handy way of spotting errors.

------------------------------------------------------------------------
r2635 | jkbonfield | 2011-07-20 12:10:33 +0100 (Wed, 20 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/gap5_check

Added execute permission
------------------------------------------------------------------------
r2634 | jkbonfield | 2011-07-20 12:03:30 +0100 (Wed, 20 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/gap5_check
   M /staden/trunk/src/gap5/gap5_check.tcl

Add gap5_check as a callable program and updated the tcl code to use
the same argument parsing as gap5_consensus / gap5_export.

------------------------------------------------------------------------
r2633 | jkbonfield | 2011-07-20 11:42:46 +0100 (Wed, 20 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

More chksum fixes for libraries - this time when CACHE_REF_DEBUG
debugging mode is enabled.

------------------------------------------------------------------------
r2632 | jkbonfield | 2011-07-20 11:39:40 +0100 (Wed, 20 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Disable cache checksum for library objects as we tend to update the
insert size and standard deviation figures on-the-fly, even in
read-only mode. So it's expected the struct may differ.

------------------------------------------------------------------------
r2631 | jkbonfield | 2011-07-20 10:38:39 +0100 (Wed, 20 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/staden_config.h.in


------------------------------------------------------------------------
r2630 | jkbonfield | 2011-07-20 10:38:28 +0100 (Wed, 20 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added get_visible_{start,end,length} methods to the contig
object. They're analogous to the existing start/end/length ones but
return the clipped/visible region of a cotnig.

The contig_id selector now uses these visible versions when setting
the scalebars and the defaults when output contig consensus via the
command-line tool also default to these values too.

------------------------------------------------------------------------
r2629 | jkbonfield | 2011-07-20 09:59:32 +0100 (Wed, 20 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/ac_stubs/tcl.m4
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/primer3/src/Makefile

Fixed a linking issue on MacOS X due to use of common symbols:
range_option declared in gap_range.h has now been listed as external.

Furthermore adjusted the linker arguments when building under
linux/gcc to use --warn-common. This directs the linux linker to warn
about issues which may cause link errors on other platforms, so
hopefully we'll spot these earlier on.

------------------------------------------------------------------------
r2628 | jkbonfield | 2011-07-20 09:55:15 +0100 (Wed, 20 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/g-struct.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_view.c

Made the debugging outputs when opening and closing database appear to
stderr instead of stdout. This helps scripts that may want to extract
data and print to stdout.

------------------------------------------------------------------------
r2627 | jkbonfield | 2011-07-18 16:33:00 +0100 (Mon, 18 Jul 2011) | 6 lines
Changed paths:
   A /staden/trunk/src/gap5/gap5_command.tcl

Combined multiple gap5_* commands into a single tool:

gap5_command <sub_cmd> [options ...]

This provides consensus, export and check methods so far.

------------------------------------------------------------------------
r2626 | jkbonfield | 2011-07-18 12:22:07 +0100 (Mon, 18 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/init.c

Fixed initialisation of old tgap library.

------------------------------------------------------------------------
r2625 | jkbonfield | 2011-07-18 11:51:34 +0100 (Mon, 18 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/Makefile.in
   M /staden/trunk/src/Misc/Makefile
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/ace_reorder.pl (from /staden/trunk/src/tgap/ace_reorder.pl:2608)
   A /staden/trunk/src/gap5/actf.c (from /staden/trunk/src/tgap/actf.c:2608)
   A /staden/trunk/src/gap5/actf.h (from /staden/trunk/src/tgap/actf.h:2608)
   A /staden/trunk/src/gap5/b+tree2.c (from /staden/trunk/src/tgap/b+tree2.c:2608)
   A /staden/trunk/src/gap5/b+tree2.h (from /staden/trunk/src/tgap/b+tree2.h:2608)
   A /staden/trunk/src/gap5/caf2baf.pl (from /staden/trunk/src/tgap/caf2baf.pl:2608)
   M /staden/trunk/src/gap5/depth.tcl
   A /staden/trunk/src/gap5/docs/BAF (from /staden/trunk/src/tgap/BAF:2608)
   A /staden/trunk/src/gap5/g-alloc.c (from /staden/trunk/src/tgap/g-alloc.c:2608)
   A /staden/trunk/src/gap5/g-alloc.h (from /staden/trunk/src/tgap/g-alloc.h:2608)
   A /staden/trunk/src/gap5/g-connect.c (from /staden/trunk/src/tgap/g-connect.c:2608)
   A /staden/trunk/src/gap5/g-connect.h (from /staden/trunk/src/tgap/g-connect.h:2608)
   A /staden/trunk/src/gap5/g-db.c (from /staden/trunk/src/tgap/g-db.c:2608)
   A /staden/trunk/src/gap5/g-db.h (from /staden/trunk/src/tgap/g-db.h:2608)
   A /staden/trunk/src/gap5/g-defs.h (from /staden/trunk/src/tgap/g-defs.h:2608)
   A /staden/trunk/src/gap5/g-error.c (from /staden/trunk/src/tgap/g-error.c:2608)
   A /staden/trunk/src/gap5/g-error.h (from /staden/trunk/src/tgap/g-error.h:2608)
   A /staden/trunk/src/gap5/g-filedefs.h (from /staden/trunk/src/tgap/g-filedefs.h:2608)
   A /staden/trunk/src/gap5/g-files.c (from /staden/trunk/src/tgap/g-files.c:2608)
   A /staden/trunk/src/gap5/g-files.h (from /staden/trunk/src/tgap/g-files.h:2608)
   A /staden/trunk/src/gap5/g-io.c (from /staden/trunk/src/tgap/g-io.c:2608)
   A /staden/trunk/src/gap5/g-io.h (from /staden/trunk/src/tgap/g-io.h:2608)
   A /staden/trunk/src/gap5/g-misc.h (from /staden/trunk/src/tgap/g-misc.h:2608)
   A /staden/trunk/src/gap5/g-os.h (from /staden/trunk/src/tgap/g-os.h:2608)
   A /staden/trunk/src/gap5/g-request.c (from /staden/trunk/src/tgap/g-request.c:2608)
   A /staden/trunk/src/gap5/g-request.h (from /staden/trunk/src/tgap/g-request.h:2608)
   A /staden/trunk/src/gap5/g-struct.c (from /staden/trunk/src/tgap/g-struct.c:2608)
   A /staden/trunk/src/gap5/g-struct.h (from /staden/trunk/src/tgap/g-struct.h:2608)
   A /staden/trunk/src/gap5/g.h (from /staden/trunk/src/tgap/g.h:2608)
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5_check.tcl
   M /staden/trunk/src/gap5/gap5_consensus.tcl
   M /staden/trunk/src/gap5/gap5_export.tcl
   A /staden/trunk/src/gap5/gap_cli_arg.c (from /staden/trunk/src/tgap/gap_cli_arg.c:2608)
   A /staden/trunk/src/gap5/gap_cli_arg.h (from /staden/trunk/src/tgap/gap_cli_arg.h:2608)
   A /staden/trunk/src/gap5/hache_table.c (from /staden/trunk/src/tgap/hache_table.c:2608)
   A /staden/trunk/src/gap5/hache_table.h (from /staden/trunk/src/tgap/hache_table.h:2608)
   A /staden/trunk/src/gap5/mkdefs.c (from /staden/trunk/src/tgap/mkdefs.c:2608)
   A /staden/trunk/src/gap5/sam2fai.pl (from /staden/trunk/src/tgap/sam2fai.pl:2608)
   A /staden/trunk/src/gap5/tg_anno.c (from /staden/trunk/src/tgap/tg_anno.c:2608)
   A /staden/trunk/src/gap5/tg_anno.h (from /staden/trunk/src/tgap/tg_anno.h:2608)
   A /staden/trunk/src/gap5/tg_bin.c (from /staden/trunk/src/tgap/tg_bin.c:2620)
   A /staden/trunk/src/gap5/tg_bin.h (from /staden/trunk/src/tgap/tg_bin.h:2608)
   A /staden/trunk/src/gap5/tg_cache.c (from /staden/trunk/src/tgap/tg_cache.c:2616)
   A /staden/trunk/src/gap5/tg_cache_item.h (from /staden/trunk/src/tgap/tg_cache_item.h:2616)
   A /staden/trunk/src/gap5/tg_check.c (from /staden/trunk/src/tgap/tg_check.c:2623)
   A /staden/trunk/src/gap5/tg_check.h (from /staden/trunk/src/tgap/tg_check.h:2608)
   A /staden/trunk/src/gap5/tg_contig.c (from /staden/trunk/src/tgap/tg_contig.c:2621)
   A /staden/trunk/src/gap5/tg_contig.h (from /staden/trunk/src/tgap/tg_contig.h:2608)
   A /staden/trunk/src/gap5/tg_gio.c (from /staden/trunk/src/tgap/tg_gio.c:2608)
   A /staden/trunk/src/gap5/tg_gio.h (from /staden/trunk/src/tgap/tg_gio.h:2611)
   A /staden/trunk/src/gap5/tg_iface.h (from /staden/trunk/src/tgap/tg_iface.h:2608)
   A /staden/trunk/src/gap5/tg_iface_g.c (from /staden/trunk/src/tgap/tg_iface_g.c:2622)
   A /staden/trunk/src/gap5/tg_iface_g.h (from /staden/trunk/src/tgap/tg_iface_g.h:2608)
   A /staden/trunk/src/gap5/tg_library.c (from /staden/trunk/src/tgap/tg_library.c:2608)
   A /staden/trunk/src/gap5/tg_library.h (from /staden/trunk/src/tgap/tg_library.h:2608)
   A /staden/trunk/src/gap5/tg_register.c (from /staden/trunk/src/tgap/tg_register.c:2608)
   A /staden/trunk/src/gap5/tg_register.h (from /staden/trunk/src/tgap/tg_register.h:2608)
   A /staden/trunk/src/gap5/tg_sequence.c (from /staden/trunk/src/tgap/tg_sequence.c:2608)
   A /staden/trunk/src/gap5/tg_sequence.h (from /staden/trunk/src/tgap/tg_sequence.h:2608)
   A /staden/trunk/src/gap5/tg_struct.h (from /staden/trunk/src/tgap/tg_struct.h:2608)
   A /staden/trunk/src/gap5/tg_tcl.c (from /staden/trunk/src/tgap/tg_tcl.c:2608)
   A /staden/trunk/src/gap5/tg_tcl.h (from /staden/trunk/src/tgap/tg_tcl.h:2608)
   A /staden/trunk/src/gap5/tg_track.c (from /staden/trunk/src/tgap/tg_track.c:2608)
   A /staden/trunk/src/gap5/tg_track.h (from /staden/trunk/src/tgap/tg_track.h:2608)
   A /staden/trunk/src/gap5/tg_tracks.c (from /staden/trunk/src/tgap/tg_tracks.c:2608)
   A /staden/trunk/src/gap5/tg_tracks.h (from /staden/trunk/src/tgap/tg_tracks.h:2608)
   A /staden/trunk/src/gap5/tg_utils.c (from /staden/trunk/src/tgap/tg_utils.c:2608)
   A /staden/trunk/src/gap5/tg_utils.h (from /staden/trunk/src/tgap/tg_utils.h:2608)
   A /staden/trunk/src/gap5/xalloc.h (from /staden/trunk/src/tgap/xalloc.h:2608)
   A /staden/trunk/src/gap5/zfio.c (from /staden/trunk/src/tgap/zfio.c:2608)
   A /staden/trunk/src/gap5/zfio.h (from /staden/trunk/src/tgap/zfio.h:2608)
   D /staden/trunk/src/tgap
   M /staden/trunk/src/tk_utils/Makefile

Merged tgap directory into gap5.

------------------------------------------------------------------------
r2624 | jkbonfield | 2011-07-18 10:12:54 +0100 (Mon, 18 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Allow calc_consensus and calc_quality to request regions outside of
the contig visible extents. This fixes an error in the contig editor
that allows us to remove bases at the extreme left or right of the
contig if the first or last visible consensus base is *.

------------------------------------------------------------------------
r2623 | jkbonfield | 2011-07-18 10:11:59 +0100 (Mon, 18 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Fixed check for seq left<right. I'm not sure how to handle the case of
removing the last visible base in a sequence, but it causes no
inherent problems in gap5 so for now accept this. Perhaps in future we
should distinguish between warnings vs errors.

------------------------------------------------------------------------
r2622 | jkbonfield | 2011-07-16 14:51:42 +0100 (Sat, 16 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Reverted to the older group-reorder code when reading and writing seq
blocks. It's slower, but the new code has subtle bugs. I will fix
these later, but for now the SVN trunk needs to be working.

------------------------------------------------------------------------
r2621 | jkbonfield | 2011-07-15 18:11:43 +0100 (Fri, 15 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/tgap/tg_contig.c

Removed over-zealous checks of bin->nseqs==0 when setting a bin
start_used/end_used to zero. Empty bins may have children with data,
so the recent assertion is infact sometimes false.

------------------------------------------------------------------------
r2620 | jkbonfield | 2011-07-15 17:21:29 +0100 (Fri, 15 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Rewrite of how bin_remove_item_from_bin handles bin start/end used parameters.

------------------------------------------------------------------------
r2619 | jkbonfield | 2011-07-15 16:36:28 +0100 (Fri, 15 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed an issue where cached consensus sequences were sometimes counted
as seqs for the bin->nseq value.

Removed some debugging left in during last commit.

------------------------------------------------------------------------
r2618 | jkbonfield | 2011-07-15 15:22:35 +0100 (Fri, 15 Jul 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Yet more break contig fixes.

1) More issues with single bp tags being the only thing in a contig:
   another < vs <= bug.

2) Fixed an issue where tags were not copied to the right copy. This
   happens when tags start to the left of the break point that are on
   a sequence with visible start to the right of the break point.
   Rechecked all the combinations of this.

------------------------------------------------------------------------
r2617 | jkbonfield | 2011-07-15 15:20:49 +0100 (Fri, 15 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Bug fix to contig_insert_bases2(). If we insert in a region containing
no sequences, but still adjust the bin size, then we weren't returning
a status to indicate an insert took place and so didn't update the
contig dimensions.

Now we ensure any time bin->size is increased we will update contig size.

------------------------------------------------------------------------
r2616 | jkbonfield | 2011-07-15 15:19:30 +0100 (Fri, 15 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c
   M /staden/trunk/src/tgap/tg_cache_item.h

Added a checksum to cached items. When we populate the cache we
compute a checksum. When we unload we recompute the checksum and only
permit it to differ if the item was locked for RW at some stage. This
will identify places where we forgot to call cache_rw() causing
in-memory and on-disk structures to potentially differ.

------------------------------------------------------------------------
r2615 | jkbonfield | 2011-07-15 10:06:33 +0100 (Fri, 15 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Do a full recalculation of bin start/end used when removing an item at
the boundary of start/end used.

------------------------------------------------------------------------
r2614 | jkbonfield | 2011-07-14 14:51:53 +0100 (Thu, 14 Jul 2011) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed multiple data corruption bugs in break contig.

1) Breaking at a position where the right contig ends before base 0
   (so entirely negative, prior to shifting) was not setting contig
   boundaries correctly.

2) Incorrect computation of annotation start coordinates, meaning we
   could accidentally move them to the right hand contig when they
   overlapped the left hand contig.

3) Was Incorrtly claiming bin is empty when it infact is just 1 base
   long (eg contains only a single bp tag).

------------------------------------------------------------------------
r2613 | jkbonfield | 2011-07-14 11:46:03 +0100 (Thu, 14 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed ref count leak, albeit only in occasions when we have already
met an earlier error.

------------------------------------------------------------------------
r2612 | jkbonfield | 2011-07-14 11:45:33 +0100 (Thu, 14 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Added loop detection in bin_incr_nseq/nref/nanno code. This has
triggered from time to time, but not sure why and cannot yet repeat.

------------------------------------------------------------------------
r2611 | jkbonfield | 2011-07-14 11:44:56 +0100 (Thu, 14 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c
   M /staden/trunk/src/tgap/tg_gio.h

Improved the CACHE_REF_DEBUG ref counting debugging code.
If we cache_incr(), cache_rw() and then cache_decr() we failed to
remove the debugging indicating the first cache_incr as cache_rw has
changed our ref count. This was showing up as falsely reporting
reference leaks that didn't actually happen.

------------------------------------------------------------------------
r2610 | jkbonfield | 2011-07-13 15:06:06 +0100 (Wed, 13 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Fixed complement_contig crashes by using cache_incr() and cache_decr()
on the contig. Previously these could cause the contig to be purged
out of memory and result in crashes.

------------------------------------------------------------------------
r2609 | jkbonfield | 2011-07-13 12:36:48 +0100 (Wed, 13 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Fixed a bug when removing a column of pads causes the last item in a
bin to be removed. It wasn't setting start_used/end_used to zero.

------------------------------------------------------------------------
r2608 | jkbonfield | 2011-07-13 11:43:17 +0100 (Wed, 13 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Ugly hack - protection against failing to load a cached consensus in
case of corrupted databases or other I/O failures.

------------------------------------------------------------------------
r2607 | jkbonfield | 2011-07-13 11:42:18 +0100 (Wed, 13 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Juggled the code a little bit to allow the join contigs implementation
to be executed outside of an edview struct. Exposed this as a
join_contigs command callable from Tcl. (This allows the gap5
dummy-user thrashing code to try joining.)

------------------------------------------------------------------------
r2606 | jkbonfield | 2011-07-13 11:40:31 +0100 (Wed, 13 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Improved the fixing of cases where seq len doesn't match range
end-start+1. We try to adjust start now for complemented sequences
instead of always fixing end. This hopefully keeps things in the same
position as is visually displayed.

------------------------------------------------------------------------
r2605 | jkbonfield | 2011-07-13 11:39:17 +0100 (Wed, 13 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Fixes to inserting data when at the extreme end of a complemented
contig, in the cutoff data.

The fix was to give up attempting to track the exact behaviour of bin
start_used and end_used and simply recompute it verbatim. Not as fast,
but robust.

------------------------------------------------------------------------
r2604 | jkbonfield | 2011-07-13 11:36:14 +0100 (Wed, 13 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Added code to protect against attempting to write a bin range with a
record but no data. This can happen when we end up removing all items
within a bin.

------------------------------------------------------------------------
r2603 | jkbonfield | 2011-07-13 11:33:48 +0100 (Wed, 13 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixes to break contig.

1) We check if breaking here will produce a contig with no data, which
   causes inconsistencies. Quit early if so.

2) Fixed an error in remove_empty_bins where the first non-empty bin
   recursing down from the root is complemented. It was setting the
   bin offset incorrectly.

------------------------------------------------------------------------
r2602 | jkbonfield | 2011-07-11 11:33:27 +0100 (Mon, 11 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Worked around issues with the malign code in seq_utils. This assumes
contigs start at base 1 and go to base N, so we now shift data to
ensure this is so before running the algorithm,  and shift it back at
the end.

------------------------------------------------------------------------
r2601 | jkbonfield | 2011-07-08 16:54:34 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2600 | jkbonfield | 2011-07-08 16:42:15 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   A /staden/trunk/src/gap5/gap5_check.tcl

CLI interface to check database
------------------------------------------------------------------------
r2599 | jkbonfield | 2011-07-08 16:24:08 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Fixed check_seq for consensus seqs - blank base-calls is expected
------------------------------------------------------------------------
r2598 | jkbonfield | 2011-07-08 16:23:32 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tkEditor.c

Adding debugging method 'ref_count' for reporting contig ref counts
------------------------------------------------------------------------
r2597 | jkbonfield | 2011-07-08 16:23:08 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed ref count leak in editor_undo_info
------------------------------------------------------------------------
r2596 | jkbonfield | 2011-07-08 14:21:02 +0100 (Fri, 08 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Protect against tags in SAM being beyond the extent of a sequence. We
now warn about this and clip the tag appropriately.

------------------------------------------------------------------------
r2595 | jkbonfield | 2011-07-08 12:08:16 +0100 (Fri, 08 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

When deleting sequences or tags in contig_delete_base2() we now
correctly update the nseq and nanno bin fields.

------------------------------------------------------------------------
r2594 | jkbonfield | 2011-07-08 11:43:05 +0100 (Fri, 08 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_tcl.c

Fixed Tcl $contig move_anno method. It was incorrectly setting obj_rec
to obj_type (silly error), and also wasn't correct compensating for
sequence positions. Ie I previously tested it on consensus tags only...

------------------------------------------------------------------------
r2593 | jkbonfield | 2011-07-07 17:32:08 +0100 (Thu, 07 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Added missing cache_rw() to bin_remove_item_from_bin, causing some
data to be not written back to disk sometimes (or for the editor to
modify base io instead of its child io).

------------------------------------------------------------------------
r2592 | jkbonfield | 2011-07-07 17:16:02 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added keyboard short-cut for checking consistency of the contig being edited, using the editor's child-io struct
------------------------------------------------------------------------
r2591 | jkbonfield | 2011-07-07 17:15:30 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_sequence.c

Improved (ie bug fixed) range updating in sequence_range_length function
------------------------------------------------------------------------
r2590 | jkbonfield | 2011-07-07 17:14:50 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/Misc/shell.c

Removal of warning msg
------------------------------------------------------------------------
r2589 | jkbonfield | 2011-07-07 16:22:41 +0100 (Thu, 07 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/tgap/hache_table.c
   M /staden/trunk/src/tgap/hache_table.h

Added code to reverse the linked lists in hash tables. Use this in the
contig editor, which fixes issues of overlapping tags not displaying
correctly.

------------------------------------------------------------------------
r2588 | jkbonfield | 2011-07-07 16:21:41 +0100 (Thu, 07 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c

Improved debugging with CACHE_REF_DEBUG.

------------------------------------------------------------------------
r2587 | jkbonfield | 2011-07-07 14:11:33 +0100 (Thu, 07 Jul 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/tgap/tg_bin.c
   M /staden/trunk/src/tgap/tg_iface_g.c

Fixed a major corruption involving reuse of old GRange slots. The
free-list, if containing at least one item, was failing to terminate
with record -1, instead pointing at record 0.

This has been fixed in the unpack_rng_array() function to prevent
possible data corruption, but at a cost of sometimes leaking bin slots
(freeing them up and never reusing them). The correct solution will
involve a minor change to the packed range format which I'll work on
later.

Also added extra code for ensuring bin flags get updated to request data
changed is written back to disk (this is almost certainly done
already, but it's clearer to do at source rather than later on).

------------------------------------------------------------------------
r2586 | jkbonfield | 2011-07-07 14:07:58 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Further checks and fixes: bin->free_rec list
------------------------------------------------------------------------
r2585 | jkbonfield | 2011-07-06 17:08:36 +0100 (Wed, 06 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tgap/tg_tcl.c

Lots of overhauls to editor Undo, which also involved adding a new
move_seq method to the tg-tcl interface.

These fix undo of removal of pad columns for the first or last base in
a contig and the first or last base in a sequence. They also fix undo
of tag deletion - we now recreate the tag using the old record number
instead of a new one (which broke subsequent undo ops on that same
tag).

------------------------------------------------------------------------
r2584 | jkbonfield | 2011-07-06 17:06:50 +0100 (Wed, 06 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Correct errors introduced in insert/delete by the patch to allow these
functions to shift data instead of insert data. They were causing the
bin start/end used portion to be updated incorrectly in some special cases.

------------------------------------------------------------------------
r2583 | jkbonfield | 2011-07-06 17:05:09 +0100 (Wed, 06 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_sequence.c

Replaced an assert with a warning message instead, now that we have a
dedicated checker.

Corrected error in sequence_delete_base() when removing the very last
base. Also added much more code to sequence_range_length() to update
bin used ranges and contig sizes as appropriate.

------------------------------------------------------------------------
r2582 | jkbonfield | 2011-07-06 17:02:31 +0100 (Wed, 06 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Changes to allow check_contig to run on child IOs
------------------------------------------------------------------------
r2581 | jkbonfield | 2011-07-06 17:01:52 +0100 (Wed, 06 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c

Comments
------------------------------------------------------------------------
r2580 | jkbonfield | 2011-07-05 12:18:11 +0100 (Tue, 05 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Added a reference count (lock) to the contig in calculate_consensus_simple2.
This fixes a crash that sometimes happened due in gap5_consensus.

------------------------------------------------------------------------
r2579 | jkbonfield | 2011-07-04 17:42:04 +0100 (Mon, 04 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed edReadEnd() to set the cursor to 1 past the contig end when
cutoffs are not shown. It's now in agreement with the with-cutoffs
implementation.

------------------------------------------------------------------------
r2578 | jkbonfield | 2011-07-04 15:17:35 +0100 (Mon, 04 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Removed memory corruption when we have stored a range containing zero
array elements. This leads to calling ArrayCreate with dim 0 which
secretly gets converted to dim 1, but we reset the array pointer to
one of size 0 causing later corruptions when we try to extend.

Also reverted the order of checks in the seq block decoding to check
in[i].bin before parent_rec. While perhaps a bit slower on our
benchmarks, it avoids spurious valgrind complaints.

------------------------------------------------------------------------
r2577 | jkbonfield | 2011-07-04 15:15:18 +0100 (Mon, 04 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Added assertion to next_range(). Not triggered (yet).

------------------------------------------------------------------------
r2576 | jkbonfield | 2011-07-01 17:17:28 +0100 (Fri, 01 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/ChangeLog
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/gap5/docs/TODO


------------------------------------------------------------------------
r2575 | jkbonfield | 2011-07-01 17:06:10 +0100 (Fri, 01 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Changed the amount of data we tack on to the end of consensus
sequences when computing overlaps. Previously it was a fixed 30%, but
since we modified the band size for the alignment algorithm this was
pushing the alignment beyond the band causing broken alignments in the
join editor.

Now we use the same calculation to keep this in sync with the
alignment algorithm, incase we change the parameters again.

------------------------------------------------------------------------
r2574 | jkbonfield | 2011-07-01 16:42:53 +0100 (Fri, 01 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Further fix to start/end ranges after breaking.

This fix is for the left-hand contigs start coordinate, which can
change if the right hand contig happened to contain the furthest-left
sequence (in cutoff).

------------------------------------------------------------------------
r2573 | jkbonfield | 2011-07-01 12:38:36 +0100 (Fri, 01 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/gap4_compat.tcl

Fixed a crash caused by typing #<num> into a contig identifier
dialogue where <num> was neither a GT_Contig or GT_Seq record id.

------------------------------------------------------------------------
r2572 | jkbonfield | 2011-07-01 12:37:34 +0100 (Fri, 01 Jul 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tgap/tg_anno.c
   M /staden/trunk/src/tgap/tg_check.c
   M /staden/trunk/src/tgap/tg_contig.c
   M /staden/trunk/src/tgap/tg_tcl.c

Fixed the usage of obj_rec in anno_ele_t. Obj_type/obj_rec (and
pair_rec in range_t) point to the record that is being annotated. This
works well for sequences, but is problematic for contigs. Eg consider
breaking a contig in two; all consensus annotations in the right hand
half will need their obj_rec (and pair_rec) fields changing.

Mostly this worked as we simply didn't bother and instead took
consensus annotations to be on the contig they are within, regardless
of the contents of obj_rec or pair_rec, but not in all cases. Now we
force obj_rec to be zero when obj_type is GT_Contig and fixed the
exceptions where we failed to ignore the field.

------------------------------------------------------------------------
r2571 | jkbonfield | 2011-06-30 17:27:13 +0100 (Thu, 30 Jun 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Changed assert ABS(r->end - r->start) + 1 != ABS(s->len) to be less
aggressive. It's now a verror message and we gloss over it, as the
assert served its purpose - to find and fix the bug.

------------------------------------------------------------------------
r2570 | jkbonfield | 2011-06-30 17:11:23 +0100 (Thu, 30 Jun 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Corrected handling of REG_QUIT events
------------------------------------------------------------------------
r2569 | jkbonfield | 2011-06-30 17:11:01 +0100 (Thu, 30 Jun 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Speed increase wheni n read-only mode and asking for sequence only. It
no longer attempts to get quality data as well to store in the cache,
as it cannot (and will not) do this due to r/o mode.

------------------------------------------------------------------------
r2568 | jkbonfield | 2011-06-30 17:10:05 +0100 (Thu, 30 Jun 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Allow 'n' as well as 'N' in seqs
------------------------------------------------------------------------
r2567 | jkbonfield | 2011-06-30 17:09:48 +0100 (Thu, 30 Jun 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Sped up io_seq_block_read when there are a large number of libraries.
Sometimes it can be 3x faster, but for the usual case there is little
difference.

------------------------------------------------------------------------
r2566 | jkbonfield | 2011-06-30 12:04:27 +0100 (Thu, 30 Jun 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl

Bug fix when saving fastq. We always computed the quality for the
entire contig rather than just the region we specified.

-----------------------------------------------------------------------------
Older ChangeLog format below.

2011-06-30  jkbonfield

	* tgap/tg_check.c: Extra check for where a child bin has a
	  non-zero record but cannot be read. Also fixable.

	* gap5/break_contig.c, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_tracks.c: Fixed bin_get_position() to deal with
	  complemented bins correctly, and also return relative
	  orientation of the query bin to the contig now.
	  
	  This and changes in Break Contig together have fixed a bug where
	  breaking a contig could sometimes cause the bin position to be
	  incorrect and at odds with contig->start/end.

	* gap5/consen.tcl: Fixed a reference count leak in the Save
	  Consensus code.

2011-06-29  jkbonfield

	* gap5/contig_editor.tcl, gap5/tk-io-reg.c,
	  tgap/tg_register.c: Fixed quit_displays and REG_QUIT
	  notifications so that the contig editor correctly cets a
	  chance to veto any attempts at shutting down gap5 if there
	  are unsaved changes.

	* gap5/gap4_compat.c: contig_name_to_number() now accepts
	  reading numbers too, used after the contig index lookup
	  fails.
	  
	  This means using fofn or lists for contigs containing
	  reading names works again, as per Gap4 style.

2011-06-28  jkbonfield

	* tgap/tg_check.c: Removal of false positives (empty bins).
	  
	  Added fix-up for contig order size.

	* tgap/tg_contig.c: Removed a reference count leak in the
	  contig iterator (leaking bins at times).
	  
	  Made contig_destroy() decrement the size of the contig_order
	  array.  This wasn't strictly a problem as we always use
	  io->db.Ncontigs to work out how many contigs there are, but
	  it's inefficient (writing out more data than we need to) and
	  the new check_database code just happened to notice it due
	  to extra-anal checking.

2011-06-28  awhitwham

	* gap5/fasta.c: Fixed double free.

2011-06-27  jkbonfield

	* gap5/check_database.tcl, gap5/gap5.tcl, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/tclIndex, tgap/tg_check.c,
	  tgap/tg_check.h, tgap/tg_tcl.c: Further work on Check Database.
	  
	  * It now has a user interface.
	  * The fix mode can now correct for more things.
	  * Uses vmessage() instead of fprintf().
	  * Added annotation and refpos checks.
	  * Added checks for libraries and contig order.

	* tgap/tg_iface_g.c: Fixed lock/view leak in io_rec_exists().

	* gap5/list_contigs.tcl, gap5/list_proc.tcl: Removal of reference
	  count leak ($io get_contig).

	* tgap/tg_gio.c, tgap/xerror.c, tgap/xerror.h: Removed unused error
	  handling code.
	  
	  Improved error messages reported when failing to create a new
	  database.

	* tgap/tg_bin.c: Removal of debugging info

2011-06-24  jkbonfield

	* gap5/sam_index.c: Fix for consensus tags. The anno_ele_t
	  struct was previously claiming it annotations the sequence
	  the Zc:A:* aux record was found on, rather than the
	  contig. However the range_t for that anno was correct which
	  is why the affect was invisible.
	  
	  The bug fix is purely a consistency fix.

	* gap5/consensus.c: Fixed memory corruption in the consensus
	  algorithm.
	  
	  Recomputing an existing cached consensus due to changes to
	  the contig, when the contig also grew, was sometimes
	  overflowing a buffer.

	* gap5/ace.c: Two fixes to ACE importing.
	  
	  1) The mapping quality has now changed to 255 (the SAM
	  synonym for unknown), both consistently in range_t and seq_t
	  structs.  Previously it was 0 and 50 which caused
	  check_contig() to complain.
	  
	  2) Fixed a stack corruption when copying over the sequence
	  data.  I've no idea why this ever worked, but it used to.

2011-06-23  jkbonfield

	* tgap/Makefile, tgap/tg_check.c, tgap/tg_check.h, tgap/tg_tcl.c:
	  Added a check_contig() function for internal consistency
	  checking.
	  
	  It's a work in progress: functional now and already
	  identifying some issues, but without a UI.

	* NEWS: Collation of change logs

	* gap5/consensus.c, gap5/consensus.h, tgap/tg_bin.c: Bug fixes
	  to removal of data from a contig (utilised when moving
	  data). This wasn't updating the bin start_used and end_used
	  fields where the sequence being removed was the cause of the
	  bin extents being that large.
	  
	  When this happens, it also now triggers a check on the
	  contig extents, as the contig start/end may also need
	  updating.

2011-06-21  jkbonfield

	* gap5/tg_index_common.c, gap5/tg_index_common.h: Accidentally
	  commited half a test-change in tg_index_common.c. So
	  commented it out and the associated code in tg_index_common.h.
	  
	  (The change was to track mapping quality and only build
	  insert size distributions from good quality
	  alignments. Potentially useful, hence commented out instead
	  of removed completely.)

	* tk_utils/init.tcl: We now check whether the editor "Sheet"
	  font is fixed width. Some Tk version and font package
	  combinations (eg Tk8.5 when specifying font name "Fixed")
	  didn't work too well and chose alternatives, not always
	  sensible ones.
	  
	  In these cases we fall back to a default Courier which
	  should work everywhere.

	* gap5/contig_selector.tcl: Removed List Notes from the context
	  menu.

	* gap5/consensus.c: I'm not sure it matters greatly, but
	  explicitly allow for extending the search range in iterators
	  within consensus_valid_range. (In theory the CITER_CSTART
	  and CITER_CEND already indicate this, but to be honest I
	  forget whether this change was the one that fixed the clip
	  point code so I'm keeping it!)

	* gap4/shuffle_pads.c: Improved alignment positioning. Instead
	  of +/-3 for the length we allow half a band-width. This
	  improves alignments in many cases.

	* NEWS, gap5/Makefile, gap5/gap5rc_menu_full,
	  gap5/newgap5_cmds.c, gap5/shuffle_pads.c,
	  gap5/shuffle_pads.h, gap5/shuffle_pads.tcl,
	  seq_utils/align_lib.c, seq_utils/align_lib.h: Added the
	  first version of Shuffle Pads to gap5. This is based on the
	  Gap4 version, which in turn is based on Gene Myers'
	  ReAligner program.  It's not desparately fast, but
	  functional.

2011-06-17  jkbonfield

	* tgap/tg_contig.c, tgap/tg_contig.h: Fixed two bugs with the
	  contig iterators, introduced in the recent change to try and
	  speed them up.
	  
	  Firstly, CITER_SMALL_BS had a value which clashed with CITER_IEND
	  causing data to always be sorted on right hand end even when
	  explicitly asked to sort of left end. This means iterators could
	  skip
	  data.
	  
	  Secondly, we jumped CITER_BS into the contig for each range
	  search, even when the first one only fetched CITER_SMALL_BS
	  worth of data.
	  
	  The affects were ride ranging, but mostly hard to
	  detect. The most obvious impact is control-a and control-e
	  to jump to the start and end of the contig in the contig
	  editor would sometimes not take us all the way there when
	  faced with widely varying sequence lengths (eg capillary
	  assemblies).

2011-06-16  jkbonfield

	* tgap/tg_bin.c: Identified a bug in bin_add_range and
	  bin_for_range.
	  
	  When creating new bins as the smallest bin is larger than
	  io->min_bin_size and we're in a complemented orientation
	  (our parent or one of its parents has been complemented),
	  then we were setting offset incorrect. This meant that
	  sequences were put in the incorrect location. This bug was
	  in bin_for_range().
	  
	  Also in bin_add_range() we updated the start_used and
	  end_used bin fields incorrectly for complemented bins.

2011-06-14  jkbonfield

	* system.mk.in: More SVN_VERSION fixes

	* system.mk.in: Patch to fix latest SVN_VERSION string.

	* gap5/bam.c: Removed harmless icc compiler warning

	* Misc/misc.h, configure.in, gap4/gap.tcl, gap5/gap5.tcl,
	  gap5/tg_index.c, gap5/tg_index_common.c, gap5/tg_view.c,
	  pregap4/gui.tcl, staden_config.h.in, system.mk.in,
	  tk_utils/init.c, trev/trev.tcl: Added the svn head revision
	  number to C define and Tcl global variables. We use these
	  when reporting program version numbers, so even minor
	  revision updates become obvious for users running the
	  programs.

2011-06-13  jkbonfield

	* gap4/init.c: Remove signal handlers for Gap4 too. This is
	  because abort() within a signal handler very often ends up
	  in a core file which gdb cannot produce stack traces from
	  (on linux). I'd rather have no messages on a crash then a
	  broken core file.

	* tgap/actf.c: Fixed uninitialised memory access. Could
	  occasionally result in failure to open databases.

	* gap5/editor_view.c, gap5/editor_view.h, gap5/find_oligo.c:
	  Added an editor method to find existing editors for a
	  specific contig. Used this within the Sequence Search
	  function so that the Next button won't keep bringing up new
	  editors each time.
	  
	  This allowed resolving a user request, as we can (and do) now
	  underline the appropriate section of the editor too.

	* gap5/gap-error.c, gap5/init.c, gap5/stack_dump.c: Added
	  stack dump printing for the linux signal handlers, but I now
	  decided the signal handler itself is a bad idea given how it
	  prevents gdb from working. I'd rather have no stack trace
	  and a working gdb than a stack trace and a core file I
	  cannot debug.

2011-06-10  jkbonfield

	* tgap/tg_struct.h: (Forgot with previous commit)
	  Added in-memory-only fields to library_t for caching.

	* gap5/editor_view.c, gap5/gap5rc, gap5/gap5rc_menu_full,
	  gap5/libraries.tcl, gap5/tkEditor.c, tgap/tg_iface_g.c,
	  tgap/tg_library.c, tgap/tg_sequence.c, tgap/tg_sequence.h: Added
	  some template status colours to the contig editor:
	  
	  white = ok pair
	  blue = single ended
	  orange = pair, spanning contigs
	  red = inconsistent orientation
	  grey = consistent orientation, but distance too large or too
	  small.
	  
	  In the process of this I also added some in-memory only
	  fields to the library_t struct for tracking whether the
	  library stats are up to date. Also improved the library mean
	  and s.d. calculations to be iterative, attempting to home in
	  on a suitable peak and remove outliers. This doesn't change
	  the mean significantly, but dramatically reduces the
	  variance to a sensible figure by excluding likely invalid
	  templates.
	  
	  In the editor names display, this also caused a few tweaks
	  to mapping quality display. Now in packed mode the names are
	  always coloured, either by template status or by mapping
	  quality. (Ie the Quality button no longer controls the
	  colouring of the names.) The unpacked dir+readname name
	  display has room for showing both template and mapping
	  quality data, so both are always shown.

	* tk_utils/init.tcl, tk_utils/sheet.c, tk_utils/sheet.h,
	  tk_utils/tkSheet_common.c, tk_utils/tkSheet_common.h,
	  tk_utils/tkSheet_config.h, tk_utils/tk_utilsrc: Finally
	  implemented the sh_bold highlight mode, some 10+ years after
	  it was first added to the bit-field.

	* gap5/consensus.c, gap5/consensus.h, gap5/contig_editor.tcl,
	  gap5/editor_search.c, gap5/editor_search.tcl,
	  gap5/newgap5_cmds.c, gap5/newgap_structs.h: Added unpadded
	  position display/search to the contig editor.
	  
	  Right now this is a noddy approach operating by simply
	  computing the consensus and counting '*'s, although it's
	  rescued to some extent by the consensus cache. (I had to
	  enable this again for child IO's, but hopefully it now works
	  fully.)
	  
	  The editor "goto" box in the bottom left still works on
	  padded or reference coordinates as listed by the P or R
	  button, but manually adding the letter 'u' after a number
	  will request unpadded coord.  The P/R button hasn't been
	  made P/R/U yet as the display of coordinates will be too
	  slow still.
	  
	  There are more explicit padded vs unpadded options in the
	  search dialogue, or hitting Return in the editor consensus
	  will also show that coordinate.

2011-06-07  jkbonfield

	* gap5/newgap5_cmds.c, gap5/newgap_structs.h, gap5/readpair.c,
	  gap5/readpair.h, gap5/readpair.tcl: The Find Read Pairs plot
	  now has the option to filter the reported hits by the
	  library. By default it uses all. Note filtering slows down
	  the code substantially.

	* gap5/consensus.c, tgap/tg_contig.c, tgap/tg_contig.h: Speed
	  increase to the contig iterator when supplied with whence &
	  CITER_SMALL_BS. Then it only uses 100 bp window instead of a
	  10Kb window for the initial range query. This is optimal
	  when being called from consensus_valid_range as the chances
	  are 100bp from the end is sufficient to find the real contig
	  clip point, while still not affecting efficiency for range
	  queries beyond the ends.

2011-06-06  jkbonfield

	* gap5/gap_range.c: Bug fix to the template pairing.
	  
	  The recent change to add the quality plot changed how the
	  detection of "done this pair" code worked, from zeroing
	  record number to setting a flag (as we needed the record
	  left intact). Unfortunately it was bugged. The impact was
	  that using filters would lose many pairs and they'd stay
	  lost until we had to query a new range.

	* gap5/contig_editor.tcl, tk_utils/sheet.c, tk_utils/sheet.h,
	  tk_utils/tkSheet_config.h: The sheet widget now has an
	  option to control whether a cursor is solid or a hollow
	  box. This isn't automatically tied to focus, but is
	  controlled explicitly from the join editor to indicate which
	  of the pair is the "curr_editor".

	* gap5/contig_editor.tcl, gap5/editor_search.tcl: Improved
	  editor search UI. Hovering over the Search button in the
	  dialogue window will now highlight which editor of an join
	  editor pair will be searched in. (As before, left-clicking
	  in an editor will change this, only now it's obvious this
	  happens.)
	  
	  Also fixed control-S/control-R so they don't bring up a separate
	  dialogue window.

	* gap5/contig_editor.tcl: Clicking on a base within the tag
	  now displays the summary data of the base underneath it
	  instead of repeating the mouse-over text. This is the same
	  interface as gap4 now.

2011-06-03  jkbonfield

	* Misc/dstring.c, gap4/newgap_cmds.c, gap4/tkEditor.c,
	  gap4/tman_interface.c, gap5/consensus.c, gap5/editor_search.c,
	  gap5/hash_lib.c, gap5/hash_lib.h, gap5/readpair.c,
	  gap5/sam_index.c, gap5/tg_index.c, spin/seq_results.c,
	  spin/seqed_search.c, tgap/tg_gio.c, tgap/tg_iface_g.c,
	  tgap/tg_library.c, tk_utils/tcl_io_lib.c: Another rag-tag batch
	  of compiler warning removals.
	  
	  90% of these are unused variables, but there's a few missing
	  prototypes and the occasional printf arguments issue (in error
	  handling code).

	* spin2/Makefile, spin2/seq_reg_cmds.c, spin2/spin.tcl: Spin2 is
	  still unused program, but minor tweaks to get it to compile
	  should we ever need to release it again.

	* gap5/Makefile, gap5/depth.tcl, gap5/depth_track.c,
	  gap5/gap5rc, gap5/gap_range.c, gap5/gap_range.h,
	  gap5/newgap5_cmds.c, gap5/quality_plot.c,
	  gap5/quality_plot.h, gap5/template_display.c: Added various
	  consensus quality plots to the template display. By default
	  they are turned off as they incur a heavy CPU cost: unlike
	  the main template display, computing the consensus needs to
	  fetch all the seq_t objects rather than just the bin/range
	  arrays.
	  
	  The quality plots occupy one single track but are
	  configuration to show consensus quality, discrepancies or
	  heterozygosity (the highest log-odds score for any het
	  mixture).

	* gap5/consensus.c, gap5/consensus.h: Speed optimisations to
	  calculate_consensus_bit_het. Also exposed it outside the
	  scope of this file so it can be called directly when a
	  rangec_t array is already know. This also allows direct
	  control of what to compute, to skip some things. Eg don't
	  bother filling out the 7-way log-odds scores if all we're
	  going to be using is the phred score.

	* tgap/tg_iface_g.c: Minor speed optimisation to unpack_rng_array()

2011-06-01  awhitwham

	* tgap/actf.c, tgap/g-files.c, tgap/g-files.h: Fixed bug where gap5
	  couldn't open a db in another directory from the File menu.

2011-05-31  jkbonfield

	* gap4/fij.c: Fixed free ordering, which was causing glibc
	  malloc checking to fail.  Only happened when
	  make_consensus() failed (eg due to too small a max-consensus
	  size).

2011-05-26  jkbonfield

	* gap5/contig_editor.tcl, tgap/tg_contig.c, tgap/tg_tcl.c:
	  Added editor Undo support for the contig-shift
	  operations. This was a bit complex, so needed a $contig
	  move_anno method adding in the tcl interface too.

2011-05-25  jkbonfield

	* tgap/tg_contig.c: Fixed moving of annotation tags when using
	  the new contig shift left/right functions.
	  
	  Sped up the shift functions by tweaking hache table
	  configuration.

2011-05-24  jkbonfield

	* gap5/contig_editor.tcl, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_tcl.c: Added commands to shift data in a
	  contig. These move all data to the right of the editing
	  cursor to the right or left by one base (bound to
	  control-left and control-right arrow keys in th editor with
	  the cursor on the consensus).
	  
	  This is implemented using the existing code to insert or remove
	  columns of pads, but without the actual sequence-editing step.

	* tgap/tg_sequence.c, tgap/tg_sequence.h, tgap/tg_tcl.c: Fixed a
	  bug where the tcl interface to sequence_insert_bases and
	  sequence_delete_bases didn't update the range_t structure.
	  Consequentially the sequence length and the start..end length in
	  the
	  range struct could differ.
	  
	  This was detected via the assertions added in svn update
	  #2493, so we now know what was altering the data that
	  triggered the bug fixed there.
	  
	  From C the only other use of the sequence ins/del functions
	  are from the code in tg_contig.c to insert/delete entire
	  columns of pads, and these already updated the range arrays
	  correctly. Resolved the issue by creating a new
	  sequence_range_length() function to update the range data
	  any time we feel it's been invalidated due to changing
	  sequence length.

2011-05-20  jkbonfield

	* gap5/contig_editor.tcl, gap5/gap5rc_menu_full: Fixed the Commands
	  menu to work properly in a join editor. Now Create
	  Tag on the top window adds tags to that window and not the bottom
	  one.

2011-05-19  awhitwham

	* gap5/afg.h: Added missing header file.

2011-05-19  jkbonfield

	* gap5/consensus.c, gap5/consensus.h, gap5/editor_search.c,
	  gap5/editor_search.tcl, gap5/gap5rc: Added a discrepancy
	  calculation to the consensus algorithm too. This attempts to
	  score discrpeancies based on the number of mismatching bases
	  vs the expected number given depth and confidence values.
	  It then expresses this in a (half-baked?) way that takes
	  into account significance through sample-size.
	  
	  Exposed both this and the previous het score[6] value to the
	  contig editor search window.

	* tgap/tg_anno.c: Unused code at present - for future work on tag
	  orientation

2011-05-18  awhitwham

	* gap5/Makefile, gap5/afg.c, gap5/tg_index.c: Experimental Velvet
	  afg file indexing added.

2011-05-18  jkbonfield

	* gap5/contig_editor.tcl: Added a Join To function for read-pairs
	  that span contigs.

	* gap5/contig_editor.tcl, gap5/editor_view.c,
	  gap5/editor_view.h, gap5/fij.c, gap5/tkEditor.c: Added
	  next_difference and prev_difference methods to the editor
	  widget. These search through the join editor consensus
	  sequences looking for differences. The join editor
	  "differences" line now has < and > buttons to call these.
	  
	  Also bug fixed the FIJ "Invoke Join Editor" menu item so
	  that it positions the editor cursor on the correct consensus
	  base instead of the first read in the contig (often being
	  beyond the end of it leading to an invisible cursor).

	* gap5/consensus.c: Remove the code in
	  calculate_consensus_simple() to convert a call to N if the
	  scores[call] < Q_CUTOFF. This often happens now due to it
	  preferring say A/C over A, but we'd rather the consensus is
	  still kept as A for ease of algorithms elsewhere.

2011-05-17  awhitwham

	* gap5/caf.c: Replaced zf file functions with normal ones. CAF does
	  not work with compressed files.

2011-05-17  jkbonfield

	* gap5/consensus.c, gap5/consensus.h, gap5/editor_view.c,
	  gap5/gap5rc: Implemented a new consensus algorithm to compute
	  probabilities for
	  both pure single-base columns of data and mixed heterozygous
	  columns.
	  
	  This means it can call the consensus as likely consisting
	  of, say, an AT mix instead of pure A or pure T. We still
	  also call the most likely homozygous consensus, but if it is
	  more likely to be a heterozygous mix then the probability
	  assigned to a homozygous call is therefore far lower than
	  before.
	  
	  My belief is that this will prevent major conflicts still
	  being given very high homozygous consensus values simply
	  because one base type outweighs another. This work also
	  forms the basis of SNP calling or misassembly detection.

2011-05-13  jkbonfield

	* gap5/consensus.c: Removed the fixed confidence of pads, now
	  using the score listed on that base. Also permit confidence
	  100 on pads to force consensus.

	* gap5/gap5: Don't override $GTAGDB if already set.

	* tgap/tg_tcl.c: Fix to inserting sequences in certain
	  combinations of complemented bins. This becomes visible when
	  using control-left/control-right in the editor to move
	  sequences around, which sometimes had the impact of reverse
	  complementing data too.

2011-05-06  jkbonfield

	* gap5/docs/TODO, tgap/tg_bin.c, tgap/tg_bin.h: Fixed issues with
	  moving sequences using control-left/right arrow
	  keys.
	  
	  In some situations it would reverse complement data due to
	  incorrectly checking BIN_COMPLEMENT flag rather than XORing
	  it with the full path back to the root bin.
	  
	  It also incorrectly returned the complement flag when using
	  CACHE_LAST_BIN optimisations.

	* gap5/editor_view.c: Fixed cut and paste of complemented
	  sequences when in a bin that has been complemented.

	* tgap/tg_sequence.c: typo

	* tgap/tg_contig.c, tgap/tg_sequence.c: In attempts to track
	  down crashes when inserting columns of pads to contigs that
	  have been highly broken, complemented and joined I temporary
	  implemented a new version of contig_insert_base(). For now
	  this is #ifdef-ed out though as it turns out the cause is a
	  disparity between s->len and r->end - r->start + 1: cause
	  unknown!
	  
	  So, added some asserts to check for this. This doesn't fix
	  the bug and data corruption! It just means it'll hopefully
	  it'll be pointed out far sooner after it occurs, giving a
	  more obvious link between cause and effect.
	  
	  Also improved robustness of sequence insertion to check for
	  attempting to insert off the end of a sequence.

	* gap5/contig_editor.tcl: The Goto... feature now attempts to
	  list gap size between template pairs.
	  
	  Fixed a display error where the contig record was not
	  re-cached when inserting or deleting columns of pads.

	* gap5/libraries.tcl: Added a key and scrollbars to the plot
	  interface.

	* gap5/ace.c, gap5/baf.c, gap5/caf.c, gap5/fasta.c,
	  gap5/maq.c, gap5/sam_index.c, gap5/tg_index_common.c,
	  tgap/tg_iface_g.c, tgap/tg_struct.h: Modified contig_t,
	  seq_t, anno_ele_t and library_t data structures to use "char
	  data[1]" as the terminating entry rather than "char
	  *data". This is both more in line with what I intended
	  (actually "char data[]" would be better, but may not be
	  supported everywhere yet) and also works around a bug(?) in
	  GCC 4.4.4 onwards giving false-hits in the buffer overrun
	  detection code of _FORTIFY_SOURCE.

	* gap5/docs/TODO:

2011-05-04  jkbonfield

	* tgap/tg_cache.c, tgap/tg_cache_item.h: Fixed undefined
	  behaviour in construct_key() and the use of structure
	  assignments. It had an accidental assumption on structure
	  copying preserving the contents of structure padding
	  bytes. This exhibited itself as problems when compiling on
	  gcc 4.4.
	  
	  Also reworked the cached_item struct to remove excessive use
	  of bit-fields and instead moved them into the recently
	  creating structure padding caused by changing tg_rec to
	  64-bit.

	* tgap/tg_iface_g.c: Debugging support (disabled atm)

2011-04-21  jkbonfield

	* gap5/readpair.c: Removal of debugging output.

	* gap5/gap_hash.c: Enable word size 14 in find repeats on large
	  data-sets; > 100Mb of consensus

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/readpair.c:
	  Fixed Find Read Pairs. It now should work better with
	  reversed matches and it now also invokes the join editor at
	  the correct locations.

	* gap5/consensus.c: Fix an issue with the new consensus valid
	  range code. When faced with inconsistent data where all
	  reads are outside the claimed start..end range, or simply
	  contigs with no data, we no longer return INT_MIN/INT_MAX as
	  values. Instead we return 0.

	* gap5/fasta.c, tgap/tg_bin.c, tgap/tg_cache.c: Some tweaks to
	  improve handling *really* large single sequences (>
	  1Gb). It's still not robust in that situation and not to be
	  recommended.

2011-04-20  jkbonfield

	* gap5/editor_search.c: Allow #record_number to be used for reading
	  name search

	* gap5/contig_editor.tcl: Fixed bug when right clicking on reading
	  names

	* Misc/Makefile, Misc/misc.h, Misc/strtol64.c: Added
	  strtol32/strtol64 and atoi equiv implementations.
	  
	  These avoid having to check everywhere whether strtol or
	  strtoll is the appropriate function to return an int64_t
	  data type.

2011-04-19  jkbonfield

	* gap5/gap5.tcl, gap5/tg_index.c: Bump version to 1.2.12 for local
	  test release.

	* gap5/hash_lib.c: fast_mode is now off by default. It was
	  always set/unset explicitly by FIJ, but the "align" button
	  in the join editor just uses the default.

	* gap5/gap_hash.c, gap5/hash_lib.c, gap5/hash_lib.h: Further speed
	  up of Find Repeats, along with a memory reduction.
	  
	  We now have versions of init_hashn, store_hashn and reps
	  that don't use the h->counts[] array.

	* gap5/consensus.c: Rewrite of consensus_valid_range() to use
	  contig iterators. The new version is generally substantially
	  faster.

	* tgap/tg_iface_g.c: Check the master database version and
	  don't attempt to write structures in formats newer than the
	  master version indicates.
	  
	  This has currently only been implemented for version 1 vs 2,
	  which covers the addition of reference positions in bin
	  Ranges and nannotations in bin structs.

	* Misc/Makefile, gap4/Makefile, get_scf_field/Makefile,
	  haplo/Makefile, polyA_clip/Makefile, qclip/Makefile,
	  spin/Makefile, text_utils/Makefile, tk_utils/Makefile:
	  Auto-updates from "make depend"

	* gap5/Makefile, gap5/actf.c, gap5/actf.h, gap5/fij.c,
	  gap5/find_repeats.c, gap5/fort.h, gap5/gap_globals.c,
	  gap5/gap_hash.c, tgap/Makefile, tgap/actf.c, tgap/actf.h: Moved
	  actf.c from gap5 to tgap as it's used by libtgap. This fixes
	  MacOS X build issues.
	  
	  Also removed the redundant fort.h

2011-04-18  jkbonfield

	* gap5/contig_editor.tcl: Fixed the editor Join command. It
	  saved the two contigs but then gave the option to bail out
	  after saving if the mismatch was two high.  Now the order of
	  this logic has been reversed.

	* gap5/contig_editor.tcl, gap5/editor_join.c,
	  tgap/tg_sequence.c, tgap/tg_tcl.c: Quality values inserted
	  (manually or automatically by the join editor Align button)
	  to the consensus and/or sequences now default to quality
	  -1. This is interpreted as MIN(left_qual,right_qual).

2011-04-15  jkbonfield

	* gap5/do_fij.c: Reverse the order of comparisons when doing single
	  vs all in FIJ.
	  
	  The outer loop is now the single contig with the inner loop
	  being each contig in turn to compare against it. This sounds
	  like it should be slower than hashing all at once and
	  comparing a single contig against it, but benchmarking says
	  otherwise.

	* gap5/assemble_single.tcl, gap5/gap5rc, gap5/map_reads.tcl,
	  gap5/tclIndex, tk_utils/Makefile, tk_utils/init.c,
	  tk_utils/tcl_io_lib.c, tk_utils/tcl_io_lib.h: Extended the
	  Map Reads functions of gap5 to be able to use a file of
	  filenames, using io_lib to read from experiment files and
	  trace files (either as local files or remote via URLs).

	* gap5/consen.tcl: Removal of debugging output

	* gap4/cs-object.c: Speed increase to DeleteRepeats (as per gap5
	  change).

	* gap5/cs-object.c, gap5/cs-object.h: Huge speed increase in
	  destroying the contig selector "canvas item ID to C pointer"
	  hash table. With ~1 million find repeat hits it's now 1500
	  times faster to shut down the display.

2011-04-14  jkbonfield

	* tgap/g-files.c: Minor update to finding files by old vs new
	  filename. Previously it sometimes modified the database
	  filename during the first pass, causing it to fail 2nd as
	  well.

	* gap4/tagEditor.c: Fix accessing of free memory by minor moving of
	  TagEdDestroy call

	* gap5/do_fij.c, gap5/docs/TODO, gap5/editor_join.c, gap5/fij.c,
	  gap5/fij.h, gap5/fij.tcl, gap5/gap5rc, gap5/gap_hash.c,
	  gap5/hash_lib.c, gap5/hash_lib.h, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h, seq_utils/align_lib.h,
	  seq_utils/dna_utils.c, seq_utils/dna_utils.h: Major speed
	  improvements to Find Internal Joins and Find Repeats.
	  
	  FIJ is around 10x faster in quick mode, and I also added a
	  fastest mode that takes a few more liberties in order to
	  speed things up further (another 2-3x over quick
	  mode). Speed gains will vary by size of project and number
	  of contigs. The above was on a project with ~1500 contigs
	  and ~20Mb of consensus.
	  
	  Some related speed ups may be possible in the sensitive
	  mode, but for now I've left that code largely as-is.
	  
	  One of the speeds to FIJ involved the hashing code, which is
	  the core of Find Repeats. Consequentially Find Repeats is
	  somewhere around 100x faster! Again, depending on the
	  project.

	* seq_utils/align_lib.c: Minor improvements to debug calls

	* tk_utils/tkTrace.c: Removed use of png_set_compression_level, to
	  avoid issues with Z_BEST_COMPRESSION not being found on some
	  Macs. Why?

	* tk_utils/text_output.c: Allow for \r at start of a vmessage()
	  call to request overwriting the current output line

	* tk_utils/scalebox.tcl: Added a -variable option to scalebox

	* gap5/contig_selector.c: Faster repeat/FIJ plotting

	* gap5/consensus.c: Fixed a bug involving consensus being spaces at
	  the ends of contig.
	  
	  Removed debugging printfs.

2011-03-24  jkbonfield

	* gap5/contig_editor.tcl: Modified Page Up and Page Down to
	  scroll 1 screen full at a time instead of 1 Kb. The modified
	  Page Up/Down (shift, control shift+control) have been
	  updated to do the old 1k and beyond scroll incremements.
	  
	  Also added Home and End keybindings to mimic control-a and
	  control-e.

	* gap5/gap5rc_menu_full, gap5/search.tcl: Added a prefix
	  search for sequence names, using the new iterator prefix
	  mechanism.

	* tgap/b+tree2.c, tgap/b+tree2.h, tgap/tg_gio.h,
	  tgap/tg_iface.h, tgap/tg_iface_g.c, tgap/tg_sequence.c,
	  tgap/tg_sequence.h, tgap/tg_tcl.c: Added an iterator to the
	  B+Tree implementation (currently only "next" and no
	  "previous"). Exposed this to the Tcl interface.

2011-03-23  jkbonfield

	* gap5/tkEditor.c: Added bounds checking to the X scrollbar

	* gap5/depth.tcl, gap5/template_display.c: Removed excessive
	  debugging output.

	* gap5/consensus.c, gap5/editor_view.c: The consensus off the
	  ends of contigs is now " " (space) rather than "N".
	  
	  Also put bounds checking in for user-selections in the
	  consensus line, preventing users from attempting to create
	  tags off the ends of contigs.

	* gap5/contig_editor.tcl: Added more incr/decr contig calls as tag
	  creation/deletion can modify the contig struct. This had the
	  effect of causing data to temporarily vanish due to out of date
	  caches.

	* tgap/tg_contig.c: Fixed typo in postscript generation

2011-03-22  jkbonfield

	* gap5/sam_index.c, gap5/sam_pileup.c, gap5/sam_pileup.h: Added
	  handling for cigar N (reference skip) alignments.
	  
	  For now we just create a separate sequence, but we need a
	  more general purpose mechanism of dealing with templates
	  with more than 2 sequences.
	  
	  TODO: Check the TC field in sam aux as an indicator of
	  whether it's acceptable to remove the hashed template name
	  when we see the second record. Also set this mode when
	  finding a cigar N op.

	* gap5/bam.c: Improved error messages when parsing BAM headers
	  - with line numbers and report of erroneous text.
	  
	  We no longer simply exit on bad formatted data, but attempt to
	  gracefully continue albeit with messages to stderr.

	* tk_utils/text_output.c: Changed default value of "noisy" to 0.
	  This also has the effect of reducing the need for our_interp
	  to be initialised before calling verror.

2011-03-21  jkbonfield

	* gap5/gap_range.c: Minor bug fix to handle cases when depth is
	  zero.

	* ChangeLog, NEWS:

	* gap5/depth.tcl, gap5/gap_range.c, gap5/gap_range.h: Improvements
	  to the template display:
	  
	  1) It now deals better with contigs that do not start as base 1.
	  
	  2) The depth plot should no longer change Y values so
	  drastically when zooming in and out. This still exists in part
	  due to aliasing, but it's far better than it was.

2011-03-18  jkbonfield

	* gap5/actf.c: Fix to actf_lock(); don't complain of missing
	  database files when we're attempting to create a new one.

	* gap5/actf.c, gap5/actf.h, tgap/g-files.c, tgap/g-files.h,
	  tgap/tg_gio.c: Added BUSY file locking for Gap5, as per Gap4.

	* gap5/tag_editor.tcl: Temporarily removed the tag editor Move and
	  Copy buttons as they haven't yet been implemented.

	* gap5/bam.c: Removed buffer overrun in sam_next_seq() when
	  processing SAM files with no @SQ lines. It wasn't null
	  terminating the reference string.

2011-03-17  jkbonfield

	* gap5/fasta.c, gap5/fasta.h, gap5/newgap5_cmds.c: Fixed fasta
	  import:
	  
	  It now correctly terminates the last reading. Previously it
	  would produce a blank contig for the last sequence.
	  
	  It also now calls bin_add_range at the end to flush any cached
	  nseq values, so contigs no longer claim to have zero sequences
	  in them.

	* gap5/contig_selector.c: Fixed a bug with reordering contigs. It
	  could cause a contig to be duplicated and another to be
	  overwritten when the user moved contigs around.

2011-03-16  jkbonfield

	* gap5/break_contig.c, gap5/consensus.c, gap5/contig_editor.tcl,
	  gap5/contig_selector.tcl, gap5/editor_join.c,
	  gap5/editor_search.c, gap5/editor_search.tcl,
	  gap5/editor_view.c, gap5/gap5.tcl, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/list_contigs.tcl,
	  gap5/newgap5_cmds.c, gap5/sam_index.c, gap5/tg_index.c,
	  gap5/tg_index.h, gap5/tkEditor.c, gap5/tkEditor.h,
	  tgap/g-files.c, tgap/tg_anno.c, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_contig.c, tgap/tg_contig.h, tgap/tg_iface_g.c,
	  tgap/tg_struct.h, tgap/tg_tcl.c:

	  Reference base coordinates are now tracked when the input is a
	  SAM/BAM file. This required adjustments to the on-disc file
	  formats for bins, although the code will still read the old
	  format data too.
	  
	  In the editor window the position box in the bottom left now has
	  a P or R label next to it. Clicking this toggles padded vs
	  reference coordinates. It can be adjusted from the settings menu
	  too. When in Reference mode the contig coordinate line also
	  updates too.
	  
	  An editor search mode of "reference indel" has been added, to
	  skip ahead to the next consensus insertion or deletion to the
	  reference. Do not confuse these with pads - it's specifically
	  where the data has been removed. Even when all the sequences
	  have a D operator, if they have all had a * added then the
	  consensus is the correct length and still has a 1:1 mapping to
	  the reference, meaning there are no missing bases to find. A
	  future useful addition though would be to add markers for
	  consensus pads that align against a reference base
	  (deletion of zero length maybe?) so we can search for these.
	  
	  We also need to decide how to fit unpadded coordinates into this
	  system still.
	  
	  Implementation wise, a bin range now has an additional type
	  REFPOS. A refpos object has no actual record, but instead uses
	  these range fields to hold a mapping to the absolute reference
	  ID and coordinate.
	  
	  Added nrefpos and nanno to the bin struct in addition to the
	  existing nseqs field. Much like nseqs these count the number of
	  objects in this bin and child bins in a recursive manner.
	  
	  Updated the contig iterators to use nseqs, nrefpos and nanno
	  fields to short-cut the searches for next/previous
	  item. Basically this is my "needle in a haystack" algorithm
	  allowing us to rapidly skip forward to e.g. the next annotation
	  simply by noting which bins have nanno == 0, and not requiring a
	  linear read of every bin range.
	  
	  
	  
	  Other passenger updates that appeared in this large update: -
	  Editor "stripe mode" or "fanfold mode" has reappeared. This is
	  just a visual tweak to make visualising columns easier in deep
	  repetitive data.
	  
	  - Fixed contig annotations in SAM to no longer claim to be on
	  sequences.
	  
	  - Relaxed the SAM data out of order check as it's currently
	  triggered by alignments starting with a deletion in the cigar
	  string. We need a better check for this.
	  
	  - SAM/BAM reading code now automatically removes duplicates
	  unless tg_index -D flag is specified.
	  
	  - Fixed a break contig bug where tags to the right of the break
	  point are on readings that start to the left of the break point
	  were not always moved to the left hand contig (when the tags
	  happened to also fall into a new bin further to the right).

	* gap5/dis_readings.c, gap5/readpair.c: Minor printf formatting
	  tweaks - ensure we use PRIrec instead of %d.

	* gap5/list_contigs.tcl: Minor change to report =number instead of
	  #number for contig records.

	* gap5/gap4_compat.c: Improved robustness when given incorrect
	  inputs - eg contigs that don't exist, or a contig number to
	  rnumtocnum().

	* gap5/docs/IMPLEMENTATION, gap5/docs/TODO:

	* gap5/dis_readings.c: Fixed algorithm for detecting empty bins.
	  Previously a bin with no sequences but having annotations was
	  labelled as empty and removed.

	* gap5/bam.c: Fixed parsing of SAM files that have "*" as the
	  quality string.

2011-03-15  jkbonfield

	* gap5/configure.tcl, gap5/tag_checklist.tcl,
	  gap5/trace_display.tcl: Fix for SF bug 3213620:
	  
	  Saving settings now writes to ~/.gap5rc instead of .gaprc.

2011-03-08  jkbonfield

	* tk_utils/sheet.c, tk_utils/sheet.h, tk_utils/tkSheet_common.c,
	  tk_utils/tkSheet_config.h, tk_utils/tkSheet_struct.h: Added more
	  'sh_' highlight options: caret for deletion markers between
	  characters; sh_indel for an alternative colouring scheme to
	  highlight specific bases.
	  
	  The sh_underline highlight is now an extra pixel lower provided
	  the font has sufficient descender room.

2011-03-03  jkbonfield

	* tgap/tg_contig.c: Correction to last fix - extra check in case of
	  overlapping bins

	* tgap/tg_contig.c: Fixed a major bug with contig_delete_base: it
	  was no longer correctly moving the data in the right hand bin
	  leftwards due to an earlier bug fix.

2011-03-02  jkbonfield

	* tgap/tg_cache.c: Fix to previous fix!
	  
	  Reverted back some of the incr/decr ref counting code. This
	  still cures the original bug with join contigs (I believe), but
	  doesn't now crash with assertion failures elsewhere.
	  
	  It *does* still have a reference count leak somewhere though
	  which I was attempting to fix and clearly failed. Anyway -
	  working with leak is clearly a big improvement over not working
	  at all. More to come.

	* gap5/bam.c, gap5/sam_pileup.c, gap5/sam_pileup.h: Improved
	  handling of SAM files. We now properly deal with unpadded
	  data correctly when it has no reference at all.
	  
	  We also cope with SAM files with missing @SQ records or even
	  header lines at all. (Instead we just figure them out as we go.)

	* gap5/consensus.c: Fixed use of consensus cache when contig start
	  exactly matches the bin start. Previously it failed to copy out
	  of the cached bin, leaving blanks in the consensus.

2011-03-01  jkbonfield

	* tgap/tg_cache.c: Fixed reference counting bug in cache_dup. It
	  wasn't incrementing the ref count of the base object,
	  potentially allowing it to go out of scope. This in turn meant
	  that subsequent writes of that object from the child io could
	  attempt to flush data back to the wrong record
	  (if the view had been reused). This was fortunately caught via
	  an assert, but is likely the cause of some early corruptions we
	  saw.
	  
	  The reference counting in copy-on-write scenarios still isn't
	  ideal and I think there's a reference count leak here, albeit
	  small.  This is still preferable though than data corruption so
	  I'm submitting the partial fix already.

	* gap5/contig_editor.tcl, gap5/contig_id.tcl, gap5/gap_utils.tcl:
	  Removed various minor reference count leaks.

	* tgap/tg_bin.c: Fixed bin used size updating when being given
	  length 1 sequences.

2011-02-25  jkbonfield

	* gap5/caf.c: Applied patch from Rob Davies to fix get_line(). The
	  new version honours the \ continuation lines in CAF, making
	  multi-line tags now work OK.

	* gap5/tg_index_common.c: Bug fix to unescape_line when finding \
	  on the end of lines.

2011-02-24  jkbonfield

	* gap5/bam.c, gap5/bam.h: Fixed binary mode on windows (need to
	  check - unable at present).
	  
	  Added cigar_len field to the bam struct as a 32-bit int. This
	  means we can now support sam files with cigar length > 64k,
	  although bam by design still has this limitation.

2011-02-23  jkbonfield

	* gap5/tg_index.c: Fixed minor bug in memory allocation for
	  argument parsing.

2011-02-22  jkbonfield

	* gap5/bam.c: Fixed issue in bam_more_output() (the decompression
	  output, but on "input" side) when faced with truncated reads. We
	  now keep going until either real eof or read enough.

2011-02-21  jkbonfield

	* gap4/tman_interface.c: Protection against a infinitely recursive
	  loop. We observed this happening, apparently due to a sequence
	  not being loaded into memory yet while scrolling off the end of
	  it. (I cannot see how it is possible to bring up a trace for a
	  sequence you haven't yet observed, but apparently some clever
	  user discovered a way.)

2011-02-18  jkbonfield

	* incrTcl-3.3cvs: Header files are no longer needed given we do not
	  depend on itcl any more.

2011-02-15  jkbonfield

	* ac_stubs/tcl.m4, staden.profile, system.mk.in: Improvements to
	  help find libraries in <root>/lib/staden. The tcl.m4 already had
	  code for --enable-rpath (default) and --disable-rpath, so we now
	  expose these to the Makefile properly.

2011-02-10  jkbonfield

	* README.build: More MacOS X build hints

	* Misc/os.h: ppc64 detection too

2011-02-09  jkbonfield

	* windows/wix/splash.bmp: Correct version number this time
	  (2.0.0b8)

	* windows/wix/splash.bmp: Version number change

2011-02-08  jkbonfield

	* README.build, gap5/gap5.tcl, gap5/tg_index.c, gap5/tg_view.c:
	  Updates to gap5 versions (1.2.11). 1.2.9 was last beta release,
	  but 1.2.10 has been used as several internal interim releases.

2011-02-07  jkbonfield

	* tgap/tg_iface_g.c: Better handling of error case in
	  io_seq_index_query_all()

2011-02-04  jkbonfield

	* tgap/tg_iface_g.c: Added extra paranoia after observing a
	  corrupted database, where another record type got written to aux
	  slot 0 (should be a GDatabase record), despite an apparent check
	  for this with an assert.
	  
	  The cached_item struct holds both a record and a View; a handle
	  to that record. The View in turn has a cache of the aux data for
	  this record, which in turn holds the record number again. Double
	  check that these two are identical so at least we die rather
	  than corrupt
	  (and hopefully help to point out what went wrong if so).

	* README.macosx:

	* gap5/template_display.c: Fixed error in XPutImage macro for
	  windows.

	* tk_utils/tkAquaX.c: Not used, but there incase we wish to restart
	  the aqua port some day.

	* gap5/ng_fb_cmds.tcl: Fixed DB_Load to work with the new file
	  suffixes.

2011-02-03  jkbonfield

	* configure.in: Added check for the Aqua framework version of
	  tcl/tk. These aren't supported currently as we need the X11
	  build of Tk.
	  
	  Rather than accept this at configure time and barf mysteriously
	  mid compile, we now spot the issue and fail early.

	* gap5/template_display.c: Replaced TkPutImage calls with
	  XPutImage and a check for _WIN32 to #define back to TkPutImage.
	  
	  The reason for this is that Windows is the exception here, not
	  vice versa. Plus TkPutImage requires use of the internal
	  tkInt.h, which causes compilation problems on many platforms.

2011-02-02  jkbonfield

	* gap5/editor_search.c: Fixed crash when searching (name, tag
	  type, tag contents) with the editor cursor at the end of the
	  contig. This caused the iterator to
	  (validly) be NULL. I now check.

	* gap5/contig_selector.tcl: Fixed ContigParams to work when
	  CurContig is a contig that has just been removed (eg by joining
	  it to another) and CurContig is specified using the =cnum
	  notation.
	  
	  To trigger the bug before, try:
	  
	  tg_index -z 65536 NT_113898.bam; # produces 1 contig
	  gap5 NT_113898.0 &
	  
	  Break Contig dialogue, pos 1000000, OK
	  [ CurContig is now eg =5]
	  Complement Contig via contig selector popup menu
	  Find Internal Joins
	  "Next" button -> Join editor -> "Join" button
	  [ We now have joined eg contig =5 to contig =581]
	  Complement Contig via contig selector poup menu
	  [ Calls ContigParams with CurContig =5, which crashed. ]

	* tgap/tg_struct.h: Removal of duplicate #define

	* tgap/g-alloc.c: Improvements to the debug program built when
	  using -DHEAP_CHECK. (No affect on gap5.) We now output the
	  object type and compression method used.

	* ChangeLog, NEWS: Updates from svn log

2011-02-01  jkbonfield

	* staden/trunk/doc/manual/dependencies,
	  staden/trunk/doc/manual/gap5-t.texi,
	  staden/trunk/doc/manual/gap5_list_libraries.png,
	  staden/trunk/doc/manual/list_libraries-t.texi,
	  gap5/depth.tcl, gap5/gap5rc_menu_full, gap5/libraries.tcl,
	  tgap/tg_library.c, tgap/tg_tcl.c: Improved List Libraries
	  interface in gap5 and also added it to the
	  documentatiopn. Other minor gap5 doc changes too.

	* tgap/tg_cache.c: Fixed bug where attempting to call
	  cache_rw() in read-only mode would grant access, but then
	  cause a crash later on. It now properly returns NULL.

2011-01-31  jkbonfield

	* staden/trunk/doc/manual/Makefile,
	  staden/trunk/doc/manual/calc_consensus-t.texi,
	  staden/trunk/doc/manual/comparator-t.texi,
	  staden/trunk/doc/manual/contig_selector-t.texi,
	  staden/trunk/doc/manual/find_oligo-t.texi,
	  staden/trunk/doc/manual/gap4-t.texi,
	  staden/trunk/doc/manual/gap4.texi,
	  staden/trunk/doc/manual/gap5-t.texi,
	  staden/trunk/doc/manual/gap5.texi,
	  staden/trunk/doc/manual/gap5_assembly-t.texi,
	  staden/trunk/doc/manual/gap5_break_contig.png,
	  staden/trunk/doc/manual/gap5_contig_editor-t.texi,
	  staden/trunk/doc/manual/gap5_disassembly-t.texi,
	  staden/trunk/doc/manual/gap5_disassembly.png,
	  staden/trunk/doc/manual/gap5_export-t.texi,
	  staden/trunk/doc/manual/gap5_export_sequences.png,
	  staden/trunk/doc/manual/gap5_export_tags.png,
	  staden/trunk/doc/manual/gap5_fij-t.texi,
	  staden/trunk/doc/manual/gap5_find_read_pairs.png,
	  staden/trunk/doc/manual/gap5_read_pairs-t.texi,
	  staden/trunk/doc/manual/gap5_repeats-t.texi,
	  staden/trunk/doc/manual/gap5_rp_comparator.png,
	  staden/trunk/doc/manual/header.m4,
	  staden/trunk/doc/manual/lists-t.texi,
	  staden/trunk/doc/manual/results-t.texi, gap5/break_contig.tcl,
	  gap5/configure.tcl, gap5/contig_editor.tcl, gap5/depth.tcl,
	  gap5/dis_readings.tcl, gap5/editor_search.tcl,
	  gap5/find_oligo.tcl, gap5/find_repeats.tcl,
	  gap5/gap5rc_menu_full, gap5/list_contigs.tcl, gap5/list_proc.tcl,
	  gap5/map_reads.tcl, gap5/ng_fb_cmds.tcl, gap5/qual.tcl,
	  gap5/readpair.tcl, gap5/result_manager.tcl, gap5/search.tcl,
	  gap5/tag_checklist.tcl, gap5/tag_editor.tcl,
	  gap5/template_display.tcl, gap5/trace_display.tcl,
	  tk_utils/help_netscape.tcl: Fixes to gap5 documentation.
	  (Unsure what happened to last commit...)

	* gap5/export_contigs.tcl: Removed BAF output as it's unimplemented
	  atm.

	* gap5/qualIO.c: Implemented get_base_confidences() function at
	  last.

2011-01-28  jkbonfield

	* gap5/contig_editor.tcl: Fixed default colours for contig editor
	  window.

	* gap5/ng_fb_cmds.tcl, gap5/tg_index.c, tgap/g-defs.h,
	  tgap/g-files.c, tgap/tg_iface_g.c: Renamed Gap5 database
	  suffixes. We now have .g5d/.g5x instead of ""/.aux.
	  
	  Also adjusted tg_index to generate a sensible default
	  database name instead of g_db, named after the input
	  filename.

	* gap5/gap.tcl, gap5/gap5, gap5/gap5.tcl: Renamed gap.tcl to
	  gap5.tcl to make sprun.exe work on Windows.

	* gap4/tagdb.c, gap5/tagdb.c: Changed the default tagdb file
	  to GTAGDB. Previously with GTAGDB environ unset it looked in
	  $STADTABL/TAGDB which didn't exist, causing gap4 to die.

	* windows/wix/generate_wxs.pl: Added manual to the startup menu.

2011-01-27  jkbonfield

	* Misc/win_funcs.h, gap5/bam.c, tgap/zfio.c,
	  tk_utils/text_output.c: Minor updates to remove warnings under
	  Windows.

	* Misc/os.h, Misc/win_funcs.h: Enabled large file support when
	  building under mingw. Tested on a 32-bit vista
	  system, but we need to verify these defines are needed when
	  building on a
	  native 64bit system.

	* windows/wix/generate_wxs.pl: Improved handling of file
	  associations.

	* gap5/tk-io-reg.c: Removed bizarre memset of regs in the
	  tk_contig_deregister function. It was overflowing the struct
	  and corrupting memory.

2011-01-26  jkbonfield

	* windows/run/main.cpp, windows/wix/README, windows/wix/banner.bmp,
	  windows/wix/generate_wxs.pl, windows/wix/splash.bmp,
	  windows/wix/staden.wxs, windows/wix/ui.wxi: More windows tweaks,
	  this time for the installer.
	  
	  Upgraded the wix generation code to work with the latest WiX
	  release (3.5).

2011-01-25  jkbonfield

	* tgap/tg_iface_g.c: Reversed earlier change to i32 data type
	  (int to uint). It's meant to be signed due to the older
	  range format. This was an error in the past (and has already
	  been fixed for newer format databases), but we can't just
	  fix the datatype to remove compiler warnings without doing
	  more work as we introduce decoding bugs.

	* gap5/template_draw.h, staden_config.h.in: Report back to unix.
	  Required inttypes.h added after the previous
	  change from u_int32_t to uint32_t.

	* Misc/Makefile, Misc/getfile.c, Misc/os.h, Misc/win_funcs.c,
	  Misc/win_funcs.h, ac_stubs/ax_lib_curses.m4,
	  ac_stubs/ax_lib_lzma.m4, ac_stubs/ax_lib_png.m4,
	  ac_stubs/ax_lib_zlib.m4, configure.in, copy_reads/copy_reads,
	  gap4/IO.c, gap4/gap4, gap5/contig_editor.tcl, gap5/depth_track.c,
	  gap5/gap5, gap5/gap5_consensus, gap5/gap5_export,
	  gap5/template_display.c, gap5/template_draw.c,
	  gap5/template_draw.h, gap5/tg_index, gap5/tg_view,
	  gap5/tg_view.c, prefinish/prefinish, pregap4/pregap4, spin/spin,
	  spin_emboss/create_emboss_files, staden_config.h.in,
	  system.mk.in, tgap/zfio.c, tk_utils/Makefile, trev/trev: Windows
	  port - misc and minor edits mainly.

	* gap5/tg_view.c: Removed incorrect cache_decr calls.

2011-01-19  jkbonfield

	* Misc/dstring.c, Misc/dstring.h, Misc/error.c, Misc/error.h,
	  Misc/misc.h, Misc/vlen.c, Misc/vlen.h, gap4/gap-error.c,
	  gap4/gap-error.h, gap4/gap_hash.c, gap4/tkEditor.c,
	  gap5/cs-object.h, gap5/dis_readings.c, gap5/do_fij.c, gap5/fij.c,
	  gap5/find_oligo.c, gap5/find_repeats.c, gap5/gap-error.c,
	  gap5/gap-error.h, gap5/gap_hash.c, gap5/newgap5_cmds.c,
	  gap5/qual.c, gap5/qualIO.c, gap5/readpair.c, gap5/tk-io-reg.c,
	  gap5/tkEditor.c, polyA_clip/seqInfo.c, polyA_clip/seqInfo.h,
	  qclip/seqInfo.c, qclip/seqInfo.h, text_utils/text_output.h,
	  text_utils/text_output_stubs.c, tk_utils/tcl_utils.c,
	  tk_utils/tcl_utils.h, tk_utils/text_output.c,
	  tk_utils/text_output.h: Added gcc printf format checking via
	  __attribute__ (if using gcc).
	  This spotted a myriad of minor bugs (mostly in error handling
	  code), even including some 10+ years old. Now fixed.

2011-01-18  jkbonfield

	* gap5/bam.c, gap5/bam.h, gap5/sam_index.c, gap5/sam_pileup.c,
	  tgap/tg_iface_g.c: Minor signed vs unsigned changes to prevent
	  compiler warnings.

	* ac_stubs/ax_lib_staden_io_lib.m4: Extra checks for header files,
	  incase we have io_lib-config but no headers installed

	* gap5/bam.c: Bug fixed endianness reversal code after testing on a
	  PowerPC iMac.

	* tgap/g-files.c: Rearranged code to remove (incorrect?) gcc
	  warning on gcc 3.3

2011-01-17  jkbonfield

	* gap5/dis_readings.c: Bug fix to disassemble readings with
	  the "remove reads from database" option. The order of this
	  is critical to not produce errors and abort early, which it
	  was doing. Also since the addition of a proper bin removal
	  system the r->rec == s->rec assert could be hit; we now only
	  perform this section if the bin index hasn't already been
	  updated to be BIN_RANGE_UNUSED.

	* gap5/assemble_single.tcl, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c, gap5/tclIndex:
	  Added a basic GUI to support import of fasta/fastq files
	  (equiv to tg_index -a foo.fasta).

	* gap5/fasta.c: Bug fix to fasta parsing

	* gap5/fasta.c: Bug fix to fasta parsing

2011-01-14  jkbonfield

	* seq_utils/sequence_formats.h: Fixed potential single byte
	  buffer overflow in parse_feat(). On all mainstream platforms
	  the single byte coincides with structure padding so it had
	  nil effect anyway.

	* gap5/Makefile, gap5/fasta.c, gap5/tg_index.c,
	  gap5/tg_index_common.c, tgap/zfio.c, tgap/zfio.h: Added
	  fasta and fastq reading code to tg_index. It just creates
	  single read contigs, but this can be useful for pulling in
	  consensus sequences or a few finishing reads with the aim to
	  then searches for matches within gap5.

	* Misc/misc.h, convert/gapDB.c, convert/list.h,
	  copy_reads/copy_reads.c, eba/qual.c, gap4/assemble_direct.c,
	  gap4/clones.c, gap4/oligo.c, gap4/shuffle_pads.c,
	  gap4/tman_cons.c, gap4/tman_diff.c, gap4/tman_interface.c,
	  gap5/ace.c, gap5/bam.c, gap5/editor_join.c, gap5/editor_search.c,
	  gap5/find_oligo.c, gap5/import_gff.c, gap5/readpair.c,
	  gap5/sam_index.c, gap5/tg_index.c, gap5/tg_index_common.c,
	  gap5/tman_interface.c, get_scf_field/get_scf_field.c,
	  haplo/haplo_snps.c, hetins/hetins.c, make_weights/make_weights.c,
	  prefinish/finish_pcr.c, primer3/src/dpal.c,
	  primer3/src/primer3_lib.c, screen_seq/screen_seq.c,
	  seq_utils/align_lib.c, seq_utils/filter_words.c,
	  seq_utils/renz_utils.c, spin/nip_splice_search.c,
	  spin/seq_plot_funcs.c, spin/seq_raster.c, spin/seqed_write.c,
	  spin/sim.c, spin/sip_find_identity.c, spin/splice_search.c,
	  spin/tkSeqed.c, spin/trna_search.c, stops/stops.c,
	  tgap/g-alloc.c, tgap/tg_anno.c, tgap/tg_bin.c, tgap/tg_cache.c,
	  tgap/tg_contig.c, tgap/tg_sequence.c, vector_clip/vector_clip.c:
	  Many updates to fix gcc warnings.
	  
	  - Removal of type punned casts to resolve strict aliasing
	  problems.
	  
	  - Initialising more variables to avoid "may be used
	  uninitialised" warnings. Note most of these are invalid gcc
	  warnings, but a few cases are real when faced with invalid
	  data or abnormal errors.

	* gap5/export_contigs.c: Bug fix to export SAM format. When
	  outputting aux fields (if stored in gap5) we were missing a
	  tab before the first aux record.

	* convert/main.c: Bug fix to rev 2344: replacing gets by fgets
	  isn't the whole story. I now also remove the \n which is
	  left in by fgets but removed by gets.

2011-01-13  jkbonfield

	* gap4/confidence_graph.c, gap4/gap-error.c, gap5/gap-error.c,
	  prefinish/finish_hash.c, tgap/tg_cache.c: More minor warning
	  removal - mostly around string literals.

	* convert/main.c: Replaced use of gets by fgets. Not that it
	  matters much in such old
	  code, but I'm on a roll with warning removal.

	* Misc/parse_db.c, seq_utils/align_lib.c: Added initialisations to
	  variables to remove compiler warnings about
	  "may be used uninitialised". The compiler is wrong, but this
	  keeps
	  things happy.

	* Misc/misc.h, Misc/vlen.c, Misc/vlen.h, mutlib/sp_align_lib.cpp,
	  text_utils/text_output.h, tgap/misc.h, tk_utils/misc.c,
	  tk_utils/text_output.c, tk_utils/text_output.h: Added const to
	  various functions. By no means is this all, but it's
	  the ones we're passing string constants into, eg
	  vmessage("foobar"),
	  which with gcc 4.5 now emits warnings about removing const from
	  string
	  literal.

	* Misc/Makefile, copy_reads/Makefile, gap4/Makefile, gap5/Makefile,
	  polyA_clip/Makefile, prefinish/Makefile, spin/Makefile,
	  tgap/Makefile, tk_utils/Makefile: Updates from 'make depend'

2011-01-12  jkbonfield

	* seq_utils/filter_words.c: Fixed potential (but rare) buffer
	  overflow

	* mutlib/tracealign_helper.cpp: Fixed transposed memset arguments
	  (thank you gcc!)

2011-01-07  jkbonfield

	* tk_utils/user_defaults.tcl: Fix to make this work on MacOS
	  X. I'm not sure on the cause of bdir not ending in a /, but
	  by ensuring it is so we now find the libraries correctly.

	* configure.in: Bug fix to previous itcl* changes

	* README.build, configure.in: Made itcl/itk/iwidgets optional

	* tk_utils/xcombobox.tcl: Added -command option for ttk::combobox
	  version

	* spin/comborange.tcl: Bugfix with xcombobox -text vs -label

	* spin/nip_translation.tcl: Removal of debugging info

	* spin_emboss/acd2tcl.tcl,
	  spin_emboss/acdtcl/aaindexextract.acd,
	  spin_emboss/acdtcl/abiview.acd,
	  spin_emboss/acdtcl/ajbad.acd,
	  spin_emboss/acdtcl/ajfeatest.acd,
	  spin_emboss/acdtcl/ajtest.acd,
	  spin_emboss/acdtcl/antigenic.acd,
	  spin_emboss/acdtcl/backtranseq.acd,
	  spin_emboss/acdtcl/banana.acd,
	  spin_emboss/acdtcl/biosed.acd,
	  spin_emboss/acdtcl/btwisted.acd, spin_emboss/acdtcl/cai.acd,
	  spin_emboss/acdtcl/chaos.acd, spin_emboss/acdtcl/charge.acd,
	  spin_emboss/acdtcl/checktrans.acd,
	  spin_emboss/acdtcl/chips.acd, spin_emboss/acdtcl/cirdna.acd,
	  spin_emboss/acdtcl/codcmp.acd,
	  spin_emboss/acdtcl/coderet.acd,
	  spin_emboss/acdtcl/complex.acd,
	  spin_emboss/acdtcl/compseq.acd, spin_emboss/acdtcl/cons.acd,
	  spin_emboss/acdtcl/contacts.acd,
	  spin_emboss/acdtcl/corbatest.acd,
	  spin_emboss/acdtcl/cpgplot.acd,
	  spin_emboss/acdtcl/cpgreport.acd,
	  spin_emboss/acdtcl/cusp.acd,
	  spin_emboss/acdtcl/cutgextract.acd,
	  spin_emboss/acdtcl/cutseq.acd, spin_emboss/acdtcl/dan.acd,
	  spin_emboss/acdtcl/dbiblast.acd,
	  spin_emboss/acdtcl/dbifasta.acd,
	  spin_emboss/acdtcl/dbiflat.acd,
	  spin_emboss/acdtcl/dbigcg.acd,
	  spin_emboss/acdtcl/degapseq.acd,
	  spin_emboss/acdtcl/demoalign.acd,
	  spin_emboss/acdtcl/demofeatures.acd,
	  spin_emboss/acdtcl/demolist.acd,
	  spin_emboss/acdtcl/demoreport.acd,
	  spin_emboss/acdtcl/demosequence.acd,
	  spin_emboss/acdtcl/demostring.acd,
	  spin_emboss/acdtcl/demotable.acd,
	  spin_emboss/acdtcl/descseq.acd,
	  spin_emboss/acdtcl/diffseq.acd,
	  spin_emboss/acdtcl/digest.acd,
	  spin_emboss/acdtcl/distmat.acd,
	  spin_emboss/acdtcl/domainer.acd,
	  spin_emboss/acdtcl/dotmatcher.acd,
	  spin_emboss/acdtcl/dotpath.acd,
	  spin_emboss/acdtcl/dottup.acd, spin_emboss/acdtcl/dreg.acd,
	  spin_emboss/acdtcl/einverted.acd,
	  spin_emboss/acdtcl/embossdata.acd,
	  spin_emboss/acdtcl/embossversion.acd,
	  spin_emboss/acdtcl/emma.acd, spin_emboss/acdtcl/emowse.acd,
	  spin_emboss/acdtcl/entrails.acd,
	  spin_emboss/acdtcl/entret.acd,
	  spin_emboss/acdtcl/epestfind.acd,
	  spin_emboss/acdtcl/eprimer3.acd,
	  spin_emboss/acdtcl/equicktandem.acd,
	  spin_emboss/acdtcl/est2genome.acd,
	  spin_emboss/acdtcl/etandem.acd,
	  spin_emboss/acdtcl/extractfeat.acd,
	  spin_emboss/acdtcl/extractseq.acd,
	  spin_emboss/acdtcl/findkm.acd,
	  spin_emboss/acdtcl/fraggle.acd,
	  spin_emboss/acdtcl/freak.acd, spin_emboss/acdtcl/funky.acd,
	  spin_emboss/acdtcl/fuzznuc.acd,
	  spin_emboss/acdtcl/fuzzpro.acd,
	  spin_emboss/acdtcl/fuzztran.acd,
	  spin_emboss/acdtcl/garnier.acd,
	  spin_emboss/acdtcl/geecee.acd,
	  spin_emboss/acdtcl/getorf.acd,
	  spin_emboss/acdtcl/helixturnhelix.acd,
	  spin_emboss/acdtcl/hetparse.acd,
	  spin_emboss/acdtcl/histogramtest.acd,
	  spin_emboss/acdtcl/hmmgen.acd,
	  spin_emboss/acdtcl/hmoment.acd, spin_emboss/acdtcl/iep.acd,
	  spin_emboss/acdtcl/infoalign.acd,
	  spin_emboss/acdtcl/infoseq.acd,
	  spin_emboss/acdtcl/interface.acd,
	  spin_emboss/acdtcl/isochore.acd,
	  spin_emboss/acdtcl/lindna.acd,
	  spin_emboss/acdtcl/listor.acd,
	  spin_emboss/acdtcl/marscan.acd,
	  spin_emboss/acdtcl/maskfeat.acd,
	  spin_emboss/acdtcl/maskseq.acd,
	  spin_emboss/acdtcl/matcher.acd,
	  spin_emboss/acdtcl/megamerger.acd,
	  spin_emboss/acdtcl/merger.acd, spin_emboss/acdtcl/msbar.acd,
	  spin_emboss/acdtcl/mwcontam.acd,
	  spin_emboss/acdtcl/mwfilter.acd,
	  spin_emboss/acdtcl/needle.acd,
	  spin_emboss/acdtcl/newcoils.acd,
	  spin_emboss/acdtcl/newcpgreport.acd,
	  spin_emboss/acdtcl/newcpgseek.acd,
	  spin_emboss/acdtcl/newseq.acd,
	  spin_emboss/acdtcl/noreturn.acd,
	  spin_emboss/acdtcl/notseq.acd,
	  spin_emboss/acdtcl/nthseq.acd,
	  spin_emboss/acdtcl/octanol.acd,
	  spin_emboss/acdtcl/oddcomp.acd,
	  spin_emboss/acdtcl/palindrome.acd,
	  spin_emboss/acdtcl/pasteseq.acd,
	  spin_emboss/acdtcl/patmatdb.acd,
	  spin_emboss/acdtcl/patmatmotifs.acd,
	  spin_emboss/acdtcl/patmattest.acd,
	  spin_emboss/acdtcl/pdbparse.acd,
	  spin_emboss/acdtcl/pdbtosp.acd,
	  spin_emboss/acdtcl/pepcoil.acd,
	  spin_emboss/acdtcl/pepinfo.acd,
	  spin_emboss/acdtcl/pepnet.acd,
	  spin_emboss/acdtcl/pepstats.acd,
	  spin_emboss/acdtcl/pepwheel.acd,
	  spin_emboss/acdtcl/pepwindow.acd,
	  spin_emboss/acdtcl/pepwindowall.acd,
	  spin_emboss/acdtcl/plotcon.acd,
	  spin_emboss/acdtcl/plotorf.acd,
	  spin_emboss/acdtcl/polydot.acd, spin_emboss/acdtcl/preg.acd,
	  spin_emboss/acdtcl/prettyplot.acd,
	  spin_emboss/acdtcl/prettyseq.acd,
	  spin_emboss/acdtcl/prima.acd,
	  spin_emboss/acdtcl/primers.acd,
	  spin_emboss/acdtcl/primersearch.acd,
	  spin_emboss/acdtcl/printsextract.acd,
	  spin_emboss/acdtcl/profgen.acd,
	  spin_emboss/acdtcl/profit.acd,
	  spin_emboss/acdtcl/prophecy.acd,
	  spin_emboss/acdtcl/prophet.acd,
	  spin_emboss/acdtcl/prosextract.acd,
	  spin_emboss/acdtcl/pscan.acd, spin_emboss/acdtcl/qatest.acd,
	  spin_emboss/acdtcl/qatestcalcfeat.acd,
	  spin_emboss/acdtcl/qatestcalcregexp.acd,
	  spin_emboss/acdtcl/qatestcalcseq.acd,
	  spin_emboss/acdtcl/qatestcalcseqall.acd,
	  spin_emboss/acdtcl/qatestcalcseqset.acd,
	  spin_emboss/acdtcl/qatestcalcstring.acd,
	  spin_emboss/acdtcl/rebaseextract.acd,
	  spin_emboss/acdtcl/recoder.acd,
	  spin_emboss/acdtcl/redata.acd, spin_emboss/acdtcl/remap.acd,
	  spin_emboss/acdtcl/restover.acd,
	  spin_emboss/acdtcl/restrict.acd,
	  spin_emboss/acdtcl/revseq.acd,
	  spin_emboss/acdtcl/scopalign.acd,
	  spin_emboss/acdtcl/scopnr.acd,
	  spin_emboss/acdtcl/scopparse.acd,
	  spin_emboss/acdtcl/scoprep.acd,
	  spin_emboss/acdtcl/scopreso.acd,
	  spin_emboss/acdtcl/scopseqs.acd,
	  spin_emboss/acdtcl/seealso.acd,
	  spin_emboss/acdtcl/seqalign.acd,
	  spin_emboss/acdtcl/seqinfo.acd,
	  spin_emboss/acdtcl/seqmatchall.acd,
	  spin_emboss/acdtcl/seqnr.acd, spin_emboss/acdtcl/seqret.acd,
	  spin_emboss/acdtcl/seqretall.acd,
	  spin_emboss/acdtcl/seqretallfeat.acd,
	  spin_emboss/acdtcl/seqretset.acd,
	  spin_emboss/acdtcl/seqretsingle.acd,
	  spin_emboss/acdtcl/seqretsplit.acd,
	  spin_emboss/acdtcl/seqrettype.acd,
	  spin_emboss/acdtcl/seqsearch.acd,
	  spin_emboss/acdtcl/seqsort.acd,
	  spin_emboss/acdtcl/seqwords.acd,
	  spin_emboss/acdtcl/showalign.acd,
	  spin_emboss/acdtcl/showdb.acd,
	  spin_emboss/acdtcl/showfeat.acd,
	  spin_emboss/acdtcl/showorf.acd,
	  spin_emboss/acdtcl/showseq.acd,
	  spin_emboss/acdtcl/shuffleseq.acd,
	  spin_emboss/acdtcl/sigcleave.acd,
	  spin_emboss/acdtcl/siggen.acd,
	  spin_emboss/acdtcl/sigplot.acd,
	  spin_emboss/acdtcl/sigscan.acd,
	  spin_emboss/acdtcl/silent.acd, spin_emboss/acdtcl/sirna.acd,
	  spin_emboss/acdtcl/sixpack.acd,
	  spin_emboss/acdtcl/skipseq.acd,
	  spin_emboss/acdtcl/splitter.acd,
	  spin_emboss/acdtcl/stretcher.acd,
	  spin_emboss/acdtcl/stssearch.acd,
	  spin_emboss/acdtcl/supermatcher.acd,
	  spin_emboss/acdtcl/syco.acd, spin_emboss/acdtcl/tclIndex,
	  spin_emboss/acdtcl/tcode.acd,
	  spin_emboss/acdtcl/testplot.acd,
	  spin_emboss/acdtcl/textsearch.acd,
	  spin_emboss/acdtcl/tfextract.acd,
	  spin_emboss/acdtcl/tfm.acd, spin_emboss/acdtcl/tfscan.acd,
	  spin_emboss/acdtcl/tmap.acd,
	  spin_emboss/acdtcl/tranalign.acd,
	  spin_emboss/acdtcl/transeq.acd,
	  spin_emboss/acdtcl/treetypedisplay.acd,
	  spin_emboss/acdtcl/trimest.acd,
	  spin_emboss/acdtcl/trimseq.acd,
	  spin_emboss/acdtcl/twofeat.acd,
	  spin_emboss/acdtcl/union.acd,
	  spin_emboss/acdtcl/vectorstrip.acd,
	  spin_emboss/acdtcl/water.acd,
	  spin_emboss/acdtcl/whichdb.acd,
	  spin_emboss/acdtcl/wobble.acd,
	  spin_emboss/acdtcl/wordcount.acd,
	  spin_emboss/acdtcl/wordmatch.acd,
	  spin_emboss/acdtcl/wossname.acd,
	  spin_emboss/acdtcl/yank.acd,
	  spin_emboss/create_emboss_files.tcl, spin_emboss/tclIndex:
	  Removed the Tcl generated from .acd files and instead made
	  the tclIndex auto-generate them as needed. The
	  create_emboss_files program may still be used to create and
	  save them though if desired.

2011-01-07  awhitwham

	* gap5/sam_index.c: Removed line causing double free.

2011-01-06  jkbonfield

	* gap4/gap_prefinish.tcl: Added a error window to cope with
	  Iwidgets package possibly being
	  absent.
	  
	  When it is absent, we simply warn the user that the
	  prefinish GUI is unavailable. This is a reasonable
	  alternative to completely rewriting it to avoid itcl (which
	  is non-trivial).

	* gap4/tag_editor.tcl: Removal of debugging output

	* gap4/acd2tag.tcl, gap5/contig_editor.tcl,
	  spin/comborange.tcl, spin_emboss/acd2tcl.tcl,
	  spin_emboss/emboss_utils.tcl, tk_utils/tclIndex,
	  tk_utils/xcombo.tcl, tk_utils/xcombobox.tcl: Replaced a
	  hacky xcombo with a proper mega-widget implementation of
	  xcombobox, which uses either native tk 8.4 or the
	  ttk::combobox from tk8.5.
	  
	  Rewrote the acd2tcl (and derived acd2tag) code to remove all
	  iwidgets uses.

2011-01-05  jkbonfield

	* pregap4/gui.tcl, pregap4/pregap4.tcl, spin/Makefile,
	  spin/comborange.itk, spin/comborange.tcl, spin/dataentry.itk,
	  spin/dataentry.tcl, spin/nip_translation.tcl,
	  spin/nip_trna_search.c, spin/orientedradiobox.itk,
	  spin/radioboxn.itk, spin/seq_id.tcl, spin/seqentry.tcl,
	  spin/sequence_manager.tcl, spin/sip_similar_spans.tcl,
	  spin/spin.tcl, spin/spinrange.itk, spin/spinrc, spin/tclIndex,
	  spin/twinnedrange.itk: Removal of itcl/itk/iwidgets dependencies
	  for pregap4 and spin.
	  
	  Tested on Tcl8.4, but if 8.5 is present we'll use some of those
	  ttk widgets in preference (specifically ttk:notebook for now).

	* tk_utils/init.tcl, tk_utils/tabnotebook.tcl, tk_utils/tclIndex,
	  tk_utils/xcombo.tcl, tk_utils/xentry.tcl,
	  tk_utils/xfilebrowser.tcl, tk_utils/xget_fname.tcl,
	  tk_utils/xradiobox.tcl, tk_utils/xscrolledlistbox.tcl,
	  tk_utils/xscrolledtext.tcl, tk_utils/xspinbox.tcl,
	  tk_utils/xtwinspin.tcl: Added various new mega-widgets and
	  tweaked existing ones.
	  
	  This is part of a larger goal to totally remove any dependency on
	  incrtcl, incrtk and incrwidgets.

	* tk_utils/tk_utilsrc: Minor font changes for MacOS X

	* gap5/depth.tcl: Use canvas "-dash -.." instead of the
	  numeric equivalent "-dash {6 4 2 4 2 4}". I've no idea why
	  this matters, but it fixes a crash in the MacOS Tk
	  implementation (or X libraries?).

	* tgap/tg_iface_g.c: Improved handling of HAVE_LIBLZMA macro for
	  when lzma isn't found by autoconf

	* copy_reads/copy_reads.c, gap4/init.c, gap5/init.c,
	  haplo/haplo_tcl.c, prefinish/finish.c, spin/seq_reg_cmds.c,
	  tgap/tg_tcl.c, tk_utils/init.c: Added Unload and SafeUnload
	  tcl init functions. These aren't used by our code, but Tcl
	  looks for them on load and the MacOS X symbol table querying
	  library seems to spit out unsightly error messages.

2010-12-16  jkbonfield

	* gap5/cs-object.h: Bug fixed FIJ.
	  
	  After adding find read pairs I chanegd the size of some
	  structures, but forgot to make obj_fij the same size. I
	  should be using a union instead, but it's nastily coded with
	  casting (supposedly) compatible data structs.

2010-12-15  awhitwham

	* find_renz/Makefile, gap4/Makefile: Added explicit io_lib links
	  for Centos compilation.

	* make_weights/Makefile: Added an explicit link to io_lib.
	  Centos-5.5 seems to prefer it this way.

	* gap5/caf.c: Cosmetic file changes.

2010-12-13  awhitwham

	* gap5/tg_index_common.c, gap5/tg_index_common.h: Replaced the
	  useful, but non-standard, getline with one of my own making.

2010-12-09  awhitwham

	* Misc/string_alloc.c: Removed the size limitations to make it more
	  flexible.

2010-12-08  awhitwham

	* gap5/ace.c, gap5/baf.c, gap5/caf.c, gap5/maq.c, gap5/sam_index.c,
	  gap5/tg_index.c, gap5/tg_index.h, gap5/tg_index_common.c,
	  gap5/tg_index_common.h: Added a -q option to tg_index to limit
	  the amount of unpaired reads held in memory. This should
	  significantly reduce the memory usage of tg_index at the cost of
	  longer running times.

	* tgap/hache_table.c, tgap/hache_table.h: Added a table empty
	  function to remove all data but keep the data structures in
	  place.

2010-12-02  jkbonfield

	* gap4/gap-tcl.c: Added io_read_array and io_write_array Tcl
	  commands. These also copy to the internal cached copies of
	  arrays if the record number matches.
	  
	  The purpose is to ease implementation of code to reorder
	  contigs at the scripting level.

2010-12-01  jkbonfield

	* tgap/tg_bin.c, tgap/tg_cache.c, tgap/tg_gio.h: Removed a
	  reference count leak (which looks like a memory leak, but
	  isn't traceable by valgrind) in the bin_for_range() function.
	  
	  Also added extra cache leak detection code. This can be enabled
	  by adding -DCACHE_REF_DEBUG to the CFLAGS in system.mk and
	  recompiling
	  everything.

	* gap5/sam_index.c, gap5/sam_pileup.c, gap5/tg_index_common.c:
	  Various minor memory leaks fixed

2010-11-30  jkbonfield

	* gap5/tg_index.c: Added a cache_flush call while indexing
	  read names. This resolves excessive memory using during
	  tg_index -t on large data sets.

2010-11-29  jkbonfield

	* gap5/cs-object.h, gap5/gap5rc, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h, gap5/readpair.c, gap5/readpair.h,
	  gap5/readpair.tcl: Added a minimum mapping quality filter to the
	  Find Read Pairs plot.

2010-11-29  awhitwham

	* gap4/newgap_cmds.c: Removed header include.

2010-11-29  jkbonfield

	* gap5/bam.c, gap5/bam.h: Forgot to add these with previous commit.
	  
	  Reimplementation of portions of samtools library for use in new
	  pileup code.s

2010-11-26  jkbonfield

	* gap5/editor_view.c: When displaying tags we now draw a box
	  around bases that have multiple tags on them, so it's visually
	  obvious there is more information available than the top-most
	  one being displayed.

	* gap5/caf.c, gap5/export_contigs.c, tgap/tg_library.c,
	  tgap/tg_library.h: Improvements to the CAF import and export.
	  
	  - We now use the CAF Ligation_no line (or Insert_size if not
	  present) to generate a library for each sequence record. These
	  records get output again too when using export sequences.
	  
	  - The library handling code has been improved to automatically
	  compute mean and standard deviations.
	  
	  - On export, "-" now gets converted to "N" correctly instead of
	  being interpreted as a pad.
	  
	  - Now exports consensus tags too.

2010-11-25  jkbonfield

	* gap5/contig_editor.tcl: 3 minor changes to the contig editor.
	  - We now create primer tags with the oligo name earlier in the
	  tag and the sequence later. This helps the editor status line
	  contain more useful information.
	  
	  - The editor status line now replaces multiple spaces and tabs
	  with a single space, in order to reduce horizontal space. It
	  also no longer lists newlines as "\n" but "//" instead, hoping
	  that this is more indicative of a break in data that an escaped
	  newline symbol.
	  
	  - Names are cut (for pasting) with the left mouse button now as
	  well as the middle.

	* gap5/tg_index.c: Made name indexing the default now; use -T to
	  disable.

	* tgap/tg_bin.c: Fixed a bug in the adding items to bins. The
	  delayed increment of the number of sequences in a bin could
	  corrupt memory and/or crash if the cached last_bin value pointed
	  to a bin object which has been purged from the cache.
	  
	  Rather than increment the reference count to block this, we now
	  just cache the record number and look up the bin as and when
	  needed.

	* tgap/tg_tcl.c: Fixed library insert size data - previously we
	  were dividing by 100, but this was a misunderstanding between
	  in-memory and on-disk formats.

	* gap4/dbcheck.c: Grammar fix in error message

2010-11-24  jkbonfield

	* gap4/newgap_cmds.c, gap5/Makefile, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h, gap5/readpair.c, gap5/readpair.h,
	  gap5/readpair.tcl: Added "Find Read Pairs" first draft.
	  
	  This supports plotting read-pairs using all vs all, all vs end
	  and end vs end search modes.

	* gap5/contig_editor.tcl: Fixed a bug with highlighting reading
	  names when we start making the selection from outside a reading
	  name.

	* gap5/consensus.c: Removed small memory leak

2010-11-19  jkbonfield

	* gap5/sam_pileup.c: Append new sequences to the end of the pileup
	  list instead of the start, effectively reversing the order of
	  data within columns.
	  
	  This now means we add data in the same order as the old tg_index
	  and the same order as viewed within samtools tview.

	* gap4/GTAGDB, gap5/import_gff.c: Bug fix to gap5 import_gff
	  function.
	  
	  Added generic GFF tags for lines with "colour=<0-17>" to match
	  up with those used in Artemis.

2010-11-18  jkbonfield

	* configure.in, gap5/Makefile, gap5/docs/TODO,
	  gap5/newgap5_cmds.c, gap5/sam_index.c, gap5/sam_index.h,
	  gap5/sam_index2.c, gap5/sam_pileup.c, gap5/sam_pileup.h,
	  gap5/tg_index.c, staden_config.h.in, system.mk.in: Major update
	  of bam/sam reading code. We no longer have any dependency on the
	  samtools package, instead rewriting the bam/sam reading code and
	  the pileup code ourselves. This has several consequences.
	  
	  - BAM/SAM reading should be slightly faster in most cases, and
	  considerably faster in highly padded regions.
	  
	  - Cases of deletions immediately following insertions in CIGAR
	  strings will now produce the correct alignments.
	  
	  - No need for --with-samtools in configure scripts and the need
	  to recompile samtools with -fPIC.
	  
	  - Support for gzipped SAM files.

	* gap5/depad_seq_tree.c: Bug fix in get_padded_coord(). When
	  asking for a coordinate beyond the last pad we were just
	  returning the unpadded value rather than the using the unpadded
	  distance since the last known pad.

2010-11-16  jkbonfield

	* gap5/sam_pileup.c: Minor reformatting of append_int()

2010-10-29  jkbonfield

	* tgap/tg_iface_g.c: Improved error checking to handle cases of
	  running out of disk space.  We make sure we never flush any
	  changes like this now, instead either reporting an error or just
	  plain aborting. (Not ideal, but 100% better than corrupting the
	  database.)

2010-10-28  jkbonfield

	* gap5/sam_index2.c, gap5/sam_pileup.c, gap5/sam_pileup.h: A work
	  in progress and currently not linked in.  These implement an
	  alternative pileup interface to using samtool's own pileup
	  code. It's both faster and less buggy (it handles neighbouring
	  insertions and deletions), but also less complete at current in
	  that it doesn't deal with tg_index -g.

	* gap4/auto_break.c, gap4/find_oligo.c, gap4/join.c,
	  gap5/break_contig.c, gap5/caf.c, gap5/consensus.c,
	  gap5/contig_selector.c, gap5/dis_readings.c, gap5/editor_join.c,
	  gap5/export_contigs.c, gap5/find_oligo.c, gap5/import_gff.c,
	  gap5/qual.c, gap5/template_draw.c, gap5/tg_index_common.c,
	  gap5/tman_interface.c, primer3/src/oligotm.c,
	  spin/seq_plot_funcs.c, tgap/g-request.c, tgap/tg_contig.c,
	  tgap/tg_register.c, tgap/tg_tcl.c, tk_utils/tkTraceDisp.c: More
	  code tidy ups: appropriately dealt with unused variables and
	  functions.

	* configure.in, gap5/docs/TODO, gap5/gap.tcl, gap5/tg_index.c,
	  gap5/tg_view.c: Various updates preparing for new release -
	  version number changes and
	  the like.

	* gap4/edUtils2.c, gap5/editor_join.c, gap5/editor_search.c,
	  gap5/tkEditor.c, gap5/tman_display.c, gap5/tman_interface.c,
	  polyA_clip/seqInfo.c, seq_utils/align_sv.c,
	  seq_utils/dna_utils.c, seq_utils/genetic_code.c, spin/init.c,
	  spin/seqed.c, spin/seqed_restriction_enzymes.c,
	  spin/seqed_search.c, spin/seqed_translate.c, spin/seqed_write.c,
	  spin/tkSeqed.c, spin/tkSeqedNames.c, spin/tkSeqedUtils.c,
	  tgap/tg_iface.h, tgap/tg_library.c, tgap/tg_tcl.c,
	  tk_utils/sheet.c, tk_utils/tkSheet.c: Remove various (harmless)
	  compiler warnings.

2010-10-27  jkbonfield

	* ChangeLog, NEWS: Preparation for 2.0.0b8 (internal test version)

	* gap5/baf.c, gap5/caf.c, gap5/consensus.c, gap5/dis_readings.c,
	  gap5/import_gff.c, gap5/sam_index.c, gap5/tg_index.c,
	  gap5/tg_index_common.c, tgap/tg_anno.c, tgap/tg_bin.c,
	  tgap/tg_bin.h, tgap/tg_sequence.c, tgap/tg_tcl.c:
	  bin_add_range() now has the option of grouping up calls to
	  bin_incr_nseq to increment once for all items in the bin rather
	  than once for every item.
	  
	  This dramatically reduces the number of calls to bin_incr_nseq,
	  sometimes speeding up import by 10% or so.

2010-10-25  jkbonfield

	* gap5/tg_index.c, tgap/tg_iface_g.c: Added -1 to -9 parameters to
	  tg_index to allow manual control over the
	  compression levels used.

	* tgap/hache_table.h: Remove external prototypes for Hache*
	  functions.

	* tgap/hache_table.c: Optimisation of the hashing code for keys of
	  length 16. These are the dominant keys in Gap5 due to
	  cache_serch and cache_key_t. Also made the hash functions static
	  to permit better inlining.

	* tgap/g-request.c: Consider record 0 to be non-free as well as
	  G_NO_REC. Fixes data corruption where free_record could become 0
	  and then cause overwrite of the GDatabase record.

	* gap5/editor_view.c: Protect against regions of zero depth in
	  edview_row_for_item(). This function previously crashed.

2010-10-19  jkbonfield

	* tgap/tg_iface_g.c: Added assertions to block attempts to write
	  to record 0 (which should only ever be a GDatabase record).

	* gap5/fast2sam:

	* gap5/docs/UNPADDED, gap5/docs/wishlist.txt: Added missing docs

	* README.fedora8, README.macosx, staden.login: Added
	  inconsequential missing files. (Not for distrib, just svn
	  purposes.)

	* tgap/tg_iface_g.c: 32-bit vs 64-bit fix for bin ranges.

2010-10-07  awhitwham

	* gap4/notedb.h, gap4/tagdb.h, gap5/notedb.h, gap5/tagdb.h,
	  seqed/feature_colour.h, seqed/tagdb.h, spin2/feature_selector.h,
	  tk_utils/intrinsic_type.h, tk_utils/sheet.h: Removed dependency
	  on Xintrinsic.h. Use local definitions now.

2010-10-07  jkbonfield

	* gap5/gap.tcl: Correct "gap5 -h" output.

2010-10-05  awhitwham

	* convert/Makefile, gap5/Makefile, prefinish/Makefile: Added io_lib
	  to required libraries to correct Centos5.5 compilation problems.

2010-09-30  jkbonfield

	* system.mk.in: Move placement of ${DESTDIR} so that manual
	  override of e.g. --mandir after specifying --prefix still works.

2010-09-21  awhitwham

	* tgap/tg_struct.h: Removed old struct.

2010-09-15  awhitwham

	* gap5/depth.tcl: Added invoke editor from depth track.

	* gap5/caf.c: Changed to improve speed and memory use on large
	  files.

	* Misc/Makefile, Misc/string_alloc.c, Misc/string_alloc.h: Added
	  pooled string allocation.

2010-09-14  jkbonfield

	* tgap/tg_iface_g.c: Bug fix when reading old data. (Technically
	  working around an old bug.)
	  
	  The range record deltas were previously stored as uint32_t,
	  meaning some were written out as, say, 4294967291 instead of
	  -5. We should have been using int2s7/s72int instead of
	  int2u7/u72int. However it didn't matter (except for size of
	  storage) as the unsigned value was written into the address of a
	  signed 32-bit int and it worked anyway.
	  
	  Now we load as 64-bit we obtain the full glory of a large
	  integer. Fixed by changing the temporary data type I load into.

2010-09-13  jkbonfield

	* gap5/contig_editor.tcl, gap5/list_proc.tcl, gap5/tk-io-reg.c:
	  Allow HIGHLIGHT_READ to be a contig_notify option from Tcl. We
	  use this now as a generic notification, to contig 0, that
	  something somewhere has changed highlight. The targetted
	  approach still works via reg_highlight_read, but we're using the
	  new call instead to avoid spamming potentially thousands of
	  events when we load a new readings list or hit the Clear button.

	* gap5/docs/DONE, gap5/docs/TODO, gap5/editor_view.c: Fixed a bug
	  in the highlight and selection of reads in the EdName panel. The
	  coordinate handling differed slightly between querying the read
	  under the cursor and the drawing code, meaning we sometimes
	  couldn't select what we thought was visible.

	* gap5/contig_editor.tcl: Removal of debugging output.

	* gap5/docs/DONE, tgap/tg_cache.c: Fixed, I hope, a reference
	  counting problem.
	  
	  When running cache_rw on a child io cache for an item which is
	  blocked (ie seq or anno), the first time through we create a new
	  (eg) SeqBlock record. Subsuquent cache_rw on other sequences
	  within the same block were not updating the reference count on
	  the cache_master object, but cache_decr did still want to
	  decrememnt them.
	  
	  This shows up as an assertion failure if you try to edit two
	  neighbouring sequences (I tried adjusting clip points, but I
	  expect it happens with other edits too).

	* gap5/contig_editor.tcl, gap5/docs/TODO, gap5/editor_view.c,
	  gap5/list_proc.tcl, gap5/tkEditor.c, gap5/tkEditor.h,
	  tgap/tg_iface_g.c: First stab at implementing the "readings"
	  list. The contig editor can
	  (de)select members on this list as well as view them. It's not
	  perfect yet though as the list holds reading numbers instead of
	  names.
	  
	  Also moved the <<select-drag>> editor-names binding for copying
	  sequence names to middle click <2> instead.

	* tgap/tg_cache.c, tgap/tg_gio.h, tgap/tg_iface.h, tgap/tg_tcl.c:
	  Added both C and Tcl interfaces to check whether a record exists
	  with the given type. This allows the higher level layers of Gap5
	  to check validity of user input without triggering the low level
	  asserts in tg_iface_g.c.
	  
	  See cache_exists() in C and $io rec_exists in Tcl.

	* tk_utils/sheet.c, tk_utils/sheet.h: Added a new sh_box mode (and
	  sh_box_alt). As expected, these draw a box around a group of
	  characters. The sh_box_alt exists to allow two boxes
	  concatenated together; the display modes are identical, but the
	  toggle from sh_box to sh_box_alt forces the end of one style and
	  the start of a new one.

	* gap5/list_proc.c, gap5/list_proc.h: Removal of dead code -
	  FORTRAN interfaces!

2010-09-10  jkbonfield

	* tgap/tg_iface_g.c: Protect against tg_rec being large when
	  encoding bin ranges. The previous worst-case malloc of 5 bytes
	  per record id has been upped to 10 to permit full 64-bit data
	  (ceil(64/7)).

2010-09-09  jkbonfield

	* tgap/tg_iface_g.c: Fixed a bug with the 64-bit tg_rec code. When
	  reading a database in the older formats with 32-bit records, we
	  were only filling out the bottom 32-bits of the record ID
	  leaving the top 32-bits undefined.

	* gap5/editor_search.c, tgap/b+tree2.c, tgap/b+tree2.h,
	  tgap/tg_contig.c, tgap/tg_contig.h, tgap/tg_iface.h,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_sequence.h: Editor
	  searching by sequence name now accepts a prefix match. This
	  required an extra parameter to the b+tree search code.
	  
	  Also the mechanism of searching is now different as we search
	  both through a list of names pulled out of the btree (finding
	  the closest one in the direction we search) and also using a
	  positional iterator on the contig. This resolves issues where we
	  may have 10,000 sequences matching a prefix string, but only 5
	  sequences away is the first occurence of this so a linear scan
	  would have found the match faster.
	  
	  (Potentially we could modify this to allow searching by names
	  even if no name index exists, albeit at a time cost.)

2010-09-08  jkbonfield

	* abi/Makefile, eba/Makefile, gap5/Makefile, gap5/ace.c,
	  gap5/baf.c, gap5/break_contig.c, gap5/break_contig.h, gap5/caf.c,
	  gap5/consen.c, gap5/consen.h, gap5/consensus.c, gap5/consensus.h,
	  gap5/contig_selector.c, gap5/contig_selector.h, gap5/cs-object.c,
	  gap5/cs-object.h, gap5/depad_seq_tree.c, gap5/depad_seq_tree.h,
	  gap5/dis_readings.c, gap5/dis_readings.h, gap5/do_fij.c,
	  gap5/docs/TODO, gap5/editor_join.c, gap5/editor_oligo.c,
	  gap5/editor_search.c, gap5/editor_view.c, gap5/editor_view.h,
	  gap5/export_contigs.c, gap5/fij.c, gap5/find_oligo.c,
	  gap5/find_repeats.c, gap5/gap4_compat.c, gap5/gap4_compat.h,
	  gap5/gap_cli_arg.h, gap5/gap_range.c, gap5/gap_range.h,
	  gap5/import_gff.c, gap5/io-reg.h, gap5/io_utils.h,
	  gap5/list_proc.c, gap5/list_proc.h, gap5/maq.c,
	  gap5/newgap5_cmds.c, gap5/newgap_structs.h, gap5/primlib.c,
	  gap5/qual.c, gap5/qual.h, gap5/qualIO.c, gap5/qualIO.h,
	  gap5/read_depth.c, gap5/read_depth.h, gap5/sam_index.c,
	  gap5/template_draw.h, gap5/tg_index.c, gap5/tg_index.h,
	  gap5/tg_index_common.c, gap5/tg_index_common.h, gap5/tg_view.c,
	  gap5/tk-io-reg.c, gap5/tkEdNames.c, gap5/tkEditor.c,
	  gap5/tman_interface.c, gap5/tman_interface.h,
	  get_scf_field/Makefile, init_exp/Makefile, polyA_clip/Makefile,
	  qclip/Makefile, spin/Makefile, stops/Makefile, tgap/Makefile,
	  tgap/b+tree2.c, tgap/b+tree2.h, tgap/g-request.c,
	  tgap/gap_cli_arg.c, tgap/gap_cli_arg.h, tgap/tg_anno.c,
	  tgap/tg_anno.h, tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_cache.c,
	  tgap/tg_cache_item.h, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_gio.c, tgap/tg_gio.h, tgap/tg_iface.h, tgap/tg_iface_g.c,
	  tgap/tg_iface_g.h, tgap/tg_library.c, tgap/tg_library.h,
	  tgap/tg_register.c, tgap/tg_register.h, tgap/tg_sequence.c,
	  tgap/tg_sequence.h, tgap/tg_struct.h, tgap/tg_tcl.c,
	  tgap/tg_tracks.c, tgap/tg_utils.c, tgap/tg_utils.h,
	  tk_utils/Makefile, tracediff/Makefile: MAJOR overhaul of record
	  numbers.
	  
	  We now must use tg_rec throughout all the code as the data type
	  for record numbers instead of int or GRec. GRec still exists,
	  but it should only be within the tgap/g-* code and
	  tgap/tg_iface_g.c interface. Basically GRec is the data type for
	  the underlying "g" library, which is still 32-bit, while tg_rec
	  is used throughout gap5 proper for records.
	  
	  The purpose of this is:
	  A) Allow for more sequence record numbers. The given bottom
	  10-bits of
	  a sequence (or anno) record are an index into a SeqBlock and the
	  upper
	  bits the SeqBlock record. This previously meant just 21 bits of
	  record
	  space for SeqBlock or about 2 million records.
	  
	  B) Allow for future changes of record number to be an ID into
	  other
	  storage media. Right now they're an index into the g-layer aux
	  file,
	  but we plan on using them as an index into a bam file if we
	  permit
	  copy-on-write (or even an index into Arcturus). For bam the
	  obvious
	  way is to use the record number as a file offset, which therefore
	  needs more than 2Gb worth of address space.
	  
	  
	  Change summary:
	  
	  1) All use of types for records are now tg_rec.
	  For Tcl interfaces, we use Tcl_WideInt instead of int and
	  functions
	  like Tcl_GetWideInt instead of Tcl_GetInt. (These are defined to
	  be
	  at least 64-bit.)
	  Use atorec() instead of atoi() when converting from string to
	  tg_rec.
	  
	  2) All uses of %d in printing record IDs are now %"PRIrec"
	  instead.
	  (Similarly PRIbtr for BTRec types in b+tree2.c)
	  
	  3) Removed the option to reserve sequence record numbers from
	  tg_index
	  and allocate() function.
	  
	  4) Changed the format of some data structures. This means the new
	  gap5
	  databases are INCOMPATIBLE with the old ones. This gap5 will
	  still
	  read old data, but not vice versa. This was required to handle
	  64-bit values.
	  
	  5) Split GDatabase into GDatabase (g-layer) and database_t (gap5
	  layer) types. In theory the G data structures are interface
	  specific ("g" layer in this case) and shouldn't ever be used by
	  the
	  gap5 code. Not important right now, but a necessary split to
	  enforce if we ever switch to, say, sqlite as a storage engine.
	  
	  6) The parse_args functions for tcl interfaces now have a new
	  data
	  type ARG_REC, to replace the usual ARG_INT used before.
	  
	  7) Added index_del interfaces for sequence and contig names. Not
	  strictly part of the tg_rec code, but discovered their omission
	  during these changes.
	  
	  8) Bug fix to btree_search for when looking at an item at the
	  current
	  root.
	  
	  9) Removed bin_id field from bin_index_t. It was never filled out
	  properly and was essentially the same as rec.
	  
	  10) Removed rec arrays from SeqBlock and AnnoEleBlock internal
	  structures. The arrays were pointless as they were all sequential
	  anyway given we have no reallocation system (and they're were not
	  written to disc).
	  
	  11) Bug fix to bin_get_position when recursing over complemented
	  data (not part of tg_rec fixes).

2010-09-01  jkbonfield

	* gap5/docs/DONE, gap5/docs/TODO:

2010-08-31  jkbonfield

	* tgap/g-request.c: g_unlock_views() now sorts the views by record
	  number so that writing out to the aux file is in file offset
	  order.
	  
	  I'm not sure if this makes a big difference or not, but it seems
	  wise to not do things in random (or as was actually regularly
	  happen, reverse) file offset.
	  
	  Also fixed update_record to check against 0 as well as
	  G_NO_IMAGE. This prevents (ignored) errors from heap_free(),
	  although I'm unsure why we get image of zero anyway.

	* tgap/tg_iface.h, tgap/tg_iface_g.c: More mid-level deallocation
	  code.

	* gap5/dis_readings.c: Added lots of code for deallocating data
	  Also lots of extra checking code: check_contig_bins().  Now also
	  trims contig left/right ends if we disassemble data at the end.

	* gap5/break_contig.c: Implemented remove_empty_bins() function to
	  recurse through a contig tidying up dead and useless bins after
	  a break. It's easier to do this here than during the break
	  itself.
	  
	  Fixed memory leak in contig_visible_start/end - now deallocate
	  the contig iterator.

	* tgap/tg_cache.c, tgap/tg_cache_item.h, tgap/tg_contig.c,
	  tgap/tg_gio.h: Mid-level item deallocation:
	  
	  Cache items now have a forgetme bit-flag. When set it indicates
	  the record should be removed. The cache_rec_deallocate function
	  does this.  This is turn then calls the 'iface' destroy methods.
	  
	  Added asserts to cache_decr. We should never get to negative ref
	  counts. Equally so we should never hit a zero ref count on a
	  modified item. (This was the cause of a corruption recently.)

	* tgap/tg_bin.c: Protect against invalid records in
	  bin_get_item_position - no longer crash, but return -1 instead.
	  
	  bin_invalidate_consensus() no longer forces bin to be rewritten
	  if it already had no valid cached consensus present.

	* tgap/g-filedefs.h, tgap/g-io.c, tgap/g-os.h, tgap/g-request.c,
	  tgap/g-request.h, tgap/g-struct.h: Store free record numbers in
	  a linked list (starting with AuxHeader.free_record). Add
	  G_VIEW_DELETED as a view type, which triggers the adding to this
	  free list upon unlocking.  The new g_free_rec_() interface
	  removes the most recent record item from the list and returns
	  it. (Or G_NO_REC if none available.)

	* tgap/g-alloc.c: Tweaks to output when DEBUG is
	  defined. Otherwise no impact.  Also added a debug function,
	  heap_largest_check(), to aid in looking for allocation
	  problems. (It found none, but will leave the debug code in
	  place.)

2010-08-25  awhitwham

	* gap5/Makefile, gap5/caf.c, gap5/caf.h, gap5/tg_index.c,
	  gap5/tg_index_common.c: Added CAF format to tg_index.

2010-08-20  jkbonfield

	* gap5/dis_readings.c: Various tweaks and improvements to the hole
	  detection and contig-end trimming algorithms.
	  
	  Previously we could either end up with contigs containing no
	  data or contigs with holes in.

	* gap5/ace.c, gap5/baf.c, gap5/break_contig.c,
	  gap5/dis_readings.tcl, gap5/editor_view.c, gap5/export_contigs.c,
	  gap5/gap_range.c, gap5/maq.c, gap5/sam_index.c, tgap/tg_bin.c,
	  tgap/tg_cache.c, tgap/tg_contig.c, tgap/tg_gio.c,
	  tgap/tg_sequence.c: Mass tidy up of cache_incr and cache_decr
	  calls. This fixes several bugs which often revealed themselves
	  as "cache_unload: Assertion `io->base || ci->updated == 0'
	  failed." 
	  
	  This happens when we cache_decr too much, making the ref count
	  go to zero and removing the item from the hachetable in_use
	  list. The in_use list is scanned through looking for
	  ci->updated==1 when flushing changes, so a record which has been
	  modified and then decrememented doesn't get written on a
	  flush. Instead it's identified in the above insert upon closing
	  the io handle.

	* gap5/dis_readings.c, gap5/newgap5_cmds.c: Bug fixes to
	  disassemble readings:
	  
	  1) Don't crash when called with zero reads to disassemble.
	  2) Handle unknown read names, instead of trying to disassemble
	  rec -1.
	  3) The iter_next and iter_prev code in remove_contig_holes now
	  has auto-extend on the range. The reason is that the start/end we
	  have is the range for a region that we've just removed a read
	  from and may not be guaranteed to have overlapping data on (eg
	  if the contig already had a hole).

	* tgap/hache_table.c: We now issue a warning when attempting to
	  decrement a reference count of an item with zero reference count
	  already.  This is nearly always a symptom of buggy reference
	  count updates in the calling code.
	  
	  Also fixed a bug in the ref-info code for haches with cache_size
	  of zero.

	* tgap/g-files.c, tgap/g-files.h, tgap/g-request.c: Aded
	  g_remember_index as an analog to the g_forget_index. This is
	  called when explicitly locking a record. Also we no longer call
	  g_forget_index when flushing, only when explicitly unlocking.
	  
	  Combined these should ensure that the reference counting of
	  idx_hash works correctly.

2010-08-19  jkbonfield

	* gap5/Makefile, gap5/dis_readings.c, gap5/dis_readings.h,
	  gap5/dis_readings.tcl, gap5/docs/TODO, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h: First draft of disassemble readings.

	* tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_sequence.c: Generalised
	  the sequence_invalidate_consensus as bin_invalidate_consensus
	  which now takes arbitrary ranges, rather than just the range a
	  sequence covers.
	  
	  (We need this for disassemble readings.)

	* tgap/tg_bin.c: Invalidate the consensus cache in more
	  places. The best catch-all of this is bin_incr_nseq() as any
	  time we add or remove from a bin we have to call this, which
	  automatically invalidates any consensus in all bins from here on
	  up.
	  
	  What about if the consensus is in a bin below? We still need to
	  check for this, but a belt-and-braces approach means this change
	  is still viable.

	* gap5/break_contig.c: Fixed contig_visible_start - it was
	  returning 1 mostly rather than the actual start.

	* gap5/consensus.c: Removed assert as it still seems to be
	  triggered.
	  
	  I know this sounds bad, but given the comment above it I
	  concluded it was overly aggressive. I'm not *100%* sure on that
	  though...

	* gap5/gap.tcl, gap5/sam_index.c, gap5/tg_index.c, tgap/b+tree2.c,
	  tgap/tg_gio.c, tgap/tg_iface_g.c: Improved handling of errors
	  when indexing broken files or opening corrupted databases.
	  
	  We shouldn't crash (either via deliberate assert/abort or due to
	  not checking returns) and should also now exit with an error
	  code.

2010-08-17  jkbonfield

	* gap5/consensus.c: Fixed the "perfect base" handling code.
	  
	  We no longer explicitly check * and N (which was wrong as "-" is
	  an ambiguous base). We now check the primary quality for the
	  called base using lookup[base].

	* gap5/gap5rc: Added missing CONTIG_EDITOR.SHOW_CUTOFFS definition.

	* gap5/gap5rc_menu_full: Removal of unimplemented items from menus
	  (Check Database, Extract Readings, Reading coverage).
	  
	  Moved Import GFF from Edit to File menu.

	* gap5/editor_view.c: Further fixes to the Y-caching code to
	  prevent crashes: this time in tk_redisplayCursor.

	* gap5/trace_display.tcl: Remove the "compact" button/mode.
	  
	  Removed the Diff button/option as it's not in gap5 yet.
	  
	  Fixed complement so it no longer causes a tk error.

2010-08-13  jkbonfield

	* gap5/consensus.c: Fixed 'perfect' base check (manually edited at
	  Q100) to only apply to real bases and not N or *. These
	  previously had all-zero for scores of acgt which was interpreted
	  as perfect too.

2010-08-12  jkbonfield

	* gap5/contig_editor.tcl, gap5/gap5rc, gap5/gap5rc_menu_full: Added
	  a contig editor "Save Settings" command.

	* gap4/contig_editor.tcl: Removal of debugging output

	* gap5/consensus.c, tgap/tg_sequence.c: Integer quality values of
	  100 (phred or logodds) for the called base are now treated as
	  probability 1.0 for correctness, regardless of contrary evidence
	  (unless it's another Q100). This means that manually edited
	  bases now always take precedence in the consensus.

	* gap5/contig_editor.tcl: The Undo button now updates the
	  information line with a summary of the change it will make when
	  pressed.
	  
	  Added C-s and C-r keybindings for searching forwards and
	  backwards.

2010-08-12  awhitwham

	* gap5/depth.tcl: Now redraws contig edit cursor on scroll.

2010-08-12  jkbonfield

	* gap5/tag_editor.tcl: Fixed tag_macro_copy

	* gap5/contig_editor.tcl, gap5/gap5rc_menu_full,
	  gap5/tag_editor.tcl: Added the Save Tag Macros command to the
	  editor Settings menu (and also load them up at editor
	  start). This stores them in $HOME/.gap5rc

	* gap5/contig_editor.tcl, gap5/tag_editor.tcl: Added "tag macros" -
	  as per Gap4.
	  
	  Also added the tag_editor.tcl file which was forgotten before.
	  (It's in the tarballs, but oddly not svn.)

	* gap5/editor_view.c: Protect against xx->rec_hash being
	  NULL. This was added to lots of functions, but I suspect most
	  already check by dint of checking xx->nr too.
	  
	  The one we fixed a crash in is edview_row_for_item. It died when
	  attempting to launch an editor at a region with zero data.

	* gap5/gap5_consensus.tcl: Added a tk_messageBox equivalent so
	  that errors reported from consen.tcl generate a decent message
	  instead of a tcl error about tk_messageBox not existing.

	* gap5/contig_editor.tcl, gap5/docs/TODO, gap5/editor_view.c,
	  gap5/editor_view.h, gap5/tkEditor.c: Added two new editor widget
	  methods: getxy and show_cursor.
	  
	  F11/F12 for fast tag editing or removal now only operate on the
	  item under the editing cursor, rather than under the mouse
	  pointer.  This brings it back inline with Gap4.
	  
	  Deletion of data has been made safer. We only permit deletion of
	  pads now unless Control+Delete is used, which will revert to the
	  old behaviour of removing anything (even entire columns).

2010-08-11  jkbonfield

	* gap5/contig_editor.tcl: More key bindings:
	  
	  Page up/down already scrolled in X by 1Kb, but with Shift,
	  Control or Shift+Control this now moves by 10, 100 and 1000Kb.
	  
	  We can now adjust the base confidence values using [, ]
	  Shift+Up/Down arrows and Control+Up/Down arrows - much as we did
	  in gap4.

2010-08-06  jkbonfield

	* gap5/docs/TODO:

	* gap5/tkEditor.c: Protect against attempts of -ve Y scroll
	  positions

	* tgap/tg_contig.c: Fixed sort order when sorting by technology
	  and some samples have seq_tech while others do not.
	  
	  Bug fix to the update_range_y calls in contig_items_in_range().
	  We update these as we go along, rather than at end, meaning
	  multiple technologies should compensate correctly for the shift
	  in start.

2010-08-05  awhitwham

	* gap5/template_display.c: Added scrolling offset to xhair return
	  values.

2010-08-03  jkbonfield

	* gap5/editor_view.c: Fixed bugs in the new Y-layout code.
	  
	  - Protect against scrolling off end of contig and having no
	  visible rows to try and match.
	  
	  - We can now get entirely blank lines due to preserving Y, so
	  make sure we draw them to avoid ghosting.

2010-08-03  awhitwham

	* gap5/depth.tcl, gap5/depth_track.c, gap5/gap_range.c,
	  gap5/gap_range.h, gap5/template_display.c: Tweaks to the track
	  view filters.

2010-08-03  jkbonfield

	* system.mk.in: Honour DESTDIR variable (which by default is blank
	  and has no impact). See
	  http://www.gnu.org/software/hello/manual/automake/DESTDIR.html
	  for more information.

2010-08-03  awhitwham

	* gap5/depth.tcl, gap5/depth_track.c, gap5/depth_track.h,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c,
	  gap5/template_display.c, gap5/template_display.h,
	  gap5/template_draw.c: Changed template display to use custom
	  canvas item types rather than tkRaster for track display.

2010-08-02  jkbonfield

	* primer3/src/Makefile: Added $(L)/.dir dependency to the
	  $(L)/$(SHLIB_PREFIX)... targets.  This means that when
	  outputting -o lib/libfoo.so we ensure that lib/ is created
	  first.
	  
	  This should resolve some parallel make problems.

	* copy_reads/Makefile, g/Makefile, gap4/Makefile, gap5/Makefile,
	  haplo/Makefile, mutlib/Makefile, prefinish/Makefile,
	  seq_utils/Makefile, spin/Makefile, text_utils/Makefile,
	  tgap/Makefile, tk_utils/Makefile: Added $(L)/.dir dependency to
	  the $(L)/$(SHLIB_PREFIX)... targets.
	  This means that when outputting -o lib/libfoo.so we ensure that
	  lib/ is created first.
	  
	  This should resolve some parallel make problems.

	* ac_stubs/ax_lib_samtools.m4: Added -lbam to SAMTOOLS_LDFLAGS when
	  not using --with-samtools, but detecting a working bam.a/h.

	* ac_stubs/ax_lib_samtools.m4: Fixed typo in comment

	* Makefile.in: Added primer3/src as dependency to gap5, given the
	  recent addition to using this library. Hopefully this fixed some
	  parallel make failures.

	* ac_stubs/ax_lib_samtools.m4: Fixed elseif/elif issue in
	  --with-samtools option.

2010-07-16  jkbonfield

	* gap5/editor_view.c, gap5/editor_view.h: Sped up the contig editor
	  when dealing with excessively deep alignments.
	  
	  Specifically we now have a hash to go from record numbers to
	  index into xx->r[i], allowing rapid identification of object
	  location. Conversely we also now binary search xx->r[] when
	  looking for items at specific Y coords.

	* gap5/contig_editor.tcl, gap5/editor_view.c: Avoid calling
	  consensus_valid_range() for as long as possible, as it
	  can be slow to compute. Instead we first check if a consensus
	  position is valid when moving the editor cursor simply by
	  checking if the consensus is non-N.

2010-07-15  jkbonfield

	* tgap/tg_contig.c: Now only call update_range_y when COMPUTE_YPOS
	  job is set. Also removed a debugging printf.

2010-07-14  jkbonfield

	* Tagged VERSION 2.0.0b7

	* ChangeLog, NEWS, configure.in, gap5/docs/DONE, gap5/docs/TODO:
	  1.2.9 (aka 2.0.0b7) release

2010-07-14  jkbonfield

        * gap5/template_display.c, tgap/tg_cache.c, tgap/tg_contig.c,
          tgap/tg_contig.h, tgap/tg_gio.h, tgap/tg_iface_g.c,
          tgap/tg_struct.h: Updated the compute_ypos function in
          tg_contig.c (note, not the one in template_display.c) to
          keep track of previous Y coordinates.

          We achieve this by modifying the low-level cached bin-range
          structures to also include a Y (in memory and not written to
          disk). If our next query already has Y coordinates used then
          we prefer these over allocating new ones.

          This prevents the "rotating" effect of short-read data when
          scrolling right in the contig editor, although at the moment
          this still happens when scrolling left.

2010-07-09  jkbonfield

        * gap5/docs/TODO:

        * ChangeLog, NEWS, gap5/docs/TODO:

        * tgap/tg_bin.c, tgap/tg_contig.c: Fixed our check for
          bin->{start_used,start_end} being valid from comparing
          whether they are equal to checking whether bin->rng is
          blank.

          The former method meant that a bin consisting solely of a 1
          base tag (eg start_used=1000, end_used=1000) was considered
          empty. The next time we add another tag to the bin,
          start/end weren't extended but instead moved as-if
          initialising an empty bin. This caused tags to be invisible
          in some corner cases.

2010-07-08  jkbonfield

        * gap5/Makefile, gap5/gap5rc_menu_full, gap5/import_gff.c,
          gap5/import_gff.h, gap5/import_gff.tcl, gap5/newgap5_cmds.c,
          gap5/tclIndex: Added an Import GFF function to act as the
          reverse of the tag export code in export_contigs.c.

          It handles both padded and unpadded coordinates, although
          unpadded import is far slower.

          Also right now the GFF type field is ignored, instead using
          a type= attribute at the end.

        * gap5/export_contigs.c: Fixed writing unpadded coordinates
          for GFF tags when not-mapping from sequence to consensus
          positions.

2010-07-07  jkbonfield

        * gap5/export_contigs.c: Now use
          active_list_contigs_extended()
          when exporting tags in GFF
          format.

          Fixed separator in GFF attrib section, from "," to ";".

        * gap5/gap4_compat.c, gap5/io_utils.h, gap5/list_proc.c,
          gap5/list_proc.h: When expanding a list of contig names to
          contig recs, start and end coordinates we now have the
          option of using the full unclipped contig length instead of
          the previous clipped length.

          This is through using the new active_list_contigs_extended()
          function instead of active_list_contigs().

          Functions will need to use what is appropriate. Outputting
          consensus makes sense to only have the clipped portion as
          the extensions are just poly-N. Outputting all sequence and
          tags may make sense to use extended mode.

        * gap5/baf.c: Bug fix to parsing of consensus tags in BAF

2010-07-02  jkbonfield

        * gap5/editor_view.c: Disabled the debugging output:
          accidentally left on from earlier commit.

        * gap5/sam_index.c: Prevented crash when dealing with CIGAR
          strings using "N" (skipped bases). These can come from
          TopHat's spliced alignments. The samtools pileup interface
          treats a single input sequence as having multiple start and
          end coordinates (unfortunately without a flag indicating
          whether it's a true or spliced end).

          We need a better method of handling this, especially with
          regards to templates and more than 2 reads on it. (We
          actually know how many we expect due to previous scanning of
          CIGAR.)

2010-07-02  awhitwham

        * gap5/depth.tcl: Fixed the resizing issues on the template
          tracks.

2010-07-01  jkbonfield

        * gap5/break_contig.c: Added two new utility functions which
          we may later wish to move to a more general purpose
          location: contig_visible_start and
          contig_visible_end. Visible here including cutoff data but
          excluding the invisible cached consensus data.

        * gap5/editor_view.c, gap5/export_contigs.c: Updated the way
	  we interpret consensus tags.

          Previously the range (flags & GRANGE_FLAG_TAG_SEQ) bit was
	  used to distinguish sequence tags vs consensus tags, but
	  also the range pair_rec held the record number the tag was
	  bound to. This makes sense for sequences, but we also stored
	  the consensus record for consensus tags.

          The problem comes when breaking a contig. We reparent an
	  entire section of bin tree, attaching it to a new contig
	  record. We do not wish to go through the entire bin tree
	  changing r->pair_rec to be the new contig ID. Fortunately
	  checking the GRANGE_FLAG_TAG_SEQ bit is sufficient to know
	  if the tag is for the consensus instead.

          So... changed cases where we checked r->pair_rec ==
          contig_rec to instead use !(r->flags & GRANGE_FLAG_TAG_SEQ).

          Also updated the GFF export code in export_contigs.c so it
	  does hex escaping instead of C-string escaped (as mandated
	  in GFF3 spec at http://www.sequenceontology.org/gff3.shtml).

        * gap5/docs/TODO:

        * tgap/tg_contig.c, tgap/tg_contig.h: Overloaded the "whence"
	  type to the iterator to also control whether we sort by
	  start (default and old mode) or end of read. This is
	  particularly useful when using whence of CITER_LAST and
	  using contig_iter_prev to walk through the list backwards,
	  allowing us to iterate along the order in which sequences
	  become visible while going backwards.

        * tk_utils/sheet.c, tk_utils/sheet.h: Removed the maximum
          number of rows/columns. It wasn't functioning correctly
          anyway, being only checked in some cases and consequentially
          causing memory corruptions. (Albeit hard to hit unless using
          nil2 font.)

        * gap5/editor_view.c: Protect against potentiallty
	  uninitialised values returned from edview_item_at_pos when
	  nothing is visible. (This makes it easier for error checking
	  in the calling function.)

          Fixed buffer overflow when an editor sheet is at the maximum
          display width.

2010-06-30  jkbonfield

        * gap5/baf.c: Fixed a bug with consensus tags. We were
	  incorrectly setting the flag to indicate they were sequence
	  tags. (This was causing crashes in break contig too.)

2010-06-28  jkbonfield

	* gap5/editor_view.c: Attempted to improve the positioning of
	  the Y scrollbar when scrolling around in X. This is somewhat
	  tricky to get right, especially when multiple sequences are
	  packed in a line as the Y coordinates of them jump around a
	  lot anyway. However our method is as follows.
	  
	  - Attempt to keep the top sequence still in the top position
	  after scrolling, adjusting Y scrollbar as necessary.
	  
	  - If top sequence is no longer overlapping, repeat for bottom
	  sequence.
	  
	  - If the editing cursor was on screen before, and is still
	  within X-bounds of the new scrolled position, it should be still
	  be visible after.
	  
	  Also fixed horizontal cursor movement keys (eg left/right
	  arrows) so that they also checked to make sure the cursor is
	  visible.  Previously it didn't snap back to visibility if the X
	  cursor position was still on screen but it had been manually
	  scrolled off the top of bottom.

	* tgap/tg_contig.c: Fixed bug in Y-allocation by sequence
	  technology type - we now exclude tags during this. Previously we
	  chose Y ranges too large.

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/gap5rc,
	  gap5/tkEditor.c, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_struct.h: Added a CSIR_SORT_BY_SEQ_TECH flag for the
	  contig_items_in_range function. This required adding seq_tech to
	  the rangec_t struct (in-memory, not on-disk version) too. Should
	  this be added to on-disk struct at some stage for efficiency?
	  
	  For now the editor always passes this flag in so capillary
	  sequences are always on top. I need to make this adjustable.
	  
	  The editor also no longer calls contig_items_in_range
	  continually (even on mouse overs) as it now correctly tracks
	  edits and so caches this data.
	  
	  Finally the seq_tech field can now be (and is) displayed in the
	  brief status line of the editor.

	* gap5/sam_index.c: Fill out sequencing technology field from
	  read-group PL string. Also attempt to guess this from sequence
	  names when no read-group is available, although this is highly
	  error prone.

	* gap5/libraries.tcl: Changed solexa for illumina in output

	* gap5/contig_editor.tcl: Moved the calls to store_undo when
	  adjusting read clip points or read positions to after the edit
	  takes place.
	  
	  This fixes a redisplay bug in other copies of the editor window
	  as it is the store_undo code that sends the event message around
	  to redisplay.

2010-06-23  jkbonfield

	* gap5/export_contigs.c: Fixed SAM quality strings to cap at
	  quality 94 (ASCII ~ after adding 33). This prevents Picard from
	  throwing an error.

	* gap5/contig_editor.tcl, gap5/depth.tcl, tgap/tg_register.c: Added
	  a context sensitive menu to the sequence name panel in the
	  editor.
	  
	  This sports a "Goto ..." function to jump to other reads on this
	  same template, even when they're in another contig (it'll bring
	  up a new editor).

2010-06-21  jkbonfield

	* gap5/export_contigs.c: SAM output is now sorted by clipped
	  position instead of unclipped position, removing the need to
	  convert from sam to bam and then run samtools sort.

	* gap5/baf.c, gap5/export_contigs.c, gap5/sam_index.c,
	  gap5/tg_index_common.c, gap5/tg_index_common.h: Added
	  experimental tag support to the SAM format, both for export and
	  import.
	  
	  This uses Zc (consensus) and Zs (sequence) SAM auxillary tag
	  records.

	* Misc/dstring.c, Misc/dstring.h: Added more functions to append
	  single characters, an integer (in ascii form) or to zero (empty)
	  a string for reuse again.

2010-06-17  awhitwham

	* gap5/depth.tcl, gap5/depth_track.c, gap5/gap_range.c: Fixed some
	  of the template display's scrolling bugs.

2010-06-17  jkbonfield

	* gap5/Makefile: Added back PROGS definition as it prevented any
	  targets from being built. Oops.

2010-06-16  jkbonfield

	* gap5/Makefile, gap5/gap5_consensus, gap5/gap5_consensus.tcl,
	  gap5/gap5_export, gap5/gap5_export.tcl, gap5/tg_index,
	  gap5/tg_view: Added wrapper scripts for tg_index and tg_view so
	  they set the correct LD_LIBRARY_PATH environment without
	  explicitly requiring the user to source staden.profile.
	  
	  Also added (with wrappers) gap5_consensus and gap5_export
	  command line toos to dump out data from a gap5 database
	  non-interactively.

	* gap5/gap.tcl, gap5/tg_index.c, gap5/tg_view.c: Bumped gap5
	  version to 1.2.9 for local test release

	* gap5/gap_range.c: Removed some extra depth code that appeared to
	  add template depth on to sequence depth. I'm not sure of the
	  intent for this original code, but I'm sure we'll find out
	  sooner or later. (Right now it's less bugged than before
	  though.)
	  
	  Changed the colouring of reads to use the true forward/reverse
	  sequence attributes instead of uncomplemented / complemented
	  status.

	* gap5/template_draw.c: Fixed a colour allocation bug causing
	  colour number 18 to end up as blue instead of grey.

2010-06-11  jkbonfield

	* gap5/contig_editor.tcl, gap5/editor_oligo.c: Improvements to the
	  primer selection interface. It can now create tags.
	  
	  Also applied a minor fix to the Join button reenabling it and
	  removing the debug message.

	* tk_utils/tclIndex, tk_utils/xcombo.tcl: Added a basic combobox
	  as an alternative to the one in tk8.5 (as it's not as common as
	  8.4 yet) or iwidgets (which I'd prefer to not have a dependency
	  on given lack of improvements to it).

2010-06-09  jkbonfield

	* gap5/export_contigs.c, gap5/sam_index.c: Sped up SAM export. The
	  [sb]am_aux_stringify functions now generate the string form
	  directly rather than using dozens of sprintf calls. Also
	  implemented a trial version of a faster fprintf implementation,
	  although right now it is unused.
	  
	  Finally, the sam export function now permits saving to final "-"
	  to signify stdout. This is of no use in the GUI, but will be
	  useful when scripting gap5.

	* gap5/gap4_compat.c: Sanitised lget_contig_num - given broken
	  input with start or end positions off the end of the contig, we
	  now clip correctly.

	* gap5/contig_editor.tcl, gap5/editor_join.c, gap5/tkEditor.c:
	  Updated the "Join" button in the editor to display the overlap
	  length and percentage mismatch. We now also get a question
	  confirmed whether we wish to make the join.
	  
	  Also bug fixed the "align" button. It had an error in computing
	  the coordinates of the overlap when one or both contigs did not
	  start at base position 1.

	* gap5/newgap5_cmds.c: Added a Tcl interface to
	  consensus_valid_range: this returns the used
	  (akas "clipped") portion of a contig.

	* gap5/depth.tcl: Minor tweak to prevent an infinite loop when the
	  template display is initially brought up on a region with no
	  visible data.

	* tgap/tg_utils.c, tgap/tg_utils.h: Updated the [us]72int and
	  int2[us]7 functions so that they're faster
	  (maybe 30% or so, depending on compiler and options). Also
	  implemented macro equivalents which are faster still, although
	  as yet these aren't used.

	* seq_utils/dna_utils.c, tgap/tg_sequence.c: Replaced complementing
	  functions with a marginally faster version.

2010-06-03  jkbonfield

	* gap5/contig_editor.tcl, gap5/gap5rc, gap5/primlib.c,
	  gap5/primlib.h, primer3/src/boulder_input.c,
	  primer3/src/oligotm.c, primer3/src/oligotm.h,
	  primer3/src/primer3.h, primer3/src/primer3_lib.c: Updated the
	  primer3 melting temperature calculation to take into account the
	  more recent formulae described in SantaLucia et al 1998, and
	  Ahsen et al 1999 (see source for full refs).  These are enabled
	  via a #define and by default are turned on.
	  
	  For Gap5 (not gap4 currently), the extra parameters required are
	  now configurable too, along with a few more of the existing
	  parameters.

2010-05-20  jkbonfield

	* gap5/export_contigs.c, gap5/sam_index.c, gap5/tg_index_common.c:
	  Improvements to SAM support, both input and output.
	  
	  - We now correctly populate the COMP2 (other pair complemented)
	  range flag. Improved on PAIRED flag too.
	  
	  - PEND_REV flags (other end reverse) are now also set during
	  tg_index of sam.
	  
	  - When exporting, we now attempt to set the strand fields
	  better.  (This fixes a bug where export to sam and reimport lost
	  some of the strand information.)

2010-05-14  awhitwham

	* gap5/docs/TODO: Added a couple of template display bugs.

	* gap5/depth.tcl, gap5/template_display.c: Improved y scrolling on
	  the template track.

2010-05-12  jkbonfield

	* gap4/join.c, gap4/searchUtils.c, gap4/tagU2.c, gap4/tkEditor.c,
	  gap5/ace.c, gap5/baf.c, gap5/break_contig.c, gap5/consensus.c,
	  gap5/contig_selector.c, gap5/cs-object.c, gap5/depad_seq_tree.c,
	  gap5/depad_seq_tree.h, gap5/do_fij.c, gap5/docs/TODO,
	  gap5/editor_join.c, gap5/editor_oligo.c, gap5/editor_oligo.h,
	  gap5/editor_search.c, gap5/editor_view.c, gap5/export_contigs.c,
	  gap5/fij.c, gap5/find_oligo.c, gap5/find_repeats.c,
	  gap5/gap4_compat.h, gap5/gap_globals.c, gap5/gap_hash.c,
	  gap5/hash_lib.c, gap5/maq.c, gap5/maq.h, gap5/newgap5_cmds.c,
	  gap5/qual.c, gap5/sam_index.c, gap5/tg_index.c,
	  gap5/tg_index_common.c, gap5/tg_view.c, gap5/tkEditor.c,
	  gap5/tman_interface.c, primer3/src/boulder_input.c,
	  primer3/src/primer3_lib.c, seq_utils/align_lib.c,
	  seq_utils/dna_utils.c, seq_utils/renz_utils.c,
	  seq_utils/sequence_formats.c, spin/seq_reg.c, tgap/b+tree2.c,
	  tgap/g-alloc.c, tgap/g-io.c, tgap/g-request.c,
	  tgap/hache_table.c, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_cache.c, tgap/tg_contig.c, tgap/tg_gio.h,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_sequence.h,
	  tgap/tg_tcl.c, tk_utils/element_canvas.c,
	  tk_utils/restriction_enzyme_map.c, tk_utils/tkTrace.c,
	  tk_utils/trace_print.c: Mass tidy up of minor compilation warning
	  issues.
	  
	  These cover unused variables, variable names shadowing "parent"
	  ones, missing prototypes, enum lists ending with comma, etc.

2010-05-12  awhitwham

	* gap5/depth_track.c, gap5/gap_range.c, gap5/template_display.c:
	  Code tidy to get rid of some warnings.

2010-05-12  jkbonfield

	* mutscan/Makefile, mutscan/staden.h, tracediff/Makefile,
	  tracediff/staden.h: A few more tweaks when building with icc with
	  regards to os.h

2010-05-11  jkbonfield

	* Misc/os.h, abi/Makefile, abi/abiIO.h, eba/Makefile, eba/conf.c,
	  eba/qual.c, gap4/seqInfo.c, get_scf_field/get_scf_field.c,
	  hetins/Makefile, hetins/hetins.c, init_exp/init_exp.c,
	  polyA_clip/polyA_clip.c, polyA_clip/seqInfo.c, qclip/consen.c,
	  qclip/seqInfo.c, qclip/seqInfo.h, stops/Makefile, stops/stops.c,
	  tk_utils/misc.c, tk_utils/tkTrace.c, tk_utils/tkTraceComp.c,
	  tk_utils/tkTraceDisp.c, tk_utils/tkTraceIO.c,
	  tk_utils/trace_print.c: Forced use of the Staden Package <os.h>
	  instead of relying on picking up one from an io_lib
	  installation.
	  
	  The key difference is that the local one will honour
	  HAVE_CONFIG_H and pick up little vs big endian definitions from
	  our autoconf derived values, while including a remote io_lib one
	  will not. (This should still work, but it requires the
	  auto-detection macros based on processor type instead.)

	* gap5/docs/TODO:

	* gap5/docs/TODO:

	* gap5/map_reads.tcl, gap5/newgap5_cmds.c, gap5/sam_index.c,
	  tgap/tg_iface.h, tgap/tg_iface_g.c: Improved Mapped Assembly.
	  When we ask to index sequence names, if a name index doesn't
	  already exist we create it.
	  
	  In the process of this we extended the database interface to add
	  an index creation method; fixed memory dup/free issues with the
	  btree code (harmless change); fixed uninitialised variables
	  (store unmapped data / aux records) for sam input via this
	  route; and moved some of the puts statements to use vmessage so
	  they appear in the editor window instead of stdout.

2010-05-11  awhitwham

	* tgap/tg_contig.c, tk_utils/tkRaster.c, tk_utils/tkRaster.h: More
	  changes to improve the template display.

	* gap5/Makefile, gap5/depth.tcl, gap5/depth_track.c,
	  gap5/depth_track.h, gap5/gap5rc_menu_full, gap5/gap_range.c,
	  gap5/gap_range.h, gap5/newgap5_cmds.c, gap5/template_display.c,
	  gap5/template_display.h: Improvements to the template display.

2010-05-10  jkbonfield

	* gap5/gap.tcl: Fixed error with starting gap5 -ro and not
	  specifying a database name.

2010-05-07  jkbonfield

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/editor_view.h,
	  gap5/gap5rc, gap5/gap5rc_menu_full, gap5/tkEditor.c: Added draft
	  of primer picking within the contig editor. This still needs
	  more work and currently just lists primers rather than picking
	  templates for them and adding tags.

2010-05-06  jkbonfield

	* gap5/editor_oligo.c, gap5/editor_oligo.h: First draft of oligo
	  selection code within the editor.

	* gap5/primlib.c, gap5/primlib.h: Added primer3 wrapper layer code.

2010-05-05  jkbonfield

	* tgap/tg_library.h: Added missing prototype

	* tgap/tg_tcl.c: Protection against NULL tc->contig when destroying
	  the command.

	* convert/Makefile, global.mk, mutlib/Makefile, mutscan/Makefile,
	  prefinish/Makefile, seq_utils/Makefile, seqed/Makefile,
	  spin/Makefile, spin2/Makefile, tgap/Makefile, tk_utils/Makefile,
	  tracediff/Makefile, trev/Makefile: We're now more explicit about
	  our library dependencies. This should aid compilation on MacOS X
	  and Windows (untested).
	  
	  Also made sure that for TCL only we add $(TCL_LIB) and for
	  Tcl/Tk both we use only $(TK_LIB) and not both. This is because
	  adding @TCL_LIBS@ and @TK_LIBS@ to the system.mk.in has lead to
	  some dependent libraries being specified twice if we explicitly
	  ask to use both $(TCL_LIB) and $(TK_LIB). For libieee.a this
	  causes problems due to a global version symbol, causing a link
	  error.

	* ac_stubs/ax_lib_curses.m4, configure.in, gap5/Makefile,
	  gap5/docs/DONE, gap5/docs/TODO, gap5/tg_view.c,
	  staden_config.h.in, system.mk.in, tgap/tg_library.c: Added
	  curses/ncurses to autoconf. It now detects which is installed on
	  the system automatically and allows an alternative path to be
	  specified too.

	* ac_stubs/ax_lib_lzma.m4: Misc cut and paste errors of samtools &
	  libz instead of lzma.

2010-04-29  jkbonfield

	* gap4/list_contigs.tcl, gap5/contig_selector.tcl, gap5/gap.tcl,
	  gap5/gap5rc_menu_full, gap5/list_contigs.tcl,
	  gap5/ng_fb_cmds.tcl: Improvements to read-only mode.
	  
	  We no longer allow Save Contig Order from the List Contig
	  windows to be tried when we opened a database in read-only
	  mode. (It didn't work as it was caught later on, but
	  ungracefully.)

2010-04-28  jkbonfield

	* gap5/break_contig.c: Commented out the remove_redundant_bins()
	  call in break contig for now as this does not correctly shift
	  the start coordinate when removing the parent bin and leaving
	  only a right-child bin.
	  
	  (This still needs fixing, but without the optimisation in place
	  we at least get correct results once again.)

	* gap5/docs/DONE, gap5/docs/TODO:

	* Misc/Makefile, abi/Makefile, convert/Makefile,
	  copy_reads/Makefile, eba/Makefile, find_renz/Makefile,
	  g/Makefile, gap4/Makefile, gap5/Makefile, global.mk,
	  haplo/Makefile, make_weights/Makefile, mutlib/Makefile,
	  polyA_clip/Makefile, prefinish/Makefile, qclip/Makefile,
	  screen_seq/Makefile, seq_utils/Makefile, spin/Makefile,
	  stops/Makefile, tgap/Makefile, tk_utils/Makefile,
	  tracediff/Makefile, vector_clip/Makefile: Fixed the "make
	  depend" code so that it works when run from a sub-directory
	  rather than only just in the top-level checkout.
	  
	  This commit also includes the results of running this - ie
	  makefiles with updated dependencies.

	* Misc/getfile.c, Misc/misc.h, Misc/os.h, Misc/parse_db.c,
	  abi/abiIO.c, abi/getABIfield.c, alf/alfsplit.c, convert/bapIO.c,
	  convert/dapIO.c, convert/flat_sd.c, find_renz/find_renz.c,
	  g/freetree.c, g/g-db.c, g/g-request.c, gap4/actf.c,
	  gap4/consen.c, gap4/edCommands.c, gap4/extract.c,
	  gap4/gap-create.c, gap4/newgap_cmds.c, gap4/tagU2.c,
	  gap5/actf.c, gap5/export_contigs.c, gap5/newgap5_cmds.c,
	  gap5/tg_index_common.c, make_weights/make_weights.c,
	  mutlib/align.cpp, mutlib/read_matrix.cpp, mutscan/main.cpp,
	  polyA_clip/polyA_clip.c, prefinish/finish.c,
	  prefinish/finish_walk.c, qclip/qclip.c, screen_seq/screen_seq.c,
	  seq_utils/genetic_code.c, seq_utils/read_matrix.c,
	  seq_utils/renz_utils.c, seq_utils/sequence_formats.c,
	  spin/codon_content.c, spin/emboss_input_funcs.c,
	  spin/nip_cmds.c, spin/readpam.c, spin/seq_reg_cmds.c,
	  spin/splice_search.c, spin/tkSeqedUtils.c, stops/stops.c,
	  tgap/b+tree2.c, tgap/g-alloc.c, tgap/g-files.c, tgap/g-io.c,
	  tgap/g-request.c, tgap/tg_contig.c, tgap/zfio.c,
	  tk_utils/capture.c, tk_utils/postscript.c,
	  tk_utils/text_output.c, tracediff/main.cpp,
	  vector_clip/vector_clip.c: Fixed various large file support
	  issues for linux.
	  
	  These include additional includes of <staden_config.h> and use of
	  fseeko in place of fseek.

	* g/g-files.c: When opening in read-only mode we no longer attempt
	  to register items with the freetree structure. This is only a
	  minor speedup, but more importantly it allows us to use copy_db
	  to attempt to recover some corrupted databases.

2010-04-20  jkbonfield

	* gap5/gap4_compat.c: Fixed contig_name_to_number to recognise
	  "=<recno>" syntax.

2010-04-19  jkbonfield

	* gap5/contig_editor.tcl: Added auto-scrolling when selecting a
	  region (underlining it). Also enabled shift+click to extend a
	  selection.

	* gap5/gap.tcl: Fixed Database Information output.

	* gap5/libraries.tcl, gap5/tclIndex: Updated the List Libraries
	  window to use Plotchart. It now has axis and things, but needs
	  more work still.

2010-04-14  jkbonfield

	* gap5/contig_selector.c, gap5/contig_selector.h,
	  gap5/newgap5_cmds.c, gap5/tk-io-reg.h: Added back
	  tk_matchresult_configure function, now in contig_selector.c.
	  This fixes an error when trying to configure a contig comparator
	  plot, such as changing colour or line width.

	* gap5/contig_selector.c, gap5/contig_selector.h,
	  gap5/contig_selector.tcl, gap5/cs-object.c, gap5/fij.c,
	  gap5/find_oligo.c, gap5/find_repeats.c, gap5/gap5rc_menu_full,
	  gap5/newgap5_cmds.c, gap5/result_manager.tcl, gap5/tk-io-reg.h:
	  The contig order can now be saved, from both the contig selector
	  and contig list windows. Furthermore we can now move contigs
	  around in the contig selector.
	  
	  The "show diagonal" and "Clear all" commands work in the contig
	  selector.
	  
	  The results manager and the results menu in the contig selector
	  now update properly.

	* tgap/tg_register.c: Remove old debugging output

	* gap5/do_fij.c: Remove duplicates from the contig_list[] as we go
	  through it. These occured when doing single vs all as the single
	  contig is in the list twice (as first and then later on in the
	  "all" bit).

	* gap5/depad_seq_tree.c, gap5/map_reads.tcl, gap5/newgap5_cmds.c:
	  The Map Reads dialogues now have an option whether to index the
	  sequence names (and this was renamed from -no_tree to
	  -index_names at the API level).
	  
	  Also fixed a bug with the tg_index -g mode, where the input bam
	  file is assumed to have been aligned against an ungapped copy of
	  the contig already in the gap5 DB. We failed to take into
	  account that contigs may not start at base 1.

	* gap5/editor_search.c, gap5/editor_search.tcl, gap5/gap5rc: Added
	  by-annotation and by-tag-type search methods to the contig
	  editor. Also fixed searching by name so it no longer tried to
	  jump to sequence names that are found in another contig.
	  
	* tgap/tg_iface_g.c: Fixed a bug when writing out SeqBlocks
	  containing a mixture of data with libraries and without
	  libraries. (This can happen when writing the cached consensus to
	  a db generated from a bam file.)
	  
	  We incorrectly handled the no-library cases, causing corrupt
	  data to be written to the DB when the first read in a block was
	  missing.

	* gap4/gap-tcl.c: Fixed a memory corruption when using tcl in
	  debugging mode (where Tcl_Free is not the same as free).

2010-04-01  jkbonfield

	* convert/Makefile, copy_reads/copy_reads, gap4/gap4, gap5/gap.tcl,
	  gap5/gap5, gap5/gap5rc, prefinish/finish_sanger, pregap4/pregap4,
	  spin/spin, spin_emboss/create_emboss_files, system.mk.in,
	  tgap/Makefile, tgap/tg_tcl.c, tk_utils/Makefile, tk_utils/init.c,
	  trev/trev: Various fixes for building on MacOS X.
	  
	  - The sh wrapper scripts seem to need a trailing / on $STADLIB
	  otherwise tcl "load" doesn't add one. I'm not sure why yet.
	  
	  - Removed tkCanvGraph.c and tclCanvGraph.c from tk_utils build.
	  These caused all sorts of problems with needing internal tcl/tk
	  header files, but they're only used by spin2 which we no longer
	  support nor build. We can cross that bridge if we ever go back
	  to it.
	  
	  - Similarly removed tclInt.h from tg_tcl.c. In theory this was
	  added to get a prototype for Tcl_GetCommandFromObj, but it
	  doesn't always seem to be there anyway. Perhaps a Tcl version
	  issue.
	  
	  - Added various more extra libs to explicitly link against in the
	  Makefiles as MacOS X doesn't like the implicit chains.
	  
	  - Removed load of iwidgets from gap5rc. Not sure if we need
	  this, but it seems to have been commented out some time ago for
	  gap4 so it seems unlikely.
	  
	  - Use @TK_LIBS@ and @TCL_LIBS@ again in system.mk.in. I do not
	  know why I commented those out (which is worrying), but they're
	  definitely required for MacOS.
	  
	  - Similarly disabled -rpath-link for now as it doesn't exist on
	  MacOS X. I'm hoping the explicit library linking will remove the
	  need for using this anyway... to test on other platforms.

	* Misc/os.h: Updated os.h to handle endianness is a better
	  fashion.  This is taken from io_lib's copy of it and hopefully
	  works better now on intel based MacOS X systems or Mac systems
	  building "fat binaries".

2010-03-26  jkbonfield
	* rel-2-0-0-b6
	  gap5-1-2-8

	* NEWS, configure.in: 2.0.0b6 updates.

	* gap5/gap.tcl, gap5/tg_index.c, gap5/tg_view.c: Bumped g5 versions
	  to 1.2.8

	* tk_utils/tk_utilsrc: Use a smaller font for the contig editor on
	  unix

	* tgap/tg_iface_g.c: Fixed memory allocation error (causing
	  crashes) when dealing with
	  multiple read-groups and read-names with substantially different
	  lengths.

2010-03-24  James Bonfield

	* Tagged rel-2-0-0-b5
	* Tagged gap5-1-2-7

2010-03-24  jkbonfield

	* gap5/docs/ChangeLog:

        * gap4/join.c: We now temporarily set the two editor panels in
          the join editor to be "StateDown" during the dojoin()
          call. This prevents them from receiving the REG_LENGTH event
          and therefore from reloading the entire contig into memory
          (unless another display exists for the same contig in
          another window).

          This substantially reduces the amount of I/O when performing
          a join.

        * gap5/break_contig.c: Fixed a bug where seq->bin_index wasn't
          updated when moving sequences from one bin to another during
          break contig.

2010-03-22  jkbonfield

	* gap5/docs/TODO:

	* gap5/gap_utils.tcl, gap5/tclIndex: Updated c_length proc to use
	  the contig get_length method. This avoids the old io_read_contig
	  emulation, which spends a lot of time and I/O needlessly
	  figuring out the first and last reading in the contig.

	* gap5/export_contigs.c: Improvements to CAF export.
	  - We use - instead of * now for pads.
	  - We generate new names using the record ID. This avoids the
	    problem of duplicate read names in gap5.

	* gap5/map_reads.tcl: We now enable B+Tree indexing of finishing
	  read sequence names.

	* gap5/tg_view.c: Minor change to tg_view -l to deal with *DEEP*
	  data

	* tgap/tg_contig.c: Minor speed improvement to the y-layout
	  algorithm.
	  
	  compute_ypos_tags() now checks whether any tags are visible and
	  short-cuts the hash table building step if it's not
	  needed. Still not optimal, but a step in the right direction.

2010-03-12  jkbonfield

	* gap5/sam_index.c: Fixed a crash that occured when adding
	  unaligned data and the unaligned read was the first read to be
	  added to a contig.

	* gap4/tag_checklist.tcl, gap5/tag_checklist.tcl: Used "extended"
	  mode of the listbox instead of our old local hack of
	  extended2. This difference is in how it handles toggling and
	  whether we can select multiples without using control, but at
	  least it's now functional again when using a native Tk instead
	  of a locally hacked one.

	* gap4/acd2tag.tcl: Fixed some issues with incorrectly resizing
	  notebooks.
	  
	  Also fixed using variables with acd dependencies.

2010-03-08  jkbonfield

	* ChangeLog:

	* NEWS, tk_utils/Makefile:

	* ac_stubs/ax_lib_lzma.m4, gap5/contig_id.tcl,
	  gap5/gap4_compat.tcl: Remove debugging chatter

	* gap5/tclIndex: Added io_read_contig

        * gap5/export_contigs.c, gap5/export_contigs.tcl: Added CAF format
          to the export contigs dialogue. Not a recommended
          format, but users are requesting it still.

        * tgap/tg_cache.c: Bug fixed an earlier fix to cache_rw(). If we
	  lock, flush and attempt to relock a record the change to the
	  function meant we failed to set the updated flag. (An example of
	  it causing a problem is crashing when computing the consensus
	  after exiting the database and reopening it.)

          This perhaps needs a fix elsewhere too. Should roll back the
	  lock to RO after a flush?

2010-03-05  jkbonfield

        * gap5/maqmap.c, gap5/sam_index.c, tgap/tg_anno.c,
          tgap/tg_register.c, tgap/tg_sequence.c, tk_utils/sheet.c: Fixed
          various compilation warnings

        * ChangeLog, NEWS, README.build, configure.in: Updates to prepare
          for 2.0.0b5

	* gap5/contig_editor.tcl, gap5/docs/DONE, gap5/docs/TODO,
	  tgap/tg_anno.c, tgap/tg_anno.h, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_sequence.c, tgap/tg_tcl.c: Added anno_get_position and
	  anno_get_position2 functions, analogous to
	  the sequence_get_position* funcs. The two share common code so
	  internally they now call the same function,
	  bin_get_item_position(),
	  that takes a type field.
	  
	  Added a move_annos method of the tcl seq object. This calls the
	  C sequence_move_annos() function. It's used within the contig
	  editor to ensure that annotations are moved with a
	  sequence. Still to do: allow partial moves, in the case of
	  inserting or deleting with a sequence.
	  
	  Fixed a bug with the bin_for_range function where the database
	  had smaller bins than the current default minimum bin
	  size. Sometimes we were putting things in larger bins than we
	  need to.
	  
	  The Contig Editor Undo command now undoes changes to tag type
	  and tag comment.

	* gap5/tkEditor.c: The "select get" editor method now returns the
	  base under the editing cursor when no selection has been
	  made. This prevents a crash when attempting to create a tag
	  without marking a region.

	* tgap/tg_cache.c: Prevented excessive item duplications when we
	  attempt to cache_rw the same object multiple times within the
	  editor.

	* tgap/tg_contig.c: Extended contig_dump_ps to output sequence
	  lines too

	* gap4/gap.tcl: Moved the -menu_file code to after the
	  load_package section (to fix a problem with Sanger's
	  exoseq_make_gapdb).

2010-03-04  jkbonfield

	* ac_stubs/ax_lib_png.m4: Fixed bug where PNG_LDFLAGS defaults to
	  -lz when no --with-png is used.
	  
	  Also fixed an issue where --with-png was assumed to be used even
	  when not explicitly specified, by virtue of picking up the
	  previous $withval used within the --with-lzma section.

	* ac_stubs/ax_lib_lzma.m4: Fixed AC_CHECK_LIB test

2010-03-03  jkbonfield

	* prefinish/finish_cDNA, prefinish/finish_cDNA_ends_only,
	  prefinish/finish_sanger.tcl: Fixed the scripts so that when run
	  as an executable rather than from tclsh the auto-restarting code
	  computes STADENROOT based on the assumption of $0 being in the
	  share/staden/scripts/$0 location.

	* tk_utils/stash: Fixed argc

2010-03-02  jkbonfield

	* tk_utils/Makefile, tk_utils/stash: Added a new stash script to
	  the installed bin directory. This pretends to be the old stash
	  executable, by virtue of running the system tclsh and running a
	  little bit of startup code.
	  
	  It's not a recommended route, but will be kept for backwards
	  compatibility for old scripts.

	* gap4/gap.tcl, gap5/gap.tcl, gap5/tg_index.c: Bumped some version
	  numbers:
	  
	  gap4 2.11.2
	  gap5 1.2.7
	  tg_index 1.2.7

	* gap5/contig_selector.tcl: Removed excessing debugging output

	* gap5/docs/DONE, gap5/docs/TODO, global.mk, system.mk.in: Fixed
	  compilation when no libpng is found.

2010-03-01  jkbonfield

	* gap5/docs/DONE:

	* gap5/contig_editor.tcl, gap5/gap4_compat.c, gap5/tkEditor.c:
	  Further event handling.
	  
	  Complement contig now requests contig_lock_write() access. This
	  in turn is now handled by the editor, bringing up a dialogue box
	  as appropriate.
	  
	  The editor also handles JOIN_TO requests better now. For this to
	  happen it may need to change the contig we're associated with,
	  which in turn means updating the $ed io and contig_rec
	  values. These methods are now set/get rather than pure get,
	  allowing them to be updated after "$ed init".

	* gap5/tk-io-reg.c, tgap/tg_register.c: Moved busy_dialog() from
	  tk-io-reg.c to tg_register.c and also make
	  use of it in the locking code.

	* gap5/tk-io-reg.c: Improved calling of tcl-registered contig_reg
	  items. To protect against memory corruptions when a function is
	  contig_deregister()ed while processing an event, we now do some
	  basic reference counting in the cr_type object.
	  
	  Also added code for handling the return value for REG_GET_LOCK
	  queries.

	* gap5/gap5rc_menu_full, gap5/tclIndex: Reenabled the Results
	  Manager window - it's no longer hidden behind the expert mode
	  flag.

	* gap5/editor_join.c: Fixed the REG_JOIN_TO event we send out to
	  include the correct contig number (was right, now left).

	* tgap/hache_table.c, tgap/hache_table.h, tgap/tg_register.c: -
	  Added a HacheTableRehash function. This allows an item to be
	  assigned to a new key without needing to remove and reinsert it.
	  
	  - Fixed contig_register_join to use HashTableRehash instead of
	  remove/insert. This means that the hacheItem doesn't change and
	  hence we fixed a bug with incorrect tracking this. Also added
	  asserts to better protect against similar bugs.

	* tgap/tg_cache.c: When unloading items from the cache we no
	  longer also unlock the record if this is a child i/o and the
	  record is still in the base i/o.
	  
	  Previously by doing this we could end up attempting to write to
	  already-freed views, leading to cryptic "Error: -1" from save
	  contig.

2010-02-25  jkbonfield

	* seq_utils/align_lib.h: Added comments so I can remember what the
	  cryptic edge_mode values mean in the future.

	* gap5/cs-object.c, gap5/fij.c: Fixed issues with complementing
	  match objects. These used to just use "contig_length - pos", but
	  the contig length includes cutoff data now. Calling
	  consensus_valid_range cures this, although we may want to cache
	  that data to speed up the process.

	* tgap/hache_table.c: Minor improvements to the hache dump debug
	  code.

	* gap5/contig_editor.tcl, gap5/contig_selector.c, gap5/docs/DONE,
	  gap5/docs/TODO, gap5/editor_join.c, gap5/find_oligo.c,
	  gap5/find_repeats.c, gap5/gap4_compat.c, gap5/tkEditor.c,
	  tgap/tg_contig.c, tgap/tg_register.c, tgap/tg_register.h: Fixed
	  missing contig notifications on events like complementing a
	  contig, joining contigs or simply just saving from the editor.
	  Now we handle these the clearing of the FIJ plot has been
	  removed as it updates correctly.
	  
	  Plots that used to register with all contigs in a verbatim
	  manner now register with contig 0. (And indeed in many case they
	  were incorrect anyway as they registered with contig 1..Ncontigs
	  rather than the actual contig record numbers.)
	  
	  To facilitate this the send_event function has been improved so
	  that sending to contig -N will send the message to all plots
	  registered against contig zero, but claiming to been an event
	  sent to contig N rather than 0 so that the receiver knows the
	  request. This change is internal to how tg_register works and
	  not something that is visible outside of that file.

	* gap4/hash_lib.c, gap5/hash_lib.c: Fixed a bug introduced in svn
	  rev 919 (Dec 9 2005) when I changed
	  (amongst other things) the edge_mode parameter from fixed
	  constants to symbolic names.
	  
	  The edge_mode parameter was incorrectly set for the first block,
	  meaning that left-end pads were penalised for. We now explicitly
	  mask off the bit requesting this and consequentially our
	  alignments now improve. Impressive it lasted this long without
	  anyone complaining about broken alignments when using FIJ in
	  fast-mode.

2010-02-19  jkbonfield

	* tgap/tg_contig.c: Fixed bug in contig_set_name(). It reset *c
	  too early, but now sets it after cache_item_resize call.

2010-02-18  jkbonfield

	* gap5/consensus.c, gap5/contig_editor.tcl, gap5/editor_search.c,
	  gap5/editor_view.c, gap5/editor_view.h, gap5/tkEditor.c,
	  gap5/tman_interface.c, tgap/tg_sequence.c, tgap/tg_sequence.h,
	  tgap/tg_tcl.c: 1) More work on undo, especially when undoing a
	  base deletion that is the first/last base in hidden data, at the
	  junction of clipped vs used.  Normally when we manually insert
	  here we want the base to be in the used visible portion, but if
	  we're inserting as a result of undoing a deletion then it's
	  probably cutoff data we're adding back instead.
	  
	  This involved changing sequence_get_base to return whether a
	  base is in used or cutoff data, along with everything that calls
	  it.
	  
	  Lots of cursor work involving cutoff data. When we turn off
	  cutoffs and our cursor is in the cutoff region of a sequence the
	  cursor now gets moved to the consensus. Moving around with arrow
	  keys will also skip cutoff data when cutoffs are not shown,
	  similarly for making selections. Finally when undoing changes
	  that occured in the cutoff data we now automatically make the
	  cutoffs visible again if they were not already.
	  
	  This also involved modifying the parameters to edSetCursorPos.

2010-02-17  jkbonfield

	* gap5/docs/DONE, gap5/docs/TODO:

	* gap5/contig_editor.tcl, gap5/ng_fb_cmds.tcl, tgap/tg_gio.c:
	  Better handling of read-only databases. We now open them instead
	  of just aborting requiring the user to re-run using -ro. We also
	  check the read-only status in the contig editor to block
	  attempted edits and saves.

	* gap5/gap5rc_menu_full: Fixed the File->New removal (previously
	  accidentally removed the "note" menu part, which isn't visible
	  anyway).

	* gap5/contig_editor.tcl, tgap/tg_sequence.c, tgap/tg_tcl.c: Added
	  methods to adjust the sequence left/right clip points in the
	  contig editor. These are bound to the < and > keys, as in gap4.

	* gap5/baf.c, gap5/export_contigs.c, tgap/BAF: Added consensus tags
	  to input/output via BAF.

2010-02-16  jkbonfield

	* gap5/export_contigs.tcl: Change the output file name based on
	  file format, and automatically pick something appropriate based
	  on the DB name too.

	* gap5/gap.tcl, gap5/newgap5_cmds.c, tgap/tg_gio.c, tgap/tg_gio.h,
	  tgap/tg_iface_g.c, tgap/tg_struct.h, tgap/tg_tcl.c: The main
	  database record now has a version number (starting with 1 for
	  v1.2.6). This relates to the global version of the database
	  format.
	  
	  Also added $io methods to query the version, the database name
	  and read-only status. These are now used to update the main
	  title bar.

	* gap5/editor_view.c, tgap/tg_sequence.c, tgap/tg_sequence.h:
	  Control-a and control-e now look at the cutoffs editor parameter
	  to determine whether they should jump to the visible start/end
	  of the sequence/contig or the hidden start/end.
	  
	  In a similar vein, the left/right arrow keys no longer scroll
	  past the visible end either unless cutoffs are shown even when
	  complemented
	  (previously this was bugged).
	  
	  To simplify the implementation of this, I added a new function
	  sequence_get_orient() which returns the relative orientation of
	  this sequence vs the contig. This is more than just "s->len < 0"
	  now considering the complemented status of bins en-route to the
	  root node and so fixes a bug the bug in scrolling along
	  sequences in a complemented contig.

	* tgap/tg_cache.c: Fixed a memory corruption involved with
	  cache_item_resize(). We now always update the data_size pointer,
	  rather than only when realloc moves the memory.

2010-02-15  jkbonfield

	* gap5/consensus.c, gap5/docs/DONE, gap5/docs/TODO, tgap/tg_bin.c,
	  tgap/tg_tcl.c: Fixed issues with consensus caching in
	  complemented contigs.
	  
	  Related to this is the issue of moving sequences in complemented
	  contigs too, which may cause creation of a new root bin which
	  itself will not be complemented. (Also fixed)

2010-02-12  jkbonfield

	* gap5/contig_editor.tcl, gap5/editor_view.c, tgap/tg_anno.c,
	  tgap/tg_anno.h, tgap/tg_tcl.c: Further editor undo fixes - this
	  time annotations.
	  
	  This involved adding an extra option to anno_get_range to allow
	  returning the relative location instead of absolute, and adding a
	  method to the tcl $tag object to query this.

	* convert/Makefile: Added an explicit -lg to the convert link
	  line.  Some systems didn't automatically follow the dependency
	  from -lgap.

	* gap5/tg_index_common.c: We now complement data correctly when
	  using tg_index -a to append to an existing contig and that
	  contig has been complemented.

	* gap5/export_contigs.c: Further fixes to ace, baf and sam output
	  when exporting a complemented contig.

	* tgap/tg_bin.c: Allow for adding to a complement contig.

	* gap5/gap4_compat.c: complement_contig() now maintains the same
	  clipped start/end position, so a contig with used (uncutoff)
	  portion of data from A to B and total coverage including hidden
	  data from A' to B' will now flip around the midpoint of A to B,
	  such that the complemented contig covers the same range of
	  visible data.
	  
	  This is now equivalent to Gap4 for contigs starting at base 1.

	* gap5/sam_index.c: Compile bam_aux_stringify even when
	  HAVE_SAMTOOLS isn't set so we can export to sam format still.

2010-02-11  jkbonfield

	* gap5/export_contigs.c: Fixed export contigs when running on
	  complemented contigs.

2010-02-09  jkbonfield

	* gap5/gap5rc_menu_full: Remove the unimplemented File->New menu
	  option

	* gap5/sam_index.c: Major speed up when dealing with very deep
	  data.
	  
	  We replaced the array of recnos with a linked list, for faster
	  adding/removal. Removed the memmove call from bio_del_seq and
	  instead do an in-situ copy while iterating over the items. This
	  essentially means one array copy per column instead of one per
	  sequencing ending per column.
	  
	  Estimations are about 27x speed up on a contig of ~50000 depth.

2010-02-08  jkbonfield

	* gap5/contig_editor.tcl, gap5/tkEditor.c: Fixed display and undo
	  issues relating to moving sequences, especially moving them left
	  from the start of the contig into negative coorindates.
	  
	  We're now more careful about caching of data which may change,
	  such as the contig struct and the root bin it points to. In Tcl
	  we resolve this largely by not caching the object, but only the
	  record number. In C we resolved it by implementing a manual way
	  to repopulate cached contig struct on demand (the decr_contig
	  and incr_contig editor methods), although it may be preferable
	  to replace these by record number caching instead at some stage.

	* tgap/tg_contig.c, tgap/tg_sequence.c: sequence_insert_base() now
	  updates *s with the new seq_t struct. Previously this didn't
	  happen so if it moved via cache_item_resize the caller kept a
	  broken pointer.
	  
	  Also moved the location of these updates in various other
	  related functions, to better handle the error cases.

	* tgap/tg_bin.c: Fixed the last_bin caching in bin_for_range(). It
	  now caches the bin record number and not the pointer. While
	  perhaps not quite as efficient, this works even when the pointer
	  changes due to a realloc or cache_rw change (eg moving from
	  base-io to child-io in the case of contig editor handling).
	  
	  This fixes a bug with undo in the editor.

	* gap5/sam_index.c: Fixed an efficiency bug when not storing
	  unmapped data. We allocated a record number for these reads and
	  didn't use it, nor remove from the pending record number
	  list. The DB was correct, but we gradually got slower and
	  slower.

2010-02-05  jkbonfield

	* tgap/tg_bin.c: Comment for later

	* tgap/tg_tcl.c: The remove_sequence and add_sequence seq methods
	  now return and accept range pair-record and range flags, so a
	  sequence can be moved while retaining all data about it.
	  
	  Also fixed a bug where reinserting a sequence did not correct
	  update the seq->bin_index field.

	* tgap/tg_gio.c: Set min_bin_size for child io so bin based edits
	  on the contig editor work properly. (Ideally the min_bin_size
	  should be remembered from tg_index, stored in the database
	  record.)

	* README.build: Added note about -fPIC and Samtools

2010-02-04  awhitwham

	* gap5/depth.tcl, gap5/template_display.c, gap5/template_display.h,
	  gap5/template_draw.c: Intermediate Template Display changes.

2010-02-03  jkbonfield

	* staden.profile: Resurrected (and majorly rewrote, hence no real
	  history) the old staden.profile script.
	  
	  It's not required to source this, but some programs tightly
	  linking with the staden package or people wishing to run the
	  smaller tools rather than the main GUI apps will need to get
	  their environment set up properly: LD_LIBRARY_PATH, MANPATH,
	  etc.
	  
	  This script does that and so should be sourced from a
	  bourne-shell syntax login script as desired.

	* gap5/ace.c, tgap/g-files.c: Further memory leak fixes

	* gap5/docs/TODO:

	* tgap/tg_cache.c: Allow for child io to have the cache destroyed.
	  In this case, such as quitting an editor and not saving changes,
	  we relax the assert to allow for updated records to be thrown
	  away without saving first.

	* tgap/g-files.c: When preloading neighbouring index records from
	  the aux file we now do so for the block the requested record
	  resides in, rather than for the record we request and the next
	  256. This means we generally load the data in fewer requests and
	  also don't attempt to load the same records multiple times
	  (which lead to a memory leak).

	* gap5/contig_editor.tcl, tgap/tg_gio.c: Removed a memory leak -
	  the editor now deallocates the child io and any cached data held
	  within it upon exit.

	* gap5/contig_editor.tcl, tgap/tg_tcl.c: Substantial improvements
	  to undo:
	  
	  Removed the Redo functionality for now. I may add this back when
	  undo itself is finished.
	  
	  Deleting an entire column of data in the consensus now remembers
	  the old data so undo works (previously it just added pads). To
	  implement this a new contig obj method was added, pileup, to
	  return a column of data.

	* gap5/contig_selector.c: Removed a minor memory leak

	* gap5/newgap5_cmds.c: Extra debugging and a leak_check command if
	  VALGRIND is defined

	* tgap/tg_sequence.c: Removed a memory leak in
	  sequence_invalidate_consensus().
	  
	  Fixed sequence_delete_base() - it sometimes used the old
	  pre-cache_rw copy of the seq_t struct leading to undefined
	  behaviour.

2010-02-01  jkbonfield

	* gap5/contig_editor.tcl: Fixed a bug whereby the child IO of a
	  top editor in a join editor was not detached properly.
	  
	  This meant that exiting editing (eg pressing "align") and then
	  cancelling the join and closing the window would still have the
	  edits cached. Subsequent invocations of an editor for that
	  contig would see these edits still.

	* tgap/tg_cache.c, tgap/tg_iface_g.c: Removed a recently added
	  memory leak in reading sequence blocks. Also worked around a
	  malloc(0) size issue which while technically not incorrect,
	  caused valgrind to whinge a bit.

	* tgap/tg_iface_g.c: Fixed a bug with the new code to reorder read
	  names by their read group. Happened when a seq block contained
	  blank entries.

	* gap5/export_contigs.c: Removal of debugging output

2010-01-28  jkbonfield

	* gap5/ace.c, gap5/baf.c, gap5/export_contigs.c,
	  gap5/export_contigs.tcl, gap5/maq.c, gap5/sam_index.c,
	  gap5/sam_index.h, gap5/tg_index.c, gap5/tg_index.h,
	  tgap/tg_cache.c, tgap/tg_contig.c, tgap/tg_iface_g.c,
	  tgap/tg_sequence.c, tgap/tg_sequence.h, tgap/tg_struct.h:
	  Multiple improvements in input/output of SAM/BAM format.
	  
	  - We now support storing SAM auxillary records (other than the
	  old RG: tag). This is disabled by default, but enabled using
	  tg_index -x.
	  
	  - We can now also store unmapped data, although at present it is
	  still visible in the contig editor. This is enabled with
	  tg_index -u.
	  
	  - Fixed the ordering of adding reads to the database. Previously
	  reads were added as their right hand end went past the sam
	  'pileup' position hence we sorted by right end. Now we create
	  records in the same order they appear in the input file, meaning
	  export contigs should output in the correct order too.  To do
	  this cache_item_create has been split into creation and
	  initialisation stages, allowing for record numbers to be
	  allocated and then filled out later.
	  
	  - When querying and sorting sequences by X, we now disambiguate
	  matches by secondary sorting on record number. This also allows
	  for the editor or output functions to match the input sam order.
	  
	  - Export contig now allows for "fixmates" sam output, similar to
	  the samtools sub-command. Warning: this is substantially
	  slower. Also improved flags with respect to unmapped data.

	* gap5/editor_join.c: Fixed joining of contigs where the start
	  position is not 1.

	* ac_stubs/tcl.m4, staden_config.h.in: Removed the tcl
	  LARGEFILE_SOURCE64 and LARGEFILE64_SOURCE defines.
	  These confused autoconf on Ubuntu 9 and aren't needed by the
	  Staden
	  Package.

	* gap5/docs/TODO:

2010-01-25  jkbonfield

	* configure.in: Fixed io_lib version we require (to >= 1.12.2).

2010-01-22  jkbonfield

	* gap5/contig_editor.tcl: Prevent attempts to join a contig to
	  itself.

	* tk_utils/canvas_box.tcl: Better handling in error conditions,
	  when highling/unhighlighting matches

	* gap4/consen.c, gap4/consen.tcl, gap4/gaprc: Added fastq output
	  for consensus.

	* gap5/consensus.c: Fixed bug in consensus generation. Very long
	  sequences (>64Kb), meaning no small leaf nodes in the bin tree,
	  could omit filling out the final portion of the consensus in the
	  calculate_consensus_simple function.
	  
	  This manifested itself as FIJ failing when given sequences that
	  were consensus seqs from another DB.

2010-01-21  jkbonfield

	* global.mk, system.mk.in: Removed the LD_LIBRARY_PATH definitions
	  in global.mk (they wouldn't work on MacOS X anyway) and added
	  -Wl,-rpath-link,$(L) to the linker flags instead.
	  
	  Similarly added -rpath-link for io_lib's install directory. This
	  is because typically it may be built along side the staden
	  package with neither yet installed or without the user yet
	  setting LD_LIBRARY_PATH up.
	  
	  This also has provision to switching to -rpath later if desired,
	  although rpath is - of course - evil.

2010-01-19  jkbonfield

	* tk_utils/sheet.c: Fixed a crash when resizing a sheet widget to
	  zero width and back again. The problem was that zero width
	  widgets are classified as unmapped by Tk_IsMapped, causing
	  reallocation failures.

2010-01-18  jkbonfield

	* primer3/src/Makefile: Fix to permit parallel makes

	* Makefile.in: Added dependencies between directories so parallel
	  makes work.

2010-01-16  James Bonfield  <jkb@sanger.ac.uk>

	* Tagged rel-2-0-0-b4
	* Tagged gap5-1-2-6

2010-01-15  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/tg_index.c: Made the repad option public (was -x, not -g).
	  
	  Tidied up the usage message.

	* gap5/depad_seq_tree.c, gap5/depad_seq_tree.h, gap5/sam_index.c:
	  Fix memory leak - we can now deallocate the pad tree.

	* ac_stubs/ax_lib_lzma.m4: Fixed link bug: -llzma and not -lzma

	* gap5/newgap5_cmds.c: Also initialise a.pair_reads in
	  tcl_import_reads interface.

	* README.build, configure.in, staden_config.h.in, system.mk.in,
	  tgap/Makefile: Added --with-lzma to specify the liblzma (xz
	  utils) install root.
	  Modified the makefiles and to support this.

	* gap5/maq.c, gap5/maqmap.c: Improved short/long maq format
	  autodetection

2010-01-14  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4,
	  ac_stubs/ax_lib_iwidgets.m4, ac_stubs/ax_lib_lzma.m4,
	  ac_stubs/ax_lib_png.m4, ac_stubs/ax_lib_samtools.m4,
	  ac_stubs/ax_lib_tklib.m4, ac_stubs/ax_lib_zlib.m4: Added a
	  AX_LIB_LZMA configure option.
	  
	  Fixed many of the expr regexp matches for version checking. These
	  used . instead of \., sometimes causing 4.12 to be interpreted as
	  4,12,2 major,minor,patch levels.
	  
	  Also fixed the [0-9]* patterns which in a few cases was typo as
	  [0-9*].

2010-01-13  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c: Fixed the offset so that output to sam
	  does not shift the data by 1.
	  
	  Also (#ifdefed out) added some experimental code to shrink cigar
	  strings, assuming the consensus to be the reference.

	* gap5/gap5rc, gap5/gap5rc_menu_full, gap5/map_reads.tcl,
	  gap5/search.tcl, gap5/tclIndex: Added an Assembly -> Map Reads
	  menu. This allows running bwa
	  externally to align data to our consensus sequences, and then
	  importing them into Gap5.
	  
	  Experimental at the moment.

	* gap5/newgap5_cmds.c: Added tcl_import_reads interface. This is
	  effectively an interface to the guts of the tg_index command.

	* tgap/tg_cache.c: Allow for 250k per seqblock instead of 150k.

	* gap5/depad_seq_tree.c, gap5/depad_seq_tree.h: Newer depadding
	  functions that represent the unpadded to padded coordinate
	  mapping in a sorted red-black tree instead of the usual array
	  method. It is hoped that this will be smaller than a full array,
	  assuming the pad density is not too high.

	* gap5/maq.c, gap5/maq.h: Moved tg_index and tg_view from tgap to
	  gap5. This allows tg_index to start using gap5 functionality, eg
	  calculating the consensus.  This is used in an experimental
	  repad option where the alignment of incoming data is padded to
	  match an existing consensus.

	* gap5/Makefile, gap5/ace.c, gap5/ace.h, gap5/baf.c, gap5/baf.h,
	  gap5/maqmap.c, gap5/maqmap.h, gap5/sam_index.c,
	  gap5/sam_index.h, gap5/tg_index.c, gap5/tg_index.h,
	  gap5/tg_index_common.c, gap5/tg_index_common.h, gap5/tg_view.c,
	  tgap/Makefile, tgap/ace.c, tgap/ace.h, tgap/baf.c, tgap/baf.h,
	  tgap/maq.c, tgap/maq.h, tgap/maqmap.c, tgap/maqmap.h,
	  tgap/sam_index.c, tgap/sam_index.h, tgap/tg_index.c,
	  tgap/tg_index.h, tgap/tg_index_common.c, tgap/tg_index_common.h,
	  tgap/tg_view.c: Moved tg_index and tg_view from tgap to
	  gap5. This allows tg_index to start using gap5 functionality, eg
	  calculating the consensus.  This is used in an experimental
	  repad option where the alignment of incoming data is padded to
	  match an existing consensus.

	* gap4/trace_display.tcl, gap5/trace_display.tcl: Fix a bug with
	  poorly sized trace windows when initially brought up.
	  
	  This only happens sometimes, and only on some window managers.

2010-01-12  awhitwham

	* gap5/Makefile, gap5/template_display.c, gap5/template_display.h,
	  gap5/template_draw.c, gap5/template_draw.h, tgap/hache_table.c,
	  tgap/hache_table.h, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_struct.h, tk_utils/tkRaster.c, tk_utils/tkRaster.h:
	  Changes to speed up the template display showing large numbers of
	  reads.

2010-01-04  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Fixed bug in reorder_by_read_group mode while
	  decoding.

	* gap4/list_contigs.tcl: Honour the contig order

2009-12-08  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c: Fixed a memory corruption / cache counting
	  problem when working on complemented contigs.

	* gap5/consen.tcl: Honour the Strip Pads dialogue option.

	* gap5/docs/TODO:

	* gap5/hash_lib.c: Random musings in comments

	* tgap/zfio.c: Added <unistd.h> so that R_OK is defined.

2009-12-04  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_gio.c, tgap/tg_gio.h, tgap/tg_iface.h,
	  tgap/tg_iface_g.c, tgap/tg_index.c, tgap/tg_index.h: Added a -c
	  <compression_method> to tg_index. This in turn gets passed all
	  the way down into tg_iface_g.c which now properly supports
	  switching from zlib to either no compression or liblzma. The top
	  bits of the format bytes now encode the compression method.
	  
	  This will still be disabled though unless -DHAVE_LIBLZMA is
	  specified in CFLAGS of the Makefile, which currently there is no
	  autoconf setting for.
	  
	  Also adjusted the format for GT_SeqBlocks to reorder quality and
	  names by the read-group (parent_rec field). This improves
	  compression of mixed assemblies.

2009-11-30  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/Makefile, gap5/contig_editor.tcl, gap5/editor_search.c,
	  gap5/editor_search.tcl, gap5/editor_view.h, gap5/tkEditor.c:
	  Added some basic editor searching. It's not as complete as Gap4,
	  but supports consensus sequences, read names and consensus
	  quality scores.

	* tgap/tg_gio.c: Bug fix to child IO: we now inherit the read-only
	  flag too. This prevents the editor from crashing due to
	  consensus caching when cutting and pasting out of the editor
	  consensus line.

2009-11-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Added experimental code to support liblzma
	  instead of zlib for compression of data. The results vary based
	  on input data, but appear to be around 15% smaller at a cost of
	  2-4x CPU usage.
	  
	  Also added code to reorder quality values and names when writing
	  a seq block so that sequences from the same library are adjacent
	  to one another. This further improves compression ratio,
	  depending on whether mixed libraries are in use: about 7%
	  smaller on a 1000genomes mixed sample.
	  
	  Both of these changes are hidden behind #ifdefs and are currently
	  disabled.

2009-11-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_struct.h: Increased size_hist[] dimensions. The values
	  can be 0 to 1792 inclusive, so it now reads [LIB_BINS+1]. This
	  fixes a corruption when dealing with values over 1Mb in size.

	* gap5/break_contig.c: Fixed a bug with break contig due to
	  over-ambitious optimisation.

2009-11-18  James Bonfield  <jkb@sanger.ac.uk>

	* gap4/legacy_f2c.c: Fixed ancient bug involving elipses and
	  function prototypes. I'm not sure why it's only surfaced now,
	  but perhaps it's a compiler version thing.
	  
	  On AMD64 gcc generates different code when calling a function
	  with ... args than when calling a function with specific types
	  args, even when the types are the default C promotion
	  rules. Fixed the various extern int declarations of swrt*_
	  functions to use ... instead of the auto-generated full argument
	  list. These now match those in f2c.c and so fixes an illegal
	  instruction and crash.

2009-11-17  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c: More minor stats on exit.

	* gap4/edCommands.c: Fixed an issue with turning off undo in
	  remove pad columns. It still turns it off in some cases, but it
	  now clears the existing undo history and it reactivates it once
	  all the pad insertions have happened.

	* gap4/gap4: Allowed for GTAGDB to be set outside the wrapper
	  script.

	* tgap/sam_index.c: Fixed several sam parsing bugs.
	  
	  1) We now reset the number of insertions to zero for each new
	  contig. This was causing data to be shifted in susbequent
	  contigs.
	  
	  2) Pads can no longer get inserted at the end of a read.
	  
	  3) The lowercase letters immediately prior to a deletion are now
	  uppercase again.

2009-11-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c: Fixed a bug in bin_for_range(). When recursing
	  down bins it could only create one extra layer of bin on the
	  right hand child of a bin.  This was because it didn't reset the
	  f_a and f_b variables used by NORM/NMIN/NMAX macros. (Bug added
	  when we fixed this code to handle inserting to complemented
	  bins.)

	* gap5/editor_join.c: Fixed a bug in join_invalidate(). It was
	  invalidating all of the right hand contig rather than just the
	  overlapping region.

2009-11-12  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c: Added @RG header lines and RG:Z:*
	  auxillary sequence records, using the new name field from
	  libraries.

	* gap5/libraries.tcl, tgap/maq.c, tgap/sam_index.c,
	  tgap/tg_iface_g.c, tgap/tg_index_common.c, tgap/tg_library.c,
	  tgap/tg_library.h, tgap/tg_struct.h, tgap/tg_tcl.c: Added a name
	  field to libraries, so we can track their original names
	  in SAM.

2009-11-09  James Bonfield  <jkb@sanger.ac.uk>

	* configure.in, gap5/gap.tcl, tgap/tg_index.c, tgap/tg_view.c:
	  Version updates - for a local 2.0.0b3 test release internal to
	  Sanger (or those that wish to fish out the source from SVN).
	  Primary changes are bug fixes.

	* gap5/consen.tcl, gap5/gap4_compat.c: Fixed the lget_contig_num
	  to always clip off cutoff data when interpreting the contig
	  start/end values.
	  
	  This allows for consensus saving to always behave better now too.

	* gap5/editor_join.c: Fixed bugs with the "align" join editor
	  button.

	* gap5/consensus.c: Fixed bug in consensus_valid_range where a
	  right hand cutoff of > 1Kb was reported as 1Kb only.
	  
	  Fixed a bug with using cached consensus data from bins that
	  don't quite butt up to one another. Why this happens I am unsure
	  still (likely a bug in contig joining), but the defensive
	  approach is to detect it and fall back to filling in the
	  consensus gaps using the old technique.
	  
	  Also fixed a consensus algorithm bug where we could overflow the
	  cache and break things. We use cache_incr/decr now to protect
	  against this.

	* tgap/tg_cache.c: Fix the internal seq_t pointers if we've had to
	  realloc it during a resize request.

2009-11-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/g-files.c, tgap/g-io.c: The read_aux_index_* functions now
	  return the number of entries read, rather than just 0 or
	  -1. This allows for us to ask to read 256 and only get back 200
	  without being in error.
	  
	  This is now utilised in g_read_index() which reads blocks of
	  index records rather than 1 at a time, vastly reducing the
	  number of seek/read system calls needed.

2009-10-30  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam_index.c: Added a "-d data_type_list" option to
	  tg_index.  By default we store everything, but now we have the
	  option of skipping the read names or qualities, or just storing
	  nothing at all (except layout data).

	* tgap/baf.c, tgap/maq.c, tgap/tg_index.c, tgap/tg_index.h,
	  tgap/tg_index_common.c: Added a "-d data_type_list" option to
	  tg_index. By default we store everything, but now we have the
	  option of skipping the read names or qualities, or just storing
	  nothing at all (except layout data).
	  
	  Also fixed the library size histograms generated in
	  tg_index_common.c.

	* gap5/export_contigs.c: Improved BAF output. It now contains
	  tags, listed in the correct location with respect to their
	  sequences. (This proved harder than expected.)

2009-10-28  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/docs/TODO:

	* gap5/newgap5_cmds.c: Added export_tags C-to-Tcl binding

2009-10-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c, gap5/export_contigs.h,
	  gap5/export_contigs.tcl, gap5/gap5rc_menu_full, gap5/tclIndex:
	  Added an Export Tags function. Currently it only outputs in GFF
	  format and it requires testing yet to see whether it is fully GFF
	  conformant.

2009-10-22  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/result_manager.tcl: Added missing file - forgot to check
	  this in!

	* tgap/tg_contig.c, tgap/tg_contig.h, tgap/tg_struct.h: The contig
	  iterators can now be given a type too to iterate sequences
	  only (the previous mechanism), annotations only, or anything.

	* tgap/tg_iface_g.c: Fixed a bug in AnnoEleBlock encoding where
	  the obj_rec was invalid. (Typically this has no effect due to it
	  being in the range array too.)

2009-10-19  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_iwidgets.m4: Added default install path as used
	  by Debian.

2009-10-16  James Bonfield  <jkb@sanger.ac.uk>

	* Tagged VERSION 2.0.0b2

2009-10-16  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_gio.h, tgap/tg_iface_g.c, tgap/tg_index.c,
	tgap/tg_index.h: Added a "-r nseqs" option to tg_index to reserve
	space in the aux file. This is an interim solution for the
	internal record number
        (ie not the actual index into the aux) not being a 64-bit number.

	Problems currently arise due to packing 1024 sequences into a
	SeqBlock record. We simulate individual sequence records by taking
	the record number of the SeqBlock and multiplying by 1024, then
	adding in the element number. However this means we have 2^21
	instead of 2^31 records avaalable in total, meaning 2 million bins
	is enough to make it impossible to allocate any sequences unless
	we ensure that we reserve the lower record numbers for the
	sequence/anno blocked structures.

        The correct solution, to be implemented later, would be to use a
	64-bit record type.

2009-10-16  Andrew Whitwham

        * tgap/tg_index_common.c, tgap/tg_index_common.h: Faster pair
          indexing.

        * tgap/ace.c, tgap/baf.c, tgap/maq.c, tgap/sam_index.c: Faster two
	  directional pairing.

2009-10-15  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/g-alloc.c: turned off VALGRIND mode

        * tgap/sam_index.c: Added a comment

        * gap5/docs/TODO:

        * tgap/baf.c: Allow for extra blank lines in the baf file.  Report
	  time %age more often, also listing the number of contigs created
	  since last checkpoint as this has a significant impact on speed.

2009-10-14  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_anno.c: Fixed return value from anno_ele_set_type(),
	  This sometimes caused saving a tag in the contig editor to fail
	  with an error dialogue.

        * configure.in: version change to 2.0.0b2

        * gap5/docs/TODO:

        * tgap/baf.c: Fix bug when processing annotations with no text
          comment.

        * tgap/ace.c, tgap/tg_tcl.c, tgap/zfio.c: Bug fix for zlib.h and
	  LARGE_FILE support; move or add staden_config.h include

        * copy_reads/copy_reads, gap4/gap4, gap5/gap5,
	  prefinish/prefinish, pregap4/pregap4, spin/spin,
	  spin_emboss/create_emboss_files, trev/trev: Bug fix for when
	  LD_LIBRARY_PATH hasn't already been exported in user's
	  environment

        * Makefile.in: Small update to distsrc

        * Misc/array_arith.h, Misc/find.c, Misc/usleep.c,
          gap4/tman_cons.c,
          pregap4/Makefile, scripts/Makefile,
          seq_utils/sequence_formats.c,
          spin/nip_cmds.h, spin/nip_structs.h,
          spin/nip_translation.tcl,
          spin/resource.h, spin/seq_id.tcl, spin/seq_results.h,
          tk_utils/biolimsbox.tcl: Fixed rogue executable property

2009-10-13  James Bonfield  <jkb@sanger.ac.uk>

 	* Gap5 VERSION 1.2.4 *

2009-10-13  James Bonfield  <jkb@sanger.ac.uk>
	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4: Now detects the
	default itcl/itk install on 32-bit fedora 11 systems.

	* tgap/g-files.c: Removed the large integer constant from assert.
	It just causes warnings as there's no real portable way to define
	it as long long (eg 0x7fffLL).
	
        * gap5/gap5: Set execute property
        
	* gap5/ChangeLog, gap5/NEWS:

	* gap5/gap.tcl: Bumped version to 1.2.4

	* gap5/gap4_compat.tcl: removal of debugging info

	* gap5/editor_view.c, tgap/tg_contig.c, tgap/tg_contig.h:
	#ifdef-ed out the code to allow cached consensus sequences to be
	visible in the editor and/or template displays. See tg_contig.h
	for the #define to reenable this if further debugging is required.
	
2009-10-12  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/zfio.c, tgap/zfio.h: Added the zfopen/zfgets/zfclose
	 interface. This is required by the gzip support added a couple
	 checkins ago, but was omitted through error.

	 * copy_reads/copy_reads, copy_reads/copy_reads_main.tcl,
	 gap4/gap4, gap5/gap5, pregap4/pregap4, spin/spin,
	 spin_emboss/acd2tcl.tcl, spin_emboss/create_emboss_files,
	 spin_emboss/create_emboss_files.tcl, tk_utils/Makefile,
	 tk_utils/init.c, tk_utils/init.tcl, trev/trev: Replaced use of
	 stash by tclsh. This means that the setting of TCL_LIBRARY is
	 pushed over to the system install of Tcl rather than us having to
	 work it out for stash instead.

	 To facilitate this, the tkinit function is no more and the few
	 bits it did have been moved into Tk_Utils_Init instead. Replaced
	 the odd required use of tkinit with "package require Tk".

	 Also fixed create_emboss_files to run in the correct
	 directory.

	* gap5/export_contigs.c: We now output @SQ header lines to SAM
	  format, meaning it can be used to load in again via tg_index or
	  converted to bam directly without using a .fai file.
	  
	  Also ensure that all contig coordinates are positive, shifting
	  data if required, as SAM requires positions >= 1.

	* tgap/tg_index.c: Removed the old "aln" format from tg_index.
	  
	  Tg_index now attempts to automatically work out the file type
	  for the data files (eg sam vs ace etc).

	* configure.in, staden_config.h.in, tgap/Makefile, tgap/ace.c,
	  tgap/baf.c, tgap/baf.h, tgap/sam.c, tgap/sam.h, tgap/sam_index.c,
	  tgap/sam_index.h: Renamed sam.[ch] to sam_index.[ch] to avoid
	  header file clash with
	  samtools.
	  
	  Added gzipped file support for ACE/BAF.
	  
	  Removed the old "aln" format from tg_index.
	  
	  Tg_index now attempts to automatically work out the file type
	  for the data files (eg sam vs ace etc).

2009-10-09  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl, gap5/editor_view.c: The editor now
	  starts up at the reading specified rather than base 1 of the
	  contig.

	* tgap/tg_tcl.c: Bug fixed the sequence object. Fetching the
	  record from the sequence appears to have broken when we moved to
	  SeqBlock structs.

	* tgap/sam.c: Added code to generate SAMX type tags from the SAM
	  auxillary tags.  For now this is #ifdefed out via
	  SAM_AUX_AS_TAG, as it adds unnecessarily to file size.

	* gap5/export_contigs.c: Improved SAM file generation, specifically
	  the flags.
	  
	  Also added code to generate the insert size and position
	  columns.  This majorly slows down the code so for now it's
	  disabled, but I plan on making it an option at some stage.

	* tgap/ace.c: Minor reformatting

	* tgap/tg_index.c, tgap/tg_index.h, tgap/tg_index_common.c,
	  tgap/tg_index_common.h: When using tg_index -t to index sequence
	  names, the B+Tree index is now built at the end rather than
	  while adding sequences. To do this is writes to a temporary
	  file, sorts the result, and then adds the items in an already
	  sorted fashion. This *dramatically* reduces the number of cache
	  misses in btree nodes.
	  
	  Testing on a project with 24million sequences the wall-clock
	  time dropped from ~126000 seconds to 750 seconds. Without name
	  indexing it took 549 seconds, implying only a small overhead to
	  index names now.

	* tgap/b+tree2.c, tgap/b+tree2.h, tgap/tg_iface_g.c: Improved the
	  encoding of B+Tree nodes. These are packed in a better
	  manner now and compressed too. Gap5 can still read the old format
	  data, but newer gap5 databases will not be readable by old gap5
	  versions if name indexing is used.

2009-10-07  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/docs/TODO:

	* gap5/export_contigs.c: For ACE format output, added back the DS
	  lines as they appear to be mandatory for consed, even if often
	  pointless. Also adjusted the BS line generation to work better
	  when contigs have holes.

	* gap5/Makefile: Added find_oligo.o to objs list

	* gap5/consensus.c: In calculate_consensus_simple we no longer
	  skip bins with no range data as this prevented us from caching
	  the consensus in a blank bin.

2009-10-02  Andrew Whitwham

	* tgap/Makefile, tgap/ace.c, tgap/baf.c, tgap/g-alloc.c,
	  tgap/maq.c, tgap/sam.c, tgap/tg_index_common.c: Moved common
	  functions to tg_index_common.

	* tgap/tg_index_common.c, tgap/tg_index_common.h: Initial version.

2009-10-02  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/newgap5_cmds.c: Added the Tcl interface to find_oligos
	  (sequence search). Accidentally missed in earlier checkin.

	* tgap/tg_bin.c: Now invalidate consensus cache when adding new
	  sequences in bin_add_range()

2009-10-01  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/find_oligo.c, gap5/find_oligo.h, gap5/find_oligo.tcl,
	  gap5/gap5rc, gap5/gap5rc_menu_full: Added the Sequence Search
	  option.
	  
	  Missing (compared to gap4) right now is the ability to search
	  the sequence covered by a specific tag type to then find all
	  other occurences of that sequence elsewhere. It's a bit specific
	  and likely not of top most priority, so it's disabled for now.

2009-09-30  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c: Fixed bug where inserting/deleting a base to
	  the consensus crashed if
	  we have an annotation at that position.

	* gap5/break_contig.c, gap5/consensus.c, gap5/editor_join.c,
	  gap5/editor_view.c, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_sequence.h,
	  tgap/tg_struct.h: Added a new experimental consensus caching
	  system. The consensus is stored as a fragmented sequence along
	  with other sequences, breaking it into (approximately) 64k
	  blocks to be stored in bins at the appropriate level.
	  
	  To achieve this, the range flags have been extended from seq vs
	  "isanno" to a mask and a set of values, allowing for ISCONS and
	  (unimplemented) ISREF too. Consequently a lot of code needed to
	  be modified; more still does too including the contig editor,
	  where cached consensus is currently visible purely for debugging
	  purposes.
	  
	  Editing, breaking and joining contigs invalidates cached
	  consensus.
	  
	  A new contig_bins_in_range function has been created to look for
	  the candidate bins that may contain cached consensus data.
	  
	  Also fixed sequence_copy so that it didn't zero rec, block and
	  idx subfields.

	* gap5/newgap5_cmds.c: Fixed memory leak in tcl_reformat_sequence

	* tgap/ace.c, tgap/baf.c, tgap/maq.c, tgap/sam.c, tgap/tg_anno.c,
	  tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_index.c, tgap/tg_tcl.c:
	  bin_add_range and bin_for_range functions now take an extra
	  argument to return whether the bin in complemented relative to
	  the contig.

	* tgap/tg_gio.c, tgap/tg_gio.h: Added a read_only flag to GapIO so
	  we can easily query if we can modify the database.

2009-09-24  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c: Newly created sequences now get their seq->rec
	  field set correctly.

	* Makefile.in, gap4/Makefile, global.mk, mutlib/Makefile: More
	  small tweaks regarding make depend.

	* seqed/Makefile, spin2/Makefile, tracediff/Makefile: Futher
	  dependency tweaks

	* copy_reads/copy_reads, gap4/gap4, gap5/gap5, prefinish/prefinish,
	  pregap4/pregap4, spin/spin, spin_emboss/create_emboss_files,
	  trev/trev: Improvements to setting LD_LIBRARY_PATH.

	* Misc/Makefile, Misc/dependencies, abi/Makefile,
	  abi/dependencies, alf/Makefile, alf/dependencies,
	  convert/Makefile, convert/dependencies, copy_reads/Makefile,
	  copy_reads/dependencies, eba/Makefile, eba/dependencies,
	  find_renz/Makefile, find_renz/dependencies, g/Makefile,
	  g/dependencies, gap4/Makefile, gap4/dependencies, gap5/Makefile,
	  get_scf_field/Makefile, get_scf_field/dependencies, global.mk,
	  haplo/Makefile, haplo/dependencies, hetins/Makefile,
	  hetins/dependencies, init_exp/Makefile, init_exp/dependencies,
	  make_weights/Makefile, make_weights/dependencies,
	  mutlib/Makefile, mutlib/dependencies, mutscan/Makefile,
	  mutscan/dependencies, polyA_clip/Makefile,
	  polyA_clip/dependencies, prefinish/Makefile,
	  prefinish/dependencies, primer3/src/Makefile,
	  primer3/src/dependencies, qclip/Makefile, qclip/dependencies,
	  screen_seq/Makefile, screen_seq/dependencies,
	  seq_utils/Makefile, seq_utils/dependencies, seqed/Makefile,
	  seqed/dependencies, spin/Makefile, spin/dependencies,
	  spin2/Makefile, spin2/dependencies, stops/Makefile,
	  stops/dependencies, text_utils/Makefile,
	  text_utils/dependencies, tgap/Makefile, tk_utils/Makefile,
	  tk_utils/dependencies, tracediff/Makefile,
	  tracediff/dependencies, trev/Makefile, vector_clip/Makefile,
	  vector_clip/dependencies: Major overhaul of the "make depend"
	  system. We no longer use the make include directive to load in a
	  prebuilt dependencies file.  Instead this is appended to the
	  Makefile itself. Furthermore the users can just do a direct make
	  without having the auto-dependency code to run, removing the
	  requirement on imake (for makedepend) to build.
	  
	  Developers will still want to use make depend from time to time.

2009-09-18  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/tkEdNames.c: Fixed buffer overflow in the get_number
	  method. (Previously fixed for the tkEditor widget.)

2009-09-15  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam.c, tgap/tg_iface_g.c, tgap/tg_index.c,
	  tk_utils/tkTrace.c: Added more #include <staden_config.h>
	  statements, or in some cases moved them so they appear before
	  sys/types.h gets included. This fixes some compilation issues on
	  32-bit fedora.

	* global.mk: Switched from using LD_RUN_PATH to LD_LIBRARY_PATH
	  during linking.
	  
	  We need one of these so (for example) libmisc.so, referenced by
	  libtk_utils.so, is found when we use only -ltk_utils (and no
	  explicit -lmisc is used).
	  
	  LD_RUN_PATH however had the undesireable effect of forcing the
	  build directory to be searched even after a make install.

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4,
	  ac_stubs/ax_lib_iwidgets.m4, ac_stubs/ax_lib_tklib.m4,
	  shlib.conf.in: Improvements for handling itcl/itk on Centos (and
	  presmuably other OSes).

2009-09-10  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl: Improvements to undo for tag editing.

	* gap5/consensus.c: Added code (currently "#if 0"ed out) to
	  attempt to cache the consensus in tracks per bin. Specifically
	  the plan was to store the A,C,G,T,* accumulated log(probability)
	  values for data held within that bin as a track. It means we can
	  compute the consensus without having to load all the invdividual
	  sequences.
	  
	  In practice, it does speed up the consensus generation when
	  cached (usually only barely, but occasionally by > 10x), but the
	  downsides are considerable. It needs read-write access, and
	  worst of all the space it takes up is very substantial - often
	  far more than the rest of the database. The existing
	  implementation also is only approximate as we store the floating
	  point values in very low precision.
	  
	  Given the size problems I'm planning on reimplementing this via
	  another means, but the code is checked in here (disabled) so I
	  can revert or refer back to it at some stage if required.
	  
	  Also see the code changes to tg_iface_g.c.

	* gap5/newgap5_cmds.c: Use ckfree instead of free to fix memory
	  corruption, in tcl_calc_consensus()

	* README.build: Fixed typo

	* tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_cache.c,
	  tgap/tg_iface_g.c, tgap/tg_struct.h: Added a bin_track_t struct
	  to house the in-memory track data, instead of using the
	  GBinTrack struct which should only be known by the "g" interface
	  code.
	  
	  This has also allowed the addition of a track pointer to be
	  cached within the bin_track_t struct, meaning we can add fake /
	  temporary tracks to a bin structure (they're not written back to
	  disk) and still query them back again without having to load
	  from a record number.

2009-09-07  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Removed debugging information.

2009-09-04  James Bonfield  <jkb@sanger.ac.uk>

	* convert/bapDB.h, gap4/gap-error.c, gap4/legacy_f2c.c,
	  gap4/shuffle_pads.c, gap5/editor_view.c, gap5/gap-error.c,
	  gap5/gap4_compat.c, gap5/newgap5_cmds.c, gap5/qualIO.c,
	  polyA_clip/Makefile, polyA_clip/polyA_clip.c, qclip/Makefile,
	  qclip/qclip.c, tgap/b+tree2.c, tgap/baf.c, tgap/g-request.c,
	  tgap/tg_anno.h, tgap/tg_iface_g.c, tgap/tg_register.h,
	  tgap/tg_view.c, tk_utils/capture.c, tk_utils/tkTraceIO.c:
	  General warning tidyup to remove complaints from the SunStudio C
	  compiler.

	* configure.in, staden_config.h.in, system.mk.in: Use
	  TEA_CONFIG_CFLAGS to override the predefined vars loaded by
	  TEA_LOAD_TCLCONFIG. This means we can work out how to build
	  shared libraries if we pick a different compiler than the one
	  used to build the system tcl. Eg ./configure ... CC=foocc

2009-09-03  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/docs/TODO:

	* gap5/contig_editor.tcl, gap5/gap5rc_menu_full, gap5/tkEditor.c:
	  The contig editor now has add/remove tags functionality.

	* tgap/tg_cache.c: Fixed cache_item_create_anno_ele to initialise
	  anno_ele_t->rec field.

	* tgap/tg_anno.c, tgap/tg_anno.h, tgap/tg_tcl.c: Created a
	  anno_ele_add and anno_ele_destroy function to make adding
	  and removing tags easier. These can be called from the Tcl object
	  interface too. The tcl obj interface also has other additional
	  functions: new_contig/sequence/anno_ele (from $io),

	* gap5/break_contig.c, tgap/tg_bin.c, tgap/tg_contig.c,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_struct.h: Allow
	  for range items to be marked as unused (free). They form a
	  linked list, with a new rng_free member of the bin_index_t
	  structure pointing to the head of the list. (If this isn't
	  present due to an older format database it'll automatically get
	  created when it's next written to, although this will migrate
	  the DB to be unusable by the old gap5.)

2009-09-01  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_iwidgets.m4: Allow the --with-iwidgets=DIR
	  parameter to include the iwidgets package directory itself too,
	  rather than just the prefix

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4: Adding
	  /usr/lib64 to the search path, helping it to work out of the box
	  on 64-bit fedora

	* ac_stubs/ax_lib_tklib.m4: Fix cut and paste error - no means yes
	  in some diagnostic output...

	* ac_stubs/tcl.m4: Removed error output when /usr/include/tcl*
	  doesn't match anything

	* gap5/editor_view.c, gap5/editor_view.h, gap5/tkEdNames.c,
	  gap5/tkEditor.c: Modified edview_item_at_pos to control whether
	  we want only sequences returned or also tags. This allows
	  selecting a region to work over a tag, which previously caused
	  gap5 to crash.

	* tgap/tg_anno.c, tgap/tg_anno.h, tgap/tg_tcl.c: Added various set
	  methods to the anno_ele struct, both from C and also
	  via the tcl interface.

	* tgap/baf.c: Tags now interpret "\n" as a newline, enabling
	  multi-line annotations.

2009-08-25  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4, ac_stubs/tcl.m4:
	  Added /usr/lib64 to search paths.

2009-08-12  Andrew Whitwham

	* tgap/tg_struct.h: Added define to make build work.

2009-08-07  James Bonfield  <jkb@sanger.ac.uk>

 	* Gap5 VERSION 1.2.3 *

2009-08-07  James Bonfield  <jkb@sanger.ac.uk>

	* staden/trunk/doc/Makefile, configure.in, gap5/NEWS: Minor tweaks
	  to set version to 2.0.0b1

	* tgap/ace.c, tgap/ace.h, tgap/baf.c, tgap/baf.h, tgap/maq.c,
	  tgap/maq.h, tgap/sam.c, tgap/sam.h, tgap/tg_index.c,
	  tgap/tg_index.h: Added a -f (fast mode) parameter to tg_index.
	  When linking read-pairs this links A' to A but not A back to
	  A'. This reverse link is desireable, but currently causes major
	  I/O bottlenecks on very large data sets. I'll address this later
	  in a better fix, so -f will probably be only a temporary option.

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/tkEdNames.c:
	  Fixesd bugs with mouse-over events in the editor names panel. We
	  now always display a name, rather than accidentally picking a
	  tag. In one-per-line non-stacking mode we now also correctly
	  display the name.

	* gap5/docs/TODO:

2009-08-06  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/break_contig.c, gap5/editor_join.c: Both breaking and
	  joining contigs now track the number of sequences
	  per bin correctly.
	  
	  For break contig only:
	  - Fixed a common crash.
	  - Annotations now get moved correctly too.

	* gap5/editor_view.c: Minor debugging changes.

	* tgap/tg_contig.c: Minor change to contig_dump_ps().

	* gap5/docs/PLANS, gap5/docs/TODO:

	* gap5/docs, gap5/docs/DESIGN, gap5/docs/IMPLEMENTATION,
	  gap5/docs/TRACKS, gap5/docs/Tree_format: Added some gap5
	  code/design documentation. A lot of it is out of date now or is
	  information on how I thought things would go rather than how
	  they ultimately got implemented, but hopefully it's of use to
	  curious browsers still.

2009-08-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Fixed bug in io_anno_ele_block_read. The sub
	  cached_item records were all set to be type GT_Seq rather than
	  type GT_AnnoEle meaning cache_rw would crash later.

	* gap5/gap4_compat.c: Protect against contigs with zero sequences
	  in io_clnbr and io_crnbr.

2009-08-03  James Bonfield  <jkb@sanger.ac.uk>

	* configure.in: typo fix

2009-07-31  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/tkEditor.c: Fixed a buffer overrun in the editor get_number
	  method.

2009-07-30  James Bonfield  <jkb@sanger.ac.uk>

	* tk_utils/help_choose.tcl, tk_utils/help_config: Fixed paths for
	  displaying help

2009-07-28  James Bonfield  <jkb@sanger.ac.uk>

	* Makefile.in, configure.in, io_lib: Removed io_lib stub directory
	  and also removed the option of compiling
	  using a local io_lib directory in the staden package Makefiles.

	* io_lib/branches, io_lib/tags, io_lib/trunk, io_lib/trunk/CHANGES,
	  io_lib/trunk/COPYRIGHT, io_lib/trunk/ChangeLog,
	  io_lib/trunk/Makefile, io_lib/trunk/Makefile.am,
	  io_lib/trunk/README, io_lib/trunk/acinclude.m4,
	  io_lib/trunk/bootstrap, io_lib/trunk/configure.in,
	  io_lib/trunk/dependencies, io_lib/trunk/docs,
	  io_lib/trunk/include, io_lib/trunk/io_lib,
	  io_lib/trunk/io_lib-config.in, io_lib/trunk/io_lib.m4,
	  io_lib/trunk/man, io_lib/trunk/options.mk, io_lib/trunk/progs,
	  io_lib/trunk/tests, io_lib/CHANGES, io_lib/COPYRIGHT,
	  io_lib/ChangeLog, io_lib/Makefile, io_lib/Makefile.am,
	  io_lib/README, io_lib/acinclude.m4, io_lib/bootstrap,
	  io_lib/configure.in, io_lib/dependencies, io_lib/docs,
	  io_lib/include, io_lib/io_lib, io_lib/io_lib-config.in,
	  io_lib/io_lib.m4, io_lib/man, io_lib/options.mk, io_lib/progs,
	  io_lib/tests: Moved io_lib from staden source tree into it's own
	  top-level
	  subversion directory, complete with tags, branches, and trunk.
	  
	  For now the old tagged copies of io_lib are still in the
	  staden/tags/ directory with tag names io_lib-<version>, but that
	  is perhaps right and proper (as it's where the code actually
	  resided at that release number).

	* io_lib/abi, io_lib/alf, io_lib/ctf, io_lib/exp_file,
	  io_lib/plain, io_lib/read, io_lib/scf, io_lib/sff, io_lib/srf,
	  io_lib/utils, io_lib/ztr: Remove old stub directories; these come
	  from the earlier CVS tree when
	  we had the library split into per-format directories.

	* io_lib/progs/Makefile.am, io_lib/progs/solexa2srf.c,
	  io_lib/progs/srf2solexa.c: Removed Illumina/Solexa specific
	  programs. These are now out of date with respect to Illumina's
	  own fork, plus I don't think they belong in the largely platform
	  agnostic library.

	* io_lib/CHANGES, io_lib/ChangeLog, io_lib/README,
	  io_lib/configure.in, io_lib/io_lib/Makefile.am: Preparations for
	  1.12.0 release.
	  
	  There is now proper versioning support for the library too. The
	  soname used here is libstaden-read.so.1, to distinguish from any
	  earlier dynamic libraries. (The ABI definitely has changed over
	  the years in incompatible manners.)

	* io_lib/tests/data/slx_out/both.info,
	  io_lib/tests/data/slx_out/raw.info: Updated for new format
	  srf_info output

	* io_lib/tests/data/slx_out/proc.info: Updated with new format
	  output.

2009-07-27  James Bonfield  <jkb@sanger.ac.uk>

	* io_lib/io_lib/vlen.c: Include os.h so we can pick up NEED_VA_COPY
	  definition.

	* io_lib/progs/srf_filter.c: Reorganisation to allow chunks to be
	  added as well as removed. At present this only supports adding
	  REGN chunks.
	  
	  (Patch supplied by Steven Leonard.)

	* io_lib/progs/index_tar.c: Handle GNU tar extensions: LongLink
	  notation.
	  (Patch supplied by Steven Leonard).

	* io_lib/progs/srf2fasta.c, io_lib/progs/srf2fastq.c,
	  io_lib/progs/srf_extract_hash.c: Changed the maximum read length
	  from 1024 to 10000. This allows for capillary traces to be
	  stored in SRF.
	  (Patch supplied by Steven Leonard)

	* io_lib/progs/srf_info.c: Use int64_t instead of long for base
	  counts and chunk sizes.
	  (Supplied by Steven Leonard.)

	* io_lib/man/man1/srf_info.1, io_lib/progs/srf_info.c: Added
	  compressed chunk size to the per-chunk type output. This allows
	  us to see what takes up the most storage in an SRF.

	* io_lib/io_lib/ztr.c: removed C9Xism

	* io_lib/configure.in, io_lib/io_lib/Makefile.am,
	  io_lib/progs/Makefile.am: Re-enabled libtool, with a workaround
	  to remove the infuriating rpath nonsense. (It's now 2x slower to
	  configure, 3x slower to compile and 10x more anguish to debug,
	  but at least I can sleep at night knowing rpath hasn't had it's
	  wicked way with the code.)

	* data/Makefile:

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4,
	  ac_stubs/ax_lib_iwidgets.m4, ac_stubs/ax_lib_png.m4,
	  configure.in, shlib.conf.in, staden_config.h.in, system.mk.in,
	  tk_utils/tkTrace.c: More autoconf checks; for itcl, itk, and
	  png.  In the case of png it's an optional --with and if not
	  found we simply disable the one piece of code that relies on it.

2009-07-24  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_func_va_copy.m4, ac_stubs/ax_lib_iwidgets.m4,
	  ac_stubs/ax_lib_tklib.m4, shlib.conf.in: More autoconf checks.

	* configure.in, global.mk: Removed the dependency on Fortran for
	  building. For now we'll use the
	  f2c converted code. It may not be quite as efficient (not tested
	  that), but it's trivial to build everywhere and we're not
	  modifying
	  the code at all.

	* Makefile.in, io_lib/io_lib/Makefile: Added a Makefile for
	  io_lib/io_lib; so the library itself. This isn't expected to be
	  used normally, but it allows me to test local copies of io_lib
	  (under a different library name) in conjunction with the staden
	  source tree before releasing either.

	* tgap/tg_iface_g.c: Changed allocate() to take a data type
	  argument too.  The plan for this (#ifed out at the moment) is to
	  reserve different record-spaces for blocked data vs nonblocked
	  data.
	  
	  Without this we hit problems when the number of records goes
	  above 2 million, meaning the 10-bits of sub-record used for
	  sequence indexing takes us over 31-bits record size. (Maybe
	  long-term we should just use 64-bit record IDs; this is a
	  temporary hack and commented out in the main source tree.)

	* tgap/sam.c, tgap/tg_index.c: Fixed HAVE_SAMTOOLS macro name.

2009-07-23  James Bonfield  <jkb@sanger.ac.uk>

	* vector_clip/vector_clip.c: Removed rotate_seq() and use the
	  identical copy in seq_utils.

2009-07-22  James Bonfield  <jkb@sanger.ac.uk>

	* prefinish/prefinish_lib.tcl, prefinish/prefinishrc,
	  pregap4/modules/interactive_clip.p4m,
	  pregap4/modules/screen_seq.p4m,
	  pregap4/modules/sequence_vector_clip.p4m, pregap4/pregap4.tcl,
	  pregap4/templates.tcl, spin_emboss/emboss_utils.tcl,
	  tk_utils/help.tcl, tk_utils/help_macosx.tcl: Various pathname
	  tweaks to use STADLIB and/or STADTCL variables
	  correctly.

	* gap4/acd2tag.tcl, gap4/gap_prefinish.tcl, gap5/gap5rc,
	  prefinish/prefinish.tcl, spin_emboss/acd2tcl.tcl: Use package
	  require instead of load_package for iwidgets.

	* README.build: Minor update listing system specifics

	* ac_stubs/ax_lib_staden_io_lib.m4,
	  ac_stubs/libcurl_check_config.m4, configure.in: Improved output
	  messages while running autoconf. Samtools is also now
	  permitted to not exist, rather than aborting.

	* ac_stubs/tcl.m4: Fixed --with-tcl/tk and --with-tkinclude to
	  also search the default install locations used by Debian.

	* tk_utils/xmclistbox.tcl: Fix tab stops so the code works with
	  tk8.5

	* tk_utils/sheet.c, tk_utils/sheet.h: Updated to work with Tk 8.5
	  font methods.

	* mutlib/staden.h: Work around problem in io_lib/compress.h on
	  newer linux. The pipe2()
	  function has been added and clashes.

	* tgap/sam.c, tgap/tg_index.c: Check for HAVE_SAMTOOLS_H, so we can
	  compile without samtools being
	  installed.

2009-07-20  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_tcl.c: Include staden_config.h so HAVE_UNISTD_H is
	  defined prior to tcl includes. This prevents a conflict between
	  Tcl's compat/unistd.h when building against Tcl 8.5.

	* seq_utils/Makefile, spin/Makefile, spin_emboss/Makefile,
	  trev/Makefile: Further tweaks to distsrc Makefile target

	* spin/seq_reg_cmds.c: Removed remnant of licence checking

	* pregap4/pregap4.tcl, spin/spinrc: Replaced our local load_package
	  interface witht he standard package require => Iwidgets now found

	* pregap4/pregap4rc: Fixed search path for pregap4 modules

	* README.build, configure.in, system.mk.in: Added FORTRAN checks
	  into autoconf.

	* tk_utils/tkRaster.c: Removed debugging output

	* Makefile.in, Misc/Makefile, README.build, abi/Makefile,
	  alf/Makefile, configure.in, convert/Makefile,
	  copy_reads/Makefile, eba/Makefile, find_renz/Makefile,
	  g/Makefile, gap4/Makefile, gap4/fak2rc, gap4/gap4, gap5/Makefile,
	  gap5/gap5, get_scf_field/Makefile, global.mk, haplo/Makefile,
	  hetins/Makefile, init_exp/Makefile, make_weights/Makefile,
	  mutlib/Makefile, mutscan/Makefile, polyA_clip/Makefile,
	  prefinish/Makefile, pregap4/Makefile, primer3/Makefile,
	  primer3/src/Makefile, qclip/Makefile, screen_seq/Makefile,
	  scripts/Makefile, seq_utils/Makefile, shlib.conf.in,
	  spin/Makefile, spin_emboss/Makefile, stops/Makefile,
	  system.mk.in, text_utils/Makefile, tgap/Makefile,
	  tk_utils/Makefile, tracediff/Makefile, trev/Makefile,
	  vector_clip/Makefile: "make distsrc" should now work. It creates
	  a subdirectory containing
	  the files necessary for distribution. Note for now this isn't the
	  entire tree as some programs are unfinished and unsupported
	  (spin2,
	  seqed).

2009-07-17  James Bonfield  <jkb@sanger.ac.uk>

	* gap4/newgap_cmds.c, gap4/tkEditor.c, gap5/newgap5_cmds.c,
	  gap5/tkEditor.c, tk_utils/capture.c: Further changes to do with
	  TCL_DYNAMIC and not using ckalloc. We now
	  use TCL_VOLATILE where appropriate (or ckalloc).

	* Makefile.in, Misc/Makefile, Misc/vlen.c, abi/Makefile,
	  ac_stubs/ax_lib_samtools.m4, alf/Makefile, configure.in,
	  convert/Makefile, copy_reads/Makefile, copy_reads/copy_reads,
	  copy_reads/copy_reads_main.tcl, copy_reads/copy_readsrc, data,
	  data/RENZYM.4, data/RENZYM.6, data/RENZYM.ALL, data/alus,
	  data/blast_data, data/gcodes, data/m13mp18_primers, data/pam250,
	  data/renzyme_bairoch, data/vector_primer, data/vectors,
	  eba/Makefile, find_renz/Makefile, g/Makefile, gap4/GTAGDB,
	  gap4/Makefile, gap4/NOTEDB, gap4/cap2rc, gap4/cap3rc,
	  gap4/checked.gif, gap4/fak2rc, gap4/follow.bitmap,
	  gap4/gap-tcl.c, gap4/gap.tcl, gap4/gap4, gap4/gap4_defs.mk,
	  gap4/gap_prefinish.tcl, gap4/gaprc, gap4/gaprc_menu_demo,
	  gap4/gaprc_menu_full, gap4/gaprc_menu_mito,
	  gap4/gaprc_menu_viewer, gap4/list_contigs.tcl, gap4/phraprc,
	  gap4/unchecked.gif, gap5/Makefile, gap5/depth.tcl, gap5/gap.tcl,
	  gap5/gap5, gap5/gap5rc, gap5/gap5rc_menu_full,
	  get_scf_field/Makefile, haplo/Makefile, haplo/haplorc,
	  hetins/Makefile, init_exp/Makefile, make_weights/Makefile,
	  mutlib/Makefile, mutscan/Makefile, polyA_clip/Makefile,
	  prefinish/Makefile, prefinish/args.template,
	  prefinish/config.prefinish, prefinish/finish_sanger,
	  prefinish/prefinish, prefinish/prefinish.tcl,
	  prefinish/prefinishrc, pregap4/Makefile, pregap4/pregap4,
	  pregap4/pregap4.tcl, pregap4/pregap4rc, primer3/src/Makefile,
	  qclip/Makefile, screen_seq/Makefile, scripts/Makefile,
	  seq_utils/Makefile, seq_utils/align_lib_nuc_matrix,
	  seq_utils/nuc_matrix, seqed/seqedrc, spin/Makefile, spin/eia.wts,
	  spin/ied.wts, spin/niprc, spin/perceptron.wts,
	  spin/prokprom_10.wts, spin/prokprom_35.wts, spin/siprc,
	  spin/spin, spin/spin.tcl, spin/spinrc, spin2/FEATCOLDB,
	  spin2/FEATQUALDB, spin2/FEATUREDB, spin2/spin2rc,
	  spin2_emboss/spin2_embossrc, spin_emboss/Makefile,
	  spin_emboss/create_emboss_files, spin_emboss/emboss_menu,
	  spin_emboss/spin_embossrc, staden_config.h.in, stops/Makefile,
	  system.mk.in, text_utils/Makefile, tgap/Makefile,
	  tk_utils/2bars_h.bmp, tk_utils/2bars_v.bmp, tk_utils/Makefile,
	  tk_utils/help_config, tk_utils/init.c, tk_utils/shlib.conf,
	  tk_utils/stash.c, tk_utils/tk_utilsrc,
	  tk_utils/user_defaults.tcl, tracediff/Makefile, trev/Makefile,
	  trev/trev, trev/trev.tcl, trev/trevrc, vector_clip/Makefile:
	  Further upheaval of build system:
	  - Make install now works.
	  
	  - Removal of excessive $(O) (was $(machine)-binaries) and
	  similarly unnecessary fluff in the makefiles.
	  
	  - Moved files from tables/* to appropriate src/*. There are a
	  few exeptions (small blast databases, alu sequences, etc)
	  which have been added to a src/data directory. Not technically
	  source I guess, but it means the src tree contains everything
	  necessary to obtain a run-time environment (minus
	  documentation and test/training data).
	  
	  - Overhauled the directory layout to be more friendly to using a
	  prefix of /usr, rather than something dedicated to the staden
	  package.
	  
	  - Extra autoconf code to check for and utilise va_copy().
	  
	  - Fix to samtools autoconf.
	  
	  Other fixes:
	  - Removed use of $(MACHINE)-binaries as it's no longer needed.
	  
	  - Fixed gap-tcl.c's io_read_text function to work with thread
	  enabled Tcl. This is almost certainly the tip of the iceberg.
	  When using threads Tcl must be given memory allocated using
	  ckalloc rather than malloc. One trivial solution (used here)
	  is simply to pass data over as TCL_VOLATILE instead of
	  TCL_DYNAMIC which forces it to allocate it's own copy in
	  whatever method it deems appropriate. Obviously we then have
	  to free up our own copy.
	  
	  - Gap4's List Contigs feature has been updated to use reading
	  numbers instead of reading names internally. This avoids
	  issues when (corrupted) databases exist with duplicate read
	  names. Not elegant, but defensive.

2009-07-16  James Bonfield  <jkb@sanger.ac.uk>

	* staden/trunk/README.build, abi/abiIO.h, abi/getABIfield.c,
	  bootstrap, global.mk, tk_utils/tclAppInit.c, tracediff/Makefile:
	  Fixes to new autoconf build. Now actually builds on Debian etch.

	* Makefile, Makefile.in, Makefile.thirdparty, Misc/Makefile,
	  Misc/os.h, abi/Makefile, ac_stubs, ac_stubs/ax_lib_samtools.m4,
	  ac_stubs/ax_lib_staden_io_lib.m4, ac_stubs/ax_lib_zlib.m4,
	  ac_stubs/libcurl_check_config.m4, ac_stubs/tcl.m4, alf/Makefile,
	  configure.in, convert/Makefile, copy_reads/Makefile,
	  copy_reads/copy_reads.c, eba/Makefile, eba/conf.c, eba/conf.h,
	  eba/qual.c, find_renz/Makefile, g/Makefile, gap4/IO.c,
	  gap4/IO2.c, gap4/Makefile, gap4/assemble_direct.c, gap4/consen.c,
	  gap4/copy_db_main.c, gap4/extract.c, gap4/extract.h,
	  gap4/gap4_defs.mk, gap4/newgap_cmds.c, gap4/preass.c,
	  gap4/seqInfo.c, gap4/seqInfo.h, gap4/tagU2.c, gap4/tkEditor.c,
	  gap4/tman_cons.c, gap4/tman_diff.c, gap4/tman_display.h,
	  gap4/tman_interface.c, gap5/Makefile, gap5/consen.c,
	  gap5/extract.h, gap5/tkEditor.c, gap5/tman_display.h,
	  gap5/tman_interface.c, get_scf_field/Makefile,
	  get_scf_field/get_scf_field.c, global.mk, haplo/Makefile,
	  hetins/Makefile, hetins/hetins.c, init_exp/Makefile,
	  init_exp/init_exp.c, licence, make_weights/Makefile,
	  make_weights/make_weights.c, mk, mutlib/Makefile,
	  mutscan/Makefile, mutscan/main.cpp, mutscan/staden.h,
	  polyA_clip/Makefile, polyA_clip/polyA_clip.c,
	  polyA_clip/seqInfo.c, polyA_clip/seqInfo.h, prefinish/Makefile,
	  pregap4/Makefile, primer3/Makefile, primer3/src/Makefile,
	  qclip/Makefile, qclip/consen.c, qclip/qclip.c, qclip/seqInfo.c,
	  qclip/seqInfo.h, screen_seq/Makefile, screen_seq/screen_seq.c,
	  scripts/Makefile, seq_utils/Makefile, spin/Makefile,
	  spin/nip_cmds.c, spin/seq_reg_cmds.c, spin/sip_cmds.c,
	  spin_emboss/Makefile, staden_config.h.in, stops/Makefile,
	  stops/stops.c, system.mk.in, tcl8.4.0, text_utils/Makefile,
	  tgap/Makefile, tk8.4.0, tk_utils/Makefile, tk_utils/init.c,
	  tk_utils/misc.c, tk_utils/postscript.h, tk_utils/tkCanvGraph.c,
	  tk_utils/tkTrace.c, tk_utils/tkTrace.h, tk_utils/tkTraceComp.c,
	  tk_utils/tkTraceDisp.c, tk_utils/tkTraceIO.c,
	  tk_utils/trace_print.c, tracediff/Makefile, tracediff/main.cpp,
	  tracediff/staden.h, trev/Makefile, vector_clip/Makefile,
	  vector_clip/vector_clip.c: Major tidyup of build system:
	  
	  * We now use autoconf to generate a system.mk tailored for this
	  machine. This replaces the old mk/$(MACHINE).mk stubs.
	  
	  * We no longer have Makefile.thirdparty and the local copies of
	  tcl, tk, itcl, itk, etc.
	  
	  * Removed the defunct licencing code.
	  
	  It is recommended when using this that you make a subdirectory
	  and use ../configure. This keeps binaries and source code neatly
	  separated.

2009-06-26  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c: fix for copy-on-write of GT_SeqBlock and
	  GT_AnnoEleBlock
	  structs. This was causing save after edits in the contig editor
	  to crash.

	* gap5/editor_view.c: Fixed annotation viewing. Clicking on an
	  annotation caused crashes and also display glitches due to not
	  expected xx->cursor_type to be GT_AnnoEle.

2009-06-25  James Bonfield  <jkb@sanger.ac.uk>

	* tk_utils/tclIndex, tk_utils/xscrolledlistbox.tcl,
	  tk_utils/xscrolledtext.tcl: Added xscrolledtext and
	  xscrolledlistbox widgets - to replace iwidget equivalents. (Not
	  100%, but sufficient for our purposes.)

2009-06-22  James Bonfield  <jkb@sanger.ac.uk>

 	* VERSION 1.2.2 *

2009-06-22  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.c,
	* gap5/contig_selector.h,
	* gap5/contig_selector.tcl,
	* gap5/gap4_compat.c,
	* gap5/gap4_compat.h:
	(11:31:05) Updated various functions to use int64_t instead of int
	for contig coordinates.  Specifically anything using the total
	contig length or coordinates in the contig selector.
	
	This means that the contig selector now displays data when the
	total contig length is > 2Gb. 

	* gap5/IO.h,
	* gap5/Makefile,
	* gap5/editor_join.c,
	* gap5/editor_view.h,
	* gap5/qual.c,
	* gap5/template_display.c:
	(11:33:18) Removal of minor compilation warnings.
	
	Fixed the main build to no longer link against fortran or C++
	libraries as these aren't used in Gap5 and they hamper portability. 

2009-06-19  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/ace.c:
	(14:16:03) Initialise more elements in range_t. They were left
	uninitialised so all sorts of things could happen! 

	* gap5/template_display.c,
	* gap5/template_display.h:
	(14:17:44) Added a template size blocking factor for use in the
	Stacking Y-mode. This groups like-sized templates together, causing
	extra-long templates to appear beneath the smaller ones and so
	rearrangements become easier to spot. 

	* gap5/depth.tcl:
	(16:11:56) Added an interface to changing the "stacking y size"
	(only used in stacking mode).
	
	The entire GUI for this needs an overhaul, but that's for later. 

	* gap5/template_display.c:
	(16:16:35) Removal of some debugging info. 

	* tgap/maq.c:
	(16:18:02) Added timing stats. 

	* tgap/maq.c,
	* tgap/sam.c,
	* tgap/tg_cache.c,
	* tgap/tg_gio.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_index.c,
	* tgap/tg_register.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h:
	(16:35:07) General code tidyup. Removal of unused variables;
	deleted old #if 0 code (will get it back if we need afterall);
	tidied up some const vs non-const warnings, etc. 

	* tgap/tg_contig.h:
	(16:40:57) Export more functions 

2009-06-18  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(11:25:17) Improved the editor information line to show contig
	names when a read-pair has the position in another contig rather
	than this one. 

2009-06-17  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_anno.c,
	* tgap/tg_anno.h:
	(11:27:17) Added an anno_get_range() function to return the range_t
	struct associated with an annotation. This allows us to query
	positional data, flags, etc. 

	* tgap/tg_contig.c:
	(11:27:51) Annotations now have their Y coordinates allocated too
	(if requested) so that they reside on top of the correct sequence Y
	location. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(11:29:51) The get_seq_status editor method (calling
	edview_item_at_pos in C) can return AnnoEle records as well as the
	usual sequence/contig records. Thefore we can now show tag summary
	data in the editor information bar too. 

	* tgap/ace.c:
	(14:03:28) Now set seq.bin_index too. Without this it was causing
	assertion failures in sequence_get_pair() during viewing in gap5. 

2009-06-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Attic/tg_depth.c:
	(09:14:59) removed 

	* tgap/Makefile,
	* gap5/Makefile:
	(11:11:50) Minor makefile changes - CXX vs CXXLD etc 

	* gap5/contig_editor.tcl:
	(11:13:14) Extra options on panedwindow to show sash. This was made
	invisible with later Tk releases. (A bad case of form over
	function.) 

	* gap5/libraries.tcl:
	(11:14:12) Fix issues with apparent diagonal lines at the start of
	the library plot. These come from having no values between 0 and
	the first observed insert size. 

	* gap5/contig_selector.c,
	* gap5/cs-object.c,
	* gap5/editor_view.c,
	* gap5/list_contigs.tcl,
	* gap5/tk-io-reg.c,
	* gap5/tman_display.c:
	(11:18:14) Removal of interp->result to use the appropriate Tcl
	functions. Mainly Tcl_SetResult (plus our Tcl_vSetResult for printf
	style args) and Tcl_GetStringResult().
	
	It's not done in the best manner, but a way that works. Eg we
	regularly do things like changing atoi(interp->result) into
	atoi(Tcl_GetStringReslt(interp)). This would be better done using
	Tcl_GetInt instead, but the changes were formulaic and simply
	implemented. If I was to tailor each one carefully then optimally
	we should be using Tcl_Obj based methods anyway.
	
	The requirement for this change comes from Tcl8.6 where the result
	element from Tcl_Interp has finally been removed (rather than
	simply labelled as deprecated, which it has been for many years).
	
	Also tweaked a few other bits here and there regarding removal of
	deprecated features (especially in tkRaster.c). 

	* tgap/sam.c:
	(11:20:06) Changed search of LB tag to RG tag. It appears this is
	normally how libraries are implemented in SAM.
	
	In theory I should then read the RG header lines and redirect those
	to the LB header lines too, but by region is perhaps more useful
	for now as even though it's not a genuine library it allows for
	splitting data by lane or by run. 

	* gap5/editor_view.c:
	(11:40:32) Removed memory corruption when displaying long sequence
	tags. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/tkEditor.c,
	* gap5/tkEditor.h:
	(15:31:14) Added a Hide Annotations setting in the contig editor,
	also bound to control-Q. This allows us to see the quality values
	underneath a tag. 

2009-06-15  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.2.1 *
	
2009-06-15  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_index.c,
        * tgap/tg_view.c,
        * gap5/gap.tcl:
        (10:43:54) Bumped version to 1.2.1

2009-06-12  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_iface_g.c:
        (14:17:29) Fixed memory corruption when writing out seq blocks if
        trace_name disagrees with sequence name. (We didn't allocate enough
        storage.)

        Also insure seq_block and anno_ele_block est_size field is always
        initialised to zero.

        * tgap/caf2baf.pl:
        (15:13:08) *** empty log message ***

        * tgap/maq.c,
        * tgap/tg_iface_g.c:
        (16:24:28) Fixed use of assert. Nasties like assert(*cp++ ==
        GT_Seq) are invalid as compiled used NDEBUG to disable assert also
        no longer increments cp.

2009-06-10  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.2.0 *
	
2009-06-10  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_register.c:
	(13:19:21) Protect against io_cursor_reg(io) being NULL in
	io_cursor_get(). This can happen when shutting down all displays. 

	* tgap/g-request.c:
	(13:19:58) Added use of pwrite instead of lseek and write (similar
	to the already in-use pread calls). 

	* tgap/tg_cache.c:
	(13:20:27) Set cache size to 1024 (from 8192). More applicable now
	we have compound "blocked" data structs. 

	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(13:22:25) *INCOMPATIBILITY* Major overhaul on encoded data
	formats.
	
	Every record written to disk now starts with a byte for the data
	type and a byte for the encoding format (starting at zero for now).
	Every time we read a record we assert that the type and format are
	correct.
	
	This should help spot potential data corruptions before they take
	place. The error handling could be improved, but assert/abort is
	sufficient for now and (in theory) these should never happen
	anyway. 

	* gap5/contig_editor.tcl:
	(13:27:44) Added pageup/pagedown bindings (+/- 1k at a time). 

	* tgap/tg_index.c,
	* tgap/tg_view.c,
	* gap5/gap.tcl:
	(13:28:38) Bumped version to 1.2.0 

2009-06-09  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c,
	* tgap/tg_contig.h:
	(09:23:34) Added a flag to distinguish between the first range and
	subsequent ranges in the contig iterators.
	
	The first range needs to allow objects that overlap the range to be
	included while subsequent objects need to only allow objects that
	start entirely within the new range (in order to remove
	duplicates).
	
	This fixes a bug where the first few sequences in a contig were
	rejected when exporting to varying file formats. 

	* tgap/Makefile:
	(12:38:18) Link libtgap.so against ptmalloc3 library.
	
	This replaces the system malloc as we've seen some *dire*
	performance issues. In one case tg_index sped up 24 fold after
	linking with the new library. 

	* tgap/baf.c:
	(12:39:17) Count all object types rather than just sequences when
	deciding to flush.
	
	Improved outputs, giving timings per block of data. 

	* tgap/tg_bin.c:
	(12:40:12) Fix buf where bin->nseqs changes weren't always written
	back to disk. 

	* tgap/tg_cache.c:
	(12:40:45) Bug fix: remove empty case statement (illegal C?).
	
	Minor debug output changes. 

	* tgap/tg_iface_g.c:
	(12:41:05) Minor change to improve portability. 

	* tgap/tg_index.c:
	(12:42:44) The default value of merge_contigs is now dependant on
	whether or not we are appending. This removes the need to search
	through contig existing names when we're not appending.
	
	ASSUMPTION: per input file, all data for a single contig is
	collated together rather than intermingled. 

	* tgap/sam.c:
	(14:00:31) Fixed bug with handling 'Z' aux sam type. 

2009-06-04  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c:
	(13:32:07) #ifdefed out code; for evaluating size of fastq files
	when complementing sequences to keep in assembly orientation. 

	* gap5/editor_view.c,
	* gap5/tkEditor.c:
	(13:32:43) Added support for displaying annotation colours. 

	* tgap/ace.c,
	* tgap/g-struct.c,
	* tgap/hache_table.c,
	* tgap/hache_table.h,
	* tgap/maq.c,
	* tgap/sam.c,
	* tgap/tg_contig.c,
	* tgap/tg_index.c,
	* tgap/tg_register.c:
	(13:49:25) Strictly for debugging purposes, hache tables now have a
	name field. If set this outputs the name string in debugging output
	instead of using %p and the hache table pointer. 

	* tgap/tg_cache.c,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(13:50:04) GT_AnnoEle items are now blocked like sequences in a
	GT_AnnoEleBlock items instead. This massively reduces the file size
	for tag-rich databases.
	
	Also improved I/O stats output. 

	* tgap/tg_sequence.c:
	(13:50:13) Added sequence_reset_ptr and sequence_copy functions to
	remove code duplication. 

	* tgap/baf.c,
	* tgap/tg_bin.c:
	(13:50:27) Fixed reference count leaks 

	* tgap/tg_anno.c,
	* tgap/tg_anno.h:
	(13:50:53) Added tag types to anno_ele so we can get away with not
	using anno structs at all for the simple case of a tag marking just
	one region. Tag types are now stored in the range_t struct too,
	using the mqual field (TODO: use a union instead). Old old_type was
	stored here, but now fits in a flag instead. 

2009-06-01  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(10:36:47) Bug fix cases where the item in xx->r[] is an annotation
	instead of a sequence (eg in edCursorUp, edCursorDown and
	edview_item_at_pos). 

2009-05-29  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/BAF,
	* tgap/baf.c,
	* tgap/baf.h:
	(10:57:28) Added annotation support. 

	* tgap/sam2fai.pl:
	(10:58:00) Now preserves the order in the input sam file when
	producing the output list. (Not needed, but useful for debugging
	purposes sometimes.) 

	* tgap/tg_bin.c:
	(10:58:23) Fixed the nseqs counter so it isn't incremented by
	annotations. 

	* tgap/tg_contig.c:
	(10:59:05) compute_ypos() when operating in non-stacking mode no
	longer counts tags in computing Y coordinates. 

	* tgap/tg_iface_g.c:
	(16:32:29) Fixed bug in decoding of SeqBlocks and seq->bin_index. 

	* tgap/tg_sequence.c:
	(16:32:54) Assert in sequence_get_pair() - spotted bin_index
	decoding issues. 

2009-05-28  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/libraries.tcl:
	(14:23:34) Improved the auto-scaling and added a simple key. 

2009-05-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(15:31:35) Upped the size of the range queries used in the
	contig_iter system from 1k to 10k. 

	* gap5/NEWS:
	(15:40:35) *** empty log message *** 

	* gap5/export_contigs.c:
	(15:41:27) Improved cigar string generation for SAM format.
	
	Added ACE format output. 

	* gap5/export_contigs.tcl:
	(15:41:41) Added ACE format output. 

	* gap5/libraries.tcl,
	* gap5/tclIndex:
	(15:42:18) Added a rudimentary libraries Tk interface. 

2009-05-26  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/ace.c:
	(14:21:41) Fixed ACE file reading of complemented data. 

	* tgap/Makefile,
	* tgap/maq.c,
	* tgap/sam.c,
	* tgap/tg_cache.c,
	* tgap/tg_gio.c,
	* tgap/tg_gio.h,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_library.c,
	* tgap/tg_library.h,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(14:24:21) Added libraries as a data type.
	
	These replace the (unimplemented) DNASrc data type. For now only
	MAQ and SAM input formats populate these fields, but more will
	follow shortly. 

	* tgap/tg_contig.c:
	(14:27:50) Fixed contig_iter_next and contig_iter_prev. When faced
	with sequences of varying length these sometimes caused duplicates
	during iteration. 

2009-05-15  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.3.1 *

2009-05-15  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/baf.c:
	(09:05:14) Only flush changes every 65536 sequences now, as this
	improves data locality and reduces database fragmentation.
	
	Fixed issues with incorrect quality values for soft-clipped data in
	SAM. 

	* tgap/maq.c,
	* tgap/sam.c:
	(09:05:15) Only flush changes every 65536 sequences now, as this
	improves data locality and reduces database fragmentation.
	
	Fixed issues with incorrect quality values for soft-clipped data in
	SAM. 

	* tgap/tg_cache.c:
	(09:16:16) Tweaked the maximum data size of an uncompressed
	sequence block from 200k to 150k as this appears to be marginally
	more optimal in disk usage. 

2009-05-13  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam2fai.pl:
	(15:56:47) Added a simple tool to index sam files, building a .fai
	file suitable for use with "samtools import". 

	* gap5/export_contigs.c,
	* gap5/export_contigs.h,
	* gap5/export_contigs.tcl,
	* gap5/newgap5_cmds.c,
	* gap5/tclIndex:
	(16:01:05) Added a "File->Export Sequences" command.
	
	This outputs data in SAM, Fasta, Fastq or BAF format and can be
	used for migrating between gap5 releases or from gap5 back to
	samtools.
	
	Note that right now it's not robust with regards to CIGAR
	alignments though - it writes out padded data currently. 

	* gap5/Makefile:
	(16:02:13) Added export_contigs.c 

	* tgap/sam.c:
	(16:03:25) Fixed contig names - we now use the references listed in
	the sam file.
	
	Fixed sequence position - they were out by 1.
	
	Removed the old sam reading code (previously #if-ed out). 

2009-05-12  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c,
	* tgap/tg_bin.h,
	* tgap/tg_contig.c,
	* tgap/tg_gio.c,
	* tgap/tg_gio.h,
	* tgap/tg_index.c:
	(16:40:21) Made the minimum bin size a parameter of tg_index. This
	allows for a great improvement of speed and compression size when
	dealing with very low coverage data sets (eg many 1000G runs). 

	* tgap/tg_iface_g.c:
	(16:41:07) We now store GT_Bin structs in a more optimal fashion.
	
	This doesn't have a big impact mostly unless using lots of small
	bins with shallow depth data. 

	* tgap/tg_bin.c,
	* tgap/tg_iface_g.c:
	(16:58:16) The io->iface->bin.create method no longer creates a bin
	from a template, instead preferring simply to just allocate the
	record.
	
	This along with bin_new() changes means we don't write the bin
	struct to disk multiple times. It has a minor change on deep
	projects, but a substantial speed improvement on very shallow ones
	(with admittedly too many bins for the depth). 

2009-05-11  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(09:07:02) Handle sequences longer than MAX_SEQ_LEN. The #define
	should only be for static memory allocation for speed, and not a
	hard limit. 

	* gap5/editor_view.c:
	(16:27:38) Fixed memory leak: free memory for anno_hash. 

	* gap5/consensus.c,
	* gap5/editor_view.c:
	(16:28:20) Don't decrement the seq_t cache. This is unnecessary as
	it's not auto-incremented and it now produces issues for
	referencing counting of block data. 

	* tgap/tg_contig.c:
	(16:29:24) Fixed memory leak in compute_ypos(). 

	* tgap/tg_utils.c,
	* tgap/tg_utils.h:
	(16:30:16) Added signed versions of the 7-bit int encoding; int2s7
	and s72int. 

	* tgap/tg_cache.c,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_struct.h:
	(16:35:38) *MAJOR AND INCOMPATIBLE CHANGE*
	
	First draft of a new data type: SeqBlock. This implements a block
	of sequences, rather than a single sequence object.  The purpose is
	to improve compression by allowing for multiple sequences (up to
	1024) to be compressed as a single block of data at the g-layer.
	
	This requires a LOT of smoke and mirrors in the caching layer to
	get right, and a few tweaks to allocation of new sequence objects
	too (in tg_sequence.c).
	
	Currently it's a mess of code, but the implementation appears to
	now be working. The compression achieve is quite amazing; typically
	beating bzip2 of the old gap5 database size while still being
	faster. The actual compression ratios vary, but 5:1 isn't
	unexpected.
	
	Note that it works far better with deep assemblies and less well
	with very shallow (eg 1000 genomes) data sets. This is partly due
	to the inherent compression from having lots of similar (ie
	overlapping) strings and partly due to a better ratio of sequences
	to bins. (Lots of almost empty bins is inefficient). 

2009-05-08  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c:
	(13:23:22) When extending contigs and adding a new root bin we now
	inherit the count of sequences from the old root.
	
	Previously it restarted the count at zero, giving incorrect
	sequence counts. 

2009-04-24  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.3 *

2009-04-24  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/ChangeLog,
	* gap5/NEWS:
	(13:26:43) *** empty log message *** 

	* gap5/depth.tcl:
	(14:01:24) Added an "update idletasks" when moving the cursor
	window. This prevents oscillation as we scroll by generating motion
	events that are applied to the location of the old window,
	pre-move. 

	* gap5/depth.tcl:
	(16:10:08) Fixed an issue with resize events occurring all the
	time. This was due to changes in resize1.5 and subtracting the
	scrollbar size from ${w}(width). Now using a separate variable for
	this.
	
	Also fixed an issue where bringing up a contig editor first,
	followed by the template display. Then double left clicking to move
	the editor was giving errors. 

2009-04-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/baf.c,
	* tgap/baf.h:
	(14:23:26) Added PR (primer type) parsing. 

	* gap5/contig_editor.tcl:
	(14:24:27) Handle incoming CURSOR_NOTIFY events requesting the
	cursor to be moved. 

	* gap5/depth.tcl:
	(14:25:25) This plot now registers itself with the contig
	registration system. As such it now appears in the Results Manager
	and can display/control the contig editor editing cursors. 

	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(14:27:11) The contig editor edview struct now contains a cursor_t
	element, holding the private cursor to use used in CURSOR_MOVE
	messages. This allows integration with other windows. 

	* gap5/depth.tcl:
	(16:30:41) Fixed an issue with the template display and ruler track
	not being on the same scale - the width of the Y scrollbar impacted
	the scaling.
	
	Also dramatically simplified the calculation of the world
	coordinates. What was I thinking of? 

2009-04-21  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/hache_table.c:
	(14:03:46) HacheItemDestroy now also unlinks the in_use links.
	
	This caused crashes previously. 

	* tgap/tg_register.c,
	* tgap/tg_register.h:
	(14:07:51) Overhauled the contig deregistration system.
	Specifically in how we handle removal from the hache table.
	
	Also changed the meaning of contig 0. This is not a way to
	broadcast to all contigs (although we still have a broadcast_event
	function for this purpose) but rather a registration list for
	windows that wish to receive events that take place on any contig.
	(Such as the contig selector or Results Manager.) 

	* gap5/contig_selector.c:
	(14:09:30) Switched from registering with all contigs to just
	contig 0. 

	* gap5/contig_editor.tcl,
	* gap5/tk-io-reg.c:
	(14:19:18) Added REG_CHILD_EDIT callback instead of sending
	REG_LENGTH so that windows like the contig selector do not
	automatically redraw on every contig editor update. 

	* gap5/editor_view.c:
	(15:36:45) Fixed a bug with sequences sometimes being drawn as tags
	too due to assumptions on precedence rules. 

2009-04-17  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c:
	(10:46:44) Now using X position + record number in the Y spread
	function instead of X position + array index. This means that
	scrolling in X will give the same Y-spread variation for a sequence
	so it doesn't jump up and down now. 

	* tgap/maqmap.c:
	(14:52:52) Added <ctype.h> include to remove warnings. 

	* tgap/tg_sequence.c:
	(14:55:26) Protect against trace_name and alignment being NULL in
	sequence_new_from(). 

	* tgap/Makefile,
	* tgap/tg_anno.c,
	* tgap/tg_anno.h,
	* tgap/tg_bin.c,
	* tgap/tg_cache.c,
	* tgap/tg_contig.c,
	* tgap/tg_contig.h,
	* tgap/tg_gio.h,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(15:03:06) Added starting code for annotations. These consist of
	anno elements and annotations (possibly I'll later rename these to
	annotations and annotation_link respectively).
	
	This involves two new files (tg_anno.c and tg_anno.h), plus support
	for the anno_t and anno_ele_t data structure in tg_iface* and
	tg_cache.c.
	
	So far anno_t is largely unimplemented, but anno_ele_t is the guts
	of it and where the link to sequences or contigs occur. Right now
	this means we support single tags in a similar style to Gap4,
	without the link concept.
	
	Annotations are indexed in the same bin range arrays as sequences,
	utilising a flag to distinguish between seq_t and anno_ele_t
	references. This code needs more work as range_t should become a
	union (partly done, but commented out in tg_struct.h). This is
	being checked in now as to do this properly requires a file format
	change.
	
	The contig_seqs_in_range function had been extended to be part of a
	family, now including contig_anno_in_range and
	contig_items_in_range. The latter of these can return both
	sequences and annotations in one query. 

	* tgap/tg_bin.h:
	(15:03:51) Added prototype for bin_remove_item().
	
	Changed the minimum bin size from 1K to 4K. 

	* gap5/break_contig.c:
	(15:04:32) Removal of debugging calls to contig_dump_ps(). 

	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(15:06:40) Fixed a bug with the stacked-reads view of the editor
	where the dots in the names panel would overflow the names array.
	
	Added test support for viewing tags. This is unfinished and for now
	they're simply highlighted in inverse, but it's a proof of concept
	to help test the storage of tags (aka annotations). 

	* gap5/break_contig.tcl,
	* gap5/complement.tcl,
	* gap5/configure.tcl,
	* gap5/do_fij.c:
	(15:09:47) Added files. Not new - but apparently I forgot to commit
	these! Sorry. 

	* gap5/Attic/complement.h:
	(15:10:19) Redundant and removed. 

2009-04-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/ace.c,
	* tgap/tg_index.c:
	(16:34:37) Fixed the ACE format code to work with the newer
	pair_rec mechanism (in bin rather than seq object).
	
	Added minimal support for RT, CT and WA. For now it just skips over
	them as opposed to dying, so it doesn't yet add the tags for real. 

2009-04-15  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/gap.tcl,
	* gap5/newgap5_cmds.c,
	* gap5/ng_fb_cmds.tcl:
	(11:14:16) Fixed db_info num_contigs to return the correct value.
	
	Opening the database now checks for num_contigs <= 1000 before
	deciding whether to display the contig selector, unless -csel has
	been explicitly requested on the command line. 

2009-04-14  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl:
	(15:31:11) Improved undo/redo when using the join editor. I think
	there still maybe bugs, but it interoperates with other editors in
	a far saner fashion now with regards to which buttons are greyed
	out.
	
	Made the undo/redo buttons highlight the editor they will apply to.
	This is changed by clicking in an editor window to change focus.
	(Only makes sense for the join editor.) 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEdNames.c,
	* gap5/tkEditor.c:
	(16:16:03) The edview_item_at_pos functions now takes an extra
	"exact" argument to indicate if the query should find closest or
	exact only.
	
	This is now used in the editor <<select>> binding so that clicking
	will position the editor cursor on the nearest sequence in X (and
	more importantly allows setting the editor cursor one past the end
	of a sequence). 

2009-04-09  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_register.c,
	* tgap/tg_register.h:
	(13:18:49) Fixed send_event when asking for a events to be sent to
	an entire contig. Maybe! 

	* gap5/tk-io-reg.c:
	(13:20:10) Fixed handling of REG_GENERIC events when acting via the
	tcl interface. 

	* gap5/tkEditor.c:
	(13:20:47) Added a contig_rec subcommand. 

	* gap5/contig_editor.tcl:
	(13:22:01) Overhaul of the undo/redo mechanism. There are still
	issues to tackle here when dealing with the join editor, but the
	basic editor(s) work.
	
	Improved handling of multiple editors on the same contig. The
	contig editor now registers and responds to basic events via the
	contig registration system, meaning it's moved closer to the
	original view,model,controller design. 

2009-04-08  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(15:46:43) Improved the compute_ypos function to always find the
	minimum Y rather than sometimes just the minimum recently used Y. 

	* gap5/contig_editor.tcl:
	(15:48:20) Updated the way the settings work in the join editor.
	I've removed the notion of the "current contig" (which was never
	updated anyway) and now options like cutoffs, quality and highlight
	disagreements automatically apply to both editors in the join
	editor. 

	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEdNames.c,
	* gap5/tkEditor.c:
	(15:52:48) The "pack sequences" display mode now behaves better. -
	The editing cursor, copy selection, scrollbars, etc now operate  
	correctly rather than counting in Y as if we had one line per  
	sequence. - The names panel switches to a small scaled
	representation of the	data visible in the editor panel. This
	still allows viewing of   mapping quality and the possibility of a
	right-click menu. Obviously   the names panel is optional too still
	in as far as it can be	 minimised.
	
	Minor (unfinished) support for the editor edit_annotation method.
	Currently this does nothing. 

2009-04-06  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c,
	* tgap/tg_contig.c,
	* tgap/tg_contig.h:
	(14:05:17) Updated the tg_contig compute_ypos function to us the
	same tree based algorithm as used in the template display.
	
	There's still quite a bit of code duplication here, but where
	possible the data structures are shared. The duplication comes
	about because the data structures being sorted (range_t vs tline)
	differ. 

2009-04-03  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.2 *

2009-04-03  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c:
	(11:26:38) Added a filter dialogue to allow the template display to
	be filtered by spanning, pair/single or mapping quality.
	
	Adjusted the Y-spread function to also take into account an index
	rather than purely X location. This means lines at the same X,Y
	coordinate can now be spread too, making duplicated templates
	easier to see.
	
	Fixed Y x-hair so that the reported position in the information bar
	is now the correct Y position. 

	* gap5/depth.tcl,
	* gap5/template_display.h:
	(11:26:39) Added a filter dialogue to allow the template display to
	be filtered by spanning, pair/single or mapping quality.
	
	Adjusted the Y-spread function to also take into account an index
	rather than purely X location. This means lines at the same X,Y
	coordinate can now be spread too, making duplicated templates
	easier to see.
	
	Fixed Y x-hair so that the reported position in the information bar
	is now the correct Y position. 

	* gap5/gap.tcl:
	(11:33:01) Bumped version to 1.1.2 

	* gap5/template_display.c:
	(13:53:44) Fixed the Y crosshair value when using
	separate-by-strands mode. 

	* gap5/template_display.c:
	(14:05:24) Minor tweaks of out by one errors in Y xhair value. 

2009-04-02  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consen.tcl,
	* gap5/newgap5_cmds.c:
	(14:59:34) Sped up the consensus saving code substantially when
	many contigs are output due to an over-zelous addition to the map
	passed into string map; this ultimately made the code O(N^2) in
	speed.
	
	Added a new tcl_reformat_sequence command in C to convert binary
	quality to fastq and to perform line-wrapping. This works around
	locale issues and is faster to boot.
	
	Fixed a bug in calc_quality that wrote out one more base than
	desired. 

	* gap5/consensus.c:
	(15:09:09) Fixed the consensus generation functions when passed a
	sequence exactly 1 more than a multiple of 1024 long. Due to a < vs
	<= the last base was uninitialised. 

	* gap5/contig_editor.tcl:
	(15:11:10) Added clipboard copy for reading names, although at
	present without any highlighting. 

	* gap5/tkEdNames.c:
	(15:11:11) Added clipboard copy for reading names, although at
	present without any highlighting. 

	* gap5/editor_view.c:
	(15:12:35) Bug fixed copy(clipboard) of the consensus; it was out
	by one sometimes. 

	* gap5/list_proc.tcl:
	(15:12:52) Removal of debugging output. 

2009-03-31  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/maq.c:
	(16:28:19) minor grammar change 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(16:29:54) Added selection (copy) handling for sequences and
	consensus. 

2009-03-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/hache_table.c:
	(12:46:05) Added a HacheTableLeakCheck() function for debugging.
	
	/*  * For debugging purposes only. This function severs all links
	to items  * with a reference count > 0. Obviously this breaks the
	HacheTable in  * various ways, but the purpose is that it should be
	immediately followed  * up by an exit() call and an analysis of
	memory leaks.  *  * In theory all items with a reference count > 0
	will have pointers to them  * in other pieces of code. If they do
	not then we know we leaked memory  * somewhere by virtue of
	incrementing the reference count and not  * decrementing it again
	before losing our pointer to the object.  */ 

	* tgap/maq.c:
	(12:47:12) Fixed a bug with the recent code to skip over unmapped
	sequences. This caused a memory. Also it was erroneously skipping
	over SW matches sequences too rather than only non-matched data,
	causing other memory wastage in the pair hash. 

	* tgap/tg_sequence.c:
	(12:47:40) Fixed an uninitialised memory access in
	sequence_index_update(). 

	* gap5/editor_view.c:
	(14:11:02) Fixed a bug with the display in the editor vanishing
	whenever the names panel is scrolled. 

2009-03-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.tcl:
	(11:16:16) Fixed searching of contig names via reading names. 

	* gap5/contig_id.tcl,
	* gap5/gap4_compat.tcl:
	(11:16:19) Fixed searching of contig names via reading names. 

	* tgap/tg_iface_g.c:
	(12:23:05) Reenabled the INDEX_NAMES code for using B+Trees on
	sequence names. Fixed a bug with the btree_del_cache code too. 

	* tgap/tg_index.c:
	(12:24:16) Changed the defaults for pair-linking (now on) and btree
	indexing (now off). Added -P and -t options too (already have -p
	and -T). The -p/-P is on/off for pairing and -t/-T is on/off for
	btree indexing.
	
	Program version now 0.14. 

	* tgap/g-struct.c,
	* tgap/tg_cache.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_index.c:
	(17:12:21) Increased the size of the HacheTables by 4. This allows
	us to efficiently flush less often, which has a considerable impact
	on the performance of tg_index when using -t mode for building the
	name b+tree. 

	* tgap/maq.c,
	* tgap/maq.h:
	(17:17:51) Check the maq flags for NOMATCH and SW bits. When both
	set this implies that this sequence is not aligned, so we reject
	it.
	
	When NOMATCH only is set it implies only one end matched, which
	means we do not need to add this sequence name to the pair hash
	table.
	
	Also decreased the frequency of flushes. 

2009-03-25  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.tcl,
	* gap5/list_contigs.tcl:
	(10:25:23) Now list the number of sequences in a contig. 

	* tgap/tg_bin.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(10:27:18) Added nseqs field to the bin structure and added an
	nseqs method to contig objects to return the number of sequences in
	the root bin. This is automatically kept up to date in
	bin_add_range() and bin_remove_item(), but I am unsure currently on
	the performance hit of this. 

	* tgap/tg_index.c:
	(12:40:52) Fixed the frequency of flushing (for .aln format) to be
	less frequent. I think I had accidentally pushed out a debugging
	version. 

	* tgap/hache_table.c,
	* tgap/hache_table.h,
	* tgap/tg_cache.c:
	(12:42:48) The hache table now maintains a linked list of objects
	with at least one reference count. This is useful when iterating
	through all referenced objects, such as in cache_flush().
	
	If we use a very large hache table (eg 3276800 instead of the
	current 32768) then the benchmarks showed that about 40% of cpu
	time was spent simply iterating through the hache table finding
	which items we need to flush. The impact is far less significant
	with smaller hache tables though. 

2009-03-23  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(16:05:46) Temporarily disabled the range caching code in
	edview_visible_items as it cannot detect when data is changed (eg
	inserting a base to the consensus => identical query range, but
	sequences maybe shifted within that range). 

	* gap5/depth.tcl:
	(16:09:19) The window title bar is now named after the contig being
	displayed. 

2009-03-20  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.1 *

2009-03-20  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam.c:
	(16:30:42) Removal of memory leaks. 

	* tgap/tg_index.c:
	(16:31:12) Update version to 0.13 

	* gap5/depth.tcl:
	(16:32:35) Small tweaks to make the depth plot work again (as I've
	been mainly focusing on the template display).
	
	Adjusted the default parameters for template display (scales,
	separate strands now off). 

	* gap5/gap_canvas_box.tcl:
	(16:33:35) Copied from gap4 and tweaked. Needed to support zooming
	in the contig selector. 

	* gap5/tclIndex:
	(16:33:57) *** empty log message *** 

	* gap5/template_display.c:
	(16:36:26) Total rewrite of the compute_ypos packing algorithm.
	This needs migrating back into tg_contig.c sometime. The new one
	uses a pair of splay trees and is massively faster than before.
	
	Adjusted the line width of reads when zoomed >= 150 in Y.
	
	Restructured the plotting function to be more distinct between
	querying, allocating Y and plotting. This is a precursor to caching
	of data (so we can scroll in Y faster) and better scrolling. 

	* gap5/template_display.h:
	(16:36:56) New "colours" (actually just GC line width change) for
	fwd/rev. 

2009-03-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile,
	* tgap/sam.c,
	* tgap/tg_index.c:
	(16:35:40) Added support for indexing bam format files (see
	samtools). 

2009-03-11  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(11:10:37) Experimented with different compute_ypos() functions.
	The new one I tried I ended up rejecting, but I doubled the speed
	of the existing implementation with a bit more optimisation. 

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:06:33) Added cross-hairs 

	* gap5/gap.tcl:
	(17:35:30) Version number update.
	
	Instead of Gap v5.x.x the program is now called gap5 and has
	version 1.x.x. Although a bit of a departure, it's more sane in
	that we regain control of the major version number again. 

	* gap5/ng_fb_cmds.tcl:
	(17:46:10) Removed the assumption of having a version code in
	database names. 

2009-03-10  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(12:35:18) Added a sequence depth and template depth line
	(optional). These need moving to their own raster or canvas, but
	for now they're functional rather than elegant.
	
	Fixed a bug with the xview coordinates. The raster plot was offset
	by the contig start coordinate, so if it didn't start at zero
	(clipped) it was shifted in X. 

2009-03-09  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:34:01) Ripped out the old canvas based template display code.
	
	Added an init method of plots (implemented for template display)
	and adjusted the layout slightly.
	
	Improved (but still not completely fixed) X and Y zooming of plots.
	
	Fixed template_display object "range" method call. It's now the
	same coordinates worked out during plotting.
	
	Added a (currently unused) xzoom mode to the template display
	window to mirror the (currently used) yzoom control. 

2009-03-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(16:59:09) Rewrote compute_ypos() to be faster. It's still not
	ideal though. I think it needs the combination of a linked list for
	fast resorting and an array for y scanning. 

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:01:21) Improvements to the template display:
	
	- background is now black so the reads are more vibrant and show up
	easier with low depth data.
	
	- Can separate out by template strand.
	
	- Additional yoffset control used as an offset to the computed Y.
	This allows bringing the two halves (when separated) closer or
	further apart. 

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:45:41) Added a control to filter out single ended data. 

2009-02-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/maq.c:
	(14:01:49) Added code to read the newer maq-long format. This can
	be forced using tg_index -M, or is automatically attempted if maq
	-m fails. 

	* tgap/maq.h,
	* tgap/maqmap.c,
	* tgap/maqmap.h,
	* tgap/tg_index.c:
	(14:01:51) Added code to read the newer maq-long format. This can
	be forced using tg_index -M, or is automatically attempted if maq
	-m fails. 

2009-02-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c,
	* gap5/template_display.h:
	(12:13:29) Added a red colour for templates that have read-pairs in
	inconsistent orientations. 

2009-02-25  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c:
	(12:41:17) Check for errors in opening DB 

	* tgap/tg_bin.c,
	* tgap/tg_register.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_tcl.c,
	* tgap/tg_view.c:
	(12:43:05) Added an end return value to sequence_get_position(), in
	addition to the start. This means we can query the extents of a
	read rather than just one end. Most calls to this just have an
	extra NULL inserted to adhere to the new API. 

	* tgap/tg_contig.c,
	* tgap/tg_struct.h:
	(12:44:11) The rangec_t struct now has a pair_ind element. This is
	normally -1, but is set to the index in the array index of the data
	returned by contig_seqs_in_range() if the pair is also in this
	array.
	
	This can be used to avoid iterating through templates twice. 

	* gap5/Makefile:
	(13:59:35) Added template_display.o 

	* gap5/editor_view.c:
	(14:00:46) Changes to sequence_get_position API. 

	* gap5/gap.tcl:
	(14:01:09) Better error checking when given invalid DB to open. 

	* gap5/gap4_compat.c:
	(14:01:29) Changes due to sequence_get_position API change. 

	* gap5/newgap5_cmds.c:
	(14:02:27) Added call to TDisp_Init to register template display
	additions. 

	* gap5/qualIO.c:
	(14:02:46) Changes due to sequence_get_position API change. 

	* gap5/tman_interface.c:
	(14:03:10) Changes due to sequence_get_position API change. 

	* gap5/contig_editor.tcl:
	(14:04:01) Missing bracket? How did it work before. 

	* gap5/depth.tcl:
	(14:04:53) Major overhaul to use raster widget instead and the new
	template_display.c C code. The old canvas widget code is still
	there intact, albeit not reachable right now.
	
	This still needs a big tidyup. 

	* gap5/depth.tcl:
	(15:30:13) Allow for the old canvas based template display to still
	be viewed, so we can do mouse-overs etc. This is a temporary hack
	to get a usable interface, but ultimately I'll probably end up
	rewriting the raster method to be a canvas object so it can be
	combined with canvas overlays and fits in with the rest of the
	window. 

2009-02-19  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl:
	(14:57:13) Improved ways to colour and allocate Y positions to
	sequences 

2009-02-16  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(16:59:13) The contig editor information line now shows data on
	read-pairs if the read is paired. 

	* gap5/depth.tcl:
	(16:59:56) Added an option to colour the template by mapping
	quality. In this mode it doesn't draw the reads for paired data so
	the template is more visible. 

	* tgap/baf.c,
	* tgap/maq.c,
	* tgap/tg_contig.c,
	* tgap/tg_index.c,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(17:01:24) Added mapping quality and paired mapping quality values
	to the bin GRange structure.
	
	These are still in the seq_t struct too, but they've been
	duplicated here in order to allow graphical plots fast access to
	the summary data for viewing by quality. 

	* tgap/tg_index.c,
	* tgap/tg_view.c:
	(17:02:44) Bumped versions to 0.12 

	* gap5/gap.tcl:
	(17:02:51) Bumped version to 5.0.2 

2009-02-13  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c:
	(16:21:07) Initialise bin.anno to NULL on bin creation 

	* tgap/tg_contig.c:
	(16:24:23) Fixed bug in contig_insert_base (introduced when the
	break statement was commented out). It now shifts all bins
	appropriately again.
	
	Added a job command to contig_seqs_in_range. This allows for
	allocation of Y position (1 per line or several per line) and
	sorting by X or X&Y. 

	* tgap/tg_contig.h:
	(16:24:29) Added a job command to contig_seqs_in_range. This allows
	for allocation of Y position (1 per line or several per line) and
	sorting by X or X&Y. 

	* tgap/tg_struct.h:
	(16:24:56) Added y value to rangec_t, to facilitate Y ordering. 

	* tgap/tg_tcl.c:
	(16:25:22) Added a get_mapping_qual subcommand for sequence
	objects. 

	* tgap/tg_tracks.c,
	* tgap/tg_view.c:
	(16:26:16) Modified to support new option to
	contig_seqs_in_range(). 

	* gap5/consensus.c:
	(16:31:47) Updated calls to contig_seqs_in_range due to argument
	changes. 

	* gap5/read_depth.c,
	* gap5/tkEdNames.c:
	(16:31:48) Updated calls to contig_seqs_in_range due to argument
	changes. 

	* gap5/contig_editor.tcl:
	(16:32:59) Added GUI options for packing multiple sequences per
	line. 

	* gap5/depth.tcl:
	(16:34:08) Implemented a template Y allocation system similar to
	Magnus Manske's plots, where the Y position is based on the size of
	insert.
	
	Added some rudimentary GUI controls for this too. 

	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(16:36:06) We now cache the last read rangec_t structs from
	contig_seqs_in_range rather than requerying every time the cursor
	moves.
	
	Implemented a rough draft of stacking multiple sequences per line.
	For now this only works for display and the cursor coordinates do
	not function correctly. It also needs the names display removing
	too to be sensible. 

	* gap5/tkEditor.c:
	(16:36:50) Added -stripe_mode and -stack_mode options. (For use in
	the experimental multiple sequences per line mode.) 

	* gap5/tkEditor.h:
	(16:36:51) Added -stripe_mode and -stack_mode options. (For use in
	the experimental multiple sequences per line mode.) 

2009-02-12  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c:
	(12:14:56) Fixed memory corruption in io_contig_read 

2009-02-10  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/maq.c:
	(15:19:51) Minor speed ups 

	* tgap/tg_sequence.c:
	(15:20:47) Sped up sequence_index_update() 

	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(15:21:46) Minor tweaks for adding annotations - not yet
	implemented though. 

2009-02-09  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile:
	(14:16:16) Removed -DVALGRIND, which massively slows down
	heap_allocate 

	* tgap/g-alloc.c,
	* tgap/g-alloc.h:
	(16:26:03) Added tracking of the maximum size of object in a pool
	and also when all pools between X and Y are empty we jump straight
	to pool Y if we previously tried to allocate from X and ended up in
	Y. This caching is governed by next_free_pool, next_free_time and
	timer, with the latter two jointly implementing a means to
	invalidate the cache. 

	* tgap/g-alloc.c:
	(16:35:43) I had accidentally left heap_alloc in debug mode where
	it scanned from the first pool instead of the predicted pool in
	order to verify predictions. 

2009-02-06  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl:
	(16:05:25) Improved display of inconsistent templates, so reads and
	templates show up differently (may need to fix colours!).
	
	Fixed a bug with ordering of elements in lines sometimes giving tcl
	errors. 

	* tgap/maq.c:
	(16:06:03) Fixed parsing of read names when they have /1 and /2. We
	now also treat these as read pairs, and furthermore we set the
	actual end. 

	* tgap/tg_contig.c,
	* tgap/tg_tcl.c:
	(16:07:23) Added extra flags to handle knowing the template end. 

	* tgap/tg_cache.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_struct.h:
	(16:08:28) Added room for sequence annotations. The structs exist,
	but no I/O to create, read or write is present yet. However this
	means the sequence format shouldn't need to change when they do get
	added. 

2009-02-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_view.c:
	(10:03:35) Minor prototype fixes 

	* tgap/g-request.c:
	(10:04:42) removed unused variable 

	* tgap/hache_table.c,
	* tgap/hache_table.h:
	(10:06:22) Added protection against HacheItems being passed into
	the wrong HacheTable (as this happened in practice due to a bug).
	
	Added a new debug function: HacheTableRefInfo. This lists the
	number of cached items separated by reference count. 

	* tgap/maqmap.c:
	(10:07:14) Support for maq files with no reference sequence; minor
	allocation change 

	* tgap/tg_bin.c,
	* tgap/tg_bin.h:
	(10:08:44) Enabled the bin-prediction code in bin_for_range. Also
	some small tidy-ups regarding reference counts.
	
	Moved RD_ELEMENTS macro to tg_bin.h so it can be used elsewhere. 

	* tgap/tg_cache.c:
	(10:10:13) Fixed a bug when working with derived GapIOs. We were
	often returning a HacheItem from the base GapIO, but then
	incrementing the reference count in the derived GapIO. We always
	use the same one now (plus HacheTable checks for consistency of
	such things too to spot similar bugs). 

	* tgap/tg_contig.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_struct.h:
	(10:17:21) Changed the format of the on-disc GT_Seq, GT_Bin and
	GT_Range structures. NB: *INCOMPATIBLE* file format with previous
	release.
	
	Sequences no longer hold their paired sequence record directly in
	the sequence struct. Instead it's in the bin range array. To
	facilitate fast lookup the sequence holds the index in the bin
	range array referring back to that sequence.
	
	This allowed a change to how the pairing is computed too. In
	contigs_seqs_in_range we hash on record number and so link each
	sequence directly to its pair. This means that we don't need to
	load any sequence structs at all when plotting graphical displays
	like the template display, except for the rair cases at the edge of
	the window being plotted. (The I/O improvement in number of seeks
	and reads is somtimes a 10 fold drop.)
	
	New function sequence_get_pair() hides away the logic to compute
	the other end of a sequence pair. 

	* tgap/tg_tcl.c:
	(10:18:49) Updates for the contig interface: new dump_ps command;
	the sequences in range command now returns more data, related to
	the pairing. 

	* tgap/Makefile,
	* tgap/baf.c,
	* tgap/maq.c,
	* tgap/tg_index.c:
	(10:19:38) Updated maq, baf and plain .aln format parsers to cope
	with the new sequence and bin/range structures.
	
	NOTE: for now the ace format code has been disabled until it is
	rewritten to support the new structs. 

	* gap5/depth.tcl:
	(10:21:44) Changes to the template display following the sequence
	and bin/range structure changes.
	
	We now have an accurate and approximate mode. Both need MUCH less
	I/O than before, but approximate mode saves further I/O by not
	bothering to work out whether the other end of a template, which is
	not observed on screen, is in this contig and if so whether it is
	to the right or left of the sequence we did observe. 

	* gap5/editor_view.c:
	(10:22:13) Changed edGetTemplateReads to use the new
	sequence_get_pair function. 

	* gap5/break_contig.c,
	* gap5/break_contig.h,
	* gap5/editor_join.c:
	(10:29:57) Split break_contig into its own, more appropriately
	named, file. 

	* gap5/Makefile:
	(10:30:32) Added break_contig.o 

	* gap5/newgap5_cmds.c,
	* gap5/read_depth.h:
	(10:31:03) Minor warning fixes for undefined vars, prototypes, etc. 

	* tgap/tg_contig.c:
	(17:21:27) Removal of excessive debugging output 

	* gap5/break_contig.c,
	* tgap/tg_bin.c,
	* tgap/tg_bin.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(17:22:38) Added a bin_invalidate_track() function.
	
	In the course of this discovered and fixed a bug where the track
	valid flag was not being set or checked for correctly. 

2009-01-28  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_id.tcl,
	* gap5/contig_selector.tcl,
	* gap5/gap4_compat.tcl:
	(11:19:08) Improvements to contig_id handling. We now accept contig
	name, #seq_num and =contig_num. TODO: support reading name too for
	when contig name fails. 

	* tgap/tg_gio.c:
	(11:28:49) Protect against no contig_order array in
	gio_read_contig. 

	* tgap/tg_bin.c:
	(12:41:44) Added (currently commented out) bin-estimation code in
	bin_for_range. It's disabled as I'm not 100% sure it's infalible
	and it didn't gain as much speed as I hoped. Possibly room for
	future work though. 

	* gap5/gap.tcl:
	(12:42:12) Bumped version to 5.0.2 

2009-01-27  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_join.c:
	(17:12:22) An incomplete update to join contigs (#if-ed out for
	now) to determine the optimal bin to reparent, rather than always
	duplicating the root node. This will reduce average depth when
	making small containment joins. 

2009-01-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_join.c:
	(10:29:52) Improved break contig: It no longer creates new blank
	bins for the right hand contig when they are unnecessary. 

	* gap5/editor_join.c:
	(16:05:59) More break contig tweaks. We now remove redundant bins
	from both left and right contig after breaking. 

2009-01-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c,
	* tgap/tg_contig.h,
	* tgap/tg_tcl.c:
	(12:04:29) Added a postscript contig output function. It doesn't
	auto-scale yet, but that's relatively straight forward to manually
	edit in the ps file afterwards. 

	* gap5/editor_join.c:
	(12:05:08) Bug fixes for break contig. 

2009-01-08  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_join.c:
	(14:05:48) Bug fix in break_contig_reparent_seqs: we no longer die
	when finding a bin with no Range data. 

	* gap5/gap_hash.c:
	(14:06:29) Protect against a match in find repeats extending 1 past
	the end of the sequence. I'm not sure why this occurs, but at least
	we handle the problem gracefully now. 

	* gap5/tk-io-reg.c:
	(14:07:18) Removed a heinous programming crime of returning the
	address of a local variable.
	
	This fixed the crosshairs in the contig selector/comparator window. 

	* tgap/tg_register.c,
	* tgap/tg_register.h:
	(14:09:02) Added reference counts and an inactive flag to the
	contig registration scheme. This allows us to protect against
	sending a notification which may cause the list of registered items
	to change, making it complex to iterate through all items to
	notify.
	
	Also implemented broadcasting (sending to all contigs) correctly. 

	* gap5/contig_editor.tcl:
	(14:22:05) Added temporary fix to shut down the contig selector
	when making a join. It's not what I want to do, but it works around
	the bug (and crash) that I'm not yet sending the appropriate
	notifications to force the plots to update upon a join.
	
	Will revert this when that code is in place. 

	* gap5/contig_editor.tcl:
	(14:32:11) Fixed the window title to display the contig name(s). 

	* gap5/editor_join.c:
	(14:32:44) When splitting contigs we now name the newly produce
	right-hand side contig with a derived name (#1, #2, etc). 

	* gap5/contig_id.tcl,
	* gap5/contig_selector.tcl:
	(14:50:26) Improvements to the contig selector / id UI components.
	We still need more work here to support #read_num and =contig_num,
	but for that to work we need a way of validating them first. 

2009-01-07  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile:
	(11:25:32) Added an install target 

	* tgap/gap_cli_arg.c:
	(11:26:23) Better error handling and added code to cope for when
	Tcl conversion from string fails for some reason (unknown why). 

	* gap5/Makefile:
	(11:26:57) Huge tidyup - more Gap5 now than a hacked gap4 

	* gap5/consen.c,
	* gap5/consen.h,
	* gap5/fij.c,
	* gap5/find_repeats.c:
	(11:30:54) make_consensus() now allocates memory for the consensus
	itself, rather than relying on something passed in. This removes
	the need to use a max_consensus parameter. 

	* gap5/contig_editor.tcl:
	(11:31:23) Now shutdowns the editor windows after a join. 

	* gap5/contig_selector.tcl:
	(11:31:56) Bug fixes to zooming and scrolling. 

	* gap5/editor_join.c,
	* gap5/newgap5_cmds.c,
	* gap5/newgap_structs.h:
	(11:32:58) Added first draft of the Break Contig function. 

	* gap5/tk-io-reg.c:
	(11:33:42) Fixed parsing in the reg_init_args function. This fix is
	part of the contig selector zooming/scrolling bug fixes. 

	* gap5/list_contigs.tcl:
	(11:34:05) *** empty log message *** 

	* gap5/list_proc.tcl:
	(11:34:24) gap_defs vs gap5_defs changes 

	* gap5/tclIndex:
	(11:34:43) Added result_manager.tcl 

	* gap5/editor_view.c:
	(12:27:24) Make sure we always set xx->link->lockOffset in
	set_displayPos for a join editor, even if lock is turned off.
	
	This fixes a bug in the join editor where turning off lock,
	scrolling, not hitting "align" and then hitting "join" will result
	in the incorrect join as it uses the starting lock offset instead
	of the current visible one. 

	* gap5/editor_view.c:
	(15:15:31) Better error checking in the status line updates. 

	* gap5/editor_join.c:
	(15:16:19) Fixed break contig: when sequences were moved from one
	bin to another bin I forgot to edit the sequence itself to relink
	the bin pointer to the new parent. 

2008-12-09  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.tcl,
	* gap5/tclIndex:
	(12:48:23) Moved GetItemInfo from template_display.tcl (not used)
	to here. 

	* gap5/depth.tcl:
	(12:49:13) Split the GUI dialogue into separate template displays
	and reading depth plots. 

	* gap5/gap_utils.tcl:
	(12:49:42) New utility function "counter". Used for generating
	unique window names. 

2008-12-03  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c,
	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* tgap/tg_contig.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_tcl.c:
	(12:08:05) Modified the sequence_*_base() functions to take an
	extra argument named contig_orient. This controls whether we wish
	to make this change in the orientation that the sequence resides
	within the contig (requiring a bin traversal) or whether we already
	know and have taken that into account (such as from a former
	contig_seqs_in_range query).
	
	This allowed for multiple bug fixes relating to insertion/deletion
	of bases in the contig editor both within sequences and the
	consensus. 

	* gap5/editor_view.c:
	(12:22:03) Fixed '%b' brief format (base call). 

2008-12-02  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/g-request.c:
	(10:27:41) Initialise new index records to G_INDEX_NEW instead of
	zero. I don't think this affects anything though.
	
	Removed dead code from g_unlock_views. The heap_free call is
	already performed in update_record and so never actually got called
	in unlock_views.
	
	Tidied up some of the reading and writing argument checking steps
	to permit len==0 now. The logic of this is that it's easier to
	allocate and write a zero length block (for say X*Ncontigs when
	initialising the contig order array) than to check for the special
	case of zero length. 

	* tgap/tg_bin.h:
	(10:29:04) Increased the minimum bin size to 1024. 

	* tgap/tg_iface_g.c:
	(10:33:25) Improved error handling. "g" functions typically return
	positive error codes, so we now check these and turn into -1 rather
	than passing through verbatim and being missed.
	
	Fixed minor memory leak in io_database_create_files().
	
	Added io_database_lock and io_database_unlock functions. We use
	these to queue up writes in the g-* code and hence reduce the
	amount of aux file updating.
	
	Support for decoding zero-byte blocks in seq_decode() - ie it
	doesn't crash any more and instead initialises a blank seq_t struct
	for us. 

	* tgap/tg_sequence.c:
	(12:23:44) sequence_new_from() now performs the initialise steps
	itself as these have been removed from the low-level
	iface->seq.create call. This is to avoid initialising and flushing
	data until the proper cache_flush time, and in doing so removes
	unnecessary disk seeks.
	
	sequence_get_position has been updated to support complemented
	bins. It also has an extra argument to return whether the bin is
	effectively reverse-complemented in the contig as a whole.
	
	sequence_get_base and sequence_get_base4 now return data in the
	orientation of the seq_t struct rather than complementing
	themselves.
	
	sequence_replace_base now works with sequences in complemented
	contigs. 

	* tgap/tg_sequence.h:
	(12:24:00) sequence_get_position has been updated to support
	complemented bins. It also has an extra argument to return whether
	the bin is effectively reverse-complemented in the contig as a
	whole. 

	* tgap/tg_struct.h:
	(12:24:16) Added 'rec' to seq_t struct. 

	* tgap/tg_tcl.c:
	(12:25:06) "io num_contigs" command now returns the correct number
	of contigs rather than the maximum previous size of the
	contig_order array. 

	* tgap/tg_view.c:
	(12:25:51) Due to changes in seq_t left/right (always having left
	<= right) we no longer need to complement positions. 

	* tgap/Attic/tg_edit.c:
	(12:26:22) Redundant - no longer being maintained and likely
	doesn't work now. 

	* tgap/tg_bin.c,
	* tgap/tg_register.c:
	(12:27:04) Updated for extra argument to sequence_get_position(). 

	* tgap/tg_cache.c:
	(12:28:09) Better error checking in cache_load().
	
	Flipped sort order of cached items as the DB lock/unlock method
	reverses the order within the g-* code. 

	* tgap/tg_contig.c:
	(12:30:00) Create new contigs with MIN_BIN_SIZE instead of
	hard-coded 16.
	
	contig_seqs_in_range2() now always returns range start and end in
	sorted position (start <= end) rather than flipped for complemented
	sequence. This removes complementing code elsewhere too.
	
	Added debugging tool contig_bin_dump() - to be called from gdb or
	similar for listing out a contig bin struct. 

	* tgap/tg_index.c:
	(12:30:23) Flush less often. 

	* gap5/consen.tcl:
	(12:32:30) Removal of debugging output.
	
	Added close of fd in get_consensus. 

	* gap5/consensus.c:
	(12:33:45) Removal of now unnecessary complementing code (see
	tg_contig.c changes).
	
	Bug fix to consensus_valid_range (param cons). 

	* gap5/contig_selector.c:
	(12:34:19) Added header files. 

	* gap5/Attic/dependencies:
	(12:34:33) *** empty log message *** 

	* gap5/editor_join.c:
	(12:35:33) Update 'offset' based on reach contig_offset value too.
	
	Now also destroys the contig properly. 

	* gap5/editor_view.c:
	(12:36:14) Changed arguments to sequence_get_position. Removed
	complementing code (see tg_contigs.c change). 

	* gap5/fij.c:
	(12:36:57) Now corrects for start positions of the editor; does not
	assume starts as bp 1. 

	* gap5/find_repeats.c:
	(12:37:12) Added include file. 

	* gap5/gap4_compat.c:
	(12:37:44) sequence_get_position() arg changes.
	
	Implemented complement_contig function. 

	* gap5/gap4_compat.h:
	(12:37:56) Implemented complement_contig function. 

	* gap5/newgap5_cmds.c:
	(12:38:16) Implemented complement_contig function. 

	* gap5/qualIO.c:
	(12:38:36) sequence_get_position arg changes. 

	* gap5/read_depth.h:
	(12:38:54) Added avg_sequence_depth prototype. 

	* gap5/tman_interface.c:
	(12:39:12) sequence_get_position arg changes. 

	* gap5/Attic/dependencies:
	(12:41:58) *** empty log message *** 

	* tgap/tg_contig.c:
	(17:29:05) Adjusted the positioning of contig offsets so that the
	offset is applied verbatim regardless of orientation of the root
	bin. The root bin's position element itself can be used to move
	contigs around (ie change the numbering start) instead of the
	contig start/end records. 

	* gap5/editor_join.c,
	* gap5/gap4_compat.c,
	* tgap/tg_sequence.c:
	(17:29:06) Adjusted the positioning of contig offsets so that the
	offset is applied verbatim regardless of orientation of the root
	bin. The root bin's position element itself can be used to move
	contigs around (ie change the numbering start) instead of the
	contig start/end records. 

2008-11-25  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl:
	(10:01:36) Added a Join button.
	
	The save/cutoffs/quality buttons now apply to both editors when in
	join editor mode.
	
	The curr_editor variable is now updated when clicking on another
	editor (also in join editor mode).
	
	Fixed the mouse-over text display for the names window. 

	* gap5/editor_join.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(10:02:34) Implemented the edJoin() function and the tkEditor
	"join" sub command.  Tested and we successfully made our first
	join. Yay! Next up, complemented joins. 

2008-11-24  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c:
	(10:08:14) Add missing break statment, which caused cache_dup to
	fail. 

	* tgap/tg_sequence.c:
	(10:08:29) Commented out the richard_munge_conf() call. 

	* gap5/consensus.c,
	* gap5/consensus.h:
	(10:09:58) New function: consensus_valid_range()
	
	This looks at the cutoff data to work out where the "used" extents
	of the contig are rather than the absolute sizes of the contig bins
	including cutoffs. 

	* gap5/fij.c,
	* gap5/find_repeats.c:
	(10:18:18) Fixed calls to edit_contig and join_contig. These now
	also specify the position in contig to display. 

	* gap5/gap4_compat.c:
	(10:19:35) lget_contig_num now returns the default contig range as
	the true start and end coordinates rather than 1 to 'length'. 

	* gap5/tclIndex:
	(10:19:46) Added join_contig 

	* gap5/tkEditor.c:
	(10:20:24) New sub-commands: link_to, lock and join_align. For the
	join editor. 

	* gap5/tkEditor.h:
	(10:20:39) *** empty log message *** 

	* gap5/Makefile,
	* gap5/editor_join.c:
	(10:24:05) New file: editor_join.c. This is derived from Gap4's
	join.c and consists of functions for the Join Editor to implement
	the align and join buttons. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(10:24:47) Major works to support the Join Editor.
	
	Removed defunct and commented out calc_cons() call.
	
	Fixed bug in status line display of quality values.
	
	Fixed bug in X scrollbar position - if now compensates for contig
	start being negative (cutoff data) so user scrolled position and
	displayed position match.
	
	Allowed for editor to be started up with the cursor at a specified
	read and position. 

2008-11-17  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/baf.c,
	* tgap/baf.h:
	(11:09:55) Added minimal support for reading and storing the trace
	alignment string. 

	* tgap/maqmap.c,
	* tgap/maqmap.h:
	(11:11:30) Minor change to prototypes - added void instead of
	implicit "()" args. 

	* tgap/maq.c,
	* tgap/tg_cache.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_index.c,
	* tgap/tg_sequence.c,
	* tgap/tg_struct.h:
	(11:13:07) Added trace name and alignment strings to the seq_t
	struct. Also improved the storage mechanism for CNF1 format data
	with some basic compression for sequence and quality values. This
	saves about 40% of storage on a mixed 454/Sanger assembly - less so
	for solexa/solid. 

	* gap5/tk-io-reg.c:
	(11:59:58) Fixed a bug in argument parsing within tcl_quit_displays 

	* gap5/fij.c:
	(16:40:29) *** empty log message *** 

	* gap5/depth.tcl:
	(16:40:48) Fixed Y scrolling (produced Tk error) 

	* gap5/consensus.c:
	(16:41:11) Fixed uninitialised data for zero-depth regions. 

	* tgap/tg_register.c:
	(16:42:32) Rewrote type_notify to accept the fact that calling the
	callback function may change the list of registered items (eg if
	the notification is a quit displays request). To address this if a
	callback function is called we then recompute the list of
	registered functions. 

	* tgap/maq.c:
	(16:43:01) Ensure we zero the alignment string. This was causing
	bugs whereby sequence and quality were corrupted. 

	* tgap/baf.c:
	(16:43:33) Added support for template names (TN lines) rather than
	assuming shared read-names indicate the template. 

2008-11-14  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Attic/array.c,
	* tgap/Attic/array.h:
	(10:16:17) Duplicate copies removed - we use the version in the
	../Misc directory again now. 

2008-11-13  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/read_depth.c,
	* gap5/read_depth.h:
	(17:08:08) *** empty log message *** 

2008-11-11  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/BAF,
	* tgap/Makefile,
	* tgap/baf.c,
	* tgap/baf.h,
	* tgap/tg_index.c:
	(15:09:12) Added (some) support for BAF - the basic assembly
	format. This isn't intended to be a long-term file format but it
	will serve as a working format until a strong contender emerges.
	For now it's a replacement CAF to work around our current woes. 

	* tgap/hache_table.c,
	* tgap/hache_table.h:
	(15:09:30) Added iterators to the HacheTable code. 

	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_struct.h:
	(15:11:12) Added trace_name to the sequence_t struct and a flag to
	indicate if the field is present on disk. This allows us to add
	explicit trace names only for cases where it differs to the
	sequence name. 

	* tgap/tg_view.c:
	(15:11:29) Fixed a bug with long read names where they could
	overlap the sequence. 

	* gap5/Makefile:
	(15:12:13) Fixed Makefile to not use ~jkb/work/tgap for the tgap
	source - it now correctly uses the Staden local copy. Oops 

	* gap5/trace_display.tcl:
	(15:12:55) Protect against trace titles containing dots, which
	previously broke the tk pathnames being generated. 

2008-10-24  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c:
	(09:05:18) Added depth to the consensus struct per base.
	
	Improved support for utilising all 4 confidence values when
	available.
	
	Bug fixed some edge cases, such as zero depth regions. 

	* gap5/consensus.h:
	(09:05:31) Added depth to the consensus struct per base. 

	* gap5/contig_editor.tcl:
	(09:06:24) The status line updates quality information on keyboard
	cursor movements now as well as mouse over events. 

	* gap5/editor_view.c:
	(09:07:48) The editor "brief" status line format has been updated
	to support reporting all 4 confidence values for a sequence base
	call. 

	* gap5/gap4_compat.c:
	(09:08:23) contig_name_to_number now uses contig_index_query for
	btree scanning rather than a brute force search. 

	* gap5/newgap5_cmds.c:
	(09:10:06) New function: tcl_sequence_depth, doing pretty much what
	you expect.
	
	Start of tcl_find_internal_joins interface. Incomplete right now.
	
	tcl_calc_consensus_full now reports sequence depth too, incase
	you're already calculating the consensus anyway. 

2008-10-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/b+tree2.c:
	(14:09:23) Additional error checking in btree_find_recurse(). 

	* tgap/tg_contig.c,
	* tgap/tg_contig.h:
	(14:09:50) Added a contig_index_query function, analogous to
	sequence_index_query. 

	* tgap/tg_iface_g.c,
	* tgap/tg_index.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_tcl.c,
	* tgap/tg_view.c:
	(14:29:43) Fixed bug in btree_load_cache. If it had an error
	locking or reading data then it freed an uninitialised pointer.
	
	Fixed a view locking bug in btree_write().
	
	Added support for SEQ_FORMAT_CNF4 encoded sequences. These have 4
	log-odds confidence values instead of the 1 phred value. 

2008-10-03  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile,
	* tgap/ace.c,
	* tgap/ace.h,
	* tgap/maq.c,
	* tgap/tg_index.c:
	(16:12:13) Added support for loading (new format) ACE files in
	tg_index.
	
	For all formats we no longer flush the cache after every contig as
	this was a major speed hit when dealing with lots of small contigs.
	
	Added read-pairing support for the simple .aln format. If the name
	matches it's assumed to be part of a pair. 

	* tgap/hache_table.c:
	(16:13:07) Minor changes to the HacheTableStats function. The
	reporting number of cache hits/misses is now a delta from the last
	time the stats function was called. 

	* tgap/tg_tcl.c:
	(16:13:49) Added comments regarding usage. No code change. 

	* gap5/gap4_compat.c:
	(16:23:56) Fixes in get_contig_num. (Done so long ago I forget what
	the reasoning was - sorry!) 

	* gap5/fij.c,
	* gap5/fij.h,
	* gap5/fij.tcl,
	* gap5/newgap_structs.h:
	(16:25:46) Added Find Internal Joins function. 

	* gap5/depth.tcl,
	* gap5/tclIndex:
	(16:26:50) Added the first draft of a read-depth and template
	display. Also tidied up the menus to remove most of the unused
	functions somewhat. 

	* tgap/ace_reorder.pl:
	(17:00:02) This attempts to reorder an ACE file so that the reads
	within it are sorted in left to right order.
	
	The purpose for this is to improve efficiency when converting to a
	Gap5 database. While it'll work regardless of the read order
	(provided the reads are presented in the same order as listed int
	he AF lines), it is inefficient if the reads for a small region are
	spread throughout a large area of disk. 

	* gap5/depth.tcl:
	(17:56:15) Removed broken bits from the entry dialogue. The window
	doesn't yet support multiple contigs anyway. 

2008-08-29  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c:
	(09:01:56) Bug fixed the new flush code. Using ARR instead of arr
	macro auto-extends the array for us. 

	* tgap/tg_contig.c:
	(09:03:15) Added cache_incr/decr calls around contig_seqs_in_range2
	so that the recursive nature of the function cannot push the bin
	out of the cache. 

	* tgap/tg_tcl.c:
	(13:46:28) Overhauled the tcl objects somewhat. Contigs and
	sequence (more to follow) sport an "io" and a "delete" method. This
	comes about from the realisation that my object system doesn't
	really fit in with Tcl.
	
	Consider:
	
	if {$condition} {    set r [$io get_sequence $seq_num]	  puts
	length=[$r get_length] }
	
	This this we query the tg_cache to get a sequence object, we create
	a Tcl_Obj associated with that too (stored in $r) and register a
	*global* function named after the string form of $r. This allows us
	to call it with "$r get_length" as technically objects are not
	classes and cannot have methods invoked on them in their own right.
	The names are globally unique though so there are no clashes.
	
	Hence when $r goes out of scope it destroys the reference to the
	object but does not remove the function. We now have to explicitly
	call "$r delete" to tidy up otherwise we end up with memory leaks
	and global namespace pollution. ie:
	
	if {$condition} {    set r [$io get_sequence $seq_num]	  puts
	length=[$r get_length]	  $r delete }
	
	It's not enough to track reference counts on $r either as the act
	of calling it as a function ($r get_length) changes the type from
	sequence to cmdName, decrementing the reference. We cannot remove
	the memory yet though, so it's not possible to keep track it seems.
	
		   - -	- -  - -  - -  - -  - -  - -  - -  - -	- -
	
	Perhaps with hindsight we should use a procedural model instead:
	
	if {$condition} {    set r [g5::io::get_sequence $io $seq_num]	 
	puts length=[g5::seq::get_length $r] }
	
	This way we do not create and remove procedures plus our data
	automatically goes out of scope and is tidied up for us. The above
	is essentially what happens in perl when io is blessed to be in
	class g5::io or $r is blessed to be in class g5::seq. I guess
	incrTcl has an equivalent mechanism. 

	* gap5/gap.tcl:
	(14:58:13) Removed requirement of database name being
	"dbname.version". 

2008-08-26  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c,
	* tgap/tg_gio.h:
	(13:28:23) Fixed the cache_flush code to hand over cache_items from
	a "derived" io to the base io struct before running cache_flush on
	the base.
	
	This ensures that the base io obtains copies of data from (for
	example) the contig editor. 

	* gap5/contig_editor.tcl,
	* gap5/tkEditor.c:
	(13:30:43) Added an "edits_made" sub-command of the editor. This is
	used to implement a warning on editor exit to ask if changes should
	be saved.
	
	Also fixed an error with a callback when highlighting non-sequence
	objects in the names panel. 

2008-08-20  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c:
	(15:48:12) Added more automatic commiting of writes. I'm still not
	sure if this is correct behaviour, but given our caching is now
	held in the tg_cache layer instead of G library it serves the
	purpose. 

	* tgap/tg_tcl.c:
	(15:49:01) Added a "child" subcommand of the io type. 

	* gap5/Makefile:
	(15:49:22) Tidyup to support tgap library being part of the staden
	build system now. 

	* gap5/contig_editor.tcl:
	(15:50:59) Made the contig editor using a child io for editing in.
	The save button now works.
	
	(Previously save/exit did the same thing as we edited the live io
	instead of child io.) 

	* gap5/gap.tcl:
	(15:51:49) Minor tweaks to replace gap4 with gap5 in strings,
	functions and version (gap v5.00 now) 

	* gap5/tkEditor.c:
	(15:52:29) Added Editor class save sub-command. 

2008-08-19  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/g-files.c:
	(15:10:36) Fix issues with .aux files being > 2Gb in size. 

2008-08-13  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile,
	* tgap/Attic/array.c,
	* tgap/Attic/array.h,
	* tgap/b+tree2.c,
	* tgap/b+tree2.h,
	* tgap/g-alloc.c,
	* tgap/g-alloc.h,
	* tgap/g-connect.c,
	* tgap/g-connect.h,
	* tgap/g-db.c,
	* tgap/g-db.h,
	* tgap/g-defs.h,
	* tgap/g-error.c,
	* tgap/g-error.h,
	* tgap/g-filedefs.h,
	* tgap/g-files.c,
	* tgap/g-files.h,
	* tgap/g-io.c,
	* tgap/g-io.h,
	* tgap/g-misc.h,
	* tgap/g-os.h,
	* tgap/g-request.c,
	* tgap/g-request.h,
	* tgap/g-struct.c,
	* tgap/g-struct.h,
	* tgap/g.h,
	* tgap/gap_cli_arg.c,
	* tgap/gap_cli_arg.h,
	* tgap/hache_table.c,
	* tgap/hache_table.h,
	* tgap/libtgap.so,
	* tgap/maq.c,
	* tgap/maq.h,
	* tgap/maqmap.c,
	* tgap/maqmap.h,
	* tgap/misc.h,
	* tgap/mkdefs.c,
	* tgap/tg_bin.c,
	* tgap/tg_bin.h,
	* tgap/tg_cache.c,
	* tgap/tg_cache_item.h,
	* tgap/tg_contig.c,
	* tgap/tg_contig.h,
	* tgap/tg_depth,
	* tgap/tg_depth.c,
	* tgap/Attic/tg_edit.c,
	* tgap/tg_gio.c,
	* tgap/tg_gio.h,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c:
	(14:18:07) Initial import of tgap. This is for use in Gap5 source
	(which uses libtgap.so), but development on the test programs
	tg_index and tg_view will now take place in this CVS tree instead
	of Sanger's private SubVersion repository. 

	* tgap/tg_iface_g.h,
	* tgap/tg_index.c,
	* tgap/tg_register.c,
	* tgap/tg_register.h,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c,
	* tgap/tg_tcl.h,
	* tgap/tg_track.c,
	* tgap/tg_track.h,
	* tgap/tg_tracks.c,
	* tgap/tg_tracks.h,
	* tgap/tg_utils.c,
	* tgap/tg_utils.h,
	* tgap/tg_view.c,
	* tgap/xalloc.h,
	* tgap/xerror.c,
	* tgap/xerror.h:
	(14:18:08) Initial import of tgap. This is for use in Gap5 source
	(which uses libtgap.so), but development on the test programs
	tg_index and tg_view will now take place in this CVS tree instead
	of Sanger's private SubVersion repository. 

2008-07-14  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c:
	(15:38:06) Fixes to the consensus algorithm for solexa reads -
	specifically calling gaps. 

	* gap5/contig_editor.tcl:
	(15:39:22) Added more use of tg_tcl's interfaces - we can now move
	reads around and insert/delete bases within readings (not just the
	consensus). 

2008-06-27  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c:
	(16:23:43) Improved the consensus algorithm to handle pads. For now
	all pads score a fixed amount and we compare them against bases
	(any type) also at a fixed score. Having done that we then compute
	the base-score from non-pad bases as before, factoring in the
	probability of the base even existing right at the end.
	
	These fixed costs of overcall/undercall are reasonable for solexa
	where such errors are due to PCR and not related to the data
	quality.
	
	For capillary data we need more work to pick appropriate costs. 

	* gap5/contig_editor.tcl:
	(16:29:06) Added keybinding to use the new contig insert and delete
	base method. (Used for inserting columns of pads.) 

2008-05-30  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(14:22:00) Added code to support read-pair data. For now this is
	just the right mouse click in the editor's read name as a proof of
	concept.
	
	Fixed the "is the cursor visible?" code too so set X first, fixing
	an error in working out the Y display point. 

2008-05-27  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consen.tcl:
	(16:25:11) Added code for Gap4's main output consensus function.
	Right now it's in simple mode only with no marking or masking.
	Formats supported are fastq and fasta, with experiment file to
	follow maybe. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/tkEditor.c,
	* gap5/tkEditor.h:
	(16:28:21) Added display of mapping quality to the read-name
	section. 

2008-05-22  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consen.tcl,
	* gap5/consensus.c,
	* gap5/qual.tcl:
	(10:25:34) Implemented a new consensus algorithm using log-odds
	scores. 

	* gap5/consensus.h:
	(10:25:35) Implemented a new consensus algorithm using log-odds
	scores. 

	* gap5/Makefile:
	(10:26:40) *** empty log message *** 

	* gap5/contig_editor.tcl:
	(10:27:55) Changed the mouse highlight on bases to use
	BASE_BRIEF_FORMAT[12] instead of the READ_BRIEF_FORMAT format
	string. 

	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(10:30:26) Make use of the new consensus algorithm, which gives
	quality values so we can now grey-scale the consensus too.
	
	Improved the "brief" status line support, adding a new
	edGetBriefCon for consensus status info too. 

	* gap5/qual.c,
	* gap5/tkEditor.c:
	(10:30:30) Make use of the new consensus algorithm, which gives
	quality values so we can now grey-scale the consensus too.
	
	Improved the "brief" status line support, adding a new
	edGetBriefCon for consensus status info too. 

	* gap5/newgap5_cmds.c:
	(10:32:08) Added in List Consensus Confidence and List Base
	Confidence functions (the latter still needs major bug fixes
	though). 

	* gap5/qualIO.c:
	(10:32:09) Added in List Consensus Confidence and List Base
	Confidence functions (the latter still needs major bug fixes
	though). 

	* gap5/gap.tcl:
	(10:32:44) Temporary hack to change maxseq until I update the code
	to automatically derive it. 

2008-05-12  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/IO.h,
	* gap5/IO2.h,
	* gap5/Makefile,
	* gap5/actf.c,
	* gap5/actf.h,
	* gap5/active_tags.c,
	* gap5/active_tags.h,
	* gap5/Attic/complement.h,
	* gap5/consen.c,
	* gap5/consen.h,
	* gap5/contig_editor.tcl,
	* gap5/contig_id.tcl,
	* gap5/contig_selector.c,
	* gap5/contig_selector.h,
	* gap5/contig_selector.tcl,
	* gap5/cs-object.c,
	* gap5/cs-object.h,
	* gap5/Attic/dependencies,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/extract.h,
	* gap5/find_repeats.c,
	* gap5/find_repeats.h,
	* gap5/find_repeats.tcl,
	* gap5/fort.h,
	* gap5/gap-dbstruct.h,
	* gap5/gap-error.c,
	* gap5/gap-error.h,
	* gap5/gap-if.h,
	* gap5/gap-tcl.h,
	* gap5/gap.tcl,
	* gap5/gap4_compat.c,
	* gap5/gap4_compat.h,
	* gap5/gap4_compat.tcl,
	* gap5/gap_cli_arg.h,
	* gap5/gap_globals.c,
	* gap5/gap_globals.h,
	* gap5/gap_hash.c,
	* gap5/gap_hash.h,
	* gap5/gap_utils.tcl,
	* gap5/hash_lib.c,
	* gap5/hash_lib.h,
	* gap5/init.c,
	* gap5/io-reg.h,
	* gap5/io_handle.h,
	* gap5/io_utils.h,
	* gap5/jog.tcl,
	* gap5/list.h,
	* gap5/list_contigs.tcl,
	* gap5/list_proc.c,
	* gap5/list_proc.h,
	* gap5/list_proc.tcl,
	* gap5/newgap5_cmds.c,
	* gap5/newgap_cmds.h,
	* gap5/newgap_structs.h,
	* gap5/ng_fb_cmds.tcl,
	* gap5/notedb.c,
	* gap5/notedb.h,
	* gap5/qual.c,
	* gap5/qual.h,
	* gap5/qualIO.c,
	* gap5/qualIO.h,
	* gap5/qualP.h,
	* gap5/search.tcl,
	* gap5/sendto.tcl,
	* gap5/stack_dump.c,
	* gap5/stack_dump.h,
	* gap5/tag_checklist.tcl,
	* gap5/tagdb.c,
	* gap5/tagdb.h,
	* gap5/tclIndex,
	* gap5/template_display.tcl,
	* gap5/tk-io-reg.c,
	* gap5/tk-io-reg.h,
	* gap5/tkAppInit.c:
	(11:26:37) Try v2. Initial checkin of gap5 source. Note this
	requires the tgap source too, which will be added soon. (It
	currently exists in Sanger's own SVN repository.) 

	* gap5/tkEdNames.c,
	* gap5/tkEdNames.h,
	* gap5/tkEditor.c,
	* gap5/tkEditor.h,
	* gap5/tman_display.c,
	* gap5/tman_display.h,
	* gap5/tman_interface.c,
	* gap5/tman_interface.h,
	* gap5/trace_display.tcl:
	(11:26:38) Try v2. Initial checkin of gap5 source. Note this
	requires the tgap source too, which will be added soon. (It
	currently exists in Sanger's own SVN repository.) 

	* gap5/contig_editor.tcl,
	* gap5/contig_id.tcl,
	* gap5/gap.tcl,
	* gap5/gap4_compat.tcl,
	* gap5/ng_fb_cmds.tcl,
	* gap5/select_contig.tcl:
	(16:11:41) Minor tweaks to tidy up gap5 distrib. 

	* gap5/tk-io-reg.c:
	(16:11:42) Minor tweaks to tidy up gap5 distrib. 


