April 2016 - 2.0.0b11
==========

Gap5 Updates
------------

* Find Haplotypes function for use within the contig editor.  This
  replaces the old Sort By Sequence mode as well as generating lists
  of read IDs per haplotype.  It also creates a master "haplotypes"
  list of lists.

* Disassemble Readings now handles list of lists (in addition to 
  normal lists of readings), for use with the haplotype output.

* Improvements to Shuffle Pads.  It can now use cutoff/soft-clip
  data to detect concordant soft-clips (regions where all the
  soft-clip data agrees with one another).  It auto-detects likely
  adapter sequences to avoid extending these.

  It also now detects short tandem repeats and handles these more
  carefully.  An STR overlapping a heterozygous indel can be clipped
  back if the read doesn't span the entire STR, in order to not cause
  bias in the copy numbers.

* 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
  (unless Control key is held down while right-clicking).

* Export Contigs has an additional depadded option to use original
  reference sequence coordinates.  Note this isn't 100% robust as it
  depends on which edits have happened, in particular joining and
  breaking contigs.

* Export SAM, BAM and CRAM should now be much faster in excessively
  deep regions with soft-clips.

* The quality values can now be overriden when importing FASTQ or the
  default quality changed when importing FASTA.

* Gap5_cmd has gained Contig Extend and Contig Trim commands.

* Gap5_cmd auto_join now honours the -min_overlap and -max_overlap
  parameters.

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

* Check Assembly text results are now more verbose, for easier
  comparison between databases.

* The current selected reading list in the Contig Editor now shows the
  number of items in that list.

* Highlight Disagreements for cutoff data now defaults to displaying
  foreground coloured differences.

* The consensus algorithm has been tweaked to cope with different
  overcall and undercall likelihoods.  This is tied to sequencing
  technology, for which the default can be adjusted in the Options
  menu.  This uses the @RG "PL"atform heading in BAM files.  The List
  Libraries window permits editing of this field after import.

* Small tweaks to Find Internal Joins block alignments.

* Save Consensus can now optionally emit ambiguity codes for
  heterozygous positions.

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

* Read name indexing should uses less temporary disk space in
  tg_index.

* The multi-column reading list viewer now has Template Status and
  Library Name columns for display/sorting.

* The Template Display now has hot-keys for configurations.  Use
  Shift-Function-Key to remember the current settings and Function-Key
  to switch to that setting.  The File -> Save Settings option will
  write these to your ~/.gap5rc.


Gap5 Fixes
----------

* Fixed a bug where using the contig selector / contig list to fill
  out a dialogue box without then doing anything else at all could
  cause the name to be considered invalid.

* Removed used of some unintialised data in Shuffle Pads.
  - Validate_clip_regions could process annotation record numbers that
    have been removed already.
  - Functions setting sequence clip points could potentially set clips
    beyond the sequence ends.

* Fixed a bin corruption caused by updates to read pairs spanning two
  contigs, eg with one editor open on each end. (See r3996 for the
  long description.)

* Auto-scrolling int he template display now takes into account the
  contig start location.

* Many bug fixes to Shuffle Pads, but there is also a lot of new code
  in there too (hopefully without new bugs!).

* Tg_index -g mode was erroneously adding columns of pads in some
  cases.  Also fixed an issue with tg_index -a -g not working in some
  situations.

* Fixed rounding issues when zooming the template display quality
  plot.

* Some more (rather obscure) gap5 database corruptions have been
  fixed.

* Improved robustness in the presence of database corruptions.  While
  not foolproof, the program shouldn't crash as often.

* Import Reads no longer clears the "readings" list.

* Corrected the (reversed) insertion / deletion percentages in List
  Base Confidence.

* Quality value "*" in BAM is no longer treated as quality -1.

* Fixed a potential buffer overrun in querying individual items in the
  contig selector.

* Overhauled the base insertion and deletion code in the Contig
  Editor, fixing several problems (in particular with Undo).

* Various fixes to keep the contig start / end coordinates correct,
  removing bin errors.

* Fixed issues with annotation positions after using the editor
  commands to move sequences.  Similarly consensus tags at the ends of
  contigs should be more robust when inserting and removing consensus
  columns.

* SAM/BAM export should now correct the mate-pair flags and positions.

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

* Added back fsync to main .g5d file.  This should resolve some
  database corruptions caused by running gap5 on a cluster, saving the
  gap5 database (but not closing gap5) and then manually copying the
  database from a different cluster node.

Gap4
----

* The contig editor should now work better with newer X11 window managers.

* Fixed a bug in showing the reading frame translations.  It
  overflowed the buffer by 1 byte (a ~2002 bug).

Misc
----

* Applied patches from Debian
  https://anonscm.debian.org/viewvc/debian-med/trunk/packages/staden/trunk/debian/patches/spelling.patch?revision=21433&view=markup
  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

* The usual round of compiler warning fixes; mostly missing
  prototypes, casts and unused variables.

  This also 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.

* Added a debugging tool to replay events listed in gap5 log files
  (staden/trunk/src/gap5/replay_log.tcl). 




December 2013 - 2.0.0b10
=============


Gap5 Updates
------------

NOTE: Due to the nature of many of these updates, the Gap5 database
has had the internal version number increased. This means that while
the new Gap5 can read old Gap5 databases, old Gap5s will not be able
to read databases created by the latest Gap5 and/or Tg_index.

* Find Internal Joins

  - This has had a major face lift due to the addition of several new
    features. It uses a tabbed notebook now to avoid the dialogue
    growing excessively.

  - More join filtering; by min/max (joined) depth, maximum overlap
    length, containments vs end/end joins, read-pairs and uniqueness.

    Uniqueness here refers to only having one link out from each
    contig end, for example a contig end matching 2 or more other
    contigs would not be considered as unique.

    For read-pair filtering each potential match is checked to ensure
    there are both a minimum number of read pairs and that a minimum
    percentage of contig-spanning read pairs are between the two
    specific contigs.

  - Better control over which contigs to compare.  We now have two
    sets of contigs, A and B, and compare all contigs in set A with
    all in set B. This is a generalisation of the old "all vs all" and
    "single vs all" modes.

  - The Hidden Data search mode now works.

  - Fewer hits missed in the quick alignment mode. In particular some
    blatant exact matches were sometimes missing.

  - Small speed increase.


* Contig Editor

  - Realign Selection feature.  Underline a region and this will
    realign it against the consensus.

  - The Tag Editor now has Copy and Move buttons, as per Gap4.
    These even allow moving tags between different editors.

  - The names panel now allows bulk selection with button-1 click
    followed by Shift-button-1 to select all reads between the two
    clicked points. This is particularly powerful when combined with
    the various Settings -> Group By orderings.

    When selecting names we can now also (de)select the mate-pair at
    the same time by using Control+click instead of normal unmodified
    clicks. (This is also listed in the right-click pop up menu.)

  - We can now control which list is being updated when clicking on
    read names. The editor also shows the size of this list and has
    options to load, save, delete and clear.

  - The Settings -> Group By dialogue now has a "by sequence"
    mode. This attempts to sort sequences by similarity to the
    underlined (selected) sequence fragment.

  - The sequence search now permits searching within individual
    sequences, instead of only within the consensus.

  - More key bindings:
    - Keypad Enter is now an alternative for the Return key.
    - Control-S within the search window is the same as next search.
    - Control-L and Control-R now move pads under the editor cursor
      left or right. Alt-L/R is similar, but for any base type (be
      careful).
    - Control-Z is Undo
    - Shift-Insert, Shift-Backspace and Shift-Delete act as per their
      unmodified key presses but keep the right hand portion of the
      alignment stationary, while moving the left portion instead.

  - Holding down keys in the editor and allowing auto-repeat to
    operate should no longer run on after the key is released.

  - We can now bring up the Template Display (via the Commands menu)
    centred on a specific consensus base.

  - Shuffle Pads can now operatate over regions of a contig instead of
    the entire thing. This is also available within the editor by
    selecting (underlining) a region and using the Commands menu. The
    scoring function has been slightly updated to provide better
    alignments. Also sped up Shuffle Pads (typically 4-5x faster, more
    so on deep data).


* Template Display

  - We can now selectively filter by library.

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

  - Tags/annotations can now be displayed as their own track (they are
    also visible in the Contig Selector).

  - Improved the calculation of read-pairs. It now considers the bulk
    of the library to work out the expected orientation and insert
    sizes.

  - Spanning read-pairs now get a variety of colours, determined by
    the other pairing contig record. This helps to visually identify
    when read-pairs link to a mass of contigs or just 1 or 2 specific
    contigs.

  - Substantial speed increases in some modes, especially "accurate
    mode".  This has been achieved by caching the read-pair
    locations.  This information can become outdated by joining,
    breaking and other edits, but will be automatically recomputed as
    needed.  (Hence the template display speed can temporarily be
    variable while it's recomputing this cached information.)

  - Zooming via the mouse wheel is now centred on the mouse cursor.
    Mouse wheel is now also support on Windows (also in the Contig
    Editor).

  - The default mapping quality colouration is now minimum instead of
    average.


* Contig Selector / Lists Contigs

  - This now shows clipped lengths. The clipped contig lengths are
    also displayed in the List Contigs window.

  - There are now options to save and load plots, tying in with the
    "gap5_cmd fij" command too.

  - There are now rudimentary tools for grouping contigs into
    scaffolds in the List Contigs window. Internally we also support
    contig links, potentially allowing a full graph (as in FASTG), but
    this is not yet exposed to the GUI.


* Lists

  - Created an extended version of the List viewer for the readings
    list, showing location of both ends of a read-pair and allowing
    collation by pairing contigs. This provides an easy way to select
    and produce sub-lists. Also updated the general list handling to be
    more robust when containing readings or contigs that have been
    removed.

  - Added an in-memory list called "new_contigs". This is automatically
    appended to for each new contig we create, such as by Break Contig,
    Disassemble Readings or assembling in new data.

  - The Search Sequence Names function now generates a list of "#num
    name" instead of "name", correctly disambiguating cases with
    duplicate reading names.

    Similarly with Sequence Search and the seqs_hits list.


* Input/Output

  - There are now File -> New and File -> Import Sequences commands.
    These allow creation of new databases without needing to run
    tg_index on the command line (although it may still be desirable
    due to not needing a GUI running.)

  - The gap5_export, gap5_consensus, gap5_check (etc) commands are now
    merged into a single gap5_cmd command using the gap5_cmd
    <command_name> <arguments> syntax.
    
    Added shuffle_pads, fij, auto_join and auto_break to the available
    sub-commands.

  - Fastq export now automatically strips pads.

  - ACE import now handles WR{} records, treats clip points -1
    as unaligned data, and also handles the lack of DS lines.

  - Overhauled the GFF import and export code: it now works with gzipped
    files; GFF tags are now mini-GUIs controlled by the #!acdtag syntax
    in the GTAGDB; Importing is more liberal when given malformed escape
    codes.
  
  - Export Sequences can now also export in BAM and CRAM
    format. When exporting in CRAM the consensus sequence is embedded to
    act as a self-reference.
  
  - Temporary files used by tg_index can now honour the TMP_DIR and/or
    TEMP environment variables. This may be helpful if /tmp is too
    small.  Also changing the sorting algorithm to no longer depend on
    the external Unix "sort" program.
  
  - Improved on attempts to auto-detect manual removal of the BUSY lock
    file and updating of the gap5 database from multiple simultaneous
    programs. If this happens the programs should abort before
    corrupting the database.

  - Tg_index should be more efficient when indexing the reading names.

  - Gap5_cmd now opens the database in read-only mode when appropriate.


* Other new functions / commands

  - "Extend Contigs". This looks at the cutoff data at the
    ends of contigs and un-hides portions if the bulk of the cutoff data
    is in agreement with each other.

  - "Pair Reading List" in the Lists menu. This takes a
    list of read IDs and produces a new list containing those reads plus
    their mate-pairs.

  - New function "Bulk rename contig".  This permits, for example,
    renaming from contig* to Contig\1 (\1 being whatever the first *
    matched in the pattern) or contig* to Contig_%06d with
    auto-generated names (6 digits with leading zeros).
  
  - New function "Reading #numbers to names" list option.
  
  - New function "Delete Tags" option to remove all tags of a specific type.

  - New "Contig Trim" function to clip back straggly low-depth contig
    ends.

  - Gap5_cmd auto_break: automatically break misassembled contigs based
    on a whole slew of alignment / read-pair metrics.

* Miscellaneous

  - Internally we now group 1024 contigs into a single ContigBlock,
    reducing disk I/O times and speeding up the Contig Selector.

  - Various speed increases to Delete Contig, Disassemble Readings, Find
    Read Pairs and the Contig Selector.

  - Gap5_cmd now opens the database in read-only mode when appropriate.

  - Tg_index should be more efficient when indexing the reading names.


Gap5 bug fixes
--------------

Many internal bug fixes not so easily describable have been omitted
from this list as they have no single apparent end-user affect.

* Added numerous robustness checks to prevent crashes.

* Removed a few memory leaks.

* Fixed a large category of bugs that surfaced when closing one
  database and opening a new one without shutting down Gap5
  inbetween. 

* Fixed a crashes in the contig editor and join editor when exiting
  with the trace display open.

* Editor search by position now works when the cursor is not on the
  consensus.

* The editor was sometimes reporting the << and >> sequence
  orientations incorrectly after joining. This could also occur when
  exporting back to SAM format.

* Editor insertion/deletion into tags now correctly works with Undo in
  all cases.

* Renaming the contig in the editor and then using undo was causing
  problems with the contig name index.

* Bug fixes to contig shift (Control Left/Right arrow in the editor),
  which could occasionally cause bin start/end errors.

* Fixed sporadic crashes after lots of contig joining.

* Reference position markers when updated by Join Contigs should
  behave better; previously they sometimes caused bin "used start/end
  range are incorrect" warnings.

* The Join Editor when invoked from a Find Internal Joins line in the
  contig selector should now come up at more sensible positions,
  especially in the case of reverse alignments.

* Fixed an error causing Find Internal Joins to miss some blatantly
  obvious joins. Also tweaked the block-stitching heuristics;
  typically finding 2% more joins, with slightly lower percentage
  mismatches.

* Fixed an issue with consensus caching whereby after joining we would
  sometimes get incorrect consensus being used / exported. Caching was
  also applying multiple times over, causing slow downs. In a related
  fix the last base would (rarely) be omitted.

* Fixed a few errors in the consensus caching code.

* Extra checking when importing and exporting annotations, preventing
  crashes when faced with corrupted data.

* Export Contigs is now more robust to various sorts of data
  corruptions, making it a more viable tool for reconstructing dataabses.

* Importing MAQ and Fasta data no longer leaves the template name with
  random values. Also fixed potential crash in MAQ import.

* Fixed error in CAF files where the last quality value per
  sequence could be loaded incorrectly.

* Fixed SAM/BAM output when requesting to fix mate-pair data and only
  exporting a single contig.

* More robust handling of SAM cigar strings starting with I or P
  operators.

* CAF/AFG bug fixes when reading lines longer than 32Kb.

* Fixed errors in Map Reads / Import Reads, also updated the name to
  match the newer bwa options.

* Saving consensus quality would sometimes produce incorrect output
  due to qualities being interpreted as UTF8 codes.

* Attempting to save a consensus from a list containing duplicate
  contigs (specified by different reads within the same contig) no
  longer creates duplicate consensus output.  The contig names are now
  also output instead of #number.

* Check Database can now fix tags that extend beyond the contig extents.

* Break Contig was sometimes failing after making correctly making a
  break. When faced with very long sequences it could also break into
  too many pieces.

* Break contig now ensures the cached number of sequences and
  annotations are always updated correctly in the child contigs.

* Disassemble Readings can no longer corrupt consensus annotations.

* Disassembling a set of reads where some reads are invalid (no longer
  exist) no longer aborts mid-way.

* Fixed a memory corruption bug in Shuffle Pads that could cause
  crashes. It is also more resilient to errors in the input data.

* Shuffle Pads would sometimes leave tags in the incorrect location.

* The Template Display has better analysis of the consistency of
  templates that span regions that have been joined together.

* Fixed crashes in the Template Display when making joins.

* Fixed occasional Template Display crash during Y zooming.

* Double clicking on a hyperlinked contig name no longer crashes when
  that contig doesn't exist any more. Similarly attempting to edit a
  disassembled/deleted contig via #number or =number no longer dies.

* The Contig ID portions of dialogues now always update the start/end
  ranges correctly when selecting new contigs.

* Fixed occasional errors when updating the name and contig B+Tree
  index, which showed up as being unable to edit contigs by name.

* Fixed a bug in the Sequence Search function which caused it to find
  the same match multiple times if the match started on a pad.

* Fixed off-by-one error in Find Repeats and also prevented it from
  occasionally finding matches off the ends of the contigs.

* The Results Manager was displaying incorrect #ID values.

* Fixed a bug in decoding of PT/CT tags in SAM files when multiple
  tags are combined into a single auxiliary field.

* Attempting to open a previously deleted contig via #number should no
  longer apparently work.

* Many code tidyups to remove compilation warning messages.

* Improved compilation on Ubuntu 11.10 and RedHat.

* The code should now compile with zlib-1.2.6 and newer.

* Fixed a bizarre Template Display red/blue colour swap on Windows.

* More hardening against corrupted databases leading to crashes.

* Bug fixes to Find Internal Joins in end-all mode and checking for
  spanning read pairs.

* Fixed various corner cases in using Undo after base deletion in the
  contig editor (eg when entirely removing a read).

* Fixed bug in Contig Extend where zero base extension matches could
  lead to sequence trimming.

* Export Contigs to SAM works better with read-names containing
  slashes.

* Delete Contigs now flushes per contig, reducing memory usage.

* Break Contig now duplicates consensus tags when they overlap both
  left and right contig; this is how Gap4 worked too.


Io_lib Updates
--------------

* New tool - scramble.  This converts between various NGS formats
  including SAM, BAM and CRAM.


Misc
----

* Pregap4: Fixed vector_clip crash on exit caused by tk_utils vs
  text_utils in linking.
  
* Pregap4: Interactive Clipping now copes with spaces in filenames.

* We now support cross-compiling of windows binaries from linux.

* Tcl/Tk 8.6 is now used.

* Better support for Windows MinGW.

* Improved application launcher on MacOS X.

* Removed deprecated tg_view application.


-----------------------------------------------------------------------------

5th Dec 2011 - 2.0.0b9
============

Gap5 Updates
------------

*	Code tidy up - removed old defunct C header files.

*	Minor edits to allow the package to use Tcl v8.5 instead of
        8.4. (Locally we're still using 8.4 on unix, but the windows
        build is on 8.5 now.)

Gap5 Fixes
----------

*	Fixed parsing of quotes in CAF files. It's still not a full
        CAF parser, but sufficient for observed real-world data. Also
        fixed CAF parsing on windows by opening in binary mode.

*	Fixed key=value parsing in the new SAM tag format.

*	Removed "default" as the default tag comment.

*	Fixed a recent bug introduced by allowing contig renaming. The
        contig names were being added twice to the index, causing
        problems when later removing them.

*	Force the mapping quality for fasta/fastq imports to 0 rather
        than leaving it undefined.

*	Bug fix to the code that invalidates the consensus cache.


22nd Nov 2011
=============

Gap5 Updates
------------

*	Simplified the Save Consensus menu and fixed mishandling of
        error dialogues.

*	Renamed Disassemble Contigs to Delete Contigs and rearranged
        the Edit menu a bit.

*	Added the ability to rename contigs and to change their
        starting location.

*	Improved (hopefully) the choices made in the fast-mode Find
        Internal Joins. This should remove the occasional missed
        match.

*	Code reorganisation: removed function io-reg.h and merged in
        tg_register.h. (Also fixed restriction enzymes registration in
        the process.)

Gap5 Fixes
----------

*	Protect against invalid contig data in get_contig_name()
        function. This should avoid a crash in certain inconsistent
        databases.

*	The editor backwards sequence search was missing maybe 1 in
        1000 searches.

*	Fix to the editor From File search so it only steps through
        entries for the current contig.

*	Attempt to avoid crashes when running out of memory in
        edview_visible_items().

*	Fixed bug in template depth display due to the inconsistant
        colour being set to zero.

*	Added back the count of the number of sequences indexed in
        SAM (tg_index). Somehow this got lost in a recent update.

*	More unpadded coordinate fixes (padded calculation this time).



4th Nov 2011
============

Gap5 Fixes
----------

*	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 fixes both GFF export and GFF import. (Note it breaks it
        for users expecting gap5 to preserve reference based
        coordinate systems.)

*	Replaced RT with CT for consensus tags in SAM I/O.

*	Fixed Check Database in fix mode to actually fix bin parenting
        issues, rather than failing to commit the changes.

*	Improved error handling in contig_seqs_in_range2.


3rd Nov 2011
============

Gap5 Fixes
----------

*	Fixed potential bug in joining contigs causing it to fail to
        delete the old right hand contig. (We have seen this, but not
        100% sure this fixes it.)

	Also updated Check Database to be able to fix these problems.

*	Fixed a rather common crash & assertion failure in the contig
        editor (caused by mismatching reference counting on
        copy-on-write objects).

*	Robustness improvements: consensus when faced with corrupted
        databses and the contig selector when trying to draw zero
        contigs.

*	Disassemble Contigs now correctly unpairs reads too. This was
        leading to crashes before. Also this function now correctly
        flushes changes to disk.

*	Shuffle Pads should no longer cause some sequences to get out
        of alignment.

*	When quitting the Join Editor and not making a join, it would
        only offer to save changes to 1 of the 2 contigs. It now does
        both.

*	The differences line in the join editor should no longer find
        false matches when searching backwards.

Misc
----

*	Bug fixed the "File does not exist" error dialogue


1st Nov 2011
============

Gap5 Updates
------------

*	Added an option to Break Contig at a specific position within
        the contig editor.

*	Tag directions are now stored in the database, and can be
        edited/set using the Tag Editor within the contig editor.

*	tg_index now has a "-v version" option to request generating
        older format gap5 databases.

*	The contig editor now allows "n" or "-" to be typed in. Also
        added Insert keybinding as for insertng pads ("i" still works).

Gap5 Fixes
----------

*	The recent consensus change to call Ns was bugged and could
        cause them to appear elsewhere. Check Database in fix mode
        will now also clear any cached consensus.

*	Fixed a bug in Export Contigs to SAM format involving the
        handling of template names. It could sometimes cause a crash.

*	Fixed issues with tag parsing in SAM.


25th Oct 2011
=============

Gap5 Updates
------------

*	Protect against attempts to create annotations off the ends of
        contigs (in cutoff).

*	New function: Disassemble Contigs (needs more testing).

*	New function: Lists -> Contigs to Readings

*	Bulk trimming in the editor using < and > bindings.

*	Added grouping by base type to the contig editor.

*	Removed contig editor's cache of the contig structure. This is
        just an internal change, but it avoids a potential cause of
        inconsistencies.

*	Added the ability to copy and paste contig names as well as
        reading names from the editor window. Also rebound Button-2 to be
        copy by #number, with Button-1 still being "name".

Gap5 Fixes
----------

*	Major Join Editor bug fix. If editing cursor is not visible
        and lock mode is not enabled, the save while joining caused
        the contigs to shift positions, breaking alignment.

*	Fixed the consensus when consisting soley of reads of N.

*	It's no longer possible to attempt a join to itself. (Could be
        achieved before by using multiple join editor windows up
        simultaneously.)

*	Improved robustness of Disassemble Readings when given a list
        of sequence record numbers that don't exist or aren't sequences.

*	Fixed editor redisplay bugs when edits are made in a join
        editor being updated in another window.

*	Fixed typo in editor.


18th Oct 2011
=============

Gap5 Updates
------------

*	Added the ability to copy and paste contig names as well as
	reading names from the editor window. Also rebound Button-2 to
	be copy by #number, with Button-1 still being "name".

Gap5 Fixes
----------

*	Fixed a Disassemble Readings corruption that could leave
        zero-read contigs in some cases.

*	Added No.Annotations to the copy buffer of the List Contigs
        window.

*	Fixed some caching bugs with the B+Tree code, showing up as
        crashes or corruptions.

*	Bug fixes to the new SAM tag exporting.
	- Blank tags no longer get an additional '|' character.
	- Consensus tags are now sorted correctly, removing the need
	  to use samtools sort.


13th Oct 2011
=============

Gap5 Updates
============

*	The contig editor now has functions to select and deselect all
        sequences at a particular consensus column (or overlapping or
	within a given range).

*	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.

*	Added Check Assembly function. This compares the used/visible
        portion of a sequence against the consensus to identify
        sequences that align badly. (It doesn't yet have the gap4
        functionality of aligning the cutoff data too.)

*	Added experimental code for importing and exporting tags in
        the latest SAM format. This is still ongoing work, and an
        ongoing discussion on the samtools-devel mailing list.

Gap5 Fixes
==========

*	Using #<seq_number> in the contig_name_to_number() function no
        longer crashes gap5. Instead it figures out what you meant and
        converts the sequence number to a contig number.

*	Removed a source of Check Database crashes, although as yet I
        don't understand the underlying cause.


7th Oct 2011
============

Gap5 Updates
============

*	The contig editor has two new search modes: "depth <" and
	"depth >" to look for low and high depth regions.

*	Added a Search From File editor search mode. This is identical
        to the Gap4 equivalent and reads the same format "gapNav"
        files.

*	Improved robustness of databases; crashes while flushing
        writes should now roll back to the previous state rather than
        giving a corrupted DB.

*	The List Contigs window now has a Control-A keybinding.
        Additionally Copy and Paste should now copy all selected
        rather than just the first 4Kb or so.

*	Improved support for "*" in sequence records within SAM. (They
        get treated as "N" for now, in the absense of any reference.)
        Also improved error handling for malformed files.

*	Increased the default size of the tag editor window. Also
        disabled the line wrapping, so the horizontal scrollbar should
        be used for long lines.

Gap5 Fixes
==========

*	The editor Join To system will now automatically complement
        contigs if required.

*	The join editor now has the top and bottom contigs correctly
        ordered, once again agreeing with the title bar ("a / b"
        meaning contig a on top and contig b on the bottom.

*	The contig editor should no longer keep claiming you have
        changed data even when you simply scroll along.

*	Fixed a memory corruption in the consensus caching code,
        caused when a bin considerably shrinks.

*	The tags added by the Find Primer-Walk function in the editor
        are now positioned correctly for both strands (reverse was
        incorrect before).

*	Added back the ability to use F11/F12 in the editor for quick
        tag editing. This was accidentally lost in the 30th Sep
        release.

*	Fixed a bug that caused empty Tk error dialogues to appear
        when clicking on locations with no sequence data within the
        contig editor, but only after attempting to edit a contig with
        an invalid name.


Sep 30th 2011
-------------

Gap5 Updates
============

*	First implementation of Group Readings in the contig
        editor. This provides options to vertically reorder the
        sequences by a variety of primary and secondary collations.

*	When invoking the editor by reading name it now brings the
        editor up on the first visible base of that sequence, instead
        of the first potentially-clipped base.

*	Added a Remove Pad Columns function. It's a faster and simpler
        alternative to Shuffle Pads, designed specifically to only
        remove consensus columns entirely made up of pads.

*	The Restriction Enzyme Plot from gap4 has been added to
        gap5. This works as expected in gap4 except for the ability to
        create tags, which can be added at a later stage if desired.

*	Exporting in SAM format now provides an option to use unpadded
        reference coordinates rather than the old mode of padded
        only. This is more alike the pair-wise alignments that are
        expected from short-read aligners.

*	The Editor search dialogue window now has Page Up and Page
        Down keybindings to perform previous and next search (as per
        Gap4's key bindings).

*	The editor Trace Display is now aligned against
        sequences. This means scrolling and dragging also works. In
        addition the Lock button has been fixed.


Gap5 Fixes
==========

*	Fix to a 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.  We also now check more carefully to prevent similar
        mistakes.

*	When using dialogues asking for a single contig and a range
        within it (eg Save Consensus) it now correctly sets the
        default start and end positions based on the clipped consensus
        coordinates, instead of just 1 to contig-length.

*	It should no longer be possible to duplicate contig names when
        importing new reads.

*	Lists containing the same contig multiple times (either
        explicitly or implicitly by using different read IDs within
        the same contig) are now filtered out in functions taking
        lists of contigs (eg Find Internal Joins).

*	Remove Contig Holes now shuts down editors and updates the
        Contig Selector upon completion.

*	Fixed various disassembly related 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 assertion failures in the next save.

        - Better error handling for when faced with a record number
          that no longer exists (due to the bug above). We now bring
          up error dialogues instead of crashing.

*	Check Database on a single contig now honours the "fix"
        option. It also now reports the number of attempted fixes to
        problems found.

*	Exporting a portion of a single contig in Export Sequences now
        correctly outputs all the annotations, even if they're outside
        the desired range (by attached to readings that are
        overlapping the range).

*	Removed extraneous newline that sometimes appears in fasta or
        fastq outputs.

*	Unpadded consensus coordinates in the contig editor now always
        start at base 1, regardless of the displayed unpadded starting
        position.

*	Fixed some editor sizing issues when using non-standard font
        sizes. This was showing up as the consensus line sometimes
        being invisible in the Join Editor.

*	Removed a few gap5-cache related bugs (assertions,
        corruptions, crashes).

*	Complemeted contigs in the Template Display sometimes wrongly
        caused templates to be flagged as inconsistent. Now fixed.

*	Fixed a bug with Break Contigs sometimes causing the contig
        start and end points to be inconsistent. (Usually showing up
        as scrolling issues.)


Sep 14th 2011
-------------

Gap5 Updates
============

*	Searching by sequence name or #number in the editor now
        positions the editing cursor on the first used base instead of
        the first base (whether or not in cutoff data).

*	Any case where the editor cursor goes off screen due to using
        left/right arrow keys or performing a search now scrolls the
        editor so the last 10 characters are now the first 10
        characters, meaning it jumps by almost one screen
        full. Previously it scrolled such that 10 more characters
        would appear. 

*	We now disallow tags at the ends of contigs in the "cutoff"
        portion of a contig. Ie where sequence cutoff data resides,
        but no more non-cutoff bases exist. It is still permitted to
        have tags within a "hole" inside a contig, just not at the
        ends.

*	The contig editor width and height and the horizontal position
        of the name / sequence split pane is now remembered if the
        Settings -> Save Settings menu item is used.

Gap5 Fixes
==========

*	Many fixes to Disassemble Readings, including data
        corruptions, tag misplacements, and occasionally incorrectly
        complementing sequence data causing misalignments.

*	Major overhaul of insertion and deletion of pads in the
        consensus. These used to insert to or delete from every
        sequence overlapping that point regardless of whether that
	position was in the sequence cutoff data. Now we only edit
        sequences that overlap in used non-cutoff data.

*	Several more fixes to Break Contig including reference
        counting errors (which usually showed up as assertion
        failures). Also fixed tag misplacement errors here too.

*	Internal change to storage of annotations. If attached to a
        sequence they now should always be placed in the same internal
        contig-bin as their associated sequence. This fixes a number
        of bugs and simplifies some algorithms. Older databases are
        not restricted in this manner and so the change is backwards
        compatible.

*	Moving sequences could sometimes cause them to flip
        orientation.

*	Avoided a crash while making a join in the Join Editor. I'm
        not sure of the exact cause, however sometimes we received a
        message to move the cursor after the join but with no data
        found at that point now.

*	Sequences imported via Assembly -> Import... now have their
        sequence names indexed, meaning we can search for them by
        name.

*	Fixed some reference counting bugs while using the Contig
        Editor and Join Editors. These typically showed up as crashes
        and assertion failures.

*	Removed a memory overrun when running Find Internal Joins or
        Find Repeats with lots of small contigs.

*	Complement Contig via the List Contigs window now works.

*	The program now knows the proper filename of the database when
        opened using the File -> Open dialogue and browsing to another
        directory. This was causing errors in Check Database.


Aug 11th 2011
-------------

Aug 1st 2011
------------

Gap5 Updates
============

*	Further improvements and checks in Check Database; more checks
        for bin layouts and parentage, can automatically upgrade bins
        to v2 database format (with nanno set), checking of in-memory
        cached data vs on-disk data.

*	Break Contig now has an option to further split the right-hand
        contig up if the break caused "holes" to appear.

*	Also added a Remove Contig Holes command to break contigs
        around sequence holes.

*	Removed a lot of the debugging output. It can be reenabled by
        running "gap5 -debug 1".

Gap5 Fixes
==========

*	Fixes for building on MacOS X.

*	Fixed a major issue with using Save in the Contig Editor
        followed by continued editing. The items saved then became
        "live" and any changes made could end up being automatically
        written to disk regardless of whether the user did a second
        save.

*	Worked around issues with metacity window manager and refusals
        to raise windows. Ensure that as many dialogues as possible
        are correctly parented, otherwise metacity can gift focus to a
        window that isn't even visible. (This is a WM bug.)

*	The lowest level of Gap5 I/O code no longer simply aborts on
        an error, but now whinges instead and passes the error up one
        level. (The calling procedure may still abort though.)

* 	Fixed parsing errors with CAF format; quality lines starting
        with white space are no longer a problem.

*	Removed crashes when parsing malformed FASTA files.

*	The contig-hole detection in Disassemble Readings now checks
        "visible holes" by looking at the sequence cutoff values,
        rather than a hole being defined as no data at all.

*	Further break contig bug fixes:
	- Overlapping bins were causing a variety of issues, from
          miscalculating contig start/end to moving annotations
 	  incorrectly.
 	- Improved tag clipping at the ends of contigs.
	- Fixed cache reference counting issues.
	- Fixed out by one error in determining whether to move data
          to right contig.

*	Several bug fixes involving detection of empty bins.

*	Removed various bugs with allocating and deallocating tags
	(caused by misunderstanding my own code and the meaning of the
        "idx" field).

*	Removing tags via the editor was still leaving them in bin
        hierarchies, causing corruptions in some cases. Fixed.

*	Fixed issues with complementing of cached consensus sequences.


July 20th 2011
--------------

Gap5 Updates
============

*	Added a gap5_check command. This is a CLI version of Check
        Database.

*	Improved debugging tools and checking for validity of data via
        checksums.

*	Code reorganisation: merged the tgap and gap5 directories for
        reasons of sanity and removal of circular dependencies between
        the two.

*	The Contig ID component of dialogues now uses the visible
        start/end portion of a contig instead of just going from base
        1 to the contig length. This mainly prevents cases of runs of
        Ns appearing on the ends of consensus when saving just a
        single contig.


Gap Fixes
=========

*	Many more bug fixes to break contig.
	- Breaking at a position where the right contig ends before
	  base 0 (so entirely negative, prior to shifting) was not
	  setting contig boundaries correctly.

	- Incorrect computation of annotation start coordinates,
 	  meaning we could accidentally move them to the right hand
 	  contig when they overlapped the left hand contig. 

	- Was Incorrtly claiming bin is empty when it infact is just 1
 	  base long (eg contains only a single bp tag).

	- More issues with single bp tags being the only thing in a
 	  contig: another < vs <= bug.

	- 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.

	- Fixed an issue where cached consensus sequences were
          sometimes counted in the number of sequences within a contig.

	- Added a check to see if breaking at this position will
	  produce a contig with zero sequences. If so abort early
	  rather than create an inconsistency.

	- 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.

*	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.

*	Fixed a contig editor bug where attempting to remove a column
        in the contig cutoff regions (before first or after last
        visible base) would work if the first/last base was "*".

*	Shuffle pads no longer dies when the contig starts at a negative
	position.

*	Inserting columns in the consensus now behaves better at
	extreme places (eg 1st base in far-left cutoff).

*	Fixed a bug when writing bins that previously contained data
	but no longer do.

*	Fixed crashes in Complement Contig in some cases (typically
        very deep data).

*       Added bin simple loop detection in the various functions to
        increment or decrement the number of seqs, annotations and
        reference position markers. (This shouldn't happen, but it's a
        robustness improvement.)

*	When removing a consensus column causes removal of an item
 	from the contig, we now also update the bin and contig extents
 	incase the removal changed them.

	Similarly inserting columns could sometimes fail to update
 	contig extents.


July 8th 2011
-------------

Gap Fixes
=========

*	Improvements to the check database code - more checks, more
        fixing.

*	Tags are now displayed in strict left to right order rather than
	the broken right to left order as before.

*	Fixed (contig) reference count leaks. Harmless?

*	Added protection against malformed tags in SAM files. We trim
        them to overlap sequences if they go off the edge.

*	Deleting consensus bases such that entire tags or sequences
        are removed now correctly updates no.seq and no.anno fields in
	the bins.

*	Fixed a bug in undo of tag removal in the contig editor
	(again).

*	Added write-lock to bins when removing items. This could cause
	some data to not be written back to disk if unmodified by
	another function, or for editor edits to be pushed to main
	gap5 I/O without hitting Save. (A potentially major corruption)

*	Fixed bugs in range updates when inserting and removing to
	sequences. (Minor issue)

*	Fixed a major corruption involving reuse of bin-range
	slots. This could cause overwriting of some data once we've
	managed to remove 2 or more items from a bin and then start to
	reuse those slots.

*	Many bug fixes to editor Undo, especially in relation to
	inserting and removing columns at the first and last bases in
	sequences or the contig.

*	Fixed a bug in reference counting in the consensus algorithm,
	sometimes showing up as crashes in gap5_consensus tool.

*	Fixed a memory corruption when we remove the last item from a bin.


July 1st 2011
-------------

Gap5 Updates
============

*	Added a Check Database function. It's slow, but a useful
        sanity check for me during development, and maybe for others.

Gap5 Fixes
==========

*	Importing from fasta files should be more robust now.

*	Fixed a stack corruption when importing from ACE. Sequences
        imported now also have a mapping score of 255.

*	Fixed a memory corruption in the new consensus algorithm.

*	Removed several reference count leaks in List Contigs, Save
        Consensus and consensus iterators. This included things like
        the consensus computed for Find Internal Joins.

*	Improved handling of contig identifiers: fixed a crash when
        given #<rec> where <rec> is neither a contig or a reading;
        contig lists now work when the entries are sequence names.

*	The contig editor now correctly responds to notifications that
        the program is trying to shut down, asking the user if they
        wish to save. Formly it would sometimes simply crash.

*	Fixed another Break Contig bug that caused data to be moved
        within the contig rather than starting at base 1. This only
        happened after some combinations of complementing and joining.


Jun 23rd 2011
-------------

Gap5 Updates
============

*	Sequence Search (main menu, outside of the editor) no longer
        brings up a separate editor every time the Next button is
        pressed, instead preferring to reuse existing ones if
        available. It also underlines the matched sequence in the
        contig editor.

*	The contig editor window now colours the sequence names
        according to the consistency/validity of the templates. The
        colours are:

	  white = ok pair
	  blue = single ended
	  orange = pair, spanning contigs
	  red = inconsistent orientation
	  grey = consistent orientation, but distance too large or too
	  small.

        This also required a few tweaks to the colouring of the name
        display and UI controls. The Quality button now only turns
        quality grey-scales on and off for sequence bases, not the
        mapping qualities. Instead the Settings menu has two radio
        buttons to toggle between template status and mapping quality
        for the names panel. This only has an effect when in Pack
        Sequences mode; the one sequence per line mode has room to
        display both pieces of information and so always does so.

*	Implemented a simplistic approach for computing unpadded
        consensus coordinates. This uses the cached consensus
        sequence, which can now be updated from within the contig
        editor too (so it may ask to save changes even when it's
        simply to add more cached data), so it is far faster than
        gap4.  However it is still linear time based on the number of
        fragments and consensus length.

	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.

*	The Template display now has various quality plots. They're
        turned off by default as they incur a substantial speed
        penalty.

*	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.

*	Added the first draft of a Shuffle Pads algorithm, much the
        same as in Gap4.

*	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.)  Plus the editor cursor of an inactive editor in a
	join-editor pair is no longer solid, when visible. Instead it
	is a hollow square.
	  
	Also fixed control-S/control-R so they don't bring up a separate
	dialogue window to just hitting the Search button.

*	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.

*	Added SVN revision numbers to the version strings reported by
        most of the main programs.

*	Removed error signal handlers in gap4 and gap5 so that crashes
        are easier to debug on linux. For some reason calling abort
        from a signal handler often ends up with a stack that gdb will
        not list.

Gap5 Fixes
==========

*	Adding new sequences to complemented contigs could create
        incorrect sequencing positionings if the smallest bin had
        grown, triggering a new leaf node. Also correted some
        house-keeping coordinates (start/end used) for complemented
        bins.



26th May 2011
-------------

Gap4 bug fixes
==============

*	Fix crash in Find Internal Joins when faces with lots of small
        contigs and insufficient reserved space for the consensus.


Gap5 Updates
============

*	Major overhaul of the consensus algorithm. It now allows for
        the possibility of SNPs. Also added a discrepancy calculation
        where it compares the number of observed differences against
        the expected differences given the quality scores.

	The editor has several new search tools relating to these
	features.

*	Added editor Join To menu command for read-pairs that span
        contigs. The Go To menu item has also been updated to report
        the observed insert size.

*	Added an editor method to shift entire portions of an alignment
	left/right.

*	Bringing up the join editor should now set the editing cursor
        to the correct sequence.

*	Increased the word size in Find Repeats and some other
        optimisations - now dramatically faster, often 100x
        improvement.

	Removing the Contig Selector plots is also now far faster
        (approx 1500x faster in the extreme case of 1 million repeat
        hits). 

*	Further improvements to Find Internal Joins speeds. 

*	Various minor compilation improvements, removing warnings and
        fixing compilation issues with gcc 4.4.4 onwards and use of
        _FORTIFY_SOURCE.


Gap5 Fixes
==========

*	Removal of bugs in sequence insertion/deletion code, causing
        assertion failures. Typically observed when inserting entire
        columns of pads.

*	Create Tag now works on both editors in a Join Editor.

*	Fixed issues when shifting individual sequences left/right in
        the editor.

*	Cut and pasting of complemented sequences now works.

*	Improved robustness of specifying malformed contig names (plus
        allow #contig_rec in addition to the old =contig_rec syntax).

*	Gap5 now checks the master database version and will no longer
        automatically start updating individual records to the latest
        encoding/formats if the database is an older format. This
	allows testing of newer versions without risking the inability
        to revert back.


21st Mar 2011
-------------

Gap5 updates 
============

*	We now keep track of original reference positions during a
        SAM/BAM import. These can be displayed in the contig editor
        and we can also go to coordinates by either padded (as before)
        or reference base coordinates.

*	The number of annotations is now tracked per bin, and hence
        per contig, as per sequences. Using this we now also have a
        far faster algorithm for searching through annotations when
        very few exist. (The needle in haystack problem.)


-----------------------------------------------------------------------------

Staden 2.0.0b8p1,  21st Mar 2011 (SANGER)
================================

General changes
---------------

*	Various compilation improvements: PPC64 detection for MacOS X;
        rpath support.


Gap5 new features
=================

*	We no longer need headers (eg @SQ) when reading SAM
        files.

*	Improved contig number handling: #<record> now works in addition
        to =<record>; List Contigs report improved.

*	Tg_index now automatically removes duplicates marked in a
        BAM/SAM file. Use tg_index -D to force these to be entered.


Gap5 bug fixes
--------------

*	Major bug fix to moving contigs in the contig selector - it
        can no longer duplicate contigs and in the process remove an
        existing one.

*	Fixed a bug in fasta import where the last sequence in a fasta
        file often generated a blank contig.

*	Truncated read system calls now handled in bam reading,
        instead of interpreting these as EOF.

*	Use of binary I/O modes on Windows (BAM).

*	Added support for backslash \ continuation lines in CAF.

*	Fix for 1bp long sequences and updating the bin ranges.

*	Fixed a reference counting bug in the contig editor. This sometimes
        showed up as crashes through assertion failures when saving or
        making a join.

*	The consensus cache can no longer return sections of blank N
        data. This happened when a contig start precisely matched the
        root bin start point.

*	Saved settings in various dialogues now write to .gap5rc
        instead of .gaprc.

*	Breaking contigs could sometimes leave tags in the wrong
        contig in certain circumstances. Now fixed.

*	The template display now correctly starts up showing the start
        of a contig when that contig does not start as base 1.

*	The depth plot in the template display should more accurately
        reflect the actual depth at a variety of zoom levels instead
        of artificially increasing depth as we zoom out.


Gap4 bug fixes
--------------

*	Fixed a (rare) infinite loop in the trace display code.


Staden 2.0.0b8,  8th Feb 2011
=============================

Gap5/tg_index 1.2.11

General changes
---------------

*	Microsoft Windows version. The code should now compile and run
        under MinGW/Msys on windows.

*	MacOS X updates: improved compilation and fixed a few Mac
        specific display glitches.

*	Various code tidyups - less compiler warnings, more portable
        for linux variants (eg Centos).

*	Removed dependency on samtools. (This also avoids a few
        samtools related bugs, but hopefully not creating new ones to
        replace them.)

*	Removed dependency on IncrTcl, IncrTk, IncrWidgets. These can
        still be used for one part of Gap4 (prefinish GUI) but the
        code will build and execute without these now.



Gap5 changes
------------

*	In-program help should now be working.

*	A Disassemble Readings option has been added to the main Edit
        menu. (This performs the same task as in Gap4.)

*	Tg_index now supports the CAF, fasta and fastq
        formats. When importing fasta/fastq we just create single-read
        contigs, so it's simply an easy way of importing consensus
        sequences or a *few* finishing reads. CAF support will import
        entire assemblies though. Also improved the CAF exporting code.

*	First draft of a Find Read Pairs function (as in Gap4). At
        present read-pair orientation needs some work still, but the
        basic plot and searching is working.

*	Internal record numbers are now 64-bit instead of 32-bit,
        removing the need for reserving sequence record IDs in
        tg_index (-r option) and allowing for more than 2 billion
        sequences in a gap5 db.

*	Contig editor "tag macros" (from gap4) have been added. Use
        Shift + function key to define a tag macro and then that
        function key to apply it.

*	A "readings" list now exists (as in Gap4) which is displayed
        and can be populated using the contig editor "names"
        panel. The copying (cut/paste) of read names binding has also
        changed from left-click+drag to middle-click, now matching
        Gap4.

*	Quality value 100 now has a special meaning for the consensus
        algorithm, as in Gap4. It forces the base to be considered as
        true (as it's only possible via a manual edit).

*	More contig editor key bindings: Page up/down (already existed
        for scrolling in 1Kb) can be modified by Shift, Control or
        Shift+Control to scroll in 10, 100 and 1000Kb steps; [,] keys
        for setting base quality to 0 or 100; Shift Up/Down arrow and
        Control Up/Down arrow for incrementing/decrementing base
        qualities by 1 or 10.

*	Editor Delete now only works on pad characters unless Control
        Delete is used, in order to prevent accidental removal of real
        data.

*	Added contig editor "Save Settings" command.

*	Internal changes to the template display and Tk canvas.

*	Sped up contig editor when dealing with excessively deep
        alignments.

*	Reading names in the contig editor are now be selected for
        copy and pasting using the left mouse button.

*	Tg_index now has a -q option to limit the number of unpaired
        reads held in memory (for the "-p" option). This significantly
        reduces the memory usage on large data sets, at the expense of
        longer running times.	 

Bug fixes
---------

*	Various fixes to compilation: parallel makes, improved DESTDIR
        support.

*	Big tidy up on the cache refence counting system, fixing
        multiple sporadic crashes and rarely even data corruptions.

*	Fixes to consensus caching sometimes storing corrupted data.

*	More robust when we run out of disc space.

*	Import GFF should be more robust. This now also supports
        "colour=<0-17>" tags to match those used in Artemis.

*	The insert size in the Libraries panel is now displayed
        correctly (when filled out) instead of at 1/100th of the size.

*	Reduced excessive memory usage of tg_index -t on large data
        sets. Also fixed a few memory leaks and reference count leaks
        (appear like memory leaks).

*	SAM export now works correctly when auxillary fields or
        read-group data is present.

*	Removed a small memory corruption when shutting down
        plots. This sometimes caused crashes when quitting the contig
        editor.

*	Fixed occasional crash when joining contigs.

*	Editor searching crash fixes.


-----------------------------------------------------------------------------

Staden 2.0.0b7,  July 14th 2010
===============================

Gap5/tg_index v1.2.9.

Gap5 changes
------------

*	Added an Import GFF Annotations option to Gap5. This deals
        with padded and unpadded data, although for now the GFF types
        are not used, instead using the "type=<tag_type>;" attribute
        in the last GFF column to select a gap5 tag type. GFF Export
        has been improved too.

*	Tg_index now has support for spliced alignments in SAM/BAM,
        using the CIGAR "N" character. This isn't fully implemented
        yet as the read-pairing breaks in this case, but the data at
        least can be imported now.

*	Gap5 should now compile under MacOS X, provided the X11
        version of Tcl/Tk is used rather than native aqua.

*	Extra contig-editor search methods - by annotation, by tag
        type.

*	Selecting large regions is easier in the contig editor now. It
        either auto-scrolls at the window edge or we can use
        shift+click to extend.

*	Gap5 now has basic primer-walking oligo picking support. (PCR
        to come later.)

*       Improvements to SAM support: fixed flags when exporting; tags
        are supported (via user-defined key=value auxillary data - Zs
        and Zc record types) in both import/export; faster export;
        output is now sorted; protection against quality values higher
        than ASCII ~; now parse the PL field in read-group lines in
        tg_index.

*	The Join Editor now displays overlap length and match score,
        confirming whether we still wish to make a join. Also
        bug-fixed the align button when one or both contigs didn't
        start at base position 1.

*	Two new scripts: gap5_consensus, gap5_export. These wrap up
        gap5 menu items as non-interactive command line tools.

*	The contig editor has a Goto... menu to jump to other
        sequences on this template.

*	It should be easier to keep track of sequences when scrolling
        in the editor as it attempts to adjust the Y scrollbar to keep
        data on screen. Additionally the Y-layout doesn't change so
        much when scrolling rightwards (although left scrolling still
        changes Y layout). Improved efficiency by caching some more
        data.

*	The contig editor now sorts by sequence technology first and
        then X coordinate, meaning that ABI capillary sequences are
        always at the top of the display. NOTE: This requires the
        platform tag (PL) in SAM/BAM @RG read-group header lines.

*	Bug fix writing reading names when importing a mixture of data
        with and without read-groups.

*	Fixed the Map Reads interface, when adding to contigs that do
        not start at base 1. Also fixed some memory free issues here.

*	The Show Diagonal and Clear All commands of the contig
        selector window now work. The results menu (and Results
        Manager window) now update too.

*	Disable a few more options and buttons when in read-only
        mode. Previously it wouldn't actually have written data, but
        tried and aborted.

*	Fixed a rare bug with single base-pair tags vanishing under
        certainc onditions.


Other changes
-------------

*	[Gap4/Gap5] Updated the primer melting temperature code to use
        the latest published formulae.

*	Various compilation improvements: better detection of Large
        File Support under some linux systems; control over the
        location of curses/ncurses libraries (and which to use); fixed
        "make depend" when running from a subdirectory instead of the
        top src root; forced use of the staden os.h instead of
        sometimes picking up a copy in io_lib.



Staden 2.0.0b6,  March 26th 2010
================================

Gap5/tg_index v1.2.8.

This is just a bug-fix release to spot a major problem that slipped
through into 1.2.7.

Gap5 bug fixes since 1.2.7
--------------------------

*	Fixed an error causing crashes when decoding sequence names of
	varying lengths coming from multiple read-groups.



Staden 2.0.0b5,  March 22nd 2010
================================

Gap5 1.2.7
Gap4 4.11.2

This release requires io_lib 1.12.2 or newer.


Gap5 changes since 1.2.6
------------------------

*	Numerous contig editor bug fixes:
	- Major undo overhaul. It should work far better now.
	- Moving sequences moves tags with them
	- Issues with saving giving "error -1" resolved.
	- We can now adjust the read clip points using < and > keys.
	- Fixed an editing-cache problem where cancelling a join and
          reopening the join editor sometimes had the old edits
          retained in memory (but not saved on disk).
	
*	Joining and complementing contigs is now handled better by
        various plots. For example joining two contigs no longer
        clears the contig selector window and plots, but updates them
        correctly instead.

*	Fixed some compilation issues.
	- libpng problems resolved.
	- helped compilation when linking against io_lib releases that
	  aren't yet in your LD_LIBRARY_PATH.
	- LARGEFILE_SOURCE64 definitions removed, which caused
	  problems on Ubuntu 9 (and others?).

*	Opening a database we do not have write access to (but read
        access) now works. Read-only mode is more obvious in the title
        bar too.

*	BAF export now includes consensus tags. We can also export in
        CAF too (although it's not a recommended output format).

*	The consensus can now be saved in fastq format.

*	Tg_index gained the option to store SAM/BAM auxillary records
        with "-x". This is experimental at the moment.

*	Tg_index can now stored unmapped data with the "-u" option,
        although it is still visible within the contig editor. This is
        experimental and a work in progress.

*	Improved SAM output - the data is now written in the same
        order it was read (assuming no edits). There is also an option
        to try and fix the flags and mate-pair data when writing out
        SAM, but be warned this is information substantially slower to
        compute and output.

*	Put back the old staden.profile script, but it's now in
        $STADENROOT/share/staden instead of the main root. Also added
        a stash binary to wrap up tclsh so old stash scripts should
        work again.

*	Various speed ups to the template display.

*	The editor control-a and control-e keys (beginning and end of
        sequence) now take heed of whether cutoff data is shown.

*	Export Contigs now picks sensible filenames when changing
        format.


Other Gap5 Bug fixes
--------------------

*	Very long sequences (>64kb) could sometimes cause the cached
        consensus to omit some regions, giving problems for find
        internal joins and save consensus.

*	Block attempts to join a contig to itself.

*	Removed various minor memory leaks.

*	Inserting bases to sequences could previously rarely cause memory
        corruptions.

*	Complement contig no longer moves the used (unclipped)
        start/end positions of a contig.

*	Exporting complementing contigs in ace/sam/baf fixes.

*	Using tg_index -a to add data to an existing database now
        works when the existing contigs have been complemented.

*	Reenabled the Results Manager window in normal mode, rather
        than hiding it for experts only.

*	Gap5's File->New menu item has been removed, use tg_index to
        create databases.

*	Creating a 1bp long annotation in the editor no longer crashes
        if you haven't dragged a selection to cover 1bp.


Gap4
----

*	Alignments in find internal joins fast-mode should have their
        5' end aligned better. (Also true for gap5)




Staden 2.0.0b4,  January 15th 2010
==================================

(Gap5 1.2.6)

Gap5 Changes since 1.2.4
------------------------

*	Added support for lzma (via XZ Utils' liblzma library)
	compression in addition to the existing zlib code. This is
	about 14% smaller than zlib, although at a cost of 2-3x
	slower. Use "tg_index -c lzma" to enable this.

	Also reordered data somewhat for both lzma and libz
	compression, reducing file size by another ~7% when dealing
	data mixed from multiple read-groups.

*	Added an Export Tags function to write GFF data. (Largely
        untested and experimental.)

*	Improved BAF output so it now contains tags.

*	Tg_index now has the ability to select the types of data to
        store using -d. These can one or more from seq, qual, anno or
        name (or "all" - the default). This allows for more compact
        databases at the cost of missing some data.

*	Substantially rduced the amount of I/O operations needed when
        reading the aux file. 

*	Sam/Bam @RG records and the RG:Z:* auxillary tags are now
        parsed. These are used to place sequences into libraries,
        although we may wish to rename these as read-groups in gap5
        too.

*	Added some simple search tools within the contig editor: by
        sequence, name (if indexed), consensus quality.

*	The template display should now be substantially faster at
        drawing large numbers of sequences.

*	Gap5 has a simple mapped assembly menu, currently using bwa
	(which must be installed). Behind the scenes this uses the
	new tg_index -g option to append to the existing assembly.

*	Tg_index -a -g (gapped) mode; this assumes that the sam/bam file
        being added has been aligned against a ungapped copy of the
        consensus from the gap5 database we are appending
        too. Tg_index will add gaps to either the existing consensus
        or the newly input data as appropriate, to merge the two
        assemblies together.


Gap5 Bug fixes
--------------

*	Various cached consensus fixes.

*	Removed occasional memory corruptions while editing sequences.

*	Fixes to the "align" button in the join editor.

*	Improved saving the consensus, involving contig clip point
        changes and pad stripping.

*	Fixed cases of inserting to contigs formed by joining
        complemented contigs together.

*	Fixed several sam parsing bugs.

*	Break contig should produce fewer (hopefully no) inconsistent
        contigs.

*	Export Sequences in SAM format no longer shifts the
        coordinates by 1.

*	Improved maq long/short format autodetection.


Gap4
----

*	Fixed an issue with turning off undo in the "remove pad
        columns" editor function.

*	Fixed an ancient bug involving the C to Fortran interface.

*	Fixed a problem with incorrectly sized trace windows.



Staden 2.0.0b3 
==============

(internal test only of Gap5 1.2.5)


Staden 2.0.0b2, October 16th 2009
=================================

(Gap5 1.2.4)

Gap5 Changes
------------

*	Tags can be created and/or removed within the contig editor
        now, rather than just imported.

*	Gap4's "Sequence Search" function has been added to Gap5,
        allowing for DNA string matches against either the consensus
        and/or the sequences themselves.

*	Name indexing (tg_index -t) now operates much faster
        (sometimes 100x speed-ups). It also occupies far less space in
        the gap5 database, but note that this comes at a cost of
        incompatibility with older Gap5 formats. (This gap5 should be
        able to load up old Gap5 databases, just not vice-versa.)

*	(Experimental) The consensus algorithm can now cache the
        consensus, when in read-write mode. This dramatically speeds
        up computing the consensus for subsequent functions at a cost
        of a bit more storage space.

*	Improvements to the build system, especially on 64-bit
        machines and RedHat derived systems. The --with-iwidgets=DIR
        parameter now has more leeway too and works when given either
        the parent directory or the iwidgets sub-directory.
	"Make depend" is no longer mandatory either.

*	Tg_index now attempts to automatically work out the file
        format (eg sam, bam, ace, baf, etc). The old "aln" default
        format has been removed.

*	Tg_index now supports reading sam files provided they have @SQ
        header lines. In addition to this ace, baf and sam files may
        now be gzipped.

*	Tg_index now has faster read-pairing, using temporary files in
        /tmp. The -f (fast mode) parameter still exists, but should
        not be so significant an improvement now.

*	Added a "-r nseqs" option to tg_index. This change, which has
        been in the code for some time, but commented out, allows
        tg_index to build gap5 databases in excess of 1 billion
        reads. (The largest here so far was 1.9 billion.)
	Do not use though unless tg_index fails or you are going to be
        indexing a very large genome and need to reserve sequence
        space. See ChangeLog for more discussion on this.

*	Tags now interpret "\n" as newline within BAF files.

Gap5 bug fixes
--------------

*	Selecting a region in the contig editor that spans a tag no
        longer crashes Gap5.

*	Fixed a crash when highlighting reading some names in the
        contig editor (buffer overrun).

*	When exporting to ACE format we now write DS lines again, as
        they're needed by consed. Also fixed generation of BS segments
        when adjoining zero-depth regions.

*	Export to SAM format should generate better behaved
        flags. Additionally all positions should now be >= 1, even if
        not positioned that way in gap5 itself. (A shift occurs to
        ensure this is true.)

*	BAF files with blank annotations no longer crash tg_index.

*	(Plus many minor fixes - see ChangeLog)


Staden 2.0.0b1, August 7th 2009
===============================

(Gap5 1.2.3)

Gap5 Minor changes
------------------

*	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.

*	The code can now build without samtools support, although
        obviously it loses the ability to read .bam files.

*	Compilation from source is vastly easier, as is the rest of
        the staden package.

Bug fixes
---------

*	Break contig and join contig are no longer crashing. They also
        now keep track of the number of sequences in the contigs and
        break-contig moves annotations where appropriate too.

*	Fixed a bug that incorrectly caused tags to be considered as
        sequences in some case, causing crashes.

*	The mouse-over for the  contig editor names display now works
        better, no longer attempting to display tag information.

*	Fixed for copy-on-write of seq/anno blocks, sometimes causing
        crashes when saving the contig editor.

*	Clicking on an annotation in the editor no longer causes
        crashes.

*	Removed buffer overrun in the editor get_number method.


Gap5 1.2.2,  June 22nd 2009
===========================

Minor bug fix release.

Minor changes
-------------


*	Added a Hide Annotation setting in the contig editor. This is
        also bound to control-Q (as per Gap4). This allows us a quick
        way to see the quality values underneath a tag.

*	Annotion contents are now visible in the editor information
        line, but the "Tag editor" itself still hasn't been ported
        over from Gap4.

*	Changed SAM reading of LB tags to use TG tags. In practice
        libraries rarely seem to appear directly in the sequence
        lines, but instead occur in read-groups. In theory we should
        then check the main read-group header for LB links from there,
        but for now treating a library as a group (eg a run or a lane)
        is perhaps more useful than a genuine library grouping.

*	Lots of internal code tweaking to support newer versions of
        Tcl/Tk (tested with 8.6b1). For now we still ship with 8.4,
        but this is the first stage of making the code more portable
        and easier to build from source.

*	Extra slider (there's too many I know - it's overdue a
        redesign) in the template display. This governs the "stacking"
        y-mode, controlling where the data gets binned into groups. Eg
        every 1k so that templates 0-1000 are stacked together,
        1000-2000bp are below, 2000-3000 below those, etc.

Bug fixes
---------

*	Removed a memory corruption when displaying long sequence
        tags (> 1Kb).

*	Removed issues with diagonal lines appearing at the start
        of the library insert-size distribution plot.

*	Removed unneeded dependency on C++ (libstdc++.so.5) and
        FORTRAN (libg2c0.so) libraries.

*	The contig selector window now internally uses more 64-bit
        integers. This fixes issues where the total contig length grew
        beyond 2Gb.

*	Initialised more elements in some of the data structures.
        Previously some parts of range_t struct were
        uninitialised. Hopefully this resolves some of the random ACE
        related errors (unknown).


Gap5 1.2.1,  June 15th 2009
===========================

Mostly just a bug fix release.

Bug fixes / minor changes
-------------------------

*	caf2baf now supports annotations.

*	Fixed a crash when storing sequences with trace names that
        substantially differ to the read names.

*	Compiling with optimisation now works correctly. (Previous
        release was built with debugging and no optimisation, so the
        errors were not apparent.)


Gap5 1.2.0,  June 10th 2009
===========================

*INCOMPATIBILITY* The files written by tg_index and read/written by
gap5 are not in the same format as those produced by v1.1.x.
If you wish to migrate existing gap5 databases then it is recommended
that you use the Export Sequences function in 1.1.3 to output in BAF
format, and reindex them using tg_index v1.2.0 with the -B option.


Key changes
-----------

*	Major reduction in disk space required.
	Gap5 databases are now (de)compressed on the fly and so are a
	fraction of their original size. In most cases they'll be
	~20-30% smaller than an input BAM file too.

	This change has also meant less I/O and in particular fewer
	random file seeks. Hence Gap5 is better behaved on the Lustre
	filesystem, although local storage of NFS are still faster.

*	Minimal support for libraries. This is still work in progress,
        but the LB tag in sam/bam format is now used to separate
        sequences into libraries. (More work on this to follow,
        including better use of this information and adding library
        support to other input file formats.)

*	Can now export in ACE format too.

*	Added a -z option to tg_index to allow user specified block
        sizes. I'd suggest using this (eg "tg_index -z 64k") on sparse
        alignment files.

*	Annotatons (aka "tags" in Gap4) have been added. For now these
        are visible by colouration, but no interaction is possible
        yet. The full tag editor is planned for later 1.2.x releases.


Bug fixes / minor changes
-------------------------

*	Fixed a bug in the Export Sequences function. It occasionally
        missed sequences at the very start of a contig.

*	Fixed ACE file reading of complemented data.

*	The file format changes also included better error
        checking. The encoding of each data type now includes the data
        type itself (to ensure we've found the expected type of data)
        and a format code. The format codes should allow for more
        graceful file format changes in the future.

*	Fixed a bug in the count of how many sequences are in each
        contig.


Gap5 1.1.3.1,  May 15th 2009
============================

A minor change to support exporting the data in a variety of formats,
to facilitate migrating from one Gap5 release to the next. (The next
one will have substantially smaller database sizes and faster I/O.)


Key changes
-----------

*	Added an "Export Sequences" function to the main File
        menu. This can output in fasta, fastq, sam or baf format.


Gap5 1.1.3,  April 24th 2009
============================

This version is backwards compatible with v1.1.2 file formats.

Key changes
-----------

*	The contig editor "pack sequences" mode now behaves much
        better. The editing cursor, mouse overs, editing and selecting
	all now correctly compensate for the layout change.

	Additionally the names panel, which was useless in pack
        sequences mode, now displays a reduced ascii layout of the
        sequences allowing for the mapping quality to be shaded
        there and to easily visualise the sequence orientation.

*	The contig editor cursor (editing cursor, not scrollbar
        position) is now both visible and dragable from within the
        template display.

*	ACE format support in tg_index is back, and it no longer
        chokes on RT, CT and WA lines. Although at present I do not
        add this data to the gap5 database.

*	The contig selector no longer automatically displays at start
        up if there are more than 1000 contigs. Using the -csel
        command line option will forcibly override this check (along
        with the previously implemented -no_csel option to never
        display the contig selector on startup).

*	The join editor settings now apply to both editors rather than
        just one. Undo/Redo apply to the last used editor and on mouse-
        over they highlight which editor they currently apply to.

Bug fixes / minor changes
-------------------------

* 	The compute_ypos() function used for the pack sequences mode
        of the editor now uses the faster algorithm developed for the
        template display. Hence "Stacking" mode is now faster.

*	Undo/Redo now behaves better when multiple editors are in use
        on the same contig. Similarly the edits are redrawn instantly
        in other editor views.

*	(Transparent to users, for now.) The initial implementation of
        annotations is in place. This is listed as a minor change for
        now as currently there are no user-defined ways to add tags to
        the database. Warning: this will lead to a file format change
        soon.


Gap5 1.1.2,  April 3rd 2009
===========================

Features
--------

*	The template display now sports a "Filter" button. This allows
        certain types of data to be filtered in/out by mapping
        quality, template consistency, whether it spans contigs and
        whether single/paired.
	(Future plans here include by ligation and/or instrument type.)

*	The template display Y-mode of "stacking" should now be MUCH
        faster when given deep data sets.

*	Added the ability to select regions of a sequence or a reading
	name from the contig editor so that cut and paste works. (From
	the editor, but not into it yet.)

*	The number of sequences in a contig is now displayed in the
	contig selector and contig list windows.


Bug fixes / minor adjustments
-----------------------------

*	The template display crosshair now correctly displays the Y
	coordinate in the bottom status line.

*	Fixed a bug in the consensus algorithm; the last base was
	incorrect when the contig was 1 base longer than an exact
	multiple of 1024bp.

*	Sped up the Save Consensus command when dealing with many
	contigs.

*	Tweaked the Y-spread function of the template display so that
	multiple sequences with both identical X and Y coordinates now
	get spread apart.

*	The contig editor now instantly displays the impact of making
	insertions or deletions instead of only correctly displaying
	all sequences on the next scroll.

*	Fixed an issue of opening contigs when given a reading name
	instead of a contig name.

*	The contig editor sequence no longer vanishes temporarily when
	scrolling the sequence names.


Gap5 1.1.1,  March 19th 2009
============================
